summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/process/Gateway.java
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2014-06-30 23:03:03 +0200
committerAndrew Branson <andrew.branson@cern.ch>2014-06-30 23:03:03 +0200
commit2495be9ecfa8aea47e285f63b5bb27b0c133b1f8 (patch)
treed85f6df165386a86683de6ccee4c1767723573dd /src/main/java/com/c2kernel/process/Gateway.java
parentdc2bbfdda8ee4f32937c3e91f77e52dc4501f0f1 (diff)
Separated modifying Lookup methods into LookupManager, which is only
present in a server process. This stops clients trying to write to the directory without relying on their permissions.
Diffstat (limited to 'src/main/java/com/c2kernel/process/Gateway.java')
-rw-r--r--src/main/java/com/c2kernel/process/Gateway.java21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/main/java/com/c2kernel/process/Gateway.java b/src/main/java/com/c2kernel/process/Gateway.java
index 2499bf7..09700d6 100644
--- a/src/main/java/com/c2kernel/process/Gateway.java
+++ b/src/main/java/com/c2kernel/process/Gateway.java
@@ -9,6 +9,7 @@ import java.net.MalformedURLException;
import java.util.Enumeration;
import java.util.Properties;
+import com.c2kernel.common.CannotManageException;
import com.c2kernel.common.InvalidDataException;
import com.c2kernel.common.ObjectNotFoundException;
import com.c2kernel.entity.CorbaServer;
@@ -17,6 +18,7 @@ import com.c2kernel.entity.proxy.ProxyManager;
import com.c2kernel.entity.proxy.ProxyServer;
import com.c2kernel.lookup.AgentPath;
import com.c2kernel.lookup.Lookup;
+import com.c2kernel.lookup.LookupManager;
import com.c2kernel.persistency.ClusterStorageException;
import com.c2kernel.persistency.NextKeyManager;
import com.c2kernel.persistency.TransactionManager;
@@ -58,6 +60,7 @@ public class Gateway
static private org.omg.CORBA.ORB mORB;
static private boolean orbDestroyed = false;
static private Lookup mLookup;
+ static private LookupManager mLookupManager = null;
static private NextKeyManager mNextKeyManager;
static private TransactionManager mStorage;
static private ProxyManager mProxyManager;
@@ -145,10 +148,16 @@ public class Gateway
*
* @throws InvalidDataException - error initialising
*/
- static public void startServer(Authenticator auth) throws InvalidDataException {
+ static public void startServer(Authenticator auth) throws InvalidDataException, CannotManageException {
try {
// check top level directory contexts
- mLookup.initializeDirectory();
+ if (mLookup instanceof LookupManager) {
+ mLookupManager = (LookupManager)mLookup;
+ mLookupManager.initializeDirectory();
+ }
+ else {
+ throw new CannotManageException("Lookup implementation is not a LookupManager. Cannot write to directory");
+ }
// init next key manager
mNextKeyManager = (NextKeyManager)mC2KProps.getInstance("NextKeyManager");
@@ -322,6 +331,14 @@ public class Gateway
return mLookup;
}
+ static public LookupManager getLookupManager() throws CannotManageException
+ {
+ if (mLookupManager == null)
+ throw new CannotManageException("No Lookup Manager created. Not a server process.", "");
+ else
+ return mLookupManager;
+ }
+
static public CorbaServer getCorbaServer()
{
return mCorbaServer;