]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - runtime/org.argeo.slc.support.activemq/src/main/java/org/argeo/slc/jms/JmsAgentProxy.java
JCR UI can run processes
[gpl/argeo-slc.git] / runtime / org.argeo.slc.support.activemq / src / main / java / org / argeo / slc / jms / JmsAgentProxy.java
index 2ab9a38f869b893df6e6994355c33fe0cf16772e..d3027c93dba717cd308fead2bd5ccf93b5901309 100644 (file)
@@ -29,6 +29,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.argeo.slc.SlcException;
 import org.argeo.slc.execution.ExecutionModuleDescriptor;
+import org.argeo.slc.execution.ExecutionProcess;
 import org.argeo.slc.msg.ExecutionAnswer;
 import org.argeo.slc.msg.MsgConstants;
 import org.argeo.slc.process.SlcExecution;
@@ -53,6 +54,10 @@ public class JmsAgentProxy implements SlcAgent {
                this.jmsTemplate = jmsTemplate;
        }
 
+       public String getAgentUuid() {
+               return agentUuid;
+       }
+
        public ExecutionModuleDescriptor getExecutionModuleDescriptor(
                        final String moduleName, final String version) {
                return (ExecutionModuleDescriptor) sendReceive(new AgentMC(
@@ -70,7 +75,15 @@ public class JmsAgentProxy implements SlcAgent {
        }
 
        public void runSlcExecution(SlcExecution slcExecution) {
-               sendReceive(new AgentMC("runSlcExecution", slcExecution));
+               process(slcExecution);
+       }
+
+       public void process(ExecutionProcess executionProcess) {
+               if (!(executionProcess instanceof SlcExecution))
+                       throw new SlcException("Unsupported process type "
+                                       + executionProcess.getClass());
+               sendReceive(new AgentMC("runSlcExecution",
+                               (SlcExecution) executionProcess));
        }
 
        public boolean ping() {
@@ -194,9 +207,7 @@ public class JmsAgentProxy implements SlcAgent {
                                msg = session.createTextMessage();
                        else
                                msg = toMessage(body, session);
-                       msg
-                                       .setStringProperty(MsgConstants.PROPERTY_SLC_AGENT_ID,
-                                                       agentUuid);
+                       msg.setStringProperty(MsgConstants.PROPERTY_SLC_AGENT_ID, agentUuid);
                        msg.setStringProperty(JmsAgent.PROPERTY_QUERY, query);
                        msg.setJMSCorrelationID(correlationId);
                        setArguments(msg);