From d6cfc7505be13b3b09adf423206cf75d9f806c12 Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Mon, 18 Feb 2013 15:01:46 +0100 Subject: Initial Interface creation. Some compilation problems remain. --- src/main/java/com/c2kernel/process/Gateway.java | 30 +++++++++++++------------ 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'src/main/java/com/c2kernel/process/Gateway.java') diff --git a/src/main/java/com/c2kernel/process/Gateway.java b/src/main/java/com/c2kernel/process/Gateway.java index 2bbe638..14d1d8f 100644 --- a/src/main/java/com/c2kernel/process/Gateway.java +++ b/src/main/java/com/c2kernel/process/Gateway.java @@ -17,6 +17,7 @@ import com.c2kernel.entity.proxy.EntityProxyManager; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.LDAPLookup; import com.c2kernel.lookup.LDAPProperties; +import com.c2kernel.lookup.Lookup; import com.c2kernel.persistency.ClusterStorageException; import com.c2kernel.persistency.TransactionManager; import com.c2kernel.process.module.ModuleManager; @@ -52,7 +53,7 @@ public class Gateway static private Properties mC2KProps; static private ModuleManager mModules; static private org.omg.CORBA.ORB mORB; - static private LDAPLookup mLDAPLookup; + static private Lookup mLookup; static private TransactionManager mStorage; static private EntityProxyManager mProxyManager; static private CorbaServer mCorbaServer; @@ -130,7 +131,7 @@ public class Gateway static public void startServer() throws InvalidDataException { try { // check top level LDAP contexts - mLDAPLookup.install(); + mLookup.install(); // start entity proxy server EntityProxyManager.initServer(); @@ -190,6 +191,7 @@ public class Gateway throws InvalidDataException, ClusterStorageException { + //Class lookupClass = Class.forName(getProperty("Lookup", "com.c2kernel.lookup.LDAPLookup")); LDAPProperties ldapProps = new LDAPProperties(); if( ldapProps.mHost != null && ldapProps.mPort != null && @@ -197,7 +199,7 @@ public class Gateway { try { - mLDAPLookup = new LDAPLookup(ldapProps); + mLookup = new LDAPLookup(ldapProps); } catch (Exception ex) { @@ -228,7 +230,7 @@ public class Gateway LDAPProperties ldapProps = new LDAPProperties(); AgentPath agentPath; try { - agentPath = mLDAPLookup.getRoleManager().getAgentPath(agentName); + agentPath = mLookup.getRoleManager().getAgentPath(agentName); } catch (Exception ex) { Logger.error(ex); throw new ObjectNotFoundException("Could not resolve agent", ""); @@ -239,7 +241,7 @@ public class Gateway try { LDAPLookup.createConnection(ldapProps); - return (AgentProxy)getProxyManager().getProxy(mLDAPLookup.getRoleManager().getAgentPath(agentName)); + return (AgentProxy)getProxyManager().getProxy(mLookup.getRoleManager().getAgentPath(agentName)); } catch (Exception ex) { Logger.error(ex); throw new InvalidDataException("Could not log in", ""); @@ -265,16 +267,16 @@ public class Gateway try { ldapProps.mUser = ""; ldapProps.mPassword = ""; - mLDAPLookup = new LDAPLookup(ldapProps); - String agentDN = mLDAPLookup.getRoleManager().getAgentPath(agentName).getFullDN(); + mLookup = new LDAPLookup(ldapProps); + String agentDN = mLookup.getRoleManager().getAgentPath(agentName).getFullDN(); //found agentDN, try to log in with it ldapProps.mUser = agentDN; ldapProps.mPassword = agentPassword; - mLDAPLookup = new LDAPLookup(ldapProps); + mLookup = new LDAPLookup(ldapProps); // find agent proxy - AgentPath agentPath = mLDAPLookup.getRoleManager().getAgentPath(agentName); + AgentPath agentPath = mLookup.getRoleManager().getAgentPath(agentName); if (agentPath!=null) { @@ -348,9 +350,9 @@ public class Gateway mStorage = null; // disconnect from ldap - if (mLDAPLookup != null) - mLDAPLookup.disconnect(); - mLDAPLookup = null; + if (mLookup != null) + mLookup.disconnect(); + mLookup = null; // shut down proxy manager if (mProxyManager != null) @@ -372,9 +374,9 @@ public class Gateway return mORB; } - static public LDAPLookup getLDAPLookup() + static public Lookup getLookup() { - return mLDAPLookup; + return mLookup; } static public CorbaServer getCorbaServer() -- cgit v1.2.3