summaryrefslogtreecommitdiff
path: root/same/src/main
diff options
context:
space:
mode:
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);
+ }
+}