summaryrefslogtreecommitdiff
path: root/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/c2kernel/entity/proxy/AgentProxy.java')
-rw-r--r--src/main/java/com/c2kernel/entity/proxy/AgentProxy.java36
1 files changed, 14 insertions, 22 deletions
diff --git a/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java b/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java
index 173f239..1f24229 100644
--- a/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java
+++ b/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java
@@ -50,22 +50,18 @@ import com.c2kernel.utils.Logger;
public class AgentProxy extends ItemProxy
{
- AgentPath agentPath;
+ AgentPath mAgentPath;
+ String mAgentName;
Authenticator auth;
/**************************************************************************
* Creates an AgentProxy without cache and change notification
**************************************************************************/
protected AgentProxy( org.omg.CORBA.Object ior,
- int systemKey)
+ AgentPath agentPath)
throws ObjectNotFoundException
{
- super(ior, systemKey);
- try {
- agentPath = new AgentPath(systemKey);
- mPath = agentPath;
- } catch (InvalidItemPathException e) {
- throw new ObjectNotFoundException();
- }
+ super(ior, agentPath);
+ mAgentPath = agentPath;
}
public Authenticator getAuthObj() {
@@ -103,7 +99,7 @@ public class AgentProxy extends ItemProxy
{
OutcomeValidator validator = null;
Date startTime = new Date();
- Logger.msg(3, "AgentProxy - executing "+job.getStepPath()+" for "+agentPath.getAgentName());
+ Logger.msg(3, "AgentProxy - executing "+job.getStepPath()+" for "+mAgentPath.getAgentName());
// get the outcome validator if present
if (job.hasOutcome())
{
@@ -160,7 +156,7 @@ public class AgentProxy extends ItemProxy
throw new InvalidDataException(error, "");
}
- job.setAgentId(getSystemKey());
+ job.setAgentPath(mAgentPath);
Logger.msg(3, "AgentProxy - submitting job to item proxy");
String result = item.requestAction(job);
if (Logger.doLog(3)) {
@@ -199,12 +195,8 @@ public class AgentProxy extends ItemProxy
ObjectAlreadyExistsException,
ScriptErrorException
{
- try {
- ItemProxy targetItem = Gateway.getProxyManager().getProxy(new ItemPath(job.getItemSysKey()));
- return execute(targetItem, job);
- } catch (InvalidItemPathException e) {
- throw new ObjectNotFoundException("Job contained invalid item sysKey: "+job.getItemSysKey(), "");
- }
+ ItemProxy targetItem = Gateway.getProxyManager().getProxy(job.getItemPath());
+ return execute(targetItem, job);
}
public String execute(ItemProxy item, String predefStep, C2KLocalObject obj)
@@ -233,7 +225,7 @@ public class AgentProxy extends ItemProxy
PersistencyException,
ObjectAlreadyExistsException
{
- return item.getItem().requestAction(getSystemKey(), "workflow/predefined/"+predefStep, PredefinedStep.DONE, PredefinedStep.bundleData(params));
+ return item.getItem().requestAction(mAgentPath.getSystemKey(), "workflow/predefined/"+predefStep, PredefinedStep.DONE, PredefinedStep.bundleData(params));
}
/** Wrappers for scripts */
@@ -255,7 +247,7 @@ public class AgentProxy extends ItemProxy
while(results.hasNext()) {
Path nextMatch = results.next();
- if (returnPath != null && nextMatch.getSysKey() != -1 && returnPath.getSysKey() != nextMatch.getSysKey())
+ if (returnPath != null && nextMatch.getUUID() != null && !returnPath.getUUID().equals(nextMatch.getUUID()))
throw new ObjectNotFoundException("Too many items with that name");
returnPath = nextMatch;
}
@@ -269,14 +261,14 @@ public class AgentProxy extends ItemProxy
@Override
public AgentPath getPath() {
- return agentPath;
+ return mAgentPath;
}
public ItemProxy getItem(Path itemPath) throws ObjectNotFoundException {
return Gateway.getProxyManager().getProxy(itemPath);
}
- public ItemProxy getItemBySysKey(int sysKey) throws ObjectNotFoundException, InvalidItemPathException {
- return Gateway.getProxyManager().getProxy(new ItemPath(sysKey));
+ public ItemProxy getItemByUUID(String uuid) throws ObjectNotFoundException, InvalidItemPathException {
+ return Gateway.getProxyManager().getProxy(new ItemPath(uuid));
}
}