summaryrefslogtreecommitdiff
path: root/same
diff options
context:
space:
mode:
authorKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-03-06 13:41:08 +0100
committerKjetil Ørbekk <kjetil.orbekk@gmail.com>2012-03-06 13:41:08 +0100
commit3e2805de493e5d12eea025ae622cf8c635de0b54 (patch)
treeb83b8a98ccbb39081524a6db2f650751d7590d2b /same
parentdc77d2f9d684d2d1d960dcdcb9681ddbc0db38a9 (diff)
Add Directory support in same.
Diffstat (limited to 'same')
-rw-r--r--same/src/main/java/com/orbekk/same/ConnectionManager.java2
-rw-r--r--same/src/main/java/com/orbekk/same/ConnectionManagerImpl.java15
-rw-r--r--same/src/main/java/com/orbekk/same/TestConnectionManager.java8
3 files changed, 21 insertions, 4 deletions
diff --git a/same/src/main/java/com/orbekk/same/ConnectionManager.java b/same/src/main/java/com/orbekk/same/ConnectionManager.java
index a6d0914..4637617 100644
--- a/same/src/main/java/com/orbekk/same/ConnectionManager.java
+++ b/same/src/main/java/com/orbekk/same/ConnectionManager.java
@@ -1,6 +1,7 @@
package com.orbekk.same;
import com.orbekk.paxos.PaxosService;
+import com.orbekk.same.discovery.DirectoryService;
/**
* An interface that returns a connection for a participant.
@@ -11,4 +12,5 @@ public interface ConnectionManager {
ClientService getClient(String url);
MasterService getMaster(String url);
PaxosService getPaxos(String url);
+ DirectoryService getDirectory(String url);
}
diff --git a/same/src/main/java/com/orbekk/same/ConnectionManagerImpl.java b/same/src/main/java/com/orbekk/same/ConnectionManagerImpl.java
index 619ac27..f3f4edb 100644
--- a/same/src/main/java/com/orbekk/same/ConnectionManagerImpl.java
+++ b/same/src/main/java/com/orbekk/same/ConnectionManagerImpl.java
@@ -1,9 +1,5 @@
package com.orbekk.same;
-import com.googlecode.jsonrpc4j.ProxyUtil;
-import com.orbekk.net.MyJsonRpcHttpClient;
-import com.orbekk.paxos.PaxosService;
-
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
@@ -12,6 +8,12 @@ import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.googlecode.jsonrpc4j.ProxyUtil;
+import com.orbekk.net.MyJsonRpcHttpClient;
+import com.orbekk.paxos.PaxosService;
+import com.orbekk.same.discovery.DirectoryService;
+import com.orbekk.same.discovery.DiscoveryService;
+
public class ConnectionManagerImpl implements ConnectionManager {
private int connectionTimeout;
private int readTimeout;
@@ -66,4 +68,9 @@ public class ConnectionManagerImpl implements ConnectionManager {
public PaxosService getPaxos(String url) {
return getClassProxy(url, PaxosService.class);
}
+
+ @Override
+ public DirectoryService getDirectory(String url) {
+ return getClassProxy(url, DirectoryService.class);
+ }
}
diff --git a/same/src/main/java/com/orbekk/same/TestConnectionManager.java b/same/src/main/java/com/orbekk/same/TestConnectionManager.java
index 25a3ee6..6f5e5d8 100644
--- a/same/src/main/java/com/orbekk/same/TestConnectionManager.java
+++ b/same/src/main/java/com/orbekk/same/TestConnectionManager.java
@@ -4,6 +4,7 @@ import java.util.Map;
import java.util.HashMap;
import com.orbekk.paxos.PaxosService;
+import com.orbekk.same.discovery.DirectoryService;
/**
* This class is used in test.
@@ -15,6 +16,8 @@ public class TestConnectionManager implements ConnectionManager {
new HashMap<String, MasterService>();
public Map<String, PaxosService> paxosMap =
new HashMap<String, PaxosService>();
+ public Map<String, DirectoryService> directoryMap =
+ new HashMap<String, DirectoryService>();
public TestConnectionManager() {
}
@@ -33,4 +36,9 @@ public class TestConnectionManager implements ConnectionManager {
public PaxosService getPaxos(String url) {
return paxosMap.get(url);
}
+
+ @Override
+ public DirectoryService getDirectory(String url) {
+ return directoryMap.get(url);
+ }
}