[jbpm-commits] JBoss JBPM SVN: r3948 - in jbpm4/trunk/modules: api/src/main/java/org/jbpm/jpdl and 11 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Feb 19 08:08:17 EST 2009
Author: tom.baeyens at jboss.com
Date: 2009-02-19 08:08:17 -0500 (Thu, 19 Feb 2009)
New Revision: 3948
Added:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/jpdl/
jbpm4/trunk/modules/api/src/main/java/org/jbpm/jpdl/ExclusiveHandler.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndCancelBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndErrorBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EsbActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EsbBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExclusiveBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExclusiveBuilder.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExclusiveConditionActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExclusiveExpressionActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExclusiveHandlerActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/HqlActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/HqlBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlActivityBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlExternalActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SqlActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SqlBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskActivity.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/deploy/
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/deploy/ParseJpdlDeployer.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlExecution.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinition.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/Activities.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/ActivitiesParser.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/ParseJpdlBinding.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/StartActivities.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransition.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransitions.java
Removed:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/el/
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/ExclusiveHandler.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/JpdlException.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/JpdlExecution.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/JpdlProcessDefinition.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/ProcessArchive.java
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/deploy/
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/impl/
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/xml/
Modified:
jbpm4/trunk/modules/jpdl/src/main/resources/jbpm.jpdl.activities.xml
jbpm4/trunk/modules/jpdl/src/main/resources/jbpm.jpdl.hbm.xml
jbpm4/trunk/modules/jpdl/src/main/resources/jbpm.jpdl.wire.bindings.xml
jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/JpdlTestCase.java
jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlParseTestCase.java
jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/test/xml/JpdlXmlTest.java
Log:
JBPM-1997 and JBPM-2011 including internal into the jpdl package names
Copied: jbpm4/trunk/modules/api/src/main/java/org/jbpm/jpdl/ExclusiveHandler.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/ExclusiveHandler.java)
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/jpdl/ExclusiveHandler.java (rev 0)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/jpdl/ExclusiveHandler.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,34 @@
+/*
+ * 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.jpdl;
+
+import org.jbpm.model.OpenExecution;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface ExclusiveHandler {
+
+ /** the name of the selected outgoing transition */
+ String select(OpenExecution execution);
+}
Property changes on: jbpm4/trunk/modules/api/src/main/java/org/jbpm/jpdl/ExclusiveHandler.java
___________________________________________________________________
Name: svn:mergeinfo
+
Deleted: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/ExclusiveHandler.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/ExclusiveHandler.java 2009-02-19 12:49:19 UTC (rev 3947)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/ExclusiveHandler.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -1,34 +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.jpdl;
-
-import org.jbpm.model.OpenExecution;
-
-
-/**
- * @author Tom Baeyens
- */
-public interface ExclusiveHandler {
-
- /** the name of the selected outgoing transition */
- String select(OpenExecution execution);
-}
Deleted: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/JpdlException.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/JpdlException.java 2009-02-19 12:49:19 UTC (rev 3947)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/JpdlException.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -1,49 +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.jpdl;
-
-import org.jbpm.JbpmException;
-
-/**
- * @author Tom Baeyens
- */
-public class JpdlException extends JbpmException {
-
- private static final long serialVersionUID = 1L;
-
- public JpdlException() {
- super();
- }
-
- public JpdlException(String msg, Throwable cause) {
- super(msg, cause);
- }
-
- public JpdlException(String msg) {
- super(msg);
- }
-
- public JpdlException(Throwable cause) {
- super(cause);
- }
-
-}
Deleted: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/JpdlExecution.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/JpdlExecution.java 2009-02-19 12:49:19 UTC (rev 3947)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/JpdlExecution.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -1,33 +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.jpdl;
-
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-
-/**
- * @author Tom Baeyens
- */
-public class JpdlExecution extends ExecutionImpl {
-
- private static final long serialVersionUID = 1L;
-
-}
Deleted: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/JpdlProcessDefinition.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/JpdlProcessDefinition.java 2009-02-19 12:49:19 UTC (rev 3947)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/JpdlProcessDefinition.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -1,38 +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.jpdl;
-
-import org.jbpm.client.ClientProcessInstance;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-
-/**
- * @author Tom Baeyens
- */
-public class JpdlProcessDefinition extends ProcessDefinitionImpl {
-
- private static final long serialVersionUID = 1L;
-
- protected ExecutionImpl newProcessInstance() {
- return new JpdlExecution();
- }
-}
Deleted: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/ProcessArchive.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/ProcessArchive.java 2009-02-19 12:49:19 UTC (rev 3947)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/ProcessArchive.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -1,82 +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.jpdl;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-import org.jbpm.pvm.internal.util.IoUtil;
-
-/**
- * reads a zip file into a set of byte arrays so that files can be
- * read multiple times during parsing of a process archive.
- *
- * @author Tom Baeyens
- */
-public class ProcessArchive implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- Map<String, byte[]> entries = new HashMap<String, byte[]>();
-
- // constructors /////////////////////////////////////////////////////////////
-
- public ProcessArchive(ZipInputStream zipInputStream) {
- try {
- ZipEntry zipEntry = zipInputStream.getNextEntry();
- while(zipEntry!=null) {
- String entryName = zipEntry.getName();
- byte[] bytes = IoUtil.readBytes(zipInputStream);
- if (bytes!=null) {
- entries.put(entryName, bytes);
- }
- zipEntry = zipInputStream.getNextEntry();
- }
- } catch (IOException e) {
- throw new JpdlException("couldn't read process archive", e);
- }
- }
-
- // methods for the process archive parsers //////////////////////////////////
-
- public Map<String, byte[]> getEntries() {
- return entries;
- }
-
- public byte[] getEntry(String entryName) {
- return entries.get(entryName);
- }
-
- public InputStream getEntryInputStream(String entryName) {
- return new ByteArrayInputStream(getEntry(entryName));
- }
-
- public byte[] removeEntry(String entryName) {
- return entries.remove(entryName);
- }
-}
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndActivity.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/EndActivity.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndActivity.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndActivity.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,59 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import org.jbpm.activity.ActivityExecution;
+import org.jbpm.model.OpenExecution;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EndActivity extends JpdlActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected boolean endProcessInstance = true;
+ protected String state = null;
+
+ public void execute(ActivityExecution execution) {
+ OpenExecution executionToEnd = null;
+ if (endProcessInstance) {
+ executionToEnd = execution.getProcessInstance();
+ } else {
+ executionToEnd = execution;
+ }
+
+ if (state==null) {
+ execution.end(executionToEnd);
+ } else {
+ execution.end(executionToEnd, state);
+ }
+ }
+
+ public void setEndProcessInstance(boolean endProcessInstance) {
+ this.endProcessInstance = endProcessInstance;
+ }
+ public void setState(String state) {
+ this.state = state;
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndActivity.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndBinding.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/EndBinding.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndBinding.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndBinding.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,59 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EndBinding extends JpdlActivityBinding {
+
+ public EndBinding() {
+ super("end");
+ }
+
+ protected EndBinding(String tag) {
+ super(tag);
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+
+ boolean endProcessInstance = true;
+ String ends = XmlUtil.attribute(element, "ends", false, parse);
+ if ("execution".equalsIgnoreCase(ends)) {
+ endProcessInstance = false;
+ }
+
+ String state = XmlUtil.attribute(element, "state", false, parse);
+
+ EndActivity endActivity = new EndActivity();
+ endActivity.setEndProcessInstance(endProcessInstance);
+ endActivity.setState(state);
+
+ return endActivity;
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndBinding.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndCancelBinding.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/EndCancelBinding.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndCancelBinding.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndCancelBinding.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,43 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EndCancelBinding extends EndBinding {
+
+ public EndCancelBinding() {
+ super("end-cancel");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ EndActivity endActivity = (EndActivity) super.parse(element, parse, parser);
+ endActivity.setState("cancel");
+ return endActivity;
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndCancelBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndErrorBinding.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/EndErrorBinding.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndErrorBinding.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndErrorBinding.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,43 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EndErrorBinding extends EndBinding {
+
+ public EndErrorBinding() {
+ super("end-error");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ EndActivity endActivity = (EndActivity) super.parse(element, parse, parser);
+ endActivity.setState("error");
+ return endActivity;
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndErrorBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EsbActivity.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/EsbActivity.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EsbActivity.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EsbActivity.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,81 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import org.jboss.soa.esb.client.ServiceInvoker;
+import org.jboss.soa.esb.message.Body;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.message.format.MessageFactory;
+import org.jbpm.activity.ActivityExecution;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.model.ExpressionEvaluator;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.descriptor.ListDescriptor;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EsbActivity extends JpdlActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ private static Log log = Log.getLog(EsbActivity.class.getName());
+
+ protected String category = null;
+ protected String service = null;
+ protected ListDescriptor partsListDescriptor = null;
+
+ public void execute(ActivityExecution execution) throws Exception {
+ Message message = MessageFactory.getInstance().getMessage();
+ Body body = message.getBody();
+
+ if (partsListDescriptor!=null) {
+ WireContext wireContext = new WireContext();
+ for (Descriptor descriptor: partsListDescriptor.getValueDescriptors()) {
+ String name = descriptor.getName();
+
+ Object object = wireContext.create(descriptor, true);
+ if (object instanceof ExpressionEvaluator) {
+ ExpressionEvaluator expressionEvaluator = (ExpressionEvaluator) object;
+ object = expressionEvaluator.evaluateExpression(execution);
+ }
+ body.add(name, object);
+ }
+ }
+
+ ServiceInvoker invoker = new ServiceInvoker(category, service);
+ log.debug("sending "+message.getBody()+" to service "+service+" in category "+category+" over the esb");
+ invoker.deliverAsync(message);
+ }
+
+ public void setCategory(String category) {
+ this.category = category;
+ }
+ public void setService(String service) {
+ this.service = service;
+ }
+ public void setPartsListDescriptor(ListDescriptor partsListDescriptor) {
+ this.partsListDescriptor = partsListDescriptor;
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EsbActivity.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EsbBinding.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/EsbBinding.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EsbBinding.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EsbBinding.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,95 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ExpressionDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ListDescriptor;
+import org.jbpm.pvm.internal.wire.xml.WireParser;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class EsbBinding extends JpdlActivityBinding {
+
+ public static final String TAG = "esb";
+ private static final WireParser wireParser = WireParser.getInstance();
+
+ public EsbBinding() {
+ super(TAG);
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ EsbActivity esbActivity = new EsbActivity();
+
+ String category = XmlUtil.attribute(element, "category", true, parse);
+ esbActivity.setCategory(category);
+
+ String service = XmlUtil.attribute(element, "service", true, parse);
+ esbActivity.setService(service);
+
+ List<Descriptor> partDescriptors = new ArrayList<Descriptor>();
+ List<Element> partElements = XmlUtil.elements(element, "part");
+ for (Element partElement: partElements) {
+ String name = XmlUtil.attribute(partElement, "name", true, parse);
+ AbstractDescriptor partDescriptor = getPartDescriptor(partElement, parse);
+ partDescriptor.setName(name);
+ partDescriptors.add(partDescriptor);
+ }
+ ListDescriptor partsListDescriptor = new ListDescriptor();
+ if (!partDescriptors.isEmpty()) {
+ partsListDescriptor.setValueDescriptors(partDescriptors);
+ }
+ esbActivity.setPartsListDescriptor(partsListDescriptor);
+
+ return esbActivity;
+ }
+
+ public AbstractDescriptor getPartDescriptor(Element partElement, Parse parse) {
+ String expression = XmlUtil.attribute(partElement, "expr");
+ Element descriptorElement = XmlUtil.element(partElement);
+
+ if ( ( (expression==null) && (descriptorElement==null) )
+ ||
+ ( (expression!=null) && (descriptorElement!=null) )
+ ) {
+ parse.addProblem("in <"+TAG+"...> an expr or exactly one child element is expected");
+ }
+
+ if (expression!=null) {
+ return new ExpressionDescriptor(expression, null);
+ }
+
+ AbstractDescriptor descriptor = (AbstractDescriptor) wireParser.parseElement(descriptorElement, parse, WireParser.CATEGORY_DESCRIPTOR);
+ return descriptor;
+ }
+
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EsbBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExclusiveBinding.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/ExclusiveBinding.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExclusiveBinding.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExclusiveBinding.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,115 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import java.util.List;
+
+import org.jbpm.pvm.internal.model.ExpressionEvaluator;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.TransitionImpl;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
+import org.jbpm.pvm.internal.wire.descriptor.ExpressionDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ReferenceDescriptor;
+import org.jbpm.pvm.internal.wire.xml.WireParser;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ExclusiveBinding extends JpdlActivityBinding {
+
+ static ObjectBinding objectBinding = new ObjectBinding();
+ static WireParser wireParser = WireParser.getInstance();
+
+ public ExclusiveBinding() {
+ super("exclusive");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ if (element.hasAttribute("expr")) {
+ ExclusiveExpressionActivity exclusiveExpressionActivity = new ExclusiveExpressionActivity();
+ String expr = element.getAttribute("expr");
+ exclusiveExpressionActivity.setExpr(expr);
+ return exclusiveExpressionActivity;
+ }
+
+ if (element.hasAttribute("handler-ref")) {
+ String exclusiveHandlerName = element.getAttribute("handler-ref");
+ ExclusiveHandlerActivity exclusiveHandlerActivity = new ExclusiveHandlerActivity();
+ exclusiveHandlerActivity.setExclusiveHandlerName(exclusiveHandlerName);
+ return exclusiveHandlerActivity;
+ }
+
+ Element handlerElement = XmlUtil.element(element, "handler");
+ if (handlerElement!=null) {
+ ExclusiveHandlerActivity exclusiveHandlerActivity = new ExclusiveHandlerActivity();
+ ObjectDescriptor exclusiveHandlerDescriptor = (ObjectDescriptor)
+ objectBinding.parse(handlerElement, parse, wireParser);
+ exclusiveHandlerActivity.setExclusiveHandlerDescriptor(exclusiveHandlerDescriptor);
+ return exclusiveHandlerActivity;
+ }
+
+ boolean hasConditions = false;
+ List<Element> transitionElements = XmlUtil.elements(element, "flow");
+ ActivityImpl activity = parse.findObject(ActivityImpl.class);
+ List<TransitionImpl> transitions = (List) activity.getOutgoingTransitions();
+
+ for (int i=0; i<transitionElements.size(); i++) {
+ TransitionImpl transition = transitions.get(i);
+ Element transitionElement = transitionElements.get(i);
+
+ Element conditionElement = XmlUtil.element(transitionElement, "condition");
+ if (conditionElement!=null) {
+ hasConditions = true;
+
+ if (conditionElement.hasAttribute("expr")) {
+ String expr = conditionElement.getAttribute("expr");
+ String lang = XmlUtil.attribute(conditionElement, "expr-lang");
+ ExpressionDescriptor expressionDescriptor = new ExpressionDescriptor(expr, lang);
+ transition.setConditionDescriptor(expressionDescriptor);
+
+ } else if (conditionElement.hasAttribute("ref")) {
+ String expr = conditionElement.getAttribute("ref");
+ ReferenceDescriptor refDescriptor = new ReferenceDescriptor(expr);
+ transition.setConditionDescriptor(refDescriptor);
+
+ } else if (ObjectBinding.isObjectDescriptor(conditionElement)) {
+ ObjectDescriptor conditionDescriptor = (ObjectDescriptor) objectBinding.parse(conditionElement, parse, parser);
+ transition.setConditionDescriptor(conditionDescriptor);
+ }
+ }
+ }
+
+ if (hasConditions) {
+ return new ExclusiveConditionActivity();
+ } else {
+ parse.addProblem("exclusive '"+element.getAttribute("name")+"' must have one of: expr attribute, handler attribute, handler element or condition expressions");
+ }
+
+ return null;
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExclusiveBinding.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExclusiveBuilder.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/ExclusiveBuilder.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExclusiveBuilder.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExclusiveBuilder.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,43 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import org.jbpm.pvm.internal.builder.ActivityBehaviourBuilder;
+import org.jbpm.pvm.internal.builder.ActivityBuilder;
+import org.jbpm.pvm.internal.builder.CompositeBuilder;
+import org.jbpm.pvm.internal.wire.Descriptor;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ExclusiveBuilder extends ActivityBehaviourBuilder {
+
+ public ExclusiveBuilder(ActivityBuilder activityBuilder) {
+ super(activityBuilder);
+ }
+
+ public ExclusiveBuilder handler(Descriptor descriptor) {
+ // TODO finish this
+ return null;
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExclusiveBuilder.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExclusiveConditionActivity.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/ExclusiveConditionActivity.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExclusiveConditionActivity.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExclusiveConditionActivity.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,64 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import java.util.List;
+
+import org.jbpm.JbpmException;
+import org.jbpm.activity.ActivityExecution;
+import org.jbpm.model.Activity;
+import org.jbpm.model.Condition;
+import org.jbpm.model.Transition;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ExclusiveConditionActivity extends JpdlActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) {
+ Transition transition = findTransition(execution);
+ if (transition==null) {
+ throw new JbpmException("no outgoing transition condition evaluated to true for exclusive "+execution.getActivity());
+ }
+ if (transition.getName()!=null) {
+ execution.historyExclusive(transition.getName());
+ }
+ execution.take(transition);
+ }
+
+ private Transition findTransition(ActivityExecution execution) {
+ Activity activity = execution.getActivity();
+ List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
+ for (Transition transition : outgoingTransitions) {
+ Condition condition = transition.getCondition();
+ if ( (condition==null)
+ || (condition.evaluate(execution))
+ ) {
+ return transition;
+ }
+ }
+ return null;
+ }
+}
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExclusiveExpressionActivity.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/ExclusiveExpressionActivity.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExclusiveExpressionActivity.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExclusiveExpressionActivity.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,70 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import org.jbpm.JbpmException;
+import org.jbpm.activity.ActivityExecution;
+import org.jbpm.env.EnvironmentHelper;
+import org.jbpm.model.Activity;
+import org.jbpm.model.Transition;
+import org.jbpm.pvm.internal.script.ScriptManager;
+
+/**
+ * @author Tom Baeyens
+ */
+public class ExclusiveExpressionActivity extends JpdlActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String expr;
+ protected String lang;
+
+ public void execute(ActivityExecution execution) throws Exception {
+ Activity activity = execution.getActivity();
+ String transitionName = null;
+
+ ScriptManager scriptManager = EnvironmentHelper.get(ScriptManager.class);
+ Object result = scriptManager.evaluateExpression(expr, execution, lang);
+ if ( (result!=null)
+ && (! (result instanceof String))
+ ) {
+ throw new JbpmException("expression '"+expr+"' in exclusive '"+activity.getName()+"' returned "+result.getClass().getName()+" instead of a transitionName (String): "+result);
+ }
+ transitionName = (String) result;
+
+ Transition transition = activity.getOutgoingTransition(transitionName);
+ if (transition==null) {
+ throw new JbpmException("expression '"+expr+"' in exclusive '"+activity.getName()+"' returned unexisting outgoing transition name: "+transitionName);
+ }
+
+ execution.historyExclusive(transitionName);
+
+ execution.take(transition);
+ }
+
+ public void setExpr(String expr) {
+ this.expr = expr;
+ }
+ public void setLang(String lang) {
+ this.lang = lang;
+ }
+}
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExclusiveHandlerActivity.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/ExclusiveHandlerActivity.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExclusiveHandlerActivity.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ExclusiveHandlerActivity.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,80 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import org.jbpm.JbpmException;
+import org.jbpm.activity.ActivityExecution;
+import org.jbpm.env.Environment;
+import org.jbpm.jpdl.ExclusiveHandler;
+import org.jbpm.model.Activity;
+import org.jbpm.model.Transition;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.WireContext;
+
+/**
+ * @author Tom Baeyens
+ */
+public class ExclusiveHandlerActivity extends JpdlActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String exclusiveHandlerName;
+ protected Descriptor exclusiveHandlerDescriptor;
+
+ public void execute(ActivityExecution execution) throws Exception {
+ Activity activity = execution.getActivity();
+ String transitionName = null;
+
+ Object object = null;
+ if (exclusiveHandlerDescriptor!=null) {
+ object = WireContext.create(exclusiveHandlerDescriptor);
+ } else if (exclusiveHandlerName!=null) {
+ Environment environment = Environment.getCurrent();
+ object = environment.get(exclusiveHandlerName);
+ }
+
+ if (object==null) {
+ throw new JbpmException("exclusive handler for "+activity+" is null");
+ }
+ if (! (object instanceof ExclusiveHandler)) {
+ throw new JbpmException("handler for exclusive is not a "+ExclusiveHandler.class.getName()+": "+object.getClass().getName());
+ }
+ ExclusiveHandler exclusiveHandler = (ExclusiveHandler) object;
+ transitionName = exclusiveHandler.select(execution);
+
+ Transition transition = activity.getOutgoingTransition(transitionName);
+ if (transition==null) {
+ throw new JbpmException("handler in exclusive '"+activity.getName()+"' returned unexisting outgoing transition name: "+transitionName);
+ }
+
+ execution.historyExclusive(transitionName);
+
+ execution.take(transition);
+ }
+
+ public void setExclusiveHandlerName(String exclusiveHandlerName) {
+ this.exclusiveHandlerName = exclusiveHandlerName;
+ }
+ public void setExclusiveHandlerDescriptor(Descriptor exclusiveHandlerDescriptor) {
+ this.exclusiveHandlerDescriptor = exclusiveHandlerDescriptor;
+ }
+}
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkActivity.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/ForkActivity.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkActivity.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkActivity.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,60 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import java.util.List;
+
+import org.jbpm.Execution;
+import org.jbpm.activity.ActivityExecution;
+import org.jbpm.model.Activity;
+import org.jbpm.model.OpenExecution;
+import org.jbpm.model.Transition;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ForkActivity extends JpdlActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) throws Exception {
+ OpenExecution processInstance = execution.getProcessInstance();
+
+ Activity activity = execution.getActivity();
+ List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
+
+ // for each outgoing transition
+ for (Transition outgoingTransition: outgoingTransitions) {
+ // launch a concurrent path of execution
+ String childExecutionName = outgoingTransition.getName();
+ // creating the execution will cause the execution to become inactive
+ Execution childExecution = execution.createExecution(childExecutionName, processInstance);
+ execution.take(outgoingTransition, childExecution);
+ }
+
+ // if this was the first fork
+ if (execution.isProcessInstance()) {
+ execution.setActivity(null);
+ }
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkActivity.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkBinding.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/ForkBinding.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkBinding.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkBinding.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,42 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ForkBinding extends JpdlActivityBinding {
+
+ public ForkBinding() {
+ super("fork");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ return new ForkActivity();
+ }
+
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkBinding.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/HqlActivity.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/HqlActivity.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/HqlActivity.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/HqlActivity.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,104 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import org.hibernate.Query;
+import org.hibernate.Session;
+import org.jbpm.JbpmException;
+import org.jbpm.activity.ActivityExecution;
+import org.jbpm.env.Environment;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.descriptor.ListDescriptor;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class HqlActivity extends JpdlActivity {
+
+ private static final Log log = Log.getLog(HqlActivity.class.getName());
+
+ private static final long serialVersionUID = 1L;
+
+ protected String query;
+ protected ListDescriptor parametersDescriptor;
+ protected String resultVariableName;
+ protected boolean isResultUnique;
+
+ public void execute(ActivityExecution execution) {
+ Environment environment = Environment.getCurrent();
+ if (environment==null) {
+ throw new JbpmException("no environment for jpdl activity "+HqlBinding.TAG);
+ }
+ Session session = environment.get(Session.class);
+
+ Query q = createQuery(session);
+
+ if (parametersDescriptor!=null) {
+ for (Descriptor valueDescriptor: parametersDescriptor.getValueDescriptors()) {
+ String parameterName = valueDescriptor.getName();
+ Object value = WireContext.create(valueDescriptor);
+ applyParameter(q, parameterName, value);
+ }
+ }
+
+ Object result = null;
+ if (isResultUnique) {
+ result = q.uniqueResult();
+ } else {
+ result = q.list();
+ }
+
+ execution.setVariable(resultVariableName, result);
+
+ execution.historyAutomatic();
+ }
+
+ protected Query createQuery(Session session) {
+ return session.createQuery(query);
+ }
+
+ public void applyParameter(Query q, String parameterName, Object value) {
+ if (value instanceof String) {
+ q.setString(parameterName, (String) value);
+ } else if (value instanceof Long) {
+ q.setLong(parameterName, (Long) value);
+ } else {
+ log.error("unknown hql parameter type: "+value.getClass().getName());
+ }
+ }
+
+ public void setQuery(String query) {
+ this.query = query;
+ }
+ public void setParametersDescriptor(ListDescriptor parametersDescriptor) {
+ this.parametersDescriptor = parametersDescriptor;
+ }
+ public void setResultUnique(boolean isResultUnique) {
+ this.isResultUnique = isResultUnique;
+ }
+ public void setResultVariableName(String resultVariableName) {
+ this.resultVariableName = resultVariableName;
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/HqlActivity.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/HqlBinding.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/HqlBinding.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/HqlBinding.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/HqlBinding.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,88 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ListDescriptor;
+import org.jbpm.pvm.internal.wire.xml.WireParser;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class HqlBinding extends JpdlActivityBinding {
+
+ public static final String TAG = "hql";
+
+ public HqlBinding() {
+ super(TAG);
+ }
+
+ protected HqlBinding(String tagName) {
+ super(tagName);
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ HqlActivity hqlActivity = createHqlActivity();
+
+ Element queryElement = XmlUtil.element(element, "query", true, parse);
+ if (queryElement!=null) {
+ String query = XmlUtil.getContentText(queryElement);
+ hqlActivity.setQuery(query);
+ }
+
+ if (XmlUtil.attributeBoolean(element, "unique", false, parse, Boolean.FALSE)) {
+ hqlActivity.setResultUnique(true);
+ }
+
+ String variableName = XmlUtil.attribute(element, "var", true, parse);
+ hqlActivity.setResultVariableName(variableName);
+
+ Element parametersElement = XmlUtil.element(element, "parameters");
+ List<Element> paramElements = XmlUtil.elements(parametersElement);
+ if (!paramElements.isEmpty()) {
+ List<Descriptor> parametersDescriptor = new ArrayList<Descriptor>();
+ for (Element paramElement: paramElements) {
+ WireParser wireParser = WireParser.getInstance();
+ Descriptor paramDescriptor = (Descriptor) wireParser.parseElement(paramElement, parse, WireParser.CATEGORY_DESCRIPTOR);
+ parametersDescriptor.add(paramDescriptor);
+ }
+
+ ListDescriptor parametersListDescriptor = new ListDescriptor();
+ parametersListDescriptor.setValueDescriptors(parametersDescriptor);
+ hqlActivity.setParametersDescriptor(parametersListDescriptor);
+ }
+
+ return hqlActivity;
+ }
+
+ protected HqlActivity createHqlActivity() {
+ return new HqlActivity();
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/HqlBinding.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/JavaActivity.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,94 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import java.lang.reflect.Method;
+import java.util.List;
+
+import org.jbpm.activity.ActivityExecution;
+import org.jbpm.pvm.internal.util.ReflectUtil;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.WireContext;
+import org.jbpm.pvm.internal.wire.WireException;
+import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.wire.operation.InvokeOperation;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JavaActivity extends JpdlActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Descriptor descriptor;
+ protected String methodName;
+ protected String variableName;
+ protected InvokeOperation invokeOperation;
+
+ public void execute(ActivityExecution execution) throws Exception {
+ WireContext wireContext = new WireContext();
+ Object target = wireContext.create(descriptor, false);
+
+ try {
+ List<ArgDescriptor> argDescriptors = null;
+ Object[] args = null;
+ if (invokeOperation!=null) {
+ argDescriptors = invokeOperation.getArgDescriptors();
+ args = ObjectDescriptor.getArgs(wireContext, argDescriptors);
+ }
+
+ Class<?> clazz = target.getClass();
+ Method method = ReflectUtil.findMethod(clazz, methodName, argDescriptors, args);
+ if (method==null) {
+ throw new WireException("method "+ReflectUtil.getSignature(methodName, argDescriptors, args)+" unavailable");
+ }
+
+ Object returnValue = ReflectUtil.invoke(method, target, args);
+
+ if (variableName!=null) {
+ execution.setVariable(variableName, returnValue);
+ }
+
+ execution.historyAutomatic();
+
+ } catch (WireException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new WireException("couldn't invoke method "+methodName+": "+e.getMessage(), e);
+ }
+ }
+
+ public void setDescriptor(Descriptor descriptor) {
+ this.descriptor = descriptor;
+ }
+ public void setMethodName(String methodName) {
+ this.methodName = methodName;
+ }
+ public void setVariableName(String variableName) {
+ this.variableName = variableName;
+ }
+ public void setInvokeOperation(InvokeOperation invokeOperation) {
+ this.invokeOperation = invokeOperation;
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaActivity.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/JavaBinding.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,102 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.descriptor.ArgDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.wire.operation.InvokeOperation;
+import org.jbpm.pvm.internal.wire.operation.Operation;
+import org.jbpm.pvm.internal.wire.xml.WireParser;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JavaBinding extends JpdlActivityBinding {
+
+ public static final String TAG = "java";
+
+ private static final WireParser wireParser = WireParser.getInstance();
+
+ public JavaBinding() {
+ super(TAG);
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ JavaActivity javaActivity = new JavaActivity();
+
+ String methodName = XmlUtil.attribute(element, "method", true, parse, null);
+ javaActivity.setMethodName(methodName);
+
+ String variableName = XmlUtil.attribute(element, "var");
+ javaActivity.setVariableName(variableName);
+
+ List<Element> argElements = XmlUtil.elements(element, "arg");
+ if (!argElements.isEmpty()) {
+ List<ArgDescriptor> argDescriptors = wireParser.parseArgs(argElements, parse);
+ InvokeOperation invokeOperation = new InvokeOperation();
+ invokeOperation.setArgDescriptors(argDescriptors);
+ javaActivity.setInvokeOperation(invokeOperation);
+ }
+
+ String className = XmlUtil.attribute(element, "class");
+ if (className!=null) {
+ ObjectDescriptor objectDescriptor = new ObjectDescriptor();
+
+ objectDescriptor.setClassName(className);
+
+ // read the operations elements
+ List<Operation> operations = null;
+ List<Element> elements = XmlUtil.elements(element);
+
+ Set<String> operationTagNames = wireParser.getBindings().getTagNames(WireParser.CATEGORY_OPERATION);
+ for (Element childElement: elements) {
+ if (operationTagNames.contains(childElement.getTagName())) {
+ Operation operation = (Operation) wireParser.parseElement(childElement, parse, WireParser.CATEGORY_OPERATION);
+ if (operations==null) {
+ operations = new ArrayList<Operation>();
+ }
+ operations.add(operation);
+ }
+ }
+ objectDescriptor.setOperations(operations);
+
+ // autowiring
+ Boolean isAutoWireEnabled = XmlUtil.attributeBoolean(element, "auto-wire", false, parse);
+ if (isAutoWireEnabled!=null) {
+ objectDescriptor.setAutoWireEnabled(isAutoWireEnabled.booleanValue());
+ }
+
+ javaActivity.setDescriptor(objectDescriptor);
+ }
+
+ return javaActivity;
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JavaBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinActivity.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/JoinActivity.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinActivity.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinActivity.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,101 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.jbpm.Execution;
+import org.jbpm.activity.ActivityExecution;
+import org.jbpm.model.Activity;
+import org.jbpm.model.OpenExecution;
+import org.jbpm.model.Transition;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JoinActivity extends JpdlActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) throws Exception {
+ // end the child execution execution
+ // this will also remove the execution from it's parent
+ execution.setState(Execution.STATE_INACTIVE);
+ execution.waitForSignal();
+
+ Activity join = execution.getActivity();
+ List<OpenExecution> joinedExecutions = findJoinedExecutions(execution, join);
+
+ if (isComplete(joinedExecutions, join)) {
+ endJoinedExecutions(joinedExecutions, execution);
+
+ OpenExecution processInstance = execution.getProcessInstance();
+
+ Execution outgoingExecution = null;
+ if ( processInstance.getExecutions()==null
+ || processInstance.getExecutions().isEmpty()
+ ) {
+ outgoingExecution = processInstance;
+ } else {
+ outgoingExecution = execution.createExecution(processInstance);
+ }
+
+ execution.setActivity(join, outgoingExecution);
+ Transition transition = join.getDefaultTransition();
+ execution.take(transition, outgoingExecution);
+ }
+ }
+
+ List<OpenExecution> findJoinedExecutions(OpenExecution execution, Activity join) {
+ List<OpenExecution> joinedExecutions = new ArrayList<OpenExecution>();
+ scanRecursive(execution.getProcessInstance(), join, joinedExecutions);
+ return joinedExecutions;
+ }
+
+ void scanRecursive(OpenExecution execution, Activity join, List<OpenExecution> joinedExecutions) {
+ // if the execution is positioned in the join
+ if (join.equals(execution.getActivity())) {
+ joinedExecutions.add(execution);
+ }
+ Collection<OpenExecution> childExecutions = execution.getExecutions();
+ if (childExecutions!=null) {
+ for (OpenExecution childExecution: childExecutions) {
+ scanRecursive(childExecution, join, joinedExecutions);
+ }
+ }
+ }
+
+ boolean isComplete(List<OpenExecution> joinedExecutions, Activity join) {
+ int executionsToJoin = join.getIncomingTransitions().size();
+ return (executionsToJoin==joinedExecutions.size());
+ }
+
+ void endJoinedExecutions(List<OpenExecution> joinedExecutions, ActivityExecution execution) {
+ for (OpenExecution joinedExecution: joinedExecutions) {
+ execution.end(joinedExecution);
+ }
+ }
+
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinActivity.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinBinding.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/JoinBinding.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinBinding.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinBinding.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,42 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JoinBinding extends JpdlActivityBinding {
+
+ public JoinBinding() {
+ super("join");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ return new JoinActivity();
+ }
+
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinBinding.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlActivity.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/JpdlActivity.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlActivity.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlActivity.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,35 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import org.jbpm.activity.ActivityBehaviour;
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class JpdlActivity implements ActivityBehaviour {
+
+ private static final long serialVersionUID = 1L;
+
+ protected long dbid;
+
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlActivity.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlActivityBinding.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/JpdlActivityBinding.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlActivityBinding.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlActivityBinding.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,73 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import java.util.List;
+
+import org.jbpm.jpdl.internal.xml.UnresolvedTransitions;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.TransitionImpl;
+import org.jbpm.pvm.internal.util.TagBinding;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class JpdlActivityBinding extends TagBinding {
+
+ public JpdlActivityBinding(String tagName) {
+ super(tagName, "http://jbpm.org/4/jpdl", "activity");
+ }
+
+ public void parseName(Element element, ActivityImpl activity, Parse parse) {
+ String name = XmlUtil.attribute(element, "name", isNameRequired(), parse);
+
+ if (name!=null) {
+ // basic name validation
+ if ("".equals(name)) {
+ parse.addProblem(XmlUtil.errorMessageAttribute(element, "name", name, "is empty"));
+ } else if (name.indexOf('/')!=-1) {
+ parse.addProblem(XmlUtil.errorMessageAttribute(element, "name", name, "contains slash (/)"));
+ }
+ activity.setName(name);
+ }
+ }
+
+ public boolean isNameRequired() {
+ return true;
+ }
+
+ public void parseFlows(Element element, ActivityImpl activity, Parse parse) {
+ List<Element> transitionElements = XmlUtil.elements(element, "flow");
+ UnresolvedTransitions unresolvedTransitions = parse.findObject(UnresolvedTransitions.class);
+ for (Element transitionElement: transitionElements) {
+ String transitionName = XmlUtil.attribute(transitionElement, "name", false, parse);
+ TransitionImpl transition = activity.createOutgoingTransition(transitionName);
+ unresolvedTransitions.add(transition, transitionElement);
+ }
+ }
+
+}
+
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlActivityBinding.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlExternalActivity.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/JpdlExternalActivity.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlExternalActivity.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlExternalActivity.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,31 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import org.jbpm.activity.ExternalActivityBehaviour;
+
+/**
+ * @author Tom Baeyens
+ */
+public abstract class JpdlExternalActivity extends JpdlActivity implements ExternalActivityBehaviour {
+
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlExternalActivity.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptActivity.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/ScriptActivity.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptActivity.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptActivity.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,60 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import org.jbpm.activity.ActivityExecution;
+import org.jbpm.env.Environment;
+import org.jbpm.pvm.internal.script.ScriptManager;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ScriptActivity extends JpdlActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String script;
+ protected String language;
+ protected String variableName;
+
+ public void execute(ActivityExecution execution) {
+ ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
+ Object returnValue = scriptManager.evaluateScript(script, execution, language);
+
+ if (variableName!=null) {
+ execution.setVariable(variableName, returnValue);
+ }
+
+ execution.historyAutomatic();
+ }
+
+ public void setScript(String script) {
+ this.script = script;
+ }
+ public void setLanguage(String language) {
+ this.language = language;
+ }
+ public void setVariableName(String variableName) {
+ this.variableName = variableName;
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptActivity.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/ScriptBinding.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,69 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import org.jbpm.env.Environment;
+import org.jbpm.pvm.internal.script.ScriptManager;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ScriptBinding extends JpdlActivityBinding {
+
+ private static final String TAG = "script";
+
+ public ScriptBinding() {
+ super(TAG);
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ String language = null;
+
+ String script = XmlUtil.attribute(element, "expr");
+ Element textElement = XmlUtil.element(element, "text");
+ if(script!=null) {
+ ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
+ language = scriptManager.getDefaultExpressionLanguage();
+ if (textElement!=null) {
+ parse.addProblem("in <script ...> attribute expr can't be combined with a nexted text element");
+ }
+ } else {
+ language = XmlUtil.attribute(element, "lang");
+ script = XmlUtil.getContentText(textElement);
+ }
+
+ String variableName = XmlUtil.attribute(element, "var");
+
+ ScriptActivity scriptActivity = new ScriptActivity();
+ scriptActivity.setScript(script);
+ scriptActivity.setLanguage(language);
+ scriptActivity.setVariableName(variableName);
+
+ return scriptActivity;
+ }
+
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SqlActivity.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/SqlActivity.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SqlActivity.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SqlActivity.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,37 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import org.hibernate.Query;
+import org.hibernate.Session;
+
+/**
+ * @author Tom Baeyens
+ */
+public class SqlActivity extends HqlActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected Query createQuery(Session session) {
+ return session.createSQLQuery(query);
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SqlActivity.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SqlBinding.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/SqlBinding.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SqlBinding.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SqlBinding.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,39 @@
+/*
+ * 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.jpdl.internal.activity;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SqlBinding extends HqlBinding {
+
+ public static final String TAG = "sql";
+
+ public SqlBinding() {
+ super(TAG);
+ }
+
+ protected HqlActivity createHqlActivity() {
+ return new SqlActivity();
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SqlBinding.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartActivity.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/StartActivity.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartActivity.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartActivity.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,36 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import org.jbpm.activity.ActivityExecution;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class StartActivity extends JpdlActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) {
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartActivity.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/StartBinding.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,50 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import org.jbpm.jpdl.internal.xml.StartActivities;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class StartBinding extends JpdlActivityBinding {
+
+ public StartBinding() {
+ super("start");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ ActivityImpl startActivity = parse.findObject(ActivityImpl.class);
+ StartActivities startActivities = parse.findObject(StartActivities.class);
+ startActivities.add(startActivity);
+ return new StartActivity();
+ }
+
+ public boolean isNameRequired() {
+ return false;
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateActivity.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/StateActivity.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateActivity.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateActivity.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,60 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import java.util.Map;
+
+import org.jbpm.activity.ActivityExecution;
+import org.jbpm.model.Activity;
+import org.jbpm.model.Transition;
+
+/**
+ * @author Tom Baeyens
+ */
+public class StateActivity extends JpdlExternalActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) {
+ execution.historyActivityStart();
+
+ execution.waitForSignal();
+ }
+
+ public void signal(ActivityExecution execution, String signalName, Map<String, Object> parameters) {
+ Activity activity = execution.getActivity();
+
+ if (parameters!=null) {
+ execution.setVariables(parameters);
+ }
+
+ execution.fire(signalName, activity);
+
+ Transition transition = activity.findOutgoingTransition(signalName);
+ if (transition!=null) {
+ execution.historyActivityEnd(signalName);
+ execution.take(transition);
+ } else {
+ execution.waitForSignal();
+ }
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateActivity.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateBinding.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/StateBinding.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateBinding.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateBinding.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,44 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class StateBinding extends JpdlActivityBinding {
+
+ public StateBinding() {
+ super("state");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ return new StateActivity();
+ }
+
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StateBinding.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskActivity.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/TaskActivity.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskActivity.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskActivity.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,77 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import java.util.Map;
+
+import org.jbpm.JbpmException;
+import org.jbpm.activity.ActivityExecution;
+import org.jbpm.env.Environment;
+import org.jbpm.model.Activity;
+import org.jbpm.model.Transition;
+import org.jbpm.pvm.internal.task.TaskImpl;
+import org.jbpm.session.TaskDbSession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskActivity extends JpdlExternalActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String assignee;
+
+ public void execute(ActivityExecution execution) {
+ TaskDbSession taskDbSession = Environment.getFromCurrent(TaskDbSession.class);
+ TaskImpl task = TaskImpl.create();
+ task.setExecution(execution);
+ task.setName(execution.getActivityName());
+ task.setAssignee(assignee);
+ taskDbSession.saveTask(task);
+
+ execution.historyTaskStart(assignee);
+ execution.waitForSignal();
+ }
+
+ public void signal(ActivityExecution execution, String signalName, Map<String, Object> parameters) {
+ Activity activity = execution.getActivity();
+
+ if (parameters!=null) {
+ execution.setVariables(parameters);
+ }
+
+ execution.fire(signalName, activity);
+
+ Transition transition = activity.findOutgoingTransition(signalName);
+ if (transition!=null) {
+ execution.historyTaskEnd(signalName);
+ execution.take(transition);
+ } else {
+ throw new JbpmException("task outcome '"+signalName+"' doesn't match with the an outgoing transition "+activity.getOutgoingTransitions());
+ }
+ }
+
+ public void setAssignee(String assignee) {
+ this.assignee = assignee;
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskActivity.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/activity/TaskBinding.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,50 @@
+/*
+ * 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.jpdl.internal.activity;
+
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TaskBinding extends JpdlActivityBinding {
+
+ private static final String TAG = "task";
+
+ public TaskBinding() {
+ super(TAG);
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ TaskActivity taskActivity = new TaskActivity();
+
+ String assignee = XmlUtil.attribute(element, "assignee", true, parse);
+ taskActivity.setAssignee(assignee);
+
+ return taskActivity;
+ }
+
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/TaskBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/deploy/ParseJpdlDeployer.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/deploy/ParseJpdlDeployer.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/deploy/ParseJpdlDeployer.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/deploy/ParseJpdlDeployer.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,54 @@
+/*
+ * 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.jpdl.internal.deploy;
+
+import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.pvm.internal.deploy.Deployer;
+import org.jbpm.pvm.internal.svc.DeploymentImpl;
+import org.jbpm.pvm.internal.xml.Parse;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ParseJpdlDeployer implements Deployer {
+
+ static JpdlParser jpdlParser = new JpdlParser();
+
+ public void deploy(DeploymentImpl deployment) {
+ for (String fileName: deployment.getFileNamesForType("jpdl")) {
+ // parse them
+ Parse parse = jpdlParser.createParse();
+ parse.setProblems(deployment.getProblems());
+ parse.setInputStream(deployment.getFile(fileName));
+ parse.execute();
+
+ // add the parsed xml dom to the deployment documents
+ // so that other subsequent deployers can just use the dom
+ // instead of reparsing the whole jpdl.xml file
+ deployment.addDocument(fileName, parse.getDocument());
+ // add the parsed process definition to the objects
+ // this is where the save process deployer will find it
+ deployment.addObject(fileName, parse.getDocumentObject());
+ }
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/deploy/ParseJpdlDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlExecution.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/JpdlExecution.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlExecution.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlExecution.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,33 @@
+/*
+ * 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.jpdl.internal.model;
+
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+
+/**
+ * @author Tom Baeyens
+ */
+public class JpdlExecution extends ExecutionImpl {
+
+ private static final long serialVersionUID = 1L;
+
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlExecution.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinition.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/JpdlProcessDefinition.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinition.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinition.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,38 @@
+/*
+ * 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.jpdl.internal.model;
+
+import org.jbpm.client.ClientProcessInstance;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+
+/**
+ * @author Tom Baeyens
+ */
+public class JpdlProcessDefinition extends ProcessDefinitionImpl {
+
+ private static final long serialVersionUID = 1L;
+
+ protected ExecutionImpl newProcessInstance() {
+ return new JpdlExecution();
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/model/JpdlProcessDefinition.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/Activities.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/xml/Activities.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/Activities.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/Activities.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,38 @@
+/*
+ * 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.jpdl.internal.xml;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.pvm.internal.xml.Bindings;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class Activities {
+
+ List<String> schemaResources = new ArrayList<String>();
+ Bindings bindings = new Bindings();
+
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/Activities.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/ActivitiesParser.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/xml/ActivitiesParser.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/ActivitiesParser.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/ActivitiesParser.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,74 @@
+/*
+ * 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.jpdl.internal.xml;
+
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.util.ReflectUtil;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.xml.Binding;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+/**
+ * @author Tom Baeyens
+ */
+public class ActivitiesParser extends Parser {
+
+ private static final Log log = Log.getLog(ActivitiesParser.class.getName());
+
+ public Object parseDocumentElement(Element documentElement, Parse parse) {
+ Activities activities = parse.findObject(Activities.class);
+ if (activities==null) {
+ activities = new Activities();
+ }
+ parse.setDocumentObject(activities);
+
+ for (Element bindingElement : XmlUtil.elements(documentElement, "activity")) {
+ Binding binding = instantiateBinding(bindingElement, parse);
+ activities.bindings.addBinding(binding);
+ }
+
+ for (Element schemaElement : XmlUtil.elements(documentElement, "schema")) {
+ String schemaResource = XmlUtil.attribute(schemaElement, "resource", true, parse);
+ activities.schemaResources.add(schemaResource);
+ }
+
+ return activities;
+ }
+
+ protected Binding instantiateBinding(Element bindingElement, Parse parse) {
+ String bindingClassName = XmlUtil.attribute(bindingElement, "binding", true, parse);
+
+ log.trace("adding activity binding "+bindingClassName);
+
+ if (bindingClassName!=null) {
+ try {
+ Class<?> bindingClass = ReflectUtil.loadClass(classLoader, bindingClassName);
+ return (Binding) bindingClass.newInstance();
+ } catch (Exception e) {
+ parse.addProblem("couldn't instantiate activity binding "+bindingClassName, e);
+ }
+ }
+ return null;
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/ActivitiesParser.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/xml/JpdlParser.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,177 @@
+/*
+ * 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.jpdl.internal.xml;
+
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.SAXParser;
+
+import org.jbpm.activity.ActivityBehaviour;
+import org.jbpm.internal.log.Log;
+import org.jbpm.jpdl.internal.activity.JpdlActivityBinding;
+import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.util.ReflectUtil;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.xml.DomBuilder;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+
+/**
+ * @author Tom Baeyens
+ */
+public class JpdlParser extends Parser {
+
+ private static final Log log = Log.getLog(JpdlParser.class.getName());
+
+ public static final String[] DEFAULT_ACTIVITIES_RESOURCES = new String[]{
+ "jbpm.jpdl.activities.xml",
+ "jbpm.user.activities.xml"
+ };
+
+ static ActivitiesParser activityParser = new ActivitiesParser();
+
+ public JpdlParser() {
+ initialize();
+
+ Activities activitiesConfiguration = parseActivitiesConfiguration();
+ setBindings(activitiesConfiguration.bindings);
+ setSchemaResources(activitiesConfiguration.schemaResources);
+ }
+
+ protected Activities parseActivitiesConfiguration() {
+ Activities activities = new Activities();
+
+ for (String activityResource: DEFAULT_ACTIVITIES_RESOURCES) {
+ Enumeration<URL> resourceUrls = ReflectUtil.getResources(null, activityResource);
+ if (resourceUrls.hasMoreElements()) {
+ while (resourceUrls.hasMoreElements()) {
+ URL resourceUrl = resourceUrls.nextElement();
+ log.trace("loading jpdl activities from resource: "+resourceUrl);
+ activityParser.createParse()
+ .setUrl(resourceUrl)
+ .pushObject(activities)
+ .execute()
+ .checkProblems("jpdl activities from "+resourceUrl.toString());
+ }
+ } else {
+ log.trace("skipping unavailable jpdl activities resource: "+activityResource);
+ }
+ }
+
+ return activities;
+ }
+
+ public Object parseDocumentElement(Element documentElement, Parse parse) {
+ ProcessDefinitionImpl processDefinition = (ProcessDefinitionImpl) parse.getDocumentObject();
+ if (processDefinition==null) {
+ processDefinition = new JpdlProcessDefinition();
+ }
+
+ StartActivities startActivities = new StartActivities();
+ parse.pushObject(startActivities);
+ try {
+ String name = XmlUtil.attribute(documentElement, "name", true, parse);
+ processDefinition.setName(name);
+
+ String packageName = XmlUtil.attribute(documentElement, "package");
+ processDefinition.setPackageName(packageName);
+
+ Integer version = XmlUtil.attributeInteger(documentElement, "version", false, parse);
+ if (version!=null) {
+ processDefinition.setVersion(version);
+ }
+
+ String key = XmlUtil.attribute(documentElement, "key", false, parse);
+ if (key!=null) {
+ processDefinition.setKey(key);
+ }
+
+ Element descriptionElement = XmlUtil.element(documentElement, "description");
+ if (descriptionElement!=null) {
+ String description = XmlUtil.getContentText(descriptionElement);
+ processDefinition.setDescription(description);
+ }
+
+ UnresolvedTransitions unresolvedTransitions = new UnresolvedTransitions();
+ parse.pushObject(unresolvedTransitions);
+
+ List<Element> elements = XmlUtil.elements(documentElement);
+ for (Element element: elements) {
+ JpdlActivityBinding activityBinding = (JpdlActivityBinding) getBinding(element, "activity");
+ if (activityBinding!=null) {
+ ActivityImpl activity = (ActivityImpl) processDefinition.createActivity();
+ parse.pushObject(activity);
+ try {
+ activityBinding.parseName(element, activity, parse);
+ activityBinding.parseFlows(element, activity, parse);
+ ActivityBehaviour activityBehaviour = (ActivityBehaviour) activityBinding.parse(element, parse, this);
+ activity.setBehaviour(activityBehaviour);
+ } finally {
+ parse.popObject();
+ }
+ } else {
+ log.debug("unrecognized activity: "+XmlUtil.getTagLocalName(element));
+ }
+ }
+
+ for (UnresolvedTransition unresolvedTransition: unresolvedTransitions.list) {
+ unresolvedTransition.resolve(processDefinition, parse);
+ }
+
+ // TODO remove the initial attribute parsing
+ String initialActivityName = XmlUtil.attribute(documentElement, "initial", false, parse);
+ if (initialActivityName!=null) {
+ ActivityImpl initial = processDefinition.getActivity(initialActivityName);
+ if (initial==null) {
+ parse.addProblem("initial activity '"+initialActivityName+"' was not found");
+ } else {
+ processDefinition.setInitial(initial);
+ }
+ }
+
+ } finally {
+ parse.popObject();
+ }
+
+
+ if (startActivities.size()==0) {
+ parse.addProblem("no start activity in process");
+ } else if (startActivities.size()>1) {
+ parse.addProblem("multiple start events not yet supported");
+ // TODO verify that all start events have conditions
+ } else {
+ ActivityImpl uniqueStartEvent = startActivities.get(0);
+ processDefinition.setInitial(uniqueStartEvent);
+ }
+
+ return processDefinition;
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/ParseJpdlBinding.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/xml/ParseJpdlBinding.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/ParseJpdlBinding.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/ParseJpdlBinding.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,45 @@
+/*
+ * 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.jpdl.internal.xml;
+
+import org.jbpm.jpdl.internal.deploy.ParseJpdlDeployer;
+import org.jbpm.pvm.internal.wire.binding.WireDescriptorBinding;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ParseJpdlBinding extends WireDescriptorBinding {
+
+ public ParseJpdlBinding() {
+ super("parse-jpdl");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ return new ObjectDescriptor(ParseJpdlDeployer.class);
+ }
+
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/ParseJpdlBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/StartActivities.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/xml/StartActivities.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/StartActivities.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/StartActivities.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,50 @@
+/*
+ * 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.jpdl.internal.xml;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.pvm.internal.model.ActivityImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class StartActivities {
+
+ List<ActivityImpl> startEvents = new ArrayList<ActivityImpl>();
+
+
+ public void add(ActivityImpl startEventActivity) {
+ startEvents.add(startEventActivity);
+ }
+
+ public int size() {
+ return startEvents.size();
+ }
+
+ public ActivityImpl get(int i) {
+ return startEvents.get(i);
+ }
+
+}
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransition.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/xml/UnresolvedTransition.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransition.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransition.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,49 @@
+/*
+ * 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.jpdl.internal.xml;
+
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.model.TransitionImpl;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.w3c.dom.Element;
+
+public class UnresolvedTransition {
+ TransitionImpl transition;
+ Element transitionElement;
+ public UnresolvedTransition(TransitionImpl transition, Element transitionElement) {
+ this.transition = transition;
+ this.transitionElement = transitionElement;
+ }
+ public void resolve(ProcessDefinitionImpl processDefinition, Parse parse) {
+ String to = XmlUtil.attribute(transitionElement, "to", true, parse);
+ if (to!=null) {
+ ActivityImpl destination = (ActivityImpl) processDefinition.findActivity(to);
+ if (destination!=null) {
+ destination.addIncomingTransition(transition);
+ } else {
+ parse.addProblem(XmlUtil.errorMessageAttribute(transitionElement, "to", to, "doesn't reference an existing activity name"));
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransition.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransitions.java (from rev 3920, jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/xml/UnresolvedTransitions.java)
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransitions.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransitions.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -0,0 +1,35 @@
+/*
+ * 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.jpdl.internal.xml;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.pvm.internal.model.TransitionImpl;
+import org.w3c.dom.Element;
+
+public class UnresolvedTransitions {
+ List<UnresolvedTransition> list = new ArrayList<UnresolvedTransition>();
+ public void add(TransitionImpl transition, Element transitionElement) {
+ list.add(new UnresolvedTransition(transition, transitionElement));
+ }
+}
\ No newline at end of file
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransitions.java
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: jbpm4/trunk/modules/jpdl/src/main/resources/jbpm.jpdl.activities.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/resources/jbpm.jpdl.activities.xml 2009-02-19 12:49:19 UTC (rev 3947)
+++ jbpm4/trunk/modules/jpdl/src/main/resources/jbpm.jpdl.activities.xml 2009-02-19 13:08:17 UTC (rev 3948)
@@ -1,17 +1,17 @@
<activities>
<schema resource="jpdl.xsd" />
- <activity binding="org.jbpm.jpdl.activity.StartBinding" />
- <activity binding="org.jbpm.jpdl.activity.StateBinding" />
- <activity binding="org.jbpm.jpdl.activity.ExclusiveBinding" />
- <activity binding="org.jbpm.jpdl.activity.EndBinding" />
- <activity binding="org.jbpm.jpdl.activity.EndCancelBinding" />
- <activity binding="org.jbpm.jpdl.activity.EndErrorBinding" />
- <activity binding="org.jbpm.jpdl.activity.ForkBinding" />
- <activity binding="org.jbpm.jpdl.activity.JoinBinding" />
- <activity binding="org.jbpm.jpdl.activity.HqlBinding" />
- <activity binding="org.jbpm.jpdl.activity.SqlBinding" />
- <activity binding="org.jbpm.jpdl.activity.JavaBinding" />
- <activity binding="org.jbpm.jpdl.activity.ScriptBinding" />
- <activity binding="org.jbpm.jpdl.activity.EsbBinding" />
- <activity binding="org.jbpm.jpdl.activity.TaskBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.StartBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.StateBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.ExclusiveBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.EndBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.EndCancelBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.EndErrorBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.ForkBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.JoinBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.HqlBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.SqlBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.JavaBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.ScriptBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.EsbBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.TaskBinding" />
</activities>
Modified: jbpm4/trunk/modules/jpdl/src/main/resources/jbpm.jpdl.hbm.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/resources/jbpm.jpdl.hbm.xml 2009-02-19 12:49:19 UTC (rev 3947)
+++ jbpm4/trunk/modules/jpdl/src/main/resources/jbpm.jpdl.hbm.xml 2009-02-19 13:08:17 UTC (rev 3948)
@@ -3,26 +3,26 @@
<hibernate-mapping default-access="field">
- <joined-subclass name="org.jbpm.jpdl.JpdlProcessDefinition" table="JBPM_JPDL_PROCDEF" extends="org.jbpm.pvm.internal.model.ProcessDefinitionImpl">
+ <joined-subclass name="org.jbpm.jpdl.internal.model.JpdlProcessDefinition" table="JBPM_JPDL_PROCDEF" extends="org.jbpm.pvm.internal.model.ProcessDefinitionImpl">
<key column="DBID_"/>
</joined-subclass>
- <joined-subclass name="org.jbpm.jpdl.JpdlExecution" table="JBPM_JPDL_EXECUTION" extends="org.jbpm.pvm.internal.model.ExecutionImpl">
+ <joined-subclass name="org.jbpm.jpdl.internal.model.JpdlExecution" table="JBPM_JPDL_EXECUTION" extends="org.jbpm.pvm.internal.model.ExecutionImpl">
<key column="DBID_"/>
</joined-subclass>
- <class name="org.jbpm.jpdl.activity.JpdlActivity" table="JBPM_JPDL_ACTIVITY" abstract="true" discriminator-value="X">
+ <class name="org.jbpm.jpdl.internal.activity.JpdlActivity" table="JBPM_JPDL_ACTIVITY" abstract="true" discriminator-value="X">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
<discriminator column="CLASS_" />
- <subclass name="org.jbpm.jpdl.activity.StartActivity" discriminator-value="start" />
- <subclass name="org.jbpm.jpdl.activity.ExclusiveConditionActivity" discriminator-value="excl-cond" />
- <subclass name="org.jbpm.jpdl.activity.ExclusiveExpressionActivity" discriminator-value="excl-expr">
+ <subclass name="org.jbpm.jpdl.internal.activity.StartActivity" discriminator-value="start" />
+ <subclass name="org.jbpm.jpdl.internal.activity.ExclusiveConditionActivity" discriminator-value="excl-cond" />
+ <subclass name="org.jbpm.jpdl.internal.activity.ExclusiveExpressionActivity" discriminator-value="excl-expr">
<property name="expr" column="TEXT_" />
<property name="lang" column="TEXT2_" />
</subclass>
- <subclass name="org.jbpm.jpdl.activity.ExclusiveHandlerActivity" discriminator-value="excl-handler">
+ <subclass name="org.jbpm.jpdl.internal.activity.ExclusiveHandlerActivity" discriminator-value="excl-handler">
<property name="exclusiveHandlerName" column="TEXT_" />
<many-to-one name="exclusiveHandlerDescriptor"
column="EXCLDESCR_"
@@ -31,14 +31,14 @@
foreign-key="FK_ACT_EXCLDESCR"
index="IDX_ACT_EXCLDESCR" />
</subclass>
- <subclass name="org.jbpm.jpdl.activity.StateActivity" discriminator-value="state" />
- <subclass name="org.jbpm.jpdl.activity.EndActivity" discriminator-value="end">
+ <subclass name="org.jbpm.jpdl.internal.activity.StateActivity" discriminator-value="state" />
+ <subclass name="org.jbpm.jpdl.internal.activity.EndActivity" discriminator-value="end">
<property name="endProcessInstance" column="ENDPI_" />
<property name="state" column="TEXT_" />
</subclass>
- <subclass name="org.jbpm.jpdl.activity.ForkActivity" discriminator-value="fork" />
- <subclass name="org.jbpm.jpdl.activity.JoinActivity" discriminator-value="join" />
- <subclass name="org.jbpm.jpdl.activity.HqlActivity" discriminator-value="hql">
+ <subclass name="org.jbpm.jpdl.internal.activity.ForkActivity" discriminator-value="fork" />
+ <subclass name="org.jbpm.jpdl.internal.activity.JoinActivity" discriminator-value="join" />
+ <subclass name="org.jbpm.jpdl.internal.activity.HqlActivity" discriminator-value="hql">
<property name="query" column="TEXT_" />
<property name="resultVariableName" column="TEXT2_" />
<property name="isResultUnique" column="ISUNIQ_" />
@@ -49,9 +49,9 @@
foreign-key="FK_ACT_PARAMDESCR"
index="IDX_ACT_PARAMDESCR" />
- <subclass name="org.jbpm.jpdl.activity.SqlActivity" discriminator-value="sql" />
+ <subclass name="org.jbpm.jpdl.internal.activity.SqlActivity" discriminator-value="sql" />
</subclass>
- <subclass name="org.jbpm.jpdl.activity.JavaActivity" discriminator-value="java">
+ <subclass name="org.jbpm.jpdl.internal.activity.JavaActivity" discriminator-value="java">
<property name="methodName" column="TEXT_" />
<property name="variableName" column="TEXT2_" />
<many-to-one name="descriptor"
@@ -67,12 +67,12 @@
foreign-key="FK_ACT_INVKOPER"
index="IDX_ACT_INVKOPER" />
</subclass>
- <subclass name="org.jbpm.jpdl.activity.ScriptActivity" discriminator-value="script">
+ <subclass name="org.jbpm.jpdl.internal.activity.ScriptActivity" discriminator-value="script">
<property name="script" column="TEXT_" />
<property name="language" column="TEXT2_" />
<property name="variableName" column="TEXT3_" />
</subclass>
- <subclass name="org.jbpm.jpdl.activity.EsbActivity" discriminator-value="esb">
+ <subclass name="org.jbpm.jpdl.internal.activity.EsbActivity" discriminator-value="esb">
<property name="service" column="TEXT_" />
<property name="category" column="TEXT2_" />
<many-to-one name="partsListDescriptor"
@@ -82,7 +82,7 @@
foreign-key="FK_ACT_PARTSDESCR"
index="IDX_ACT_PARTSDESCR" />
</subclass>
- <subclass name="org.jbpm.jpdl.activity.TaskActivity" discriminator-value="task">
+ <subclass name="org.jbpm.jpdl.internal.activity.TaskActivity" discriminator-value="task">
<property name="assignee" column="TEXT_" />
</subclass>
</class>
Modified: jbpm4/trunk/modules/jpdl/src/main/resources/jbpm.jpdl.wire.bindings.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/resources/jbpm.jpdl.wire.bindings.xml 2009-02-19 12:49:19 UTC (rev 3947)
+++ jbpm4/trunk/modules/jpdl/src/main/resources/jbpm.jpdl.wire.bindings.xml 2009-02-19 13:08:17 UTC (rev 3948)
@@ -1,3 +1,3 @@
<wire-bindings>
- <binding class="org.jbpm.jpdl.xml.ParseJpdlBinding" />
+ <binding class="org.jbpm.jpdl.internal.xml.ParseJpdlBinding" />
</wire-bindings>
Modified: jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/JpdlTestCase.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/JpdlTestCase.java 2009-02-19 12:49:19 UTC (rev 3947)
+++ jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/JpdlTestCase.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -23,7 +23,7 @@
import org.jbpm.client.ClientProcessDefinition;
import org.jbpm.internal.log.Log;
-import org.jbpm.jpdl.xml.JpdlParser;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.test.BaseJbpmTestCase;
Modified: jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlParseTestCase.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlParseTestCase.java 2009-02-19 12:49:19 UTC (rev 3947)
+++ jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/jpdl/parsing/JpdlParseTestCase.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -25,7 +25,7 @@
import org.jbpm.Problem;
import org.jbpm.client.ClientProcessDefinition;
-import org.jbpm.jpdl.xml.JpdlParser;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.test.BaseJbpmTestCase;
Modified: jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/test/xml/JpdlXmlTest.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/test/xml/JpdlXmlTest.java 2009-02-19 12:49:19 UTC (rev 3947)
+++ jbpm4/trunk/modules/jpdl/src/test/java/org/jbpm/test/xml/JpdlXmlTest.java 2009-02-19 13:08:17 UTC (rev 3948)
@@ -24,7 +24,7 @@
import java.util.List;
import org.jbpm.Problem;
-import org.jbpm.jpdl.xml.JpdlParser;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
import org.jbpm.test.BaseJbpmTestCase;
/**
More information about the jbpm-commits
mailing list