summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/CreateAgentFromDescription.java
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2014-09-09 12:13:21 +0200
committerAndrew Branson <andrew.branson@cern.ch>2014-09-09 12:13:21 +0200
commitda731d2bb81666b9c697d9099da632e7dfcdc0f7 (patch)
tree567693c3c48f3d15ecbb2dac4f9db03bb6e58c72 /src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/CreateAgentFromDescription.java
parentae1e79e33fd30e3d8bcedbef8891a14a048276d7 (diff)
Replaced int sysKey Item identifier with UUID, which is now portable.
ItemPath objects are now used to identify Items throughout the kernel, replacing ints and Integers.
Diffstat (limited to 'src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/CreateAgentFromDescription.java')
-rw-r--r--src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/CreateAgentFromDescription.java17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/CreateAgentFromDescription.java b/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/CreateAgentFromDescription.java
index a7971f3..520f70f 100644
--- a/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/CreateAgentFromDescription.java
+++ b/src/main/java/com/c2kernel/lifecycle/instance/predefined/agent/CreateAgentFromDescription.java
@@ -19,6 +19,7 @@ import com.c2kernel.entity.CorbaServer;
import com.c2kernel.entity.agent.ActiveEntity;
import com.c2kernel.lifecycle.instance.predefined.item.CreateItemFromDescription;
import com.c2kernel.lookup.AgentPath;
+import com.c2kernel.lookup.ItemPath;
import com.c2kernel.lookup.RolePath;
import com.c2kernel.process.Gateway;
import com.c2kernel.utils.Logger;
@@ -42,7 +43,7 @@ public class CreateAgentFromDescription extends CreateItemFromDescription
* @see com.c2kernel.lifecycle.instance.predefined.item.CreateItemFromDescription#runActivityLogic(com.c2kernel.lookup.AgentPath, int, int, java.lang.String)
*/
@Override
- protected String runActivityLogic(AgentPath agent, int itemSysKey,
+ protected String runActivityLogic(AgentPath agent, ItemPath itemPath,
int transitionID, String requestData) throws InvalidDataException {
String[] input = getDataList(requestData);
@@ -67,8 +68,8 @@ public class CreateAgentFromDescription extends CreateItemFromDescription
} catch (ObjectNotFoundException ex) { }
// generate new entity key
- Logger.msg(6, "CreateItemFromDescription - Requesting new sysKey");
- AgentPath newAgentPath = Gateway.getNextKeyManager().generateNextAgentKey();
+ Logger.msg(6, "CreateItemFromDescription - Requesting new agent path");
+ AgentPath newAgentPath = new AgentPath(newName);
// resolve the item factory
Logger.msg(6, "CreateItemFromDescription - Resolving item factory");
@@ -77,7 +78,7 @@ public class CreateAgentFromDescription extends CreateItemFromDescription
Logger.msg(3, "CreateItemFromDescription - Creating Item");
CorbaServer factory = Gateway.getCorbaServer();
if (factory == null) throw new AccessRightsException("This process cannot create new Items", "");
- ActiveEntity newAgent = (ActiveEntity)factory.createEntity(newAgentPath);
+ ActiveEntity newAgent = factory.createAgent(newAgentPath);
Gateway.getLookupManager().add(newAgentPath);
// initialise it with its properties and workflow
@@ -85,10 +86,10 @@ public class CreateAgentFromDescription extends CreateItemFromDescription
Logger.msg(3, "CreateItemFromDescription - Initializing Item");
newAgent.initialise(
- agent.getSysKey(),
- Gateway.getMarshaller().marshall(getNewProperties(itemSysKey, newName, agent)),
- Gateway.getMarshaller().marshall(getNewWorkflow(itemSysKey)),
- Gateway.getMarshaller().marshall(getNewCollections(itemSysKey))
+ agent.getSystemKey(),
+ Gateway.getMarshaller().marshall(getNewProperties(itemPath, newName, agent)),
+ Gateway.getMarshaller().marshall(getNewWorkflow(itemPath)),
+ Gateway.getMarshaller().marshall(getNewCollections(itemPath))
);
// add roles if given