From a1f0ecbb6a2bea6aa214322c412af2f3c5ce124b Mon Sep 17 00:00:00 2001 From: Andrew Branson Date: Wed, 7 May 2014 17:33:13 +0200 Subject: Agent now extends Item, so they can have workflows. All traces of the old 'Entity' superclasses should be removed, including proxies and paths. Very large change, breaks API compatibility with CRISTAL 2.x. Fixes #135 --- src/main/java/com/c2kernel/process/Bootstrap.java | 23 ++++++++++------------ src/main/java/com/c2kernel/process/Gateway.java | 12 +++++------ .../java/com/c2kernel/process/UserCodeProcess.java | 4 ++-- 3 files changed, 18 insertions(+), 21 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 601db31..e2ad24e 100644 --- a/src/main/java/com/c2kernel/process/Bootstrap.java +++ b/src/main/java/com/c2kernel/process/Bootstrap.java @@ -10,7 +10,6 @@ import org.custommonkey.xmlunit.Diff; import org.custommonkey.xmlunit.XMLUnit; import com.c2kernel.common.ObjectNotFoundException; -import com.c2kernel.entity.TraceableEntity; import com.c2kernel.entity.proxy.ItemProxy; import com.c2kernel.events.Event; import com.c2kernel.events.History; @@ -22,7 +21,7 @@ import com.c2kernel.lifecycle.instance.predefined.ServerPredefinedStepContainer; import com.c2kernel.lifecycle.instance.stateMachine.Transition; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.DomainPath; -import com.c2kernel.lookup.EntityPath; +import com.c2kernel.lookup.ItemPath; import com.c2kernel.lookup.LDAPLookup; import com.c2kernel.lookup.Path; import com.c2kernel.lookup.RolePath; @@ -128,7 +127,7 @@ public class Bootstrap } else { DomainPath path = (DomainPath)en.nextElement(); - thisProxy = (ItemProxy)Gateway.getProxyManager().getProxy(path); + thisProxy = Gateway.getProxyManager().getProxy(path); // Verify module property and location @@ -150,7 +149,7 @@ public class Bootstrap if (!modDomPath.equals(path)) { // move item to module subtree Logger.msg("Module item "+itemName+" found with path "+path.toString()+". Moving to "+modDomPath.toString()); - modDomPath.setEntity(new EntityPath(thisProxy.getSystemKey())); + modDomPath.setEntity(new ItemPath(thisProxy.getSystemKey())); if (!modDomPath.exists()) Gateway.getLDAPLookup().add(modDomPath); Gateway.getLDAPLookup().delete(path); @@ -247,17 +246,15 @@ public class Bootstrap } - EntityPath entityPath = Gateway.getLDAPLookup().getNextKeyManager().generateNextEntityKey(); - TraceableEntity newItem = (TraceableEntity)Gateway.getCorbaServer().createEntity(entityPath); + ItemPath entityPath = Gateway.getLDAPLookup().getNextKeyManager().generateNextEntityKey(); + Gateway.getCorbaServer().createEntity(entityPath); Gateway.getLDAPLookup().add(entityPath); - newItem.initialise( - 1, - Gateway.getMarshaller().marshall(props), - Gateway.getMarshaller().marshall(ca)); DomainPath newDomPath = impHandler.getPath(itemName, ns); newDomPath.setEntity(entityPath); Gateway.getLDAPLookup().add(newDomPath); - return (ItemProxy)Gateway.getProxyManager().getProxy(entityPath); + ItemProxy newItemProxy = Gateway.getProxyManager().getProxy(entityPath); + newItemProxy.initialise( 1, props, ca, null); + return newItemProxy; } /************************************************************************** @@ -281,7 +278,7 @@ public class Bootstrap } try { - EntityPath entityPath = lookup.getNextKeyManager().generateNextEntityKey(); + ItemPath entityPath = lookup.getNextKeyManager().generateNextEntityKey(); AgentPath agentPath = new AgentPath(entityPath.getSysKey(), name); agentPath.setPassword(pass); Gateway.getCorbaServer().createEntity(agentPath); @@ -318,7 +315,7 @@ public class Bootstrap public static void createServerItem() throws Exception { String serverName = Gateway.getProperties().getProperty("ItemServer.name"); thisServerPath = new DomainPath("/servers/"+serverName); - EntityPath serverEntity; + ItemPath serverEntity; try { serverEntity = thisServerPath.getEntity(); } catch (ObjectNotFoundException ex) { diff --git a/src/main/java/com/c2kernel/process/Gateway.java b/src/main/java/com/c2kernel/process/Gateway.java index ea49ded..6c7b68d 100644 --- a/src/main/java/com/c2kernel/process/Gateway.java +++ b/src/main/java/com/c2kernel/process/Gateway.java @@ -13,7 +13,7 @@ import com.c2kernel.common.InvalidDataException; import com.c2kernel.common.ObjectNotFoundException; import com.c2kernel.entity.CorbaServer; import com.c2kernel.entity.proxy.AgentProxy; -import com.c2kernel.entity.proxy.EntityProxyManager; +import com.c2kernel.entity.proxy.ProxyManager; import com.c2kernel.lookup.AgentPath; import com.c2kernel.lookup.LDAPLookup; import com.c2kernel.lookup.LDAPProperties; @@ -57,7 +57,7 @@ public class Gateway static private boolean orbDestroyed = false; static private LDAPLookup mLDAPLookup; static private TransactionManager mStorage; - static private EntityProxyManager mProxyManager; + static private ProxyManager mProxyManager; static private CorbaServer mCorbaServer; static private CastorXMLUtility mMarshaller; static private AgentProxy mCurrentUser = null; @@ -151,7 +151,7 @@ public class Gateway mLDAPLookup.install(); // start entity proxy server - EntityProxyManager.initServer(); + ProxyManager.initServer(); // Init ORB - set various config String serverName = getProperty("ItemServer.name"); @@ -329,7 +329,7 @@ public class Gateway // Init storages mStorage = new TransactionManager(); - mProxyManager = new EntityProxyManager(); + mProxyManager = new ProxyManager(); } @@ -360,7 +360,7 @@ public class Gateway if (mProxyManager != null) mProxyManager.shutdown(); mProxyManager = null; - EntityProxyManager.shutdownServer(); + ProxyManager.shutdownServer(); // close log consoles Logger.closeConsole(); @@ -405,7 +405,7 @@ public class Gateway return mResource; } - static public EntityProxyManager getProxyManager() + static public ProxyManager getProxyManager() { return mProxyManager; } diff --git a/src/main/java/com/c2kernel/process/UserCodeProcess.java b/src/main/java/com/c2kernel/process/UserCodeProcess.java index f7bbe74..47742aa 100644 --- a/src/main/java/com/c2kernel/process/UserCodeProcess.java +++ b/src/main/java/com/c2kernel/process/UserCodeProcess.java @@ -9,7 +9,7 @@ import com.c2kernel.common.InvalidTransitionException; import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.entity.agent.Job; import com.c2kernel.entity.proxy.AgentProxy; -import com.c2kernel.entity.proxy.EntityProxyObserver; +import com.c2kernel.entity.proxy.ProxyObserver; import com.c2kernel.entity.proxy.MemberSubscription; import com.c2kernel.persistency.ClusterStorage; import com.c2kernel.scripting.ErrorInfo; @@ -24,7 +24,7 @@ import com.c2kernel.utils.Logger; * Copyright (C) 2003 CERN - European Organization for Nuclear Research * All rights reserved. **************************************************************************/ -public class UserCodeProcess extends StandardClient implements EntityProxyObserver, Runnable { +public class UserCodeProcess extends StandardClient implements ProxyObserver, Runnable { // Default state machine transitions private static final int START = 1; -- cgit v1.2.3