| 1 | |
package org.webslinger.io.tests; |
| 2 | |
|
| 3 | |
import java.io.InputStream; |
| 4 | |
import java.io.OutputStream; |
| 5 | |
import java.util.ArrayList; |
| 6 | |
import java.util.List; |
| 7 | |
|
| 8 | |
import org.webslinger.io.Monitor; |
| 9 | |
|
| 10 | |
public interface Root<R extends Root<R>> { |
| 11 | |
void touch(long time) throws Exception; |
| 12 | |
R create(String name) throws Exception; |
| 13 | |
void delete() throws Exception; |
| 14 | |
InputStream openIn() throws Exception; |
| 15 | |
OutputStream openOut() throws Exception; |
| 16 | |
Listener createListener() throws Exception; |
| 17 | |
void refresh() throws Exception; |
| 18 | |
|
| 19 | 0 | public abstract class Listener { |
| 20 | 0 | public final List<Monitor.Listener.Event> events = new ArrayList<Monitor.Listener.Event>(); |
| 21 | |
|
| 22 | |
public abstract void start() throws Exception; |
| 23 | |
public abstract void stop() throws Exception; |
| 24 | |
|
| 25 | |
protected void addEvent(Monitor.Listener.Event event) throws Exception { |
| 26 | 0 | synchronized (events) { |
| 27 | 0 | events.add(event); |
| 28 | 0 | } |
| 29 | 0 | } |
| 30 | |
} |
| 31 | |
} |