diff options
| author | Andrew Branson <andrew.branson@cern.ch> | 2013-11-18 09:48:03 +0100 |
|---|---|---|
| committer | Andrew Branson <andrew.branson@cern.ch> | 2013-11-18 17:25:00 +0100 |
| commit | d43164830403245353080f5d6f838ed9f56d9a35 (patch) | |
| tree | d880c9103fb61f5ef39f1723c4dbd634d5d83b67 /src/main/java/com/c2kernel/entity/proxy | |
| parent | 37a3c3867cb4c7705065ed1d079bdac4f3f52f50 (diff) | |
3.0-SNAPSHOT (Will be first open source version)
New StateMachine desc
IssueID #28
Diffstat (limited to 'src/main/java/com/c2kernel/entity/proxy')
| -rw-r--r-- | src/main/java/com/c2kernel/entity/proxy/AgentProxy.java | 17 | ||||
| -rw-r--r-- | src/main/java/com/c2kernel/entity/proxy/ItemProxy.java | 15 |
2 files changed, 13 insertions, 19 deletions
diff --git a/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java b/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java index 24172dc..3569421 100644 --- a/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java +++ b/src/main/java/com/c2kernel/entity/proxy/AgentProxy.java @@ -25,7 +25,6 @@ import com.c2kernel.entity.C2KLocalObject; import com.c2kernel.entity.ManageableEntity;
import com.c2kernel.entity.agent.Job;
import com.c2kernel.lifecycle.instance.predefined.PredefinedStep;
-import com.c2kernel.lifecycle.instance.stateMachine.Transitions;
import com.c2kernel.lookup.AgentPath;
import com.c2kernel.lookup.DomainPath;
import com.c2kernel.lookup.EntityPath;
@@ -111,14 +110,13 @@ public class AgentProxy extends EntityProxy ScriptErrorException
{
OutcomeValidator validator = null;
- String scriptName = job.getActPropString("ScriptName");
Date startTime = new Date();
Logger.msg(3, "AgentProxy - executing "+job.getStepPath()+" for "+path.getAgentName());
// get the outcome validator if present
- if (job.requiresOutcome() || job.isError())
+ if (job.hasOutcome())
{
- String schemaName = job.isError()?"Errors":job.getSchemaType();
- int schemaVersion = job.isError()?0:job.getSchemaVersion();
+ String schemaName = job.getSchemaName();
+ int schemaVersion = job.getSchemaVersion();
Logger.msg(5, "AgentProxy - fetching schema "+schemaName+"_"+schemaVersion+" for validation");
// retrieve schema
@@ -134,9 +132,8 @@ public class AgentProxy extends EntityProxy }
}
- if(scriptName != null && scriptName.length() > 0 &&
- (job.getPossibleTransition() == Transitions.DONE || job.getPossibleTransition() == Transitions.COMPLETE)) {
- Logger.msg(3, "AgentProxy - executing script "+scriptName);
+ if(job.hasScript()) {
+ Logger.msg(3, "AgentProxy - executing script "+job.getScriptName()+" v"+job.getScriptVersion());
try {
// pre-validate outcome from script if there is one
@@ -151,7 +148,6 @@ public class AgentProxy extends EntityProxy // load script
ErrorInfo scriptErrors = (ErrorInfo)callScript(item, job);
-
String errorString = scriptErrors.toString();
if (scriptErrors.getFatal()) {
Logger.msg(3, "AgentProxy - fatal script error");
@@ -171,6 +167,7 @@ public class AgentProxy extends EntityProxy if (error.length() > 0)
throw new InvalidDataException(error, "");
}
+ else if (job.isOutcomeRequired())
job.setAgentId(getSystemKey());
Logger.msg(3, "AgentProxy - submitting job to item proxy");
@@ -243,7 +240,7 @@ public class AgentProxy extends EntityProxy PersistencyException,
ObjectAlreadyExistsException
{
- item.requestAction(getSystemKey(), "workflow/predefined/"+predefStep, Transitions.DONE, PredefinedStep.bundleData(params));
+ item.requestAction(getSystemKey(), "workflow/predefined/"+predefStep, PredefinedStep.DONE, PredefinedStep.bundleData(params));
}
/** Wrappers for scripts */
diff --git a/src/main/java/com/c2kernel/entity/proxy/ItemProxy.java b/src/main/java/com/c2kernel/entity/proxy/ItemProxy.java index 67685e7..ceea6c3 100644 --- a/src/main/java/com/c2kernel/entity/proxy/ItemProxy.java +++ b/src/main/java/com/c2kernel/entity/proxy/ItemProxy.java @@ -26,7 +26,6 @@ import com.c2kernel.entity.ManageableEntity; import com.c2kernel.entity.agent.Job;
import com.c2kernel.entity.agent.JobArrayList;
import com.c2kernel.lifecycle.instance.Workflow;
-import com.c2kernel.lifecycle.instance.stateMachine.Transitions;
import com.c2kernel.persistency.ClusterStorage;
import com.c2kernel.persistency.outcome.Viewpoint;
import com.c2kernel.process.Gateway;
@@ -108,10 +107,10 @@ public class ItemProxy extends EntityProxy ObjectAlreadyExistsException
{
String outcome = thisJob.getOutcomeString();
- // check fields that should have been filled in
- if (outcome==null)
- if (thisJob.requiresOutcome())
- throw new InvalidDataException("Outcome is required.", "");
+ // check fields that should have been filled in
+ if (outcome==null)
+ if (thisJob.isOutcomeRequired())
+ throw new InvalidDataException("Outcome is required.", "");
else
outcome="";
@@ -120,7 +119,7 @@ public class ItemProxy extends EntityProxy Logger.msg(7, "ItemProxy - executing "+thisJob.getStepPath()+" for "+thisJob.getAgentName());
requestAction (thisJob.getAgentId(), thisJob.getStepPath(),
- thisJob.getPossibleTransition(), outcome);
+ thisJob.getTransition().getId(), outcome);
}
//requestData is xmlString
@@ -200,9 +199,7 @@ public class ItemProxy extends EntityProxy ArrayList<Job> jobList = getJobList(agentId);
for (Job job : jobList) {
- int transition = job.getPossibleTransition();
- if (job.getStepName().equals(actName))
- if (transition == Transitions.COMPLETE || transition == Transitions.DONE)
+ if (job.getStepName().equals(actName) && job.hasOutcome())
return job;
}
return null;
|
