summaryrefslogtreecommitdiff
path: root/same/src/main
diff options
context:
space:
mode:
authorKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-01-13 11:25:25 +0100
committerKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-01-13 11:25:25 +0100
commit2413c4cf76f82983dc1bde5fb3dc2ce3e1afdf15 (patch)
tree2a9a1bac84c36750af7c18eb2c15be40af11e060 /same/src/main
parenta3389e3e7782f56650760b07bb2f452e78406459 (diff)
Add new Client and Master interfaces.
Begin implementing Master interface.
Diffstat (limited to 'same/src/main')
-rw-r--r--same/src/main/java/com/orbekk/same/ClientService.java7
-rw-r--r--same/src/main/java/com/orbekk/same/MasterService.java6
-rw-r--r--same/src/main/java/com/orbekk/same/MasterServiceImpl.java32
3 files changed, 45 insertions, 0 deletions
diff --git a/same/src/main/java/com/orbekk/same/ClientService.java b/same/src/main/java/com/orbekk/same/ClientService.java
new file mode 100644
index 0000000..f5e668f
--- /dev/null
+++ b/same/src/main/java/com/orbekk/same/ClientService.java
@@ -0,0 +1,7 @@
+package com.orbekk.same;
+
+public interface ClientService {
+ void notifyNetwork(String networkName, String masterUrl);
+
+ void setState(String component, long revision, String data);
+}
diff --git a/same/src/main/java/com/orbekk/same/MasterService.java b/same/src/main/java/com/orbekk/same/MasterService.java
new file mode 100644
index 0000000..f1ef24a
--- /dev/null
+++ b/same/src/main/java/com/orbekk/same/MasterService.java
@@ -0,0 +1,6 @@
+package com.orbekk.same;
+
+public interface MasterService {
+ void joinNetworkRequest(String networkName, String clientUrl);
+ boolean updateStateRequest(String component, String newData, long revision);
+}
diff --git a/same/src/main/java/com/orbekk/same/MasterServiceImpl.java b/same/src/main/java/com/orbekk/same/MasterServiceImpl.java
new file mode 100644
index 0000000..64cde2f
--- /dev/null
+++ b/same/src/main/java/com/orbekk/same/MasterServiceImpl.java
@@ -0,0 +1,32 @@
+package com.orbekk.same;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MasterServiceImpl implements MasterService, UrlReceiver {
+ private Logger logger = LoggerFactory.getLogger(getClass());
+ private State state;
+
+ public MasterServiceImpl(State initialState) {
+ state = initialState;
+ }
+
+ @Override
+ public void joinNetworkRequest(String networkName, String clientUrl) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean updateStateRequest(String component, String newData, long revision) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void setUrl(String url) {
+ String myUrl = url + "MasterService.json";
+ logger.info("Master URL is " + myUrl);
+ state.update(".masterUrl", myUrl, 0);
+ }
+}