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/Bootstrap.java | 22 ++++++++-------- src/main/java/com/c2kernel/process/Gateway.java | 30 ++++++++++++---------- .../java/com/c2kernel/process/module/Module.java | 6 ++--- 3 files changed, 30 insertions(+), 28 deletions(-) (limited to 'src/main/java/com/c2kernel/process') diff --git a/src/main/java/com/c2kernel/process/Bootstrap.java b/src/main/java/com/c2kernel/process/Bootstrap.java index 0d22cb3..b4e192c 100644 --- a/src/main/java/com/c2kernel/process/Bootstrap.java +++ b/src/main/java/com/c2kernel/process/Bootstrap.java @@ -22,7 +22,7 @@ import com.c2kernel.lifecycle.instance.stateMachine.Transitions; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.DomainPath; import com.c2kernel.lookup.EntityPath; -import com.c2kernel.lookup.LDAPLookup; +import com.c2kernel.lookup.Lookup; import com.c2kernel.lookup.Path; import com.c2kernel.lookup.RolePath; import com.c2kernel.persistency.ClusterStorage; @@ -114,7 +114,7 @@ public class Bootstrap public static void verifyResource(String ns, String itemName, String itemType, String data) throws Exception { Logger.msg(1, "Bootstrap.verifyResource() - Verifying data of "+getDataType(itemType)+" "+itemName); - Enumeration en = Gateway.getLDAPLookup().search(getTypeRoot(itemType), itemName); + Enumeration en = Gateway.getLookup().search(getTypeRoot(itemType), itemName); ItemProxy thisProxy; Outcome newOutcome = new Outcome(0, data, getDataType(itemType), 0); @@ -183,16 +183,16 @@ public class Bootstrap ca = (CompositeActivity) ((CompositeActivityDef)LocalObjectLoader.getActDef(wf, "last")).instantiate(); } - EntityPath entityPath = Gateway.getLDAPLookup().getNextKeyManager().generateNextEntityKey(); + EntityPath entityPath = Gateway.getLookup().getNextKeyManager().generateNextEntityKey(); TraceableEntity newItem = (TraceableEntity)Gateway.getCorbaServer().createEntity(entityPath); - Gateway.getLDAPLookup().add(entityPath); + Gateway.getLookup().add(entityPath); newItem.initialise( 1, Gateway.getMarshaller().marshall(props), Gateway.getMarshaller().marshall(ca)); DomainPath newDomPath = new DomainPath(getTypeRoot(itemType).toString()+"/system/"+(ns==null?"kernel":ns)+"/"+itemName); newDomPath.setEntity(entityPath); - Gateway.getLDAPLookup().add(newDomPath); + Gateway.getLookup().add(newDomPath); return (ItemProxy)Gateway.getProxyManager().getProxy(entityPath); } @@ -224,7 +224,7 @@ public class Bootstrap **************************************************************************/ private static void checkAgent(String name, String pass, String role, boolean joblist) throws Exception { Logger.msg(1, "Bootstrap.checkAgent() - Checking for existence of '"+name+"' user."); - LDAPLookup lookup = Gateway.getLDAPLookup(); + Lookup lookup = Gateway.getLookup(); try { lookup.getRoleManager().getAgentPath(name); Logger.msg(3, "Bootstrap.checkAgent() - User '"+name+"' found."); @@ -244,7 +244,7 @@ public class Bootstrap AgentPath agentPath = new AgentPath(entityPath.getSysKey(), name); agentPath.setPassword(pass); Gateway.getCorbaServer().createEntity(agentPath); - Gateway.getLDAPLookup().add(agentPath); + Gateway.getLookup().add(agentPath); // assign admin role Logger.msg("Bootstrap.checkAgent() - Assigning role '"+role+"'"); @@ -282,11 +282,11 @@ public class Bootstrap serverEntity = thisServerPath.getEntity(); } catch (ObjectNotFoundException ex) { Logger.msg("Creating server item "+thisServerPath); - serverEntity = Gateway.getLDAPLookup().getNextKeyManager().generateNextEntityKey(); + serverEntity = Gateway.getLookup().getNextKeyManager().generateNextEntityKey(); Gateway.getCorbaServer().createEntity(serverEntity); - Gateway.getLDAPLookup().add(serverEntity); + Gateway.getLookup().add(serverEntity); thisServerPath.setEntity(serverEntity); - Gateway.getLDAPLookup().add(thisServerPath); + Gateway.getLookup().add(thisServerPath); } Gateway.getStorage().put(serverEntity.getSysKey(), new Property("Name", serverName), null); Gateway.getStorage().put(serverEntity.getSysKey(), new Property("Type", "Server"), null); @@ -306,7 +306,7 @@ public class Bootstrap PredefinedStepContainer predef = (PredefinedStepContainer)wf.search("workflow/predefined"); wf.getChildGraphModel().removeVertex(predef); wf.addChild(new ServerPredefinedStepContainer(), predef.getCentrePoint()); - wf.initialise(thisServerPath.getSysKey(), Gateway.getLDAPLookup().getRoleManager().getAgentPath("system")); + wf.initialise(thisServerPath.getSysKey(), Gateway.getLookup().getRoleManager().getAgentPath("system")); Gateway.getStorage().put(thisServerPath.getSysKey(), wf, null); } } 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() diff --git a/src/main/java/com/c2kernel/process/module/Module.java b/src/main/java/com/c2kernel/process/module/Module.java index 91c43b2..ff9aba6 100644 --- a/src/main/java/com/c2kernel/process/module/Module.java +++ b/src/main/java/com/c2kernel/process/module/Module.java @@ -93,17 +93,17 @@ public class Module { continue; } catch (ObjectNotFoundException ex) { } Logger.msg("Module.importAll() - Item '"+thisItem.name+"' not found. Creating."); - thisItem.create(Gateway.getLDAPLookup().getRoleManager().getAgentPath("system").getSysKey()); + thisItem.create(Gateway.getLookup().getRoleManager().getAgentPath("system").getSysKey()); } else if (thisImp instanceof NewAgent) { NewAgent thisAgent = (NewAgent)thisImp; try { - Gateway.getLDAPLookup().getRoleManager().getAgentPath(thisAgent.name); + Gateway.getLookup().getRoleManager().getAgentPath(thisAgent.name); Logger.msg(3, "Module.importAll() - User '"+thisAgent.name+"' found."); continue; } catch (ObjectNotFoundException ex) { } Logger.msg("Module.importAll() - User '"+thisAgent.name+"' not found. Creating."); - thisAgent.create(Gateway.getLDAPLookup().getRoleManager().getAgentPath("system").getSysKey()); + thisAgent.create(Gateway.getLookup().getRoleManager().getAgentPath("system").getSysKey()); } } } -- cgit v1.2.3