diff options
Diffstat (limited to 'same/src/main')
-rw-r--r-- | same/src/main/java/com/orbekk/same/Client.java | 10 | ||||
-rw-r--r-- | same/src/main/java/com/orbekk/same/VariableFactory.java | 6 | ||||
-rw-r--r-- | same/src/main/java/com/orbekk/same/http/StateServlet.java | 6 |
3 files changed, 13 insertions, 9 deletions
diff --git a/same/src/main/java/com/orbekk/same/Client.java b/same/src/main/java/com/orbekk/same/Client.java index 3799041..244a64d 100644 --- a/same/src/main/java/com/orbekk/same/Client.java +++ b/same/src/main/java/com/orbekk/same/Client.java @@ -20,16 +20,18 @@ public class Client implements DiscoveryListener { new ArrayList<StateChangedListener>(); private NetworkNotificationListener networkListener; - public class ClientInterface { - private ClientInterface() { + public class ClientInterfaceImpl implements ClientInterface { + private ClientInterfaceImpl() { } /** Get a copy of all the client state. */ + @Override public State getState() { return new State(state); } + @Override public void set(String name, String data, long revision) throws UpdateConflict { String masterUrl = state.getDataOf(".masterUrl"); @@ -47,16 +49,18 @@ public class Client implements DiscoveryListener { } } + @Override public void addStateListener(StateChangedListener listener) { stateListeners.add(listener); } + @Override public void removeStateListener(StateChangedListener listener) { stateListeners.remove(listener); } } - private ClientInterface clientInterface = new ClientInterface(); + private ClientInterface clientInterface = new ClientInterfaceImpl(); private ClientService serviceImpl = new ClientService() { @Override diff --git a/same/src/main/java/com/orbekk/same/VariableFactory.java b/same/src/main/java/com/orbekk/same/VariableFactory.java index 49604c6..66e6747 100644 --- a/same/src/main/java/com/orbekk/same/VariableFactory.java +++ b/same/src/main/java/com/orbekk/same/VariableFactory.java @@ -16,7 +16,7 @@ import com.orbekk.same.State.Component; */ public class VariableFactory { private Logger logger = LoggerFactory.getLogger(getClass()); - private Client.ClientInterface client; + private ClientInterface client; private ObjectMapper mapper = new ObjectMapper(); private class VariableImpl<T> implements Variable<T>, StateChangedListener { @@ -76,11 +76,11 @@ public class VariableFactory { } } - public static VariableFactory create(Client.ClientInterface client) { + public static VariableFactory create(ClientInterface client) { return new VariableFactory(client); } - VariableFactory(Client.ClientInterface client) { + VariableFactory(ClientInterface client) { this.client = client; } diff --git a/same/src/main/java/com/orbekk/same/http/StateServlet.java b/same/src/main/java/com/orbekk/same/http/StateServlet.java index 17e566d..8b4d8c5 100644 --- a/same/src/main/java/com/orbekk/same/http/StateServlet.java +++ b/same/src/main/java/com/orbekk/same/http/StateServlet.java @@ -12,18 +12,18 @@ import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.orbekk.same.Client; +import com.orbekk.same.ClientInterface; import com.orbekk.same.UpdateConflict; import com.orbekk.same.Variable; import com.orbekk.same.VariableFactory; public class StateServlet extends HttpServlet { private Logger logger = LoggerFactory.getLogger(getClass()); - private Client.ClientInterface client; + private ClientInterface client; private VariableFactory variableFactory; private final static String TITLE = "State viewer"; - public StateServlet(Client.ClientInterface client, + public StateServlet(ClientInterface client, VariableFactory variableFactory) { this.client = client; this.variableFactory = variableFactory; |