JBoss JBPM SVN: r3095 - in jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration: model and 1 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-26 04:23:21 -0500 (Wed, 26 Nov 2008)
New Revision: 3095
Modified:
jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/client/TokenImpl.java
jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/model/ProcessImpl.java
jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/service/ProcessDefinitionServiceImpl.java
jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/service/ProcessServiceImpl.java
Log:
Update API integration
Modified: jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/client/TokenImpl.java
===================================================================
--- jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/client/TokenImpl.java 2008-11-26 08:54:46 UTC (rev 3094)
+++ jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/client/TokenImpl.java 2008-11-26 09:23:21 UTC (rev 3095)
@@ -21,8 +21,14 @@
*/
package org.jbpm.integration.client;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Map;
import java.util.Set;
+import javax.management.ObjectName;
+
+import org.jbpm.api.Constants;
import org.jbpm.api.NotImplementedException;
import org.jbpm.api.client.ProcessEngine;
import org.jbpm.api.client.Token;
@@ -30,6 +36,7 @@
import org.jbpm.api.model.Process;
import org.jbpm.api.model.SequenceFlow;
import org.jbpm.api.model.Process.ProcessStatus;
+import org.jbpm.api.model.builder.ObjectNameFactory;
import org.jbpm.api.runtime.Attachments;
import org.jbpm.api.runtime.BasicAttachments;
import org.jbpm.integration.model.ProcessImpl;
@@ -47,17 +54,16 @@
private org.jbpm.graph.exe.Token oldToken;
private ProcessImpl procImpl;
private Attachments att = new BasicAttachments();
-
- public TokenImpl(ProcessImpl proc, org.jbpm.graph.exe.Token oldToken, Attachments att)
+
+ public TokenImpl(ProcessImpl proc, org.jbpm.graph.exe.Token oldToken)
{
this.oldToken = oldToken;
this.procImpl = proc;
- this.att = att;
}
- public String getTokenID()
+ public ObjectName getKey()
{
- throw new NotImplementedException();
+ return ObjectNameFactory.create(Constants.ID_DOMAIN + ":id=" + oldToken.getId());
}
public Process getProcess()
@@ -70,13 +76,13 @@
return procImpl.getProcessEngine();
}
- //@Override
+ // @Override
public Attachments getAttachments()
{
return att;
}
- //@Override
+ // @Override
public TokenStatus getTokenStatus()
{
TokenStatus status = TokenStatus.Suspended;
@@ -87,38 +93,68 @@
return status;
}
- //@Override
+ // @Override
public Set<Token> getChildTokens()
{
- throw new NotImplementedException();
+ Set<Token> childTokens = new HashSet<Token>();
+ Map oldChildMap = oldToken.getChildren();
+ if (oldChildMap != null)
+ {
+ Collection<org.jbpm.graph.exe.Token> oldChildTokens = oldChildMap.values();
+ for (org.jbpm.graph.exe.Token oldChildToken : oldChildTokens)
+ {
+ TokenImpl childToken = new TokenImpl(procImpl, oldChildToken);
+ childTokens.add(childToken);
+ }
+ }
+ return childTokens;
}
- //@Override
+ // @Override
public Node getCurrentNode()
{
String nodeName = oldToken.getNode().getName();
return procImpl.getNode(nodeName);
}
- //@Override
+ // @Override
public SequenceFlow getLastFlow()
{
throw new NotImplementedException();
}
- //@Override
+ // @Override
public Token getParentToken()
{
- throw new NotImplementedException();
+ org.jbpm.graph.exe.Token parent = oldToken.getParent();
+ return parent != null ? new TokenImpl(procImpl, parent) : null;
}
- //@Override
+ // @Override
public Token getRootToken()
{
- throw new NotImplementedException();
+ org.jbpm.graph.exe.Token root = oldToken;
+ while (root.getParent() != null)
+ root = root.getParent();
+
+ return new TokenImpl(procImpl, root);
}
- //@Override
+ // @Override
+ public void signal(String name)
+ {
+ try
+ {
+ oldToken.signal(name);
+ }
+ catch (RuntimeException rte)
+ {
+ procImpl.setProcessStatus(ProcessStatus.Aborted);
+ throw rte;
+ }
+ }
+
+ // @Override
public void signal()
{
try
Modified: jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/model/ProcessImpl.java
===================================================================
--- jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/model/ProcessImpl.java 2008-11-26 08:54:46 UTC (rev 3094)
+++ jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/model/ProcessImpl.java 2008-11-26 09:23:21 UTC (rev 3095)
@@ -22,11 +22,14 @@
package org.jbpm.integration.model;
import java.util.Date;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import javax.management.ObjectName;
import org.jbpm.api.Constants;
+import org.jbpm.api.NotImplementedException;
import org.jbpm.api.client.ProcessEngine;
import org.jbpm.api.client.Token;
import org.jbpm.api.client.Token.TokenStatus;
@@ -51,7 +54,6 @@
private ProcessDefinitionImpl procDef;
private ProcessInstance oldProc;
private ProcessStatus procStatus = ProcessStatus.None;
- private Token rootToken;
public ProcessImpl(ProcessDefinitionImpl procDef)
{
@@ -80,6 +82,7 @@
//@Override
public ProcessStatus getProcessStatus()
{
+ Token rootToken = getRootToken();
if (rootToken != null && procStatus == ProcessStatus.Active)
{
if (rootToken.getTokenStatus() == TokenStatus.Destroyed)
@@ -136,21 +139,38 @@
//@Override
public Token startProcess()
{
- return startProcess(null);
+ setProcessStatus(ProcessStatus.Active);
+ oldProc = new ProcessInstance(procDef.getOldProcessDefinition());
+ Token rootToken = new TokenImpl(this, oldProc.getRootToken());
+ rootToken.signal();
+ return rootToken;
}
//@Override
public Token startProcess(Attachments att)
{
- setProcessStatus(ProcessStatus.Active);
- oldProc = new ProcessInstance(procDef.getOldProcessDefinition());
- rootToken = new TokenImpl(this, oldProc.getRootToken(), att);
- rootToken.signal();
- return rootToken;
+ throw new NotImplementedException();
}
public Token getRootToken()
{
- return rootToken;
+ return new TokenImpl(this, oldProc.getRootToken());
}
+
+ public Set<Token> getTokens()
+ {
+ return getAllTokens(getRootToken());
+ }
+
+ private Set<Token> getAllTokens(Token token)
+ {
+ Set<Token> tokens = new HashSet<Token>();
+ if (token != null)
+ {
+ tokens.add(token);
+ for (Token childToken : token.getChildTokens())
+ tokens.addAll(getAllTokens(childToken));
+ }
+ return tokens;
+ }
}
Modified: jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/service/ProcessDefinitionServiceImpl.java
===================================================================
--- jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/service/ProcessDefinitionServiceImpl.java 2008-11-26 08:54:46 UTC (rev 3094)
+++ jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/service/ProcessDefinitionServiceImpl.java 2008-11-26 09:23:21 UTC (rev 3095)
@@ -123,7 +123,7 @@
// Unregister the associated process instances
ProcessService procService = engine.getService(ProcessService.class);
- for (ObjectName procID : procService.getProcesses(procDef.getName(), null))
+ for (ObjectName procID : procService.getProcesses(procDefID, null))
procService.unregisterProcess(procID);
// Works with the default configuration
Modified: jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/service/ProcessServiceImpl.java
===================================================================
--- jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/service/ProcessServiceImpl.java 2008-11-26 08:54:46 UTC (rev 3094)
+++ jbpm3/trunk/modules/integration/api/src/main/java/org/jbpm/integration/service/ProcessServiceImpl.java 2008-11-26 09:23:21 UTC (rev 3095)
@@ -100,17 +100,18 @@
/**
* Find the set of Processes for a given name
*
- * @param name The process name
+ * @param procDefID The process name
* @param status The optional process status
* @return An empty set if the process cannot be found
*/
//@Override
- public Set<ObjectName> getProcesses(String name, ProcessStatus status)
+ public Set<ObjectName> getProcesses(ObjectName procDefID, ProcessStatus status)
{
Set<ObjectName> procSet = new HashSet<ObjectName>();
for (Process auxProc : registeredProcs.values())
{
- if (auxProc.getName().equals(name))
+ ObjectName auxProcDefID = auxProc.getProcessDefinition().getKey();
+ if (auxProcDefID.equals(procDefID))
{
if (status == null || auxProc.getProcessStatus() == status)
procSet.add(auxProc.getKey());
17 years, 5 months
JBoss JBPM SVN: r3094 - in projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client: process and 1 other directories.
by do-not-reply@jboss.org
Author: heiko.braun(a)jboss.com
Date: 2008-11-26 03:54:46 -0500 (Wed, 26 Nov 2008)
New Revision: 3094
Modified:
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/UIConstants.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java
projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/RemoteListView.java
Log:
Fix JBPM-1848: Grid sort order doesn't respect selected items in RemoteListView
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/UIConstants.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/UIConstants.java 2008-11-26 08:53:53 UTC (rev 3093)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/UIConstants.java 2008-11-26 08:54:46 UTC (rev 3094)
@@ -35,4 +35,5 @@
public static final int EDITOR_PANEL_WIDTH = 450;
public static final String DEFAULT_TRANSITION = "(Default transition)";
+ public static final String DATE_FORMAT = "yyyy-m-j H:i:s"; //08-10-02 13:51:27
}
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java 2008-11-26 08:53:53 UTC (rev 3093)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessDefinitionList.java 2008-11-26 08:54:46 UTC (rev 3094)
@@ -27,6 +27,7 @@
import com.gwtext.client.widgets.MessageBoxConfig;
import com.gwtext.client.widgets.grid.ColumnConfig;
import com.gwtext.client.widgets.grid.ColumnModel;
+import com.gwtext.client.widgets.grid.RowSelectionModel;
import org.jboss.bpm.console.client.util.ConsoleLog;
import org.jboss.bpm.console.client.MainView;
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
@@ -45,6 +46,8 @@
{
super(titleName, view, getResourceUrl(view));
enableAddBtn(false);
+ final RowSelectionModel sm = new RowSelectionModel(true);
+ setRowSelectionModel(sm);
}
private static String getResourceUrl(MainView view)
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java 2008-11-26 08:53:53 UTC (rev 3093)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/process/ProcessInstanceList.java 2008-11-26 08:54:46 UTC (rev 3094)
@@ -31,6 +31,7 @@
import com.gwtext.client.widgets.grid.ColumnModel;
import org.jboss.bpm.console.client.util.ConsoleLog;
import org.jboss.bpm.console.client.MainView;
+import org.jboss.bpm.console.client.UIConstants;
import org.jboss.bpm.console.client.util.DateRenderer;
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
@@ -48,8 +49,7 @@
private Map<Integer, ProcessInstanceRef> row2InstanceMap = new HashMap<Integer, ProcessInstanceRef>();
private ProcessDefinitionRef parent;
- private static final String DATE_FORMAT = "yyyy-m-j H:i:s"; //08-10-02 13:51:27
-
+
public ProcessInstanceList(ProcessDefinitionRef procDef, String titleName, MainView view)
{
super(titleName, view, getResourceUrl(view, procDef.getProcessId()));
@@ -171,7 +171,7 @@
i++;
}
- ConsoleLog.debug("Loaded " + row2InstanceMap.size() + " records");
+ ConsoleLog.debug("Loaded " + row2InstanceMap.size() + " process instances");
}
public static ProcessInstanceRef transform(Record r)
@@ -216,8 +216,8 @@
new IntegerFieldDef("parentId"),
new StringFieldDef("key"),
new StringFieldDef("state"),
- new DateFieldDef("startDate", DATE_FORMAT),
- new DateFieldDef("endDate", DATE_FORMAT),
+ new DateFieldDef("startDate", UIConstants.DATE_FORMAT),
+ new DateFieldDef("endDate", UIConstants.DATE_FORMAT),
new BooleanFieldDef("suspended")
}
);
Modified: projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/RemoteListView.java
===================================================================
--- projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/RemoteListView.java 2008-11-26 08:53:53 UTC (rev 3093)
+++ projects/gwt-console/trunk/war/src/main/java/org/jboss/bpm/console/client/widgets/RemoteListView.java 2008-11-26 08:54:46 UTC (rev 3094)
@@ -131,9 +131,14 @@
grid.doOnRender(new Function() {
public void execute() {
if(-1==selectedRowIndex)
+ {
rowSelectionModel.selectFirstRow();
+ selectedRowIndex = 0;
+ }
else
+ {
rowSelectionModel.selectRow(selectedRowIndex);
+ }
}
}, 10);
}
17 years, 5 months
JBoss JBPM SVN: r3093 - projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/client.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-26 03:53:53 -0500 (Wed, 26 Nov 2008)
New Revision: 3093
Modified:
projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/client/Token.java
Log:
Add Token.signal(name)
Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/client/Token.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/client/Token.java 2008-11-26 08:53:34 UTC (rev 3092)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/client/Token.java 2008-11-26 08:53:53 UTC (rev 3093)
@@ -110,7 +110,7 @@
/**
* Signal the Token, which takes it to the next wait state
- * @param signal A transition or target name
+ * @param name A transition or target name
*/
- void signal(String signal);
+ void signal(String name);
}
\ No newline at end of file
17 years, 5 months
JBoss JBPM SVN: r3092 - in projects/spec/trunk/modules: ri/src/main/java/org/jbpm/ri/runtime and 1 other directory.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-26 03:53:34 -0500 (Wed, 26 Nov 2008)
New Revision: 3092
Modified:
projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/client/Token.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/DelegatingToken.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TokenImpl.java
Log:
Add Token.signal(name)
Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/client/Token.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/client/Token.java 2008-11-26 08:44:19 UTC (rev 3091)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/client/Token.java 2008-11-26 08:53:34 UTC (rev 3092)
@@ -107,4 +107,10 @@
* Signal the Token, which takes it to the next wait state
*/
void signal();
+
+ /**
+ * Signal the Token, which takes it to the next wait state
+ * @param signal A transition or target name
+ */
+ void signal(String signal);
}
\ No newline at end of file
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/DelegatingToken.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/DelegatingToken.java 2008-11-26 08:44:19 UTC (rev 3091)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/DelegatingToken.java 2008-11-26 08:53:34 UTC (rev 3092)
@@ -153,6 +153,12 @@
}
@Override
+ public void signal(String signal)
+ {
+ delegateToken.signal(signal);
+ }
+
+ @Override
public void signal()
{
delegateToken.signal();
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TokenImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TokenImpl.java 2008-11-26 08:44:19 UTC (rev 3091)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TokenImpl.java 2008-11-26 08:53:34 UTC (rev 3092)
@@ -32,6 +32,7 @@
import org.hibernate.Session;
import org.jboss.util.id.UID;
import org.jbpm.api.Constants;
+import org.jbpm.api.NotImplementedException;
import org.jbpm.api.client.ProcessEngine;
import org.jbpm.api.client.Token;
import org.jbpm.api.model.Node;
@@ -180,6 +181,12 @@
}
@Override
+ public void signal(String signal)
+ {
+ throw new NotImplementedException();
+ }
+
+ @Override
public void signal()
{
Node node = getCurrentNode();
17 years, 5 months
JBoss JBPM SVN: r3091 - in projects/spec/trunk/modules: api/src/main/java/org/jbpm/api/model and 3 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-26 03:44:19 -0500 (Wed, 26 Nov 2008)
New Revision: 3091
Modified:
projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/client/Token.java
projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/Process.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ProcessImpl.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/DelegatingToken.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/ThreadingTokenExecutor.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TokenImpl.java
projects/spec/trunk/modules/ri/src/main/resources/jbpm-cfg-beans.xml
Log:
Add token management to process
Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/client/Token.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/client/Token.java 2008-11-26 08:04:34 UTC (rev 3090)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/client/Token.java 2008-11-26 08:44:19 UTC (rev 3091)
@@ -25,6 +25,8 @@
import java.util.Set;
+import javax.management.ObjectName;
+
import org.jbpm.api.model.Node;
import org.jbpm.api.model.Process;
import org.jbpm.api.model.SequenceFlow;
@@ -62,7 +64,7 @@
/**
* Get the unique token identity
*/
- String getTokenID();
+ ObjectName getKey();
/**
* Get the token status
Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/Process.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/Process.java 2008-11-26 08:04:34 UTC (rev 3090)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/model/Process.java 2008-11-26 08:44:19 UTC (rev 3091)
@@ -24,6 +24,7 @@
//$Id$
import java.util.Date;
+import java.util.Set;
import org.jbpm.api.client.ProcessEngine;
import org.jbpm.api.client.Token;
@@ -61,6 +62,16 @@
ProcessStatus getProcessStatus();
/**
+ * Get the root Token associated with this Process
+ */
+ Token getRootToken();
+
+ /**
+ * Get the set of Tokens associated with this Process
+ */
+ Set<Token> getTokens();
+
+ /**
* Start the process
*/
Token startProcess();
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ProcessImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ProcessImpl.java 2008-11-26 08:04:34 UTC (rev 3090)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ProcessImpl.java 2008-11-26 08:44:19 UTC (rev 3091)
@@ -24,6 +24,7 @@
//$Id$
import java.util.Date;
+import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -94,6 +95,9 @@
private Date endDate;
@Transient
+ private Token rootToken;
+
+ @Transient
private transient RuntimeException runtimeException;
public ProcessImpl(ProcessEngine engine, ProcessDefinitionImpl procDef, ProcessStructureImpl procStruct)
@@ -162,6 +166,30 @@
}
@Override
+ public Token getRootToken()
+ {
+ return rootToken;
+ }
+
+ @Override
+ public Set<Token> getTokens()
+ {
+ return getAllTokens(rootToken);
+ }
+
+ private Set<Token> getAllTokens(Token token)
+ {
+ Set<Token> tokens = new HashSet<Token>();
+ if (token != null)
+ {
+ tokens.add(token);
+ for (Token childToken : token.getChildTokens())
+ tokens.addAll(getAllTokens(childToken));
+ }
+ return tokens;
+ }
+
+ @Override
public List<Assignment> getAssignments()
{
return procStruct.getAssignments();
@@ -271,13 +299,15 @@
@Override
public Token startProcess()
{
- return startProcessInternal(null);
+ rootToken = startProcessInternal(null);
+ return rootToken;
}
@Override
public Token startProcess(Attachments att)
{
- return startProcessInternal(att);
+ rootToken = startProcessInternal(att);
+ return rootToken;
}
private Token startProcessInternal(Attachments att)
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/DelegatingToken.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/DelegatingToken.java 2008-11-26 08:04:34 UTC (rev 3090)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/DelegatingToken.java 2008-11-26 08:44:19 UTC (rev 3091)
@@ -25,6 +25,8 @@
import java.util.Set;
+import javax.management.ObjectName;
+
import org.hibernate.Session;
import org.jbpm.api.client.ProcessEngine;
import org.jbpm.api.client.Token;
@@ -79,9 +81,9 @@
}
@Override
- public String getTokenID()
+ public ObjectName getKey()
{
- return delegateToken.getTokenID();
+ return delegateToken.getKey();
}
@Override
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/ThreadingTokenExecutor.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/ThreadingTokenExecutor.java 2008-11-26 08:04:34 UTC (rev 3090)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/ThreadingTokenExecutor.java 2008-11-26 08:44:19 UTC (rev 3091)
@@ -31,6 +31,8 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
+import javax.management.ObjectName;
+
import org.jbpm.api.client.Token;
import org.jbpm.api.client.Token.TokenStatus;
import org.jbpm.api.model.SequenceFlow;
@@ -54,7 +56,7 @@
private RuntimeProcess rtProc;
private ExecutorService executor = Executors.newCachedThreadPool();
- Map<String, RunnableToken> runnableTokens = new HashMap<String, RunnableToken>();
+ Map<ObjectName, RunnableToken> runnableTokens = new HashMap<ObjectName, RunnableToken>();
public ThreadingTokenExecutor(RuntimeProcess rtProc)
{
@@ -93,7 +95,7 @@
log.debug("Create Token: " + token);
RunnableToken rtToken = new RunnableToken(this, rtProc, mutableToken);
- runnableTokens.put(token.getTokenID(), rtToken);
+ runnableTokens.put(token.getKey(), rtToken);
}
}
@@ -110,7 +112,7 @@
MutableToken mutableToken = (MutableToken)token;
mutableToken.setTokenStatus(TokenStatus.Started);
- RunnableToken rtToken = runnableTokens.get(token.getTokenID());
+ RunnableToken rtToken = runnableTokens.get(token.getKey());
executor.submit(rtToken);
}
}
@@ -150,7 +152,7 @@
log.debug("Destroy Token: " + token);
MutableToken mutableToken = (MutableToken)token;
mutableToken.setTokenStatus(TokenStatus.Destroyed);
- runnableTokens.remove(token.getTokenID());
+ runnableTokens.remove(token.getKey());
}
}
@@ -159,7 +161,7 @@
{
synchronized (runnableTokens)
{
- RunnableToken rtToken = runnableTokens.get(token.getTokenID());
+ RunnableToken rtToken = runnableTokens.get(token.getKey());
if (rtToken == null)
throw new IllegalStateException("Not a runnable token: " + token);
@@ -177,7 +179,7 @@
{
synchronized (runnableTokens)
{
- String tokenID = token.getTokenID();
+ ObjectName tokenID = token.getKey();
RunnableToken rtToken = runnableTokens.get(tokenID);
if (rtToken == null)
throw new IllegalStateException("Not a runnable token: " + tokenID);
@@ -190,7 +192,7 @@
mutableToken.setTokenStatus(TokenStatus.Started);
rtToken = new RunnableToken(this, rtProc, mutableToken);
- runnableTokens.put(token.getTokenID(), rtToken);
+ runnableTokens.put(token.getKey(), rtToken);
executor.submit(rtToken);
}
}
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TokenImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TokenImpl.java 2008-11-26 08:04:34 UTC (rev 3090)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/runtime/TokenImpl.java 2008-11-26 08:44:19 UTC (rev 3091)
@@ -27,8 +27,11 @@
import java.util.HashSet;
import java.util.Set;
+import javax.management.ObjectName;
+
import org.hibernate.Session;
import org.jboss.util.id.UID;
+import org.jbpm.api.Constants;
import org.jbpm.api.client.ProcessEngine;
import org.jbpm.api.client.Token;
import org.jbpm.api.model.Node;
@@ -36,6 +39,7 @@
import org.jbpm.api.model.SequenceFlow;
import org.jbpm.api.model.WaitState;
import org.jbpm.api.model.Process.ProcessStatus;
+import org.jbpm.api.model.builder.ObjectNameFactory;
import org.jbpm.api.runtime.Attachments;
import org.jbpm.api.runtime.BasicAttachments;
import org.jbpm.api.runtime.Attachments.Key;
@@ -58,7 +62,7 @@
*/
public class TokenImpl implements MutableToken
{
- private String id;
+ private ObjectName key;
private SequenceFlow flow;
private Attachments att;
private TokenStatus status;
@@ -74,7 +78,7 @@
public TokenImpl(Process proc, Attachments att)
{
this.att = new BasicAttachments(att);
- this.id = new UID().toString();
+ this.key = ObjectNameFactory.create(Constants.ID_DOMAIN + ":id=" + new UID());
this.status = TokenStatus.Created;
this.proc = proc;
}
@@ -86,9 +90,9 @@
}
@Override
- public String getTokenID()
+ public ObjectName getKey()
{
- return id;
+ return key;
}
@Override
@@ -273,6 +277,6 @@
public String toString()
{
- return "[sf=" + getLastFlow() + ",status=" + getTokenStatus() + ",ctx=" + getAttachments() + ",id=" + id + "]";
+ return "[sf=" + getLastFlow() + ",status=" + getTokenStatus() + ",ctx=" + getAttachments() + ",key=" + key + "]";
}
}
\ No newline at end of file
Modified: projects/spec/trunk/modules/ri/src/main/resources/jbpm-cfg-beans.xml
===================================================================
--- projects/spec/trunk/modules/ri/src/main/resources/jbpm-cfg-beans.xml 2008-11-26 08:04:34 UTC (rev 3090)
+++ projects/spec/trunk/modules/ri/src/main/resources/jbpm-cfg-beans.xml 2008-11-26 08:44:19 UTC (rev 3091)
@@ -11,7 +11,6 @@
<property name="services">
<set elementClass="org.jbpm.api.service.Service">
<inject bean="jBPMDialectHandlerService" />
- <inject bean="jBPMExecutionService" />
<inject bean="jBPMMessageService" />
<inject bean="jBPMMessageBuilderService" />
<inject bean="jBPMPersistenceService" />
@@ -20,6 +19,7 @@
<inject bean="jBPMProcessService" />
<inject bean="jBPMSignalService" />
<inject bean="jBPMSignalBuilderService" />
+ <inject bean="jBPMThreadingService" />
</set>
</property>
</bean>
@@ -92,12 +92,12 @@
<bean name="jBPMDialectHandlerXPDL21" class="org.jbpm.dialect.xpdl21.DialectHandlerImpl"/>
<!-- Other Services -->
- <bean name="jBPMExecutionService" class="org.jbpm.ri.service.ExecutionServiceImpl" />
<bean name="jBPMMessageService" class="org.jbpm.ri.service.MessageServiceImpl" />
<bean name="jBPMMessageBuilderService" class="org.jbpm.ri.service.MessageBuilderServiceImpl" />
<bean name="jBPMProcessBuilderService" class="org.jbpm.ri.service.ProcessBuilderServiceImpl" />
<bean name="jBPMProcessDefinitionService" class="org.jbpm.ri.service.ProcessDefinitionServiceImpl" />
<bean name="jBPMSignalBuilderService" class="org.jbpm.ri.service.SignalBuilderServiceImpl" />
<bean name="jBPMSignalService" class="org.jbpm.ri.service.SignalServiceImpl" />
+ <bean name="jBPMThreadingService" class="org.jbpm.ri.service.ThreadingServiceImpl" />
</deployment>
17 years, 5 months
JBoss JBPM SVN: r3090 - in projects/spec/trunk/modules: api/src/main/java/org/jbpm/api/service and 4 other directories.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-26 03:04:34 -0500 (Wed, 26 Nov 2008)
New Revision: 3090
Added:
projects/spec/trunk/modules/api/src/main/java/org/jbpm/incubator/service/ThreadingService.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ThreadingServiceImpl.java
Removed:
projects/spec/trunk/modules/api/src/main/java/org/jbpm/incubator/service/ExecutionService.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ExecutionServiceImpl.java
Modified:
projects/spec/trunk/modules/api/.classpath
projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ProcessService.java
projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/incubator/startevent/StartEventSignalTest.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ProcessImpl.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/StartEventImpl.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ProcessDefinitionServiceImpl.java
projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ProcessServiceImpl.java
Log:
Add getProcess by procDef
Modified: projects/spec/trunk/modules/api/.classpath
===================================================================
--- projects/spec/trunk/modules/api/.classpath 2008-11-26 07:33:48 UTC (rev 3089)
+++ projects/spec/trunk/modules/api/.classpath 2008-11-26 08:04:34 UTC (rev 3090)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Modified: projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ProcessService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ProcessService.java 2008-11-26 07:33:48 UTC (rev 3089)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/api/service/ProcessService.java 2008-11-26 08:04:34 UTC (rev 3090)
@@ -75,11 +75,11 @@
public abstract Set<ObjectName> getProcesses();
/**
- * Find the set of Processes for a given name
+ * Get the set of Processes for a given ProcessDefinition
*
- * @param name The process name
+ * @param procDefID The process definition id
* @param status The optional process status
* @return An empty set if the process cannot be found
*/
- public abstract Set<ObjectName> getProcesses(String name, ProcessStatus status);
+ public abstract Set<ObjectName> getProcesses(ObjectName procDefID, ProcessStatus status);
}
\ No newline at end of file
Deleted: projects/spec/trunk/modules/api/src/main/java/org/jbpm/incubator/service/ExecutionService.java
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/incubator/service/ExecutionService.java 2008-11-26 07:33:48 UTC (rev 3089)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/incubator/service/ExecutionService.java 2008-11-26 08:04:34 UTC (rev 3090)
@@ -1,79 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.incubator.service;
-
-// $Id$
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import org.jbpm.api.model.Process;
-import org.jbpm.api.model.StartEvent;
-import org.jbpm.api.model.Process.ProcessStatus;
-import org.jbpm.api.runtime.Attachments;
-import org.jbpm.api.service.AbstractService;
-
-/**
- * The ExecutionService executes processes
- *
- * @author thomas.diesler(a)jboss.com
- * @since 18-Jun-2008
- */
-public abstract class ExecutionService extends AbstractService
-{
- private ExecutorService procExecutor = Executors.newCachedThreadPool();
-
- // Hide public constructor
- protected ExecutionService()
- {
- }
-
- /**
- * Get the process executor service
- */
- public ExecutorService getProcessExecutor()
- {
- return procExecutor;
- }
-
- /**
- * Start the Process from a given start event
- *
- * @param start The StartEvent that triggers the process
- * @param att The Attachments in the ExecutionContext
- */
- public abstract void startProcess(Process proc, StartEvent start, Attachments att);
-
- /**
- * All Tokens that are generated at the Start Event for that Process must eventually arrive at an End Event. The
- * Process will be in a running state until all Tokens are consumed. <p/> This method until the process ends without
- * timeout.
- */
- public abstract ProcessStatus waitForEnd(Process proc);
-
- /**
- * All Tokens that are generated at the Start Event for that Process must eventually arrive at an End Event. The
- * Process will be in a running state until all Tokens are consumed. <p/> This method until the process ends with a
- * given timeout.
- */
- public abstract ProcessStatus waitForEnd(Process proc, long timeout);
-}
Copied: projects/spec/trunk/modules/api/src/main/java/org/jbpm/incubator/service/ThreadingService.java (from rev 3087, projects/spec/trunk/modules/api/src/main/java/org/jbpm/incubator/service/ExecutionService.java)
===================================================================
--- projects/spec/trunk/modules/api/src/main/java/org/jbpm/incubator/service/ThreadingService.java (rev 0)
+++ projects/spec/trunk/modules/api/src/main/java/org/jbpm/incubator/service/ThreadingService.java 2008-11-26 08:04:34 UTC (rev 3090)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.incubator.service;
+
+// $Id$
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import org.jbpm.api.model.Process;
+import org.jbpm.api.model.StartEvent;
+import org.jbpm.api.model.Process.ProcessStatus;
+import org.jbpm.api.runtime.Attachments;
+import org.jbpm.api.service.AbstractService;
+
+/**
+ * The ThreadingService executes processes
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 18-Jun-2008
+ */
+public abstract class ThreadingService extends AbstractService
+{
+ private ExecutorService procExecutor = Executors.newCachedThreadPool();
+
+ // Hide public constructor
+ protected ThreadingService()
+ {
+ }
+
+ /**
+ * Get the process executor service
+ */
+ public ExecutorService getProcessExecutor()
+ {
+ return procExecutor;
+ }
+
+ /**
+ * Start the Process from a given start event
+ *
+ * @param start The StartEvent that triggers the process
+ * @param att The Attachments in the ExecutionContext
+ */
+ public abstract void startProcess(Process proc, StartEvent start, Attachments att);
+
+ /**
+ * All Tokens that are generated at the Start Event for that Process must eventually arrive at an End Event. The
+ * Process will be in a running state until all Tokens are consumed. <p/> This method until the process ends without
+ * timeout.
+ */
+ public abstract ProcessStatus waitForEnd(Process proc);
+
+ /**
+ * All Tokens that are generated at the Start Event for that Process must eventually arrive at an End Event. The
+ * Process will be in a running state until all Tokens are consumed. <p/> This method until the process ends with a
+ * given timeout.
+ */
+ public abstract ProcessStatus waitForEnd(Process proc, long timeout);
+}
Modified: projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/incubator/startevent/StartEventSignalTest.java
===================================================================
--- projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/incubator/startevent/StartEventSignalTest.java 2008-11-26 07:33:48 UTC (rev 3089)
+++ projects/spec/trunk/modules/cts/src/test/java/org/jbpm/test/incubator/startevent/StartEventSignalTest.java 2008-11-26 08:04:34 UTC (rev 3090)
@@ -62,6 +62,7 @@
// You need to register the process definition to activate the start trigger
ProcessDefinitionService procDefService = ProcessDefinitionService.locateProcessDefinitionService();
procDefService.registerProcessDefinition(procDef);
+ ObjectName procDefID = procDef.getKey();
ProcessExt proc = (ProcessExt)procDef.newInstance();
try
@@ -80,7 +81,7 @@
// Get the just started process
ProcessService procService = ProcessService.locateProcessService();
- Set<ObjectName> procIDs = procService.getProcesses("StartEventSignal", null);
+ Set<ObjectName> procIDs = procService.getProcesses(procDefID, null);
proc = (ProcessExt) procService.getProcess(procIDs.iterator().next());
// Wait for the process to end
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ProcessImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ProcessImpl.java 2008-11-26 07:33:48 UTC (rev 3089)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/ProcessImpl.java 2008-11-26 08:04:34 UTC (rev 3090)
@@ -59,7 +59,7 @@
import org.jbpm.incubator.model.ProcessStructureExt;
import org.jbpm.incubator.model.Property;
import org.jbpm.incubator.model.StartEventExt;
-import org.jbpm.incubator.service.ExecutionService;
+import org.jbpm.incubator.service.ThreadingService;
import org.jbpm.ri.runtime.TokenImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -322,7 +322,7 @@
StartEvent start = prepareProcessStart();
ProcessEngine engine = getProcessEngine();
- ExecutionService exService = engine.getService(ExecutionService.class);
+ ThreadingService exService = engine.getService(ThreadingService.class);
try
{
exService.startProcess(this, start, att);
@@ -390,7 +390,7 @@
private ProcessStatus waitForEndInternal(long timeout)
{
ProcessEngine engine = getProcessEngine();
- ExecutionService exService = engine.getService(ExecutionService.class);
+ ThreadingService exService = engine.getService(ThreadingService.class);
return exService.waitForEnd(this, timeout);
}
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/StartEventImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/StartEventImpl.java 2008-11-26 07:33:48 UTC (rev 3089)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/model/StartEventImpl.java 2008-11-26 08:04:34 UTC (rev 3090)
@@ -43,7 +43,7 @@
import org.jbpm.incubator.model.StartEventExt;
import org.jbpm.incubator.model.Signal.SignalType;
import org.jbpm.incubator.runtime.SignalHandler;
-import org.jbpm.incubator.service.ExecutionService;
+import org.jbpm.incubator.service.ThreadingService;
import org.jbpm.incubator.service.SignalService;
import org.jbpm.ri.model.builder.SingleOutFlowSupport;
import org.slf4j.Logger;
@@ -194,7 +194,7 @@
Process proc = procDef.newInstance();
StartEvent startEvent = proc.getNode(StartEvent.class, startEventName);
- ExecutionService execService = engine.getService(ExecutionService.class);
+ ThreadingService execService = engine.getService(ThreadingService.class);
execService.startProcess(proc, startEvent, null);
}
Deleted: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ExecutionServiceImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ExecutionServiceImpl.java 2008-11-26 07:33:48 UTC (rev 3089)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ExecutionServiceImpl.java 2008-11-26 08:04:34 UTC (rev 3090)
@@ -1,329 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jbpm.ri.service;
-
-// $Id$
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.management.ObjectName;
-
-import org.jbpm.api.BPMException;
-import org.jbpm.api.ProcessTimeoutException;
-import org.jbpm.api.client.ProcessEngine;
-import org.jbpm.api.client.Token;
-import org.jbpm.api.model.Expression;
-import org.jbpm.api.model.Process;
-import org.jbpm.api.model.StartEvent;
-import org.jbpm.api.model.Process.ProcessStatus;
-import org.jbpm.api.runtime.Attachments;
-import org.jbpm.api.service.ProcessService;
-import org.jbpm.incubator.client.ProcessExt;
-import org.jbpm.incubator.model.Assignment;
-import org.jbpm.incubator.model.Assignment.AssignTime;
-import org.jbpm.incubator.model.Signal.SignalType;
-import org.jbpm.incubator.runtime.TokenExecutor;
-import org.jbpm.incubator.service.ExecutionService;
-import org.jbpm.incubator.service.SignalService;
-import org.jbpm.ri.model.ProcessImpl;
-import org.jbpm.ri.model.SequenceFlowImpl;
-import org.jbpm.ri.model.SignalImpl;
-import org.jbpm.ri.runtime.DelegatingToken;
-import org.jbpm.ri.runtime.ExpressionEvaluator;
-import org.jbpm.ri.runtime.MutableToken;
-import org.jbpm.ri.runtime.RuntimeProcess;
-import org.jbpm.ri.runtime.RuntimeProcessImpl;
-import org.jbpm.ri.runtime.ThreadingTokenExecutor;
-import org.jbpm.ri.runtime.TokenImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * The process manager is the entry point to create, find and otherwise manage processes.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 18-Jun-2008
- */
-public class ExecutionServiceImpl extends ExecutionService implements MutableService
-{
- // provide logging
- final static Logger log = LoggerFactory.getLogger(ExecutionServiceImpl.class);
-
- // The map of active runtime processes
- private Map<ObjectName, RuntimeProcess> runtimeProcesses = new HashMap<ObjectName, RuntimeProcess>();
-
- @Override
- public void setProcessEngine(ProcessEngine engine)
- {
- super.setProcessEngine(engine);
- }
-
- @Override
- public void startProcess(Process proc, StartEvent start, Attachments att)
- {
- startProcessInternal(proc, start, att);
- }
-
- private synchronized void startProcessInternal(Process proc, StartEvent start, Attachments att)
- {
- @SuppressWarnings("serial")
- class InitialFlow extends SequenceFlowImpl
- {
- InitialFlow(StartEvent start)
- {
- super(start.getName());
- }
- }
-
- RuntimeProcess rtProc = getRuntimeProcess(proc, false);
- boolean startProcessThread = (rtProc == null);
-
- // Create initial Token
- TokenImpl initialToken = new TokenImpl(proc, att);
- InitialFlow initialFlow = new InitialFlow(start);
- initialToken.setLastFlow(initialFlow);
-
- // Register the initial Token
- rtProc = getRuntimeProcess(proc, true);
- TokenExecutor tokenExecutor = rtProc.getTokenExecutor();
- tokenExecutor.create(initialToken, initialFlow);
-
- // Start a new process thread
- if (startProcessThread)
- {
- RunnableProcess runnable = new RunnableProcess(rtProc);
- getProcessExecutor().execute(runnable);
- synchronized (proc)
- {
- while (proc.getProcessStatus() != ProcessStatus.Active)
- {
- try
- {
- proc.wait();
- }
- catch (InterruptedException ex)
- {
- log.error("Process interrupted", ex);
- }
- }
- }
- }
-
- // Do the start time assignments
- startTimeAssignments((ProcessExt)proc, initialToken);
-
- // Start the initial token
- tokenExecutor.start(initialToken);
- }
-
- // Evaluate the Start time assignments
- private void startTimeAssignments(ProcessExt proc, Token token)
- {
- DelegatingToken delegatingToken = new DelegatingToken((MutableToken)token);
- Attachments atts = token.getAttachments();
- for (Assignment ass : proc.getAssignments())
- {
- if (ass.getAssignTime() == AssignTime.Start)
- {
- Expression expr = ass.getFrom();
- ExpressionEvaluator exprEvaluator = new ExpressionEvaluator(expr);
- Object result = exprEvaluator.evaluateExpression(delegatingToken);
- String propName = ass.getTo().getName();
- atts.addAttachment(propName, result);
- }
- }
- }
-
- public ProcessStatus waitForEnd(Process proc)
- {
- return waitForEndInternal(proc, 0);
- }
-
- public ProcessStatus waitForEnd(Process proc, long timeout)
- {
- return waitForEndInternal(proc, timeout);
- }
-
- /**
- * Wait for the Process to end. All Tokens that are generated at the Start Event for that Process must eventually
- * arrive at an End Event. The Process will be in a running state until all Tokens are consumed. If the process was
- * aborted this method throws the causing RuntimeException if avaialable.
- */
- private ProcessStatus waitForEndInternal(Process proc, long timeout)
- {
- ProcessImpl procImpl = (ProcessImpl)proc;
-
- ProcessStatus status = proc.getProcessStatus();
- if (status == ProcessStatus.None)
- throw new IllegalStateException("Cannot wait for process in state: " + status);
-
- // Wait a little for the process to end
- boolean forever = (timeout < 1);
- long now = System.currentTimeMillis();
- long until = now + timeout;
- try
- {
- while (forever || now < until)
- {
- synchronized (proc)
- {
- if (isProcessTerminated(proc))
- {
- if (procImpl.getRuntimeException() != null)
- {
- throw new BPMException("Process aborted", procImpl.getRuntimeException());
- }
- else
- {
- break;
- }
- }
-
- // Start waiting to get notified
- long waitTimeout = forever ? 0 : until - now;
- proc.wait(waitTimeout);
- }
- now = System.currentTimeMillis();
- }
-
- // Throw timeout exception if it took too long
- if (isProcessTerminated(proc) == false)
- {
- RuntimeException rte = new ProcessTimeoutException("Process timeout after " + timeout + "ms for: " + proc.getKey());
- procImpl.setRuntimeException(rte);
- log.error(rte.getMessage());
- throw rte;
- }
- }
- catch (InterruptedException ex)
- {
- log.warn("Process interrupted", ex);
- }
- finally
- {
- // Unregister the process if not done already
- // this could happen when the Process never received a start signal
- // and then we get here because of a ProcessTimeoutException
- ProcessEngine engine = getProcessEngine();
- ProcessService procService = engine.getService(ProcessService.class);
- if (procService.getProcess(proc.getKey()) != null)
- procService.unregisterProcess(proc.getKey());
- }
-
- status = proc.getProcessStatus();
- return status;
- }
-
- private boolean isProcessTerminated(Process proc)
- {
- ProcessStatus status = proc.getProcessStatus();
- return status == ProcessStatus.Cancelled || status == ProcessStatus.Completed || status == ProcessStatus.Aborted;
- }
-
- private RuntimeProcess getRuntimeProcess(Process proc, boolean createNew)
- {
- RuntimeProcess rtProcess;
- synchronized (runtimeProcesses)
- {
- rtProcess = runtimeProcesses.get(proc.getKey());
- if (rtProcess == null && createNew)
- {
- rtProcess = new RuntimeProcessImpl(proc);
- runtimeProcesses.put(proc.getKey(), rtProcess);
- }
- }
- return rtProcess;
- }
-
- /***************************************************************
- * The runnable Process
- */
- class RunnableProcess implements Runnable
- {
- private RuntimeProcess rtProc;
-
- public RunnableProcess(RuntimeProcess rtProc)
- {
- this.rtProc = rtProc;
- }
-
- public void run()
- {
- ThreadingTokenExecutor tokenExecutor = rtProc.getTokenExecutor();
- ProcessImpl procImpl = (ProcessImpl)rtProc.getProcess();
- Process proc = rtProc.getProcess();
-
- ProcessEngine engine = getProcessEngine();
- SignalService sigService = engine.getService(SignalService.class);
-
- ObjectName procID = proc.getKey();
- String procName = proc.getName();
- try
- {
- synchronized (proc)
- {
- procImpl.setProcessStatus(ProcessStatus.Active);
- sigService.throwSignal(new SignalImpl(SignalType.SYSTEM_PROCESS_ENTER, procID));
-
- // Notify that the process is now Active
- proc.notifyAll();
- }
-
- synchronized (rtProc)
- {
- // Wait until there are no more runnable tokens
- while (tokenExecutor.hasRunnableTokens())
- {
- try
- {
- rtProc.wait();
- }
- catch (InterruptedException ex)
- {
- log.error("Process interrupted", ex);
- }
- }
-
- log.debug("End execution thread [proc=" + procName + ",status=" + proc.getProcessStatus() + "]");
-
- if (proc.getProcessStatus() == ProcessStatus.Active)
- procImpl.setProcessStatus(ProcessStatus.Completed);
- }
- }
- finally
- {
- sigService.throwSignal(new SignalImpl(SignalType.SYSTEM_PROCESS_EXIT, procID));
-
- synchronized (proc)
- {
- ProcessService procService = engine.getService(ProcessService.class);
- procService.unregisterProcess(procID);
- runtimeProcesses.remove(procID);
-
- // Notify that the process has now ended
- proc.notifyAll();
- }
- }
- }
- }
-}
\ No newline at end of file
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ProcessDefinitionServiceImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ProcessDefinitionServiceImpl.java 2008-11-26 07:33:48 UTC (rev 3089)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ProcessDefinitionServiceImpl.java 2008-11-26 08:04:34 UTC (rev 3090)
@@ -107,7 +107,7 @@
// Unregister the associated process instances
ProcessService procService = engine.getService(ProcessService.class);
- for (ObjectName procID : procService.getProcesses(procDef.getName(), null))
+ for (ObjectName procID : procService.getProcesses(procDefID, null))
procService.unregisterProcess(procID);
// Delete the ProcessDefinition through the PersistenceService
Modified: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ProcessServiceImpl.java
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ProcessServiceImpl.java 2008-11-26 07:33:48 UTC (rev 3089)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ProcessServiceImpl.java 2008-11-26 08:04:34 UTC (rev 3090)
@@ -101,17 +101,18 @@
/**
* Find the set of Processes for a given name
*
- * @param name The process name
+ * @param procDefID The process name
* @param status The optional process status
* @return An empty set if the process cannot be found
*/
@Override
- public Set<ObjectName> getProcesses(String name, ProcessStatus status)
+ public Set<ObjectName> getProcesses(ObjectName procDefID, ProcessStatus status)
{
Set<ObjectName> procSet = new HashSet<ObjectName>();
for (Process auxProc : registeredProcs.values())
{
- if (auxProc.getName().equals(name))
+ ObjectName auxProcDefID = auxProc.getProcessDefinition().getKey();
+ if (auxProcDefID.equals(procDefID))
{
if (status == null || auxProc.getProcessStatus() == status)
procSet.add(auxProc.getKey());
Copied: projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ThreadingServiceImpl.java (from rev 3087, projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ExecutionServiceImpl.java)
===================================================================
--- projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ThreadingServiceImpl.java (rev 0)
+++ projects/spec/trunk/modules/ri/src/main/java/org/jbpm/ri/service/ThreadingServiceImpl.java 2008-11-26 08:04:34 UTC (rev 3090)
@@ -0,0 +1,327 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.ri.service;
+
+// $Id$
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.management.ObjectName;
+
+import org.jbpm.api.BPMException;
+import org.jbpm.api.ProcessTimeoutException;
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.client.Token;
+import org.jbpm.api.model.Expression;
+import org.jbpm.api.model.Process;
+import org.jbpm.api.model.StartEvent;
+import org.jbpm.api.model.Process.ProcessStatus;
+import org.jbpm.api.runtime.Attachments;
+import org.jbpm.api.service.ProcessService;
+import org.jbpm.incubator.client.ProcessExt;
+import org.jbpm.incubator.model.Assignment;
+import org.jbpm.incubator.model.Assignment.AssignTime;
+import org.jbpm.incubator.model.Signal.SignalType;
+import org.jbpm.incubator.runtime.TokenExecutor;
+import org.jbpm.incubator.service.ThreadingService;
+import org.jbpm.incubator.service.SignalService;
+import org.jbpm.ri.model.ProcessImpl;
+import org.jbpm.ri.model.SequenceFlowImpl;
+import org.jbpm.ri.model.SignalImpl;
+import org.jbpm.ri.runtime.DelegatingToken;
+import org.jbpm.ri.runtime.ExpressionEvaluator;
+import org.jbpm.ri.runtime.MutableToken;
+import org.jbpm.ri.runtime.RuntimeProcess;
+import org.jbpm.ri.runtime.RuntimeProcessImpl;
+import org.jbpm.ri.runtime.ThreadingTokenExecutor;
+import org.jbpm.ri.runtime.TokenImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @author thomas.diesler(a)jboss.com
+ * @since 18-Jun-2008
+ */
+public class ThreadingServiceImpl extends ThreadingService implements MutableService
+{
+ // provide logging
+ final static Logger log = LoggerFactory.getLogger(ThreadingServiceImpl.class);
+
+ // The map of active runtime processes
+ private Map<ObjectName, RuntimeProcess> runtimeProcesses = new HashMap<ObjectName, RuntimeProcess>();
+
+ @Override
+ public void setProcessEngine(ProcessEngine engine)
+ {
+ super.setProcessEngine(engine);
+ }
+
+ @Override
+ public void startProcess(Process proc, StartEvent start, Attachments att)
+ {
+ startProcessInternal(proc, start, att);
+ }
+
+ private synchronized void startProcessInternal(Process proc, StartEvent start, Attachments att)
+ {
+ @SuppressWarnings("serial")
+ class InitialFlow extends SequenceFlowImpl
+ {
+ InitialFlow(StartEvent start)
+ {
+ super(start.getName());
+ }
+ }
+
+ RuntimeProcess rtProc = getRuntimeProcess(proc, false);
+ boolean startProcessThread = (rtProc == null);
+
+ // Create initial Token
+ TokenImpl initialToken = new TokenImpl(proc, att);
+ InitialFlow initialFlow = new InitialFlow(start);
+ initialToken.setLastFlow(initialFlow);
+
+ // Register the initial Token
+ rtProc = getRuntimeProcess(proc, true);
+ TokenExecutor tokenExecutor = rtProc.getTokenExecutor();
+ tokenExecutor.create(initialToken, initialFlow);
+
+ // Start a new process thread
+ if (startProcessThread)
+ {
+ RunnableProcess runnable = new RunnableProcess(rtProc);
+ getProcessExecutor().execute(runnable);
+ synchronized (proc)
+ {
+ while (proc.getProcessStatus() != ProcessStatus.Active)
+ {
+ try
+ {
+ proc.wait();
+ }
+ catch (InterruptedException ex)
+ {
+ log.error("Process interrupted", ex);
+ }
+ }
+ }
+ }
+
+ // Do the start time assignments
+ startTimeAssignments((ProcessExt)proc, initialToken);
+
+ // Start the initial token
+ tokenExecutor.start(initialToken);
+ }
+
+ // Evaluate the Start time assignments
+ private void startTimeAssignments(ProcessExt proc, Token token)
+ {
+ DelegatingToken delegatingToken = new DelegatingToken((MutableToken)token);
+ Attachments atts = token.getAttachments();
+ for (Assignment ass : proc.getAssignments())
+ {
+ if (ass.getAssignTime() == AssignTime.Start)
+ {
+ Expression expr = ass.getFrom();
+ ExpressionEvaluator exprEvaluator = new ExpressionEvaluator(expr);
+ Object result = exprEvaluator.evaluateExpression(delegatingToken);
+ String propName = ass.getTo().getName();
+ atts.addAttachment(propName, result);
+ }
+ }
+ }
+
+ public ProcessStatus waitForEnd(Process proc)
+ {
+ return waitForEndInternal(proc, 0);
+ }
+
+ public ProcessStatus waitForEnd(Process proc, long timeout)
+ {
+ return waitForEndInternal(proc, timeout);
+ }
+
+ /**
+ * Wait for the Process to end. All Tokens that are generated at the Start Event for that Process must eventually
+ * arrive at an End Event. The Process will be in a running state until all Tokens are consumed. If the process was
+ * aborted this method throws the causing RuntimeException if avaialable.
+ */
+ private ProcessStatus waitForEndInternal(Process proc, long timeout)
+ {
+ ProcessImpl procImpl = (ProcessImpl)proc;
+
+ ProcessStatus status = proc.getProcessStatus();
+ if (status == ProcessStatus.None)
+ throw new IllegalStateException("Cannot wait for process in state: " + status);
+
+ // Wait a little for the process to end
+ boolean forever = (timeout < 1);
+ long now = System.currentTimeMillis();
+ long until = now + timeout;
+ try
+ {
+ while (forever || now < until)
+ {
+ synchronized (proc)
+ {
+ if (isProcessTerminated(proc))
+ {
+ if (procImpl.getRuntimeException() != null)
+ {
+ throw new BPMException("Process aborted", procImpl.getRuntimeException());
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ // Start waiting to get notified
+ long waitTimeout = forever ? 0 : until - now;
+ proc.wait(waitTimeout);
+ }
+ now = System.currentTimeMillis();
+ }
+
+ // Throw timeout exception if it took too long
+ if (isProcessTerminated(proc) == false)
+ {
+ RuntimeException rte = new ProcessTimeoutException("Process timeout after " + timeout + "ms for: " + proc.getKey());
+ procImpl.setRuntimeException(rte);
+ log.error(rte.getMessage());
+ throw rte;
+ }
+ }
+ catch (InterruptedException ex)
+ {
+ log.warn("Process interrupted", ex);
+ }
+ finally
+ {
+ // Unregister the process if not done already
+ // this could happen when the Process never received a start signal
+ // and then we get here because of a ProcessTimeoutException
+ ProcessEngine engine = getProcessEngine();
+ ProcessService procService = engine.getService(ProcessService.class);
+ if (procService.getProcess(proc.getKey()) != null)
+ procService.unregisterProcess(proc.getKey());
+ }
+
+ status = proc.getProcessStatus();
+ return status;
+ }
+
+ private boolean isProcessTerminated(Process proc)
+ {
+ ProcessStatus status = proc.getProcessStatus();
+ return status == ProcessStatus.Cancelled || status == ProcessStatus.Completed || status == ProcessStatus.Aborted;
+ }
+
+ private RuntimeProcess getRuntimeProcess(Process proc, boolean createNew)
+ {
+ RuntimeProcess rtProcess;
+ synchronized (runtimeProcesses)
+ {
+ rtProcess = runtimeProcesses.get(proc.getKey());
+ if (rtProcess == null && createNew)
+ {
+ rtProcess = new RuntimeProcessImpl(proc);
+ runtimeProcesses.put(proc.getKey(), rtProcess);
+ }
+ }
+ return rtProcess;
+ }
+
+ /***************************************************************
+ * The runnable Process
+ */
+ class RunnableProcess implements Runnable
+ {
+ private RuntimeProcess rtProc;
+
+ public RunnableProcess(RuntimeProcess rtProc)
+ {
+ this.rtProc = rtProc;
+ }
+
+ public void run()
+ {
+ ThreadingTokenExecutor tokenExecutor = rtProc.getTokenExecutor();
+ ProcessImpl procImpl = (ProcessImpl)rtProc.getProcess();
+ Process proc = rtProc.getProcess();
+
+ ProcessEngine engine = getProcessEngine();
+ SignalService sigService = engine.getService(SignalService.class);
+
+ ObjectName procID = proc.getKey();
+ String procName = proc.getName();
+ try
+ {
+ synchronized (proc)
+ {
+ procImpl.setProcessStatus(ProcessStatus.Active);
+ sigService.throwSignal(new SignalImpl(SignalType.SYSTEM_PROCESS_ENTER, procID));
+
+ // Notify that the process is now Active
+ proc.notifyAll();
+ }
+
+ synchronized (rtProc)
+ {
+ // Wait until there are no more runnable tokens
+ while (tokenExecutor.hasRunnableTokens())
+ {
+ try
+ {
+ rtProc.wait();
+ }
+ catch (InterruptedException ex)
+ {
+ log.error("Process interrupted", ex);
+ }
+ }
+
+ log.debug("End execution thread [proc=" + procName + ",status=" + proc.getProcessStatus() + "]");
+
+ if (proc.getProcessStatus() == ProcessStatus.Active)
+ procImpl.setProcessStatus(ProcessStatus.Completed);
+ }
+ }
+ finally
+ {
+ sigService.throwSignal(new SignalImpl(SignalType.SYSTEM_PROCESS_EXIT, procID));
+
+ synchronized (proc)
+ {
+ ProcessService procService = engine.getService(ProcessService.class);
+ procService.unregisterProcess(procID);
+ runtimeProcesses.remove(procID);
+
+ // Notify that the process has now ended
+ proc.notifyAll();
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
17 years, 5 months
JBoss JBPM SVN: r3089 - projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-26 02:33:48 -0500 (Wed, 26 Nov 2008)
New Revision: 3089
Modified:
projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java
Log:
Restore Spec integration
Modified: projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java
===================================================================
--- projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java 2008-11-26 07:27:22 UTC (rev 3088)
+++ projects/gwt-console/trunk/server/src/main/java/org/jboss/bpm/console/server/integration/spec/ProcessManagementImpl.java 2008-11-26 07:33:48 UTC (rev 3089)
@@ -21,11 +21,22 @@
*/
package org.jboss.bpm.console.server.integration.spec;
+import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
+import javax.management.ObjectName;
+
import org.jboss.bpm.console.client.model.ProcessDefinitionRef;
import org.jboss.bpm.console.client.model.ProcessInstanceRef;
import org.jboss.bpm.console.server.integration.ProcessManagement;
+import org.jbpm.api.client.Configuration;
+import org.jbpm.api.client.ProcessEngine;
+import org.jbpm.api.model.Process;
+import org.jbpm.api.model.ProcessDefinition;
+import org.jbpm.api.model.Process.ProcessStatus;
+import org.jbpm.api.service.ProcessDefinitionService;
+import org.jbpm.api.service.ProcessService;
/**
* An implementation that delegates to the jBPM API
@@ -37,36 +48,147 @@
{
public List<ProcessDefinitionRef> getAllDefinitions()
{
- throw new RuntimeException("Not implemented");
+ List<ProcessDefinitionRef> results = new ArrayList<ProcessDefinitionRef>();
+
+ ProcessDefinitionService pdService = getProcessDefinitionService();
+ Iterator<ObjectName> itKey = pdService.getProcessDefinitions().iterator();
+ while(itKey.hasNext())
+ {
+ ObjectName procDefKey = itKey.next();
+ ProcessDefinition procDef = pdService.getProcessDefinition(procDefKey);
+ ProcessDefinitionRef pdRef = adaptProcessDefinition(procDef);
+ results.add(pdRef);
+ }
+
+ return results;
}
- public ProcessDefinitionRef getDefinitionById(long processId)
+ public ProcessDefinitionRef getDefinitionById(long procDefId)
{
- throw new RuntimeException("Not implemented");
+ ProcessDefinitionRef results = null;
+
+ ProcessDefinition procDef = getProcessDefinitionById(procDefId);
+ if (procDef != null)
+ {
+ results = new ProcessDefinitionRef(procDefId, procDef.getName(), procDef.getVersion());
+ }
+
+ return results;
}
- public List<ProcessDefinitionRef> removeDefinition(long processId)
+ public List<ProcessDefinitionRef> removeDefinition(long procDefId)
{
- throw new RuntimeException("Not implemented");
+ ProcessDefinition procDef = getProcessDefinitionById(procDefId);
+ if (procDef != null)
+ {
+ ProcessDefinitionService pdService = getProcessDefinitionService();
+ pdService.unregisterProcessDefinition(procDef.getKey());
+ }
+ return getAllDefinitions();
}
- public ProcessInstanceRef newInstance(long processId)
+ public ProcessInstanceRef newInstance(long procDefId)
{
- throw new RuntimeException("Not implemented");
+ ProcessDefinition procDef = getProcessDefinitionById(procDefId);
+ if (procDef == null)
+ throw new IllegalStateException("Cannot obtain process definition: " + procDefId);
+
+ Process proc = procDef.newInstance();
+ ProcessInstanceRef procRef = adaptProcess(proc);
+ return procRef;
}
- public List<ProcessInstanceRef> getInstancesByDefinitionId(long processId)
+ public List<ProcessInstanceRef> getInstancesByDefinitionId(long procDefId)
{
throw new RuntimeException("Not implemented");
}
- public ProcessInstanceRef getInstanceById(long instanceId)
+ public ProcessInstanceRef getInstanceById(long procID)
{
- throw new RuntimeException("Not implemented");
+ Process proc = getProcessById(procID);
+ ProcessInstanceRef procRef = adaptProcess(proc);
+ return procRef;
}
public void signalToken(long tokenId, String signal)
{
throw new RuntimeException("Not implemented");
}
+
+ private ProcessDefinitionService getProcessDefinitionService()
+ {
+ ProcessEngine engine = Configuration.getProcessEngine();
+ ProcessDefinitionService pdService = engine.getService(ProcessDefinitionService.class);
+ return pdService;
+ }
+
+ private ProcessDefinition getProcessDefinitionById(long procDefID)
+ {
+ ProcessDefinition procDef = null;
+ ProcessDefinitionService pdService = getProcessDefinitionService();
+ Iterator<ObjectName> it = pdService.getProcessDefinitions().iterator();
+ while(it.hasNext())
+ {
+ ObjectName auxKey = it.next();
+ if (procDefID == apaptKey(auxKey))
+ {
+ procDef = pdService.getProcessDefinition(auxKey);
+ break;
+ }
+ }
+ return procDef;
+ }
+
+ private ProcessDefinitionRef adaptProcessDefinition(ProcessDefinition procDef)
+ {
+ ObjectName procDefKey = procDef.getKey();
+ Long procDefID = apaptKey(procDefKey);
+ return new ProcessDefinitionRef(procDefID, procDef.getName(), procDef.getVersion());
+ }
+
+ private ProcessService getProcessService()
+ {
+ ProcessEngine engine = Configuration.getProcessEngine();
+ ProcessService pService = engine.getService(ProcessService.class);
+ return pService;
+ }
+
+ private Process getProcessById(long procID)
+ {
+ Process proc = null;
+ ProcessService pdService = getProcessService();
+ Iterator<ObjectName> it = pdService.getProcesses().iterator();
+ while(it.hasNext())
+ {
+ ObjectName auxKey = it.next();
+ if (procID == apaptKey(auxKey))
+ {
+ proc = pdService.getProcess(auxKey);
+ break;
+ }
+ }
+ return proc;
+ }
+
+ private ProcessInstanceRef adaptProcess(Process proc)
+ {
+ Long procDefID = apaptKey(proc.getProcessDefinition().getKey());
+ Long procID = apaptKey(proc.getKey());
+
+ // [TODO] clarify process status
+ ProcessStatus status = proc.getProcessStatus();
+ boolean suspended = ProcessStatus.Active != status;
+
+ ProcessInstanceRef procRef = new ProcessInstanceRef(procID, procDefID, proc.getStartDate(), proc.getEndDate(), suspended);
+ return procRef;
+ }
+
+ private Long apaptKey(ObjectName procDefKey)
+ {
+ String procDefID = procDefKey.getKeyProperty("id");
+ if (procDefID == null)
+ throw new IllegalStateException("Cannot obtain id property from: " + procDefKey);
+
+ return new Long(procDefID);
+ }
}
17 years, 5 months
JBoss JBPM SVN: r3088 - jbpm3/trunk/modules/integration/jboss42.
by do-not-reply@jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-11-26 02:27:22 -0500 (Wed, 26 Nov 2008)
New Revision: 3088
Modified:
jbpm3/trunk/modules/integration/jboss42/pom.xml
Log:
[JBPM-1818] All in-container tests skiped
Modified: jbpm3/trunk/modules/integration/jboss42/pom.xml
===================================================================
--- jbpm3/trunk/modules/integration/jboss42/pom.xml 2008-11-25 20:57:02 UTC (rev 3087)
+++ jbpm3/trunk/modules/integration/jboss42/pom.xml 2008-11-26 07:27:22 UTC (rev 3088)
@@ -140,6 +140,31 @@
</plugins>
</build>
</profile>
+
+ <!--
+ Name: sybase
+ Descr: Sybase Database Setup
+ -->
+ <profile>
+ <id>sybase</id>
+ <activation>
+ <property>
+ <name>database</name>
+ <value>sybase</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <!-- [JBPM-1818] Use Sybase instance that supports XA Transaction -->
+ <skipTests>true</skipTests>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
</profiles>
-
</project>
17 years, 5 months
JBoss JBPM SVN: r3087 - jbpm3/trunk/modules/enterprise.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2008-11-25 15:57:02 -0500 (Tue, 25 Nov 2008)
New Revision: 3087
Removed:
jbpm3/trunk/modules/enterprise/.classpath
Modified:
jbpm3/trunk/modules/enterprise/.project
Log:
removed java nature from project jbpm-enterprise
Deleted: jbpm3/trunk/modules/enterprise/.classpath
===================================================================
--- jbpm3/trunk/modules/enterprise/.classpath 2008-11-25 20:56:38 UTC (rev 3086)
+++ jbpm3/trunk/modules/enterprise/.classpath 2008-11-25 20:57:02 UTC (rev 3087)
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
Modified: jbpm3/trunk/modules/enterprise/.project
===================================================================
--- jbpm3/trunk/modules/enterprise/.project 2008-11-25 20:56:38 UTC (rev 3086)
+++ jbpm3/trunk/modules/enterprise/.project 2008-11-25 20:57:02 UTC (rev 3087)
@@ -6,18 +6,12 @@
</projects>
<buildSpec>
<buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
</natures>
</projectDescription>
17 years, 5 months
JBoss JBPM SVN: r3086 - jbpm3/trunk/modules/integration.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2008-11-25 15:56:38 -0500 (Tue, 25 Nov 2008)
New Revision: 3086
Removed:
jbpm3/trunk/modules/integration/.classpath
Modified:
jbpm3/trunk/modules/integration/.project
Log:
removed java nature from project jbpm-integration
Deleted: jbpm3/trunk/modules/integration/.classpath
===================================================================
--- jbpm3/trunk/modules/integration/.classpath 2008-11-25 17:10:47 UTC (rev 3085)
+++ jbpm3/trunk/modules/integration/.classpath 2008-11-25 20:56:38 UTC (rev 3086)
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java"/>
- <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
- <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
Modified: jbpm3/trunk/modules/integration/.project
===================================================================
--- jbpm3/trunk/modules/integration/.project 2008-11-25 17:10:47 UTC (rev 3085)
+++ jbpm3/trunk/modules/integration/.project 2008-11-25 20:56:38 UTC (rev 3086)
@@ -6,18 +6,12 @@
</projects>
<buildSpec>
<buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
</natures>
</projectDescription>
17 years, 5 months