Author: tom.baeyens(a)jboss.com
Date: 2008-12-01 11:28:48 -0500 (Mon, 01 Dec 2008)
New Revision: 3159
Added:
jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Environments.xml
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/AssignFileTypeDeployer.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProblemsDeployer.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessIdDeployer.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessVersionDeployer.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveDeployer.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AssignFileTypesBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProcessIdBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProcessVersionBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveBinding.java
Removed:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProblems.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckVersion.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CreateId.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CreateProcess.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveProcess.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckVersionBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CreateIdBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CreateProcessBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveProcessBinding.java
Modified:
jbpm4/trunk/modules/api/src/main/java/org/jbpm/Deployment.java
jbpm4/trunk/modules/api/src/main/resources/cfg.xsd
jbpm4/trunk/modules/devguide/src/main/diagrams/diagrams.mdzip
jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-ExecutionModes.xml
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/deploy/ParseJpdlDeployer.java
jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/Deployer.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/DeployerManager.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DeploymentImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProblemsBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/DeployerManagerBinding.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/DeployerManagerDescriptor.java
jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.wire.bindings.xml
jbpm4/trunk/modules/pvm/src/test/resources/environment.cfg.xml
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/api/db/svc/environment.cfg.xml
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/api/timer/environment.cfg.xml
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/internal/db/langext/environment.cfg.xml
jbpm4/trunk/modules/task/src/test/resources/environment.cfg.xml
jbpm4/trunk/modules/task/src/test/resources/jbpm.cfg.xml
jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java
jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch02-Environments.xml
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch03-Services.xml
Log:
generalized deployment
Modified: jbpm4/trunk/modules/api/src/main/java/org/jbpm/Deployment.java
===================================================================
--- jbpm4/trunk/modules/api/src/main/java/org/jbpm/Deployment.java 2008-12-01 04:47:28 UTC
(rev 3158)
+++ jbpm4/trunk/modules/api/src/main/java/org/jbpm/Deployment.java 2008-12-01 16:28:48 UTC
(rev 3159)
@@ -29,18 +29,34 @@
import java.util.zip.ZipInputStream;
-/** a deployment unit, containing all information to create a process
- * definition that will be deployed in the persistent process repository
- * of the Process Virtual Machine.
+/** a deployment unit, containing all information in source format from which
+ * a process definition will be created and stored in the process repository.
*
+ * <p>A deployment takes a bunch of files as input. Files must have a name
+ * and optionally they can have a type. During deployment, the type can be
+ * deducted from the filename automatically. Use the
<code>addXxxx</code>-methods
+ * to add files to the deployment. Use {@link #setFileType(String, String)} to
+ * set the file type programmatically.
+ * </p>
+ *
+ * <p>The deployment also manages a map of objects. The deployers will typically
+ * generate those objects based on the corresponding file contents. E.g. the
+ * jpdl deployer will produce a <code>order.jpdl.xml</code>
+ * {@link ProcessDefinition}-object from the <code>order.jpdl.xml</code>
file.
+ * </p>
+ *
+ * <p>Typically, a deployer will save the created objects into the database.
+ * </p>
+ *
+ * <p>Users can also supply objects programmatically with {@link #addObject(String,
Object)}.
+ * </p>
+ *
* @author Tom Baeyens
*/
public interface Deployment extends Serializable {
-
+
Deployment setName(String name);
- Deployment setLanguage(String language);
- Deployment addObject(String name, Object object);
Deployment addResource(String resource);
Deployment addFile(File file);
Deployment addUrl(URL url);
@@ -55,8 +71,12 @@
Deployment addDirectory(File directory);
Deployment addDirectoryCanonical(File directory);
- ProcessDefinition deploy();
- List<ProcessDefinition> deployAll();
-
+ Deployment setFileType(String fileName, String fileType);
+
+ Deployment deploy();
+
+ /** the deployed process definitions. */
+ List<ProcessDefinition> getProcessDefinitions();
+ /** the problems encountered during deployment */
List<Problem> getProblems();
}
Modified: jbpm4/trunk/modules/api/src/main/resources/cfg.xsd
===================================================================
--- jbpm4/trunk/modules/api/src/main/resources/cfg.xsd 2008-12-01 04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/api/src/main/resources/cfg.xsd 2008-12-01 16:28:48 UTC (rev 3159)
@@ -141,32 +141,13 @@
</element>
<element name="deployer-manager">
- <annotation><documentation>Has a list of deployers
(org.jbpm.deploy.Deployer)
- for each process language for handling deployments.
+ <annotation><documentation>Has a list of deployers
(org.jbpm.pvm.internal.deploy.Deployer)
+ for handling deployments.
</documentation></annotation>
<complexType>
- <choice maxOccurs="unbounded">
- <element name="language">
- <annotation><documentation>A process language that contains
- a list of deployers</documentation></annotation>
- <complexType>
- <choice maxOccurs="unbounded">
- <group ref="tns:deployers" />
- </choice>
- <attribute name="name" type="string"
use="required" />
- <attribute name="extension" type="string" />
- </complexType>
- </element>
- </choice>
- <attribute name="name" type="string">
- <annotation><documentation>The name of the object. It's optional
and serves
- as an id to refer to this object from other object declarations. This name can
- also be used lookup the object
programmatically.</documentation></annotation>
- </attribute>
- <attribute name="init" type="tns:initType"
default="lazy">
- <annotation><documentation>Specifies when and how this object should
be
- created and initialized. Default is
lazy.</documentation></annotation>
- </attribute>
+ <choice maxOccurs="unbounded">
+ <group ref="tns:deployers" />
+ </choice>
</complexType>
</element>
Modified: jbpm4/trunk/modules/devguide/src/main/diagrams/diagrams.mdzip
===================================================================
(Binary files differ)
Added: jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Environments.xml
===================================================================
--- jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Environments.xml
(rev 0)
+++
jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Environments.xml 2008-12-01
16:28:48 UTC (rev 3159)
@@ -0,0 +1,20 @@
+<chapter id="environments">
+ <title>Environments</title>
+
+ <para>This chapter describes the support for other environments then the ones
+ described in the userguide.
+ </para>
+
+ <section id="spring">
+ <title>Spring</title>
+ <para>TODO
+ </para>
+ </section>
+
+ <section id="osgi">
+ <title>OSGi</title>
+ <para>TODO
+ </para>
+ </section>
+
+</chapter>
\ No newline at end of file
Property changes on:
jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-Environments.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-ExecutionModes.xml
===================================================================
---
jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-ExecutionModes.xml 2008-12-01
04:47:28 UTC (rev 3158)
+++
jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch02-ExecutionModes.xml 2008-12-01
16:28:48 UTC (rev 3159)
@@ -107,11 +107,14 @@
<process-engine>
<deployer-manager>
- <language name="api">
- <check-version />
- <create-id />
- <save-process />
- </language>
+ <assign-file-type>
+ <file extension=".jpdl.xml"
type="jpdl" />
+ </assign-file-type>
+ <parse-jpdl />
+ <check-process-version />
+ <check-process-id />
+ <check-problems />
+ <save />
</deployer-manager>
<process-service />
Modified:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/deploy/ParseJpdlDeployer.java
===================================================================
---
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/deploy/ParseJpdlDeployer.java 2008-12-01
04:47:28 UTC (rev 3158)
+++
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/deploy/ParseJpdlDeployer.java 2008-12-01
16:28:48 UTC (rev 3159)
@@ -35,24 +35,20 @@
static JpdlParser jpdlParser = new JpdlParser();
public void deploy(DeploymentImpl deployment) {
- for (String fileName: deployment.getFileNames()) {
- // for all files ending on .jpdl.xml
- if (fileName.endsWith(".jpdl.xml")) {
-
- // 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());
- }
+ 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());
}
}
}
Modified: jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml 2008-12-01 04:47:28 UTC (rev
3158)
+++ jbpm4/trunk/modules/jpdl/src/test/resources/jbpm.cfg.xml 2008-12-01 16:28:48 UTC (rev
3159)
@@ -5,12 +5,14 @@
<process-engine>
<deployer-manager>
- <language name="jpdl">
- <parse-jpdl />
- <check-version />
- <create-id />
- <save-process />
- </language>
+ <assign-file-type>
+ <file extension=".jpdl.xml" type="jpdl" />
+ </assign-file-type>
+ <parse-jpdl />
+ <check-process-version />
+ <check-process-id />
+ <check-problems />
+ <save />
</deployer-manager>
<process-service />
Added:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/AssignFileTypeDeployer.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/AssignFileTypeDeployer.java
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/AssignFileTypeDeployer.java 2008-12-01
16:28:48 UTC (rev 3159)
@@ -0,0 +1,57 @@
+/*
+ * 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.pvm.internal.deploy;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jbpm.pvm.internal.svc.DeploymentImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class AssignFileTypeDeployer implements Deployer {
+
+ /* maps extensions to file types */
+ Map<String, String> fileTypes = new HashMap<String, String>();
+
+ public void deploy(DeploymentImpl deployment) {
+ for (String fileName: deployment.getFileNames()) {
+ for (String extension: fileTypes.keySet()) {
+ if (fileName.endsWith(extension)) {
+ String fileType = fileTypes.get(extension);
+ deployment.setFileType(fileName, fileType);
+ break;
+ }
+ }
+ }
+ }
+
+ public void addFileType(String extension, String fileType) {
+ fileTypes.put(extension, fileType);
+ }
+
+ public String toString() {
+ return "assign-file-type";
+ }
+}
Property changes on:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/AssignFileTypeDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProblems.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProblems.java 2008-12-01
04:47:28 UTC (rev 3158)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProblems.java 2008-12-01
16:28:48 UTC (rev 3159)
@@ -1,39 +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.pvm.internal.deploy;
-
-import org.jbpm.JbpmException;
-import org.jbpm.pvm.internal.svc.DeploymentImpl;
-
-
-/**
- * @author Tom Baeyens
- */
-public class CheckProblems implements Deployer {
-
- public void deploy(DeploymentImpl deployment) {
- if (deployment.hasProblems()) {
- throw new JbpmException("problems during deployment:
"+deployment.getProblemsText());
- }
- }
-
-}
Copied:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProblemsDeployer.java
(from rev 3143,
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProblems.java)
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProblemsDeployer.java
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProblemsDeployer.java 2008-12-01
16:28:48 UTC (rev 3159)
@@ -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.pvm.internal.deploy;
+
+import org.jbpm.JbpmException;
+import org.jbpm.pvm.internal.svc.DeploymentImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CheckProblemsDeployer implements Deployer {
+
+ public void deploy(DeploymentImpl deployment) {
+ if (deployment.hasProblems()) {
+ throw new JbpmException("problems during deployment:
"+deployment.getProblemsText());
+ }
+ }
+
+ public String toString() {
+ return "check-problems";
+ }
+}
Property changes on:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProblemsDeployer.java
___________________________________________________________________
Name: svn:mergeinfo
+
Copied:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessIdDeployer.java
(from rev 3143,
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CreateId.java)
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessIdDeployer.java
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessIdDeployer.java 2008-12-01
16:28:48 UTC (rev 3159)
@@ -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.pvm.internal.deploy;
+
+import org.jbpm.ProcessDefinition;
+import org.jbpm.log.Log;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.svc.DeploymentImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CheckProcessIdDeployer implements Deployer {
+
+ private static final Log log = Log.getLog(CheckProcessIdDeployer.class.getName());
+
+ public void deploy(DeploymentImpl deployment) {
+ for (String objectName : deployment.getObjectNames()) {
+ Object object = deployment.getObject(objectName);
+ if (object instanceof ProcessDefinition) {
+ createId((ProcessDefinitionImpl)object, deployment);
+ }
+ }
+ }
+
+ private void createId(ProcessDefinitionImpl processDefinition, DeploymentImpl
deployment) {
+ if (processDefinition.getId()==null) {
+ String key = processDefinition.getKey();
+ if (key==null) {
+ key = processDefinition.getName();
+ }
+
+ if ("".equals(key)) {
+ deployment.addProblem("empty string is not a valid key");
+ }
+
+ // replace any non-word character with an underscore
+ key = key.replaceAll("\\W", "_");
+
+ String id = key+":"+processDefinition.getVersion();
+
+ log.trace("created id '"+id+"' for
"+processDefinition);
+ processDefinition.setId(id);
+ }
+ }
+
+ public String toString() {
+ return "check-process-id";
+ }
+}
Copied:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessVersionDeployer.java
(from rev 3143,
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckVersion.java)
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessVersionDeployer.java
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckProcessVersionDeployer.java 2008-12-01
16:28:48 UTC (rev 3159)
@@ -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.pvm.internal.deploy;
+
+import org.jbpm.ProcessDefinition;
+import org.jbpm.client.ClientProcessDefinition;
+import org.jbpm.env.Environment;
+import org.jbpm.log.Log;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.svc.DeploymentImpl;
+import org.jbpm.session.PvmDbSession;
+
+/**
+ * @author Tom Baeyens
+ */
+public class CheckProcessVersionDeployer implements Deployer {
+
+ private static final Log log =
Log.getLog(CheckProcessVersionDeployer.class.getName());
+
+ protected boolean assign = true;
+
+ public void deploy(DeploymentImpl deployment) {
+ for (String objectName : deployment.getObjectNames()) {
+ Object object = deployment.getObject(objectName);
+ if (object instanceof ProcessDefinition) {
+ checkProcessDefinition((ProcessDefinitionImpl)object, deployment);
+ }
+ }
+ }
+
+ public void checkProcessDefinition(ProcessDefinitionImpl processDefinition,
DeploymentImpl deployment) {
+ String name = processDefinition.getName();
+ if (name == null) {
+ deployment.addProblem("process must have a name to deploy it");
+ }
+
+ int version = processDefinition.getVersion();
+ if ( (version==ProcessDefinitionImpl.UNASSIGNED_VERSION)
+ && ! assign
+ ) {
+ deployment.addProblem("no version specified in process definition
"+name);
+ }
+
+ Environment environment = Environment.getCurrent();
+ if (environment==null) {
+ deployment.addProblem("environment is required by deployer
check-version");
+ return;
+ }
+
+ PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
+ if (pvmDbSession==null) {
+ deployment.addProblem(PvmDbSession.class.getName()+" is required in the
environment by "+getClass().getName());
+ return;
+ }
+
+ if ( (version==ProcessDefinitionImpl.UNASSIGNED_VERSION)
+ && assign
+ ) {
+ ClientProcessDefinition latestDeployedVersion =
pvmDbSession.findLatestProcessDefinitionByName(name);
+ if (latestDeployedVersion!=null) {
+ version = latestDeployedVersion.getVersion() + 1;
+ } else {
+ version = 1;
+ }
+ log.debug("assigning version "+version+" to process definition
"+name);
+ processDefinition.setVersion(version);
+
+ } else {
+ if (pvmDbSession.findProcessDefinitionByName(name, version) != null) {
+ deployment.addProblem("process '" + name + "' version
" + version + " already exists");
+ }
+ }
+ }
+
+ public void setAssign(boolean assign) {
+ this.assign = assign;
+ }
+
+ public String toString() {
+ return "check-process-version";
+ }
+}
Deleted:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckVersion.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckVersion.java 2008-12-01
04:47:28 UTC (rev 3158)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CheckVersion.java 2008-12-01
16:28:48 UTC (rev 3159)
@@ -1,97 +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.pvm.internal.deploy;
-
-import org.jbpm.ProcessDefinition;
-import org.jbpm.client.ClientProcessDefinition;
-import org.jbpm.env.Environment;
-import org.jbpm.log.Log;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.pvm.internal.svc.DeploymentImpl;
-import org.jbpm.session.PvmDbSession;
-
-/**
- * @author Tom Baeyens
- */
-public class CheckVersion implements Deployer {
-
- private static final Log log = Log.getLog(CheckVersion.class.getName());
-
- protected boolean assign = true;
-
- public void deploy(DeploymentImpl deployment) {
- for (String objectName : deployment.getObjectNames()) {
- Object object = deployment.getObject(objectName);
- if (object instanceof ProcessDefinition) {
- checkProcessDefinition((ProcessDefinitionImpl)object, deployment);
- }
- }
- }
-
- public void checkProcessDefinition(ProcessDefinitionImpl processDefinition,
DeploymentImpl deployment) {
- String name = processDefinition.getName();
- if (name == null) {
- deployment.addProblem("process must have a name to deploy it");
- }
-
- int version = processDefinition.getVersion();
- if ( (version==ProcessDefinitionImpl.UNASSIGNED_VERSION)
- && ! assign
- ) {
- deployment.addProblem("no version specified in process definition
"+name);
- }
-
- Environment environment = Environment.getCurrent();
- if (environment==null) {
- deployment.addProblem("environment is required by deployer
check-version");
- return;
- }
-
- PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
- if (pvmDbSession==null) {
- deployment.addProblem(PvmDbSession.class.getName()+" is required in the
environment by "+getClass().getName());
- return;
- }
-
- if ( (version==ProcessDefinitionImpl.UNASSIGNED_VERSION)
- && assign
- ) {
- ClientProcessDefinition latestDeployedVersion =
pvmDbSession.findLatestProcessDefinitionByName(name);
- if (latestDeployedVersion!=null) {
- version = latestDeployedVersion.getVersion() + 1;
- } else {
- version = 1;
- }
- log.debug("assigning version "+version+" to process definition
"+name);
- processDefinition.setVersion(version);
-
- } else {
- if (pvmDbSession.findProcessDefinitionByName(name, version) != null) {
- deployment.addProblem("process '" + name + "' version
" + version + " already exists");
- }
- }
- }
-
- public void setAssign(boolean assign) {
- this.assign = assign;
- }
-}
Deleted: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CreateId.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CreateId.java 2008-12-01
04:47:28 UTC (rev 3158)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CreateId.java 2008-12-01
16:28:48 UTC (rev 3159)
@@ -1,66 +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.pvm.internal.deploy;
-
-import org.jbpm.ProcessDefinition;
-import org.jbpm.log.Log;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.pvm.internal.svc.DeploymentImpl;
-
-
-/**
- * @author Tom Baeyens
- */
-public class CreateId implements Deployer {
-
- private static final Log log = Log.getLog(CreateId.class.getName());
-
- public void deploy(DeploymentImpl deployment) {
- for (String objectName : deployment.getObjectNames()) {
- Object object = deployment.getObject(objectName);
- if (object instanceof ProcessDefinition) {
- createId((ProcessDefinitionImpl)object, deployment);
- }
- }
- }
-
- private void createId(ProcessDefinitionImpl processDefinition, DeploymentImpl
deployment) {
- if (processDefinition.getId()==null) {
- String key = processDefinition.getKey();
- if (key==null) {
- key = processDefinition.getName();
- }
-
- if ("".equals(key)) {
- deployment.addProblem("empty string is not a valid key");
- }
-
- // replace any non-word character with an underscore
- key = key.replaceAll("\\W", "_");
-
- String id = key+":"+processDefinition.getVersion();
-
- log.trace("created id '"+id+"' for
"+processDefinition);
- processDefinition.setId(id);
- }
- }
-}
Deleted:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CreateProcess.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CreateProcess.java 2008-12-01
04:47:28 UTC (rev 3158)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/CreateProcess.java 2008-12-01
16:28:48 UTC (rev 3159)
@@ -1,69 +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.pvm.internal.deploy;
-
-
-import org.jbpm.ProcessDefinition;
-import org.jbpm.JbpmException;
-import org.jbpm.log.Log;
-import org.jbpm.pvm.internal.svc.DeploymentImpl;
-
-
-/**
- * @author Tom Baeyens
- */
-public class CreateProcess implements Deployer {
-
- private static final Log log = Log.getLog(CreateProcess.class.getName());
-
- protected Class<?> processDefinitionClass;
-
- public void deploy(DeploymentImpl deployment) {
- ProcessDefinition processDefinition = deployment.getProcessDefinition();
-
- if (processDefinition==null) {
- if (processDefinitionClass==null) {
- deployment.addProblem("create-process deployer improperly configured: no
class specified");
- return;
- }
-
- // instantiate
- try {
- log.trace("creating new "+processDefinitionClass.getName());
- processDefinition = (ProcessDefinition) processDefinitionClass.newInstance();
- } catch (Exception e) {
- deployment.addProblem("couldn't instantiate process definition with
class "+processDefinitionClass+": "+e.toString());
- }
-
- // make the process definition available in the deployment
- deployment.setProcessDefinition(processDefinition);
-
- } else {
- log.trace("using process definition provided in deployment");
- }
- }
-
- public void setProcessDefinitionClass(Class< ? > processDefinitionClass) {
- this.processDefinitionClass = processDefinitionClass;
- }
-
-}
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/Deployer.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/Deployer.java 2008-12-01
04:47:28 UTC (rev 3158)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/Deployer.java 2008-12-01
16:28:48 UTC (rev 3159)
@@ -30,6 +30,6 @@
*/
public interface Deployer {
- void deploy(DeploymentImpl deploymentImpl);
+ void deploy(DeploymentImpl deployment);
}
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/DeployerManager.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/DeployerManager.java 2008-12-01
04:47:28 UTC (rev 3158)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/DeployerManager.java 2008-12-01
16:28:48 UTC (rev 3159)
@@ -21,11 +21,8 @@
*/
package org.jbpm.pvm.internal.deploy;
-import java.util.HashMap;
-import java.util.Iterator;
+import java.util.ArrayList;
import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
import org.jbpm.JbpmException;
import org.jbpm.log.Log;
@@ -51,81 +48,21 @@
private static final Log log = Log.getLog(DeployerManager.class.getName());
- /** maps extensions to language-ids */
- protected Map<String, String> extensions = new HashMap<String, String>();
-
- /** maps language-ids to a sequence of process deployers */
- protected Map<String, List<Deployer>> deployers = new HashMap<String,
List<Deployer>>();
+ /** configurable list of deployers */
+ protected List<Deployer> deployers = new ArrayList<Deployer>();
- public void deploy(DeploymentImpl deploymentImpl) {
- if (deploymentImpl==null) {
+ public void deploy(DeploymentImpl deployment) {
+ if (deployment==null) {
throw new JbpmException("deployment is null");
}
-
- // find the language based on the extension
- String language = deploymentImpl.getLanguage();
- if (language==null) {
- String deploymentName = deploymentImpl.getName();
- log.trace("no language specified in deployment, looking for extension in
"+deploymentName);
- if (deploymentName==null) {
- throw new JbpmException("no name nor language specified in
deployment");
- }
- Iterator<Entry<String, String>> iter =
extensions.entrySet().iterator();
- while ( (iter.hasNext())
- && (language==null)
- ) {
- Map.Entry<String, String> extensionEntry = iter.next();
- if (deploymentName.endsWith(extensionEntry.getKey())) {
- language = extensionEntry.getValue();
- }
- }
-
- if (language==null) {
- throw new JbpmException("couldn't find process language matching
extension of "+deploymentName+ " for deploying "+deploymentImpl);
- }
- }
-
- // find the process parser based on the specified language
- log.trace("looking up process deployer sequence for language "+language);
- List<Deployer> deployerSequence = deployers.get(language);
- if (deployerSequence==null) {
- throw new JbpmException("couldn't find deployer sequence for language
"+language+ " for deploying "+deploymentImpl);
- }
- log.debug("deploying deployment "+deploymentImpl+" with
"+language+"-parser");
-
- for (Deployer deployer: deployerSequence) {
- log.trace("deploying "+deploymentImpl+" to "+deployer);
- deployer.deploy(deploymentImpl);
+ for (Deployer deployer: deployers) {
+ log.debug("applying deployer "+deployer+" to "+deployment);
+ deployer.deploy(deployment);
}
}
-
- public static String getExtension(String fileName) {
- if ( (fileName==null)
- || (fileName.length()==0)
- ) {
- throw new JbpmException("can't extract extension of deployment: no file
name");
- }
-
- int lastDotIndex = fileName.lastIndexOf('.');
- if (lastDotIndex==-1) {
- lastDotIndex = 0;
- }
- return fileName.substring(lastDotIndex);
- }
-
- public void addLanguage(String language, String extension, List<Deployer>
deployerSequence) {
- if (extension!=null) {
- extensions.put(extension, language);
- }
- deployers.put(language, deployerSequence);
- }
-
- public void setExtensions(Map<String, String> extensions) {
- this.extensions = extensions;
- }
-
- public void setDeployers(Map<String, List<Deployer>> deployers) {
+
+ public void setDeployers(List<Deployer> deployers) {
this.deployers = deployers;
}
}
Copied:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveDeployer.java (from
rev 3143,
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveProcess.java)
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveDeployer.java
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveDeployer.java 2008-12-01
16:28:48 UTC (rev 3159)
@@ -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.pvm.internal.deploy;
+
+import org.jbpm.JbpmException;
+import org.jbpm.ProcessDefinition;
+import org.jbpm.env.Environment;
+import org.jbpm.log.Log;
+import org.jbpm.pvm.internal.svc.DeploymentImpl;
+import org.jbpm.session.PvmDbSession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SaveDeployer implements Deployer {
+
+ private static Log log = Log.getLog(SaveDeployer.class.getName());
+
+ public void deploy(DeploymentImpl deployment) {
+ Environment environment = Environment.getCurrent();
+ if (environment==null) {
+ deployment.addProblem("environment is required by
"+getClass().getName());
+ return;
+ }
+
+ PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
+ if (pvmDbSession==null) {
+ deployment.addProblem(PvmDbSession.class.getName()+" is required in the
environment by "+getClass().getName());
+ return;
+ }
+
+ boolean deployedProcess = false;
+ for (String objectName : deployment.getObjectNames()) {
+ Object object = deployment.getObject(objectName);
+ if (object instanceof ProcessDefinition) {
+ deployedProcess = true;
+ log.debug("saving process definition "+object);
+ pvmDbSession.save(object);
+ }
+ }
+
+ if (!deployedProcess) {
+ log.info("no process definition in "+deployment);
+ }
+ }
+
+ public String toString() {
+ return "save";
+ }
+}
Property changes on:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Deleted:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveProcess.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveProcess.java 2008-12-01
04:47:28 UTC (rev 3158)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/deploy/SaveProcess.java 2008-12-01
16:28:48 UTC (rev 3159)
@@ -1,67 +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.pvm.internal.deploy;
-
-import org.jbpm.JbpmException;
-import org.jbpm.ProcessDefinition;
-import org.jbpm.env.Environment;
-import org.jbpm.log.Log;
-import org.jbpm.pvm.internal.svc.DeploymentImpl;
-import org.jbpm.session.PvmDbSession;
-
-
-/**
- * @author Tom Baeyens
- */
-public class SaveProcess implements Deployer {
-
- private static Log log = Log.getLog(SaveProcess.class.getName());
-
- public void deploy(DeploymentImpl deployment) {
- Environment environment = Environment.getCurrent();
- if (environment==null) {
- deployment.addProblem("environment is required by
"+getClass().getName());
- return;
- }
-
- PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
- if (pvmDbSession==null) {
- deployment.addProblem(PvmDbSession.class.getName()+" is required in the
environment by "+getClass().getName());
- return;
- }
-
- boolean deployedProcess = false;
- for (String objectName : deployment.getObjectNames()) {
- Object object = deployment.getObject(objectName);
- if (object instanceof ProcessDefinition) {
- deployedProcess = true;
- log.debug("saving process definition "+object);
- pvmDbSession.save(object);
- }
- }
-
- if (!deployedProcess) {
- log.info("no process definition in "+deployment);
- }
- }
-
-}
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DeploymentImpl.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DeploymentImpl.java 2008-12-01
04:47:28 UTC (rev 3158)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/DeploymentImpl.java 2008-12-01
16:28:48 UTC (rev 3159)
@@ -54,10 +54,11 @@
import org.w3c.dom.Document;
-/** a deployment unit, containing all information to create a process
- * definition that will be deployed in the persistent store of the
- * Process Virtual Machine.
- *
+/** a deployment unit, containing all information in source format from which
+ * a process definition will be created and stored in the process repository.
+ *
+ * For more info, see Deployment.
+ *
* @author Tom Baeyens
*/
public class DeploymentImpl extends ProblemList implements Deployment, Serializable {
@@ -71,12 +72,28 @@
protected ProcessServiceImpl processServiceImpl;
protected String name;
- protected String language;
+ /** maps file names to stream source */
protected Map<String, StreamSource> files;
- protected Map<String, Document> documents;
+ /** maps file names to dom so that duplicate xml parsing can be avoided. */
+ protected Map<String, Document> fileDocuments;
+ /** maps file names to file types */
+ protected Map<String, String> fileTypes;
+
+ /** generic pool of objects.
+ * 1) users can supply objects directly to a deployment like
+ * e.g. ProcessDefinition's created by a factory
+ * 2) deployers can create objects as a result from processing the files
+ * in those cases the object names are typically identical to the file
+ * names
+ * 3) the save deployer will store all objects in the db.
+ */
protected Map<String, Object> objects;
+
+ /* maps object names to object types */
+ protected Map<String, Object> objectTypes;
+ // TODO REMOVE
protected ProcessDefinition processDefinition;
public DeploymentImpl(ProcessServiceImpl processServiceImpl) {
@@ -96,15 +113,6 @@
}
- public String getLanguage() {
- return language;
- }
-
- public Deployment setLanguage(String language) {
- this.language = language;
- return this;
- }
-
public Deployment addResource(String resource) {
addStreamSource(resource, new ResourceStreamSource(resource));
return this;
@@ -265,10 +273,10 @@
}
public Document getDocument(String name) {
- if ( (documents!=null)
- && (documents.containsKey(name))
+ if ( (fileDocuments!=null)
+ && (fileDocuments.containsKey(name))
) {
- return documents.get(name);
+ return fileDocuments.get(name);
}
if ( (files!=null)
&& (files.containsKey(name))
@@ -288,9 +296,6 @@
}
public void setProcessDefinition(ProcessDefinition processDefinition) {
- if (language==null) {
- language = "api";
- }
this.processDefinition = processDefinition;
}
@@ -310,16 +315,25 @@
return this;
}
- public ProcessDefinition deploy() {
- List<ProcessDefinition> deployedProcessDefinitions =
processServiceImpl.deploy(this);
- if (deployedProcessDefinitions.size()>0) {
- return deployedProcessDefinitions.get(0);
- }
- return null;
+ public Deployment deploy() {
+ processServiceImpl.deploy(this);
+ return this;
}
- public List<ProcessDefinition> deployAll() {
- return processServiceImpl.deploy(this);
+ public List<ProcessDefinition> getProcessDefinitions() {
+ List<ProcessDefinition> processDefinitions = null;
+ if (objects!=null) {
+ processDefinitions = new ArrayList<ProcessDefinition>();
+ for (Object object: objects.values()) {
+ if (object instanceof ProcessDefinition) {
+ processDefinitions.add((ProcessDefinition) object);
+ }
+ }
+ } else {
+ processDefinitions = Collections.EMPTY_LIST;
+ }
+
+ return processDefinitions;
}
// error logging ////////////////////////////////////////////////////////////
@@ -341,10 +355,10 @@
}
public void addDocument(String name, Document document) {
- if (documents==null) {
- documents = new HashMap<String, Document>();
+ if (fileDocuments==null) {
+ fileDocuments = new HashMap<String, Document>();
}
- documents.put(name, document);
+ fileDocuments.put(name, document);
}
/** throws an exception with appropriate message in case the parse contains
@@ -362,4 +376,33 @@
return this;
}
+ public Deployment addObject(String name, Object object, String objectType) {
+ addObject(name, objectType);
+ if (objectTypes==null) {
+ objectTypes = new HashMap<String, Object>();
+ }
+ objectTypes.put(name, objectType);
+ return this;
+ }
+
+ public Deployment setFileType(String fileName, String fileType) {
+ if (fileTypes==null) {
+ fileTypes = new HashMap<String, String>();
+ }
+ fileTypes.put(name, fileType);
+ return this;
+ }
+
+ public List<String> getFileNamesForType(String type) {
+ if (type==null) {
+ throw new JbpmException("type is null");
+ }
+ List<String> fileNames = new ArrayList<String>();
+ for (String fileName: fileTypes.keySet()) {
+ if (fileTypes.get(fileName).equals(type)) {
+ fileNames.add(fileName);
+ }
+ }
+ return fileNames;
+ }
}
Added:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AssignFileTypesBinding.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AssignFileTypesBinding.java
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AssignFileTypesBinding.java 2008-12-01
16:28:48 UTC (rev 3159)
@@ -0,0 +1,67 @@
+/*
+ * 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.pvm.internal.wire.binding;
+
+import java.util.List;
+
+import org.jbpm.pvm.internal.deploy.AssignFileTypeDeployer;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class AssignFileTypesBinding extends WireDescriptorBinding {
+
+ private static final String ASSIGN_FILE_TYPE = "assign-file-type";
+
+ public AssignFileTypesBinding() {
+ super(ASSIGN_FILE_TYPE);
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ AssignFileTypeDeployer assignFileTypeDeployer = new AssignFileTypeDeployer();
+
+ List<Element> fileElements = XmlUtil.elements(element, "file");
+ if (fileElements==null) {
+ parse.addProblem("no files in "+ASSIGN_FILE_TYPE);
+ } else {
+ for(Element fileTypeElement : fileElements) {
+ String extension = XmlUtil.attribute(fileTypeElement, "extension",
true, parse);
+ String type = XmlUtil.attribute(fileTypeElement, "type", true, parse);
+ if ( (extension!=null)
+ && (type!=null)
+ ) {
+ assignFileTypeDeployer.addFileType(extension, type);
+ }
+ }
+ }
+
+ ProvidedObjectDescriptor providedObjectDescriptor = new
ProvidedObjectDescriptor(assignFileTypeDeployer);
+
+ return providedObjectDescriptor;
+ }
+}
Property changes on:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AssignFileTypesBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProblemsBinding.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProblemsBinding.java 2008-12-01
04:47:28 UTC (rev 3158)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProblemsBinding.java 2008-12-01
16:28:48 UTC (rev 3159)
@@ -21,7 +21,7 @@
*/
package org.jbpm.pvm.internal.wire.binding;
-import org.jbpm.pvm.internal.deploy.CheckProblems;
+import org.jbpm.pvm.internal.deploy.CheckProblemsDeployer;
import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
@@ -38,8 +38,8 @@
}
public Object parse(Element element, Parse parse, Parser parser) {
- CheckProblems checkProblems = new CheckProblems();
- return new ProvidedObjectDescriptor(checkProblems);
+ CheckProblemsDeployer checkProblemsDeployer = new CheckProblemsDeployer();
+ return new ProvidedObjectDescriptor(checkProblemsDeployer);
}
}
Copied:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProcessIdBinding.java
(from rev 3143,
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CreateIdBinding.java)
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProcessIdBinding.java
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProcessIdBinding.java 2008-12-01
16:28:48 UTC (rev 3159)
@@ -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.pvm.internal.wire.binding;
+
+import org.jbpm.pvm.internal.deploy.CheckProcessIdDeployer;
+import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class CheckProcessIdBinding extends WireDescriptorBinding {
+
+ public CheckProcessIdBinding() {
+ super("check-process-id");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ CheckProcessIdDeployer checkProcessIdDeployer = new CheckProcessIdDeployer();
+ return new ProvidedObjectDescriptor(checkProcessIdDeployer);
+ }
+
+}
Copied:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProcessVersionBinding.java
(from rev 3143,
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckVersionBinding.java)
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProcessVersionBinding.java
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckProcessVersionBinding.java 2008-12-01
16:28:48 UTC (rev 3159)
@@ -0,0 +1,58 @@
+/*
+ * 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.pvm.internal.wire.binding;
+
+import org.jbpm.pvm.internal.deploy.CheckProcessVersionDeployer;
+import org.jbpm.pvm.internal.util.XmlUtil;
+import org.jbpm.pvm.internal.wire.Descriptor;
+import org.jbpm.pvm.internal.wire.descriptor.FalseDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
+import org.jbpm.pvm.internal.wire.descriptor.TrueDescriptor;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/** parses a descriptor creating a {@link CheckProcessVersionDeployer version
verification deployer}.
+ *
+ * See schema docs for more details.
+ *
+ * @author Tom Baeyens
+ */
+public class CheckProcessVersionBinding extends WireDescriptorBinding {
+
+ public CheckProcessVersionBinding() {
+ super("check-process-version");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ CheckProcessVersionDeployer checkProcessVersionDeployer = new
CheckProcessVersionDeployer();
+
+ Boolean assign = XmlUtil.attributeBoolean(element, "assign", false, parse,
null);
+ if (assign!=null) {
+ checkProcessVersionDeployer.setAssign(assign);
+ }
+
+ return new ProvidedObjectDescriptor(checkProcessVersionDeployer);
+ }
+}
Deleted:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckVersionBinding.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckVersionBinding.java 2008-12-01
04:47:28 UTC (rev 3158)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CheckVersionBinding.java 2008-12-01
16:28:48 UTC (rev 3159)
@@ -1,58 +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.pvm.internal.wire.binding;
-
-import org.jbpm.pvm.internal.deploy.CheckVersion;
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.descriptor.FalseDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.TrueDescriptor;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/** parses a descriptor creating a {@link CheckVersion version verification deployer}.
- *
- * See schema docs for more details.
- *
- * @author Tom Baeyens
- */
-public class CheckVersionBinding extends WireDescriptorBinding {
-
- public CheckVersionBinding() {
- super("check-version");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- CheckVersion checkVersion = new CheckVersion();
-
- Boolean assign = XmlUtil.attributeBoolean(element, "assign", false, parse,
null);
- if (assign!=null) {
- checkVersion.setAssign(assign);
- }
-
- return new ProvidedObjectDescriptor(checkVersion);
- }
-}
Deleted:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CreateIdBinding.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CreateIdBinding.java 2008-12-01
04:47:28 UTC (rev 3158)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CreateIdBinding.java 2008-12-01
16:28:48 UTC (rev 3159)
@@ -1,45 +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.pvm.internal.wire.binding;
-
-import org.jbpm.pvm.internal.deploy.CreateId;
-import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/**
- * @author Tom Baeyens
- */
-public class CreateIdBinding extends WireDescriptorBinding {
-
- public CreateIdBinding() {
- super("create-id");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- CreateId createId = new CreateId();
- return new ProvidedObjectDescriptor(createId);
- }
-
-}
Deleted:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CreateProcessBinding.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CreateProcessBinding.java 2008-12-01
04:47:28 UTC (rev 3158)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CreateProcessBinding.java 2008-12-01
16:28:48 UTC (rev 3159)
@@ -1,61 +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.pvm.internal.wire.binding;
-
-import org.jbpm.pvm.internal.deploy.CreateProcess;
-import org.jbpm.pvm.internal.util.ReflectUtil;
-import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.descriptor.ClassDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/** parses a descriptor for creating a {@link CreateProcess}.
- *
- * See schema docs for more details.
- *
- * @author Tom Baeyens
- */
-public class CreateProcessBinding extends WireDescriptorBinding {
-
- public CreateProcessBinding() {
- super("create-process");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- CreateProcess createProcess = new CreateProcess();
-
- if (element.hasAttribute("class")) {
- String className = element.getAttribute("class");
- Class<?> processDefinitionClass =
ReflectUtil.loadClass(parse.getClassLoader(), className);
- createProcess.setProcessDefinitionClass(processDefinitionClass);
- } else {
- parse.addProblem("class is a required attribute in
"+XmlUtil.toString(element));
- }
-
- return new ProvidedObjectDescriptor(createProcess);
- }
-
-}
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/DeployerManagerBinding.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/DeployerManagerBinding.java 2008-12-01
04:47:28 UTC (rev 3158)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/DeployerManagerBinding.java 2008-12-01
16:28:48 UTC (rev 3159)
@@ -21,15 +21,10 @@
*/
package org.jbpm.pvm.internal.wire.binding;
-import java.net.URL;
import java.util.ArrayList;
-import java.util.Enumeration;
import java.util.List;
-import org.jbpm.log.Log;
import org.jbpm.pvm.internal.deploy.DeployerManager;
-import org.jbpm.pvm.internal.stream.UrlStreamSource;
-import org.jbpm.pvm.internal.util.ReflectUtil;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.wire.Descriptor;
import org.jbpm.pvm.internal.wire.descriptor.DeployerManagerDescriptor;
@@ -47,54 +42,33 @@
*/
public class DeployerManagerBinding extends WireDescriptorBinding {
- private static final Log log = Log.getLog(DeployerManagerBinding.class.getName());
+ private static final String DEPLOYER_MANAGER_TAG = "deployer-manager";
public DeployerManagerBinding() {
- super("deployer-manager");
+ super(DEPLOYER_MANAGER_TAG);
}
public Object parse(Element element, Parse parse, Parser parser) {
DeployerManagerDescriptor descriptor = new DeployerManagerDescriptor();
- List<Element> languageElements = XmlUtil.elements(element,
"language");
- if (languageElements!=null) {
- for (Element languageElement: languageElements) {
- String language = null;
- if (languageElement.hasAttribute("name")) {
- language = languageElement.getAttribute("name");
- } else {
- parse.addProblem("name is a required attribute in element language:
"+XmlUtil.toString(languageElement));
- }
-
- String extension = null;
- if (element.hasAttribute("extension")) {
- language = element.getAttribute("extension");
- }
-
- List<Descriptor> deployerDescriptors = new ArrayList<Descriptor>();
+ List<Descriptor> deployerDescriptors = new ArrayList<Descriptor>();
+ descriptor.setDeployerDescriptors(deployerDescriptors);
- List<Element> deployerElements = XmlUtil.elements(languageElement);
- if (deployerElements!=null) {
- for (Element deployerElement: deployerElements) {
- Descriptor deployerDescriptor = (Descriptor) parser
- .parseElement(deployerElement,
- parse,
- WireParser.CATEGORY_DESCRIPTOR);
- deployerDescriptors.add(deployerDescriptor);
- }
- }
-
- if (deployerDescriptors.isEmpty()) {
- parse.addProblem("no deployers defined for "+language);
- }
-
- descriptor.addLanguage(language, extension, deployerDescriptors);
+ List<Element> deployerElements = XmlUtil.elements(element);
+ if (deployerElements!=null) {
+ for (Element deployerElement: deployerElements) {
+ Descriptor deployerDescriptor = (Descriptor) parser
+ .parseElement(deployerElement,
+ parse,
+ WireParser.CATEGORY_DESCRIPTOR);
+ deployerDescriptors.add(deployerDescriptor);
}
- } else {
- parse.addProblem("at least one language is required in a deployer-manager:
"+XmlUtil.toString(element));
}
+ if (deployerDescriptors.isEmpty()) {
+ parse.addProblem("no deployers defined for "+DEPLOYER_MANAGER_TAG);
+ }
+
return descriptor;
}
-
}
Copied:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveBinding.java
(from rev 3143,
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveProcessBinding.java)
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveBinding.java
(rev 0)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveBinding.java 2008-12-01
16:28:48 UTC (rev 3159)
@@ -0,0 +1,47 @@
+/*
+ * 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.pvm.internal.wire.binding;
+
+import org.jbpm.pvm.internal.deploy.SaveDeployer;
+import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/** parses a descriptor for creating a {@link SaveDeployer} deployer.
+ *
+ * See schema docs for more details.
+ *
+ * @author Tom Baeyens
+ */
+public class SaveBinding extends WireDescriptorBinding {
+
+ public SaveBinding() {
+ super("save");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ SaveDeployer saveDeployer = new SaveDeployer();
+ return new ProvidedObjectDescriptor(saveDeployer);
+ }
+}
Property changes on:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveBinding.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Deleted:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveProcessBinding.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveProcessBinding.java 2008-12-01
04:47:28 UTC (rev 3158)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/SaveProcessBinding.java 2008-12-01
16:28:48 UTC (rev 3159)
@@ -1,47 +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.pvm.internal.wire.binding;
-
-import org.jbpm.pvm.internal.deploy.SaveProcess;
-import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
-import org.jbpm.pvm.internal.xml.Parse;
-import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
-
-
-/** parses a descriptor for creating a {@link SaveProcess} deployer.
- *
- * See schema docs for more details.
- *
- * @author Tom Baeyens
- */
-public class SaveProcessBinding extends WireDescriptorBinding {
-
- public SaveProcessBinding() {
- super("save-process");
- }
-
- public Object parse(Element element, Parse parse, Parser parser) {
- SaveProcess saveProcess = new SaveProcess();
- return new ProvidedObjectDescriptor(saveProcess);
- }
-}
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/DeployerManagerDescriptor.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/DeployerManagerDescriptor.java 2008-12-01
04:47:28 UTC (rev 3158)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/DeployerManagerDescriptor.java 2008-12-01
16:28:48 UTC (rev 3159)
@@ -22,9 +22,7 @@
package org.jbpm.pvm.internal.wire.descriptor;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
-import java.util.Map;
import org.jbpm.pvm.internal.deploy.Deployer;
import org.jbpm.pvm.internal.deploy.DeployerManager;
@@ -40,11 +38,8 @@
private static final long serialVersionUID = 1L;
- /** maps extensions to language-ids */
- protected Map<String, String> extensions = new HashMap<String, String>();
-
- /** maps language-ids to a sequence of process deployers */
- protected Map<String, List<Descriptor>> deployerDescriptors = new
HashMap<String, List<Descriptor>>();
+ /** the list of descriptors for building the list of deployers */
+ protected List<Descriptor> deployerDescriptors = new
ArrayList<Descriptor>();
public Object construct(WireContext wireContext) {
return new DeployerManager();
@@ -53,31 +48,20 @@
public void initialize(Object object, WireContext wireContext) {
DeployerManager deployerManager = (DeployerManager) object;
- Map<String, List<Deployer>> deployers = new HashMap<String,
List<Deployer>>();
- for (Map.Entry<String, List<Descriptor>> languageEntry:
deployerDescriptors.entrySet()) {
- String language = languageEntry.getKey();
- List<Descriptor> descriptors = languageEntry.getValue();
-
- List<Deployer> deployerSequence = new ArrayList<Deployer>();
- for (Descriptor descriptor: descriptors) {
- deployerSequence.add((Deployer) wireContext.create(descriptor, true));
- }
-
- deployers.put(language, deployerSequence);
+ List<Deployer> deployers = new ArrayList<Deployer>();
+ for (Descriptor deployerDescriptor: deployerDescriptors) {
+ Deployer deployer = (Deployer) wireContext.create(deployerDescriptor, true);
+ deployers.add(deployer);
}
- deployerManager.setExtensions(extensions);
deployerManager.setDeployers(deployers);
}
public Class< ? > getType(WireDefinition wireDefinition) {
return DeployerManager.class;
}
-
- public void addLanguage(String language, String extension, List<Descriptor>
deployerDescriptorSequence) {
- if (extension!=null) {
- extensions.put(extension, language);
- }
- deployerDescriptors.put(language, deployerDescriptorSequence);
+
+ public void setDeployerDescriptors(List<Descriptor> deployerDescriptors) {
+ this.deployerDescriptors = deployerDescriptors;
}
}
Modified: jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.wire.bindings.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.wire.bindings.xml 2008-12-01
04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/pvm/src/main/resources/jbpm.pvm.wire.bindings.xml 2008-12-01
16:28:48 UTC (rev 3159)
@@ -58,11 +58,11 @@
<binding
class="org.jbpm.pvm.internal.wire.binding.ManagementServiceBinding" />
<!-- deployers -->
<binding class="org.jbpm.pvm.internal.wire.binding.DeployerManagerBinding"
/>
- <binding class="org.jbpm.pvm.internal.wire.binding.CreateProcessBinding"
/>
- <binding class="org.jbpm.pvm.internal.wire.binding.CheckVersionBinding"
/>
- <binding class="org.jbpm.pvm.internal.wire.binding.SaveProcessBinding"
/>
- <binding class="org.jbpm.pvm.internal.wire.binding.CreateIdBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.AssignFileTypesBinding"
/>
+ <binding
class="org.jbpm.pvm.internal.wire.binding.CheckProcessVersionBinding" />
+ <binding class="org.jbpm.pvm.internal.wire.binding.CheckProcessIdBinding"
/>
<binding class="org.jbpm.pvm.internal.wire.binding.CheckProblemsBinding"
/>
+ <binding class="org.jbpm.pvm.internal.wire.binding.SaveBinding" />
<!-- ############################ -->
<!-- ### Interceptor bindings ### -->
Modified: jbpm4/trunk/modules/pvm/src/test/resources/environment.cfg.xml
===================================================================
--- jbpm4/trunk/modules/pvm/src/test/resources/environment.cfg.xml 2008-12-01 04:47:28 UTC
(rev 3158)
+++ jbpm4/trunk/modules/pvm/src/test/resources/environment.cfg.xml 2008-12-01 16:28:48 UTC
(rev 3159)
@@ -5,11 +5,13 @@
<process-engine>
<deployer-manager>
- <language name="api">
- <check-version />
- <create-id />
- <save-process />
- </language>
+ <assign-file-type>
+ <file extension=".jpdl.xml" type="jpdl" />
+ </assign-file-type>
+ <check-process-version />
+ <check-process-id />
+ <check-problems />
+ <save />
</deployer-manager>
<process-service />
Modified:
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/api/db/svc/environment.cfg.xml
===================================================================
---
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/api/db/svc/environment.cfg.xml 2008-12-01
04:47:28 UTC (rev 3158)
+++
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/api/db/svc/environment.cfg.xml 2008-12-01
16:28:48 UTC (rev 3159)
@@ -4,12 +4,14 @@
<process-engine>
- <deployer-manager resource="pvm.language.deployers.xml">
- <language name="api">
- <check-version />
- <create-id />
- <save-process />
- </language>
+ <deployer-manager>
+ <assign-file-type>
+ <file extension=".jpdl.xml" type="jpdl" />
+ </assign-file-type>
+ <check-process-version />
+ <check-process-id />
+ <check-problems />
+ <save />
</deployer-manager>
<process-service />
Modified:
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/api/timer/environment.cfg.xml
===================================================================
---
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/api/timer/environment.cfg.xml 2008-12-01
04:47:28 UTC (rev 3158)
+++
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/api/timer/environment.cfg.xml 2008-12-01
16:28:48 UTC (rev 3159)
@@ -16,12 +16,14 @@
<transaction-interceptor />
</command-service>
- <deployer-manager resource="pvm.language.deployers.xml">
- <language name="api">
- <check-version />
- <create-id />
- <save-process />
- </language>
+ <deployer-manager>
+ <assign-file-type>
+ <file extension=".jpdl.xml" type="jpdl" />
+ </assign-file-type>
+ <check-process-version />
+ <check-process-id />
+ <check-problems />
+ <save />
</deployer-manager>
<hibernate-configuration>
Modified:
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/internal/db/langext/environment.cfg.xml
===================================================================
---
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/internal/db/langext/environment.cfg.xml 2008-12-01
04:47:28 UTC (rev 3158)
+++
jbpm4/trunk/modules/pvm/src/test/resources/org/jbpm/pvm/internal/db/langext/environment.cfg.xml 2008-12-01
16:28:48 UTC (rev 3159)
@@ -4,12 +4,14 @@
<process-engine>
- <deployer-manager resource="pvm.language.deployers.xml">
- <language name="api">
- <check-version />
- <create-id />
- <save-process />
- </language>
+ <deployer-manager>
+ <assign-file-type>
+ <file extension=".jpdl.xml" type="jpdl" />
+ </assign-file-type>
+ <check-process-version />
+ <check-process-id />
+ <check-problems />
+ <save />
</deployer-manager>
<process-service />
Modified: jbpm4/trunk/modules/task/src/test/resources/environment.cfg.xml
===================================================================
--- jbpm4/trunk/modules/task/src/test/resources/environment.cfg.xml 2008-12-01 04:47:28
UTC (rev 3158)
+++ jbpm4/trunk/modules/task/src/test/resources/environment.cfg.xml 2008-12-01 16:28:48
UTC (rev 3159)
@@ -5,11 +5,13 @@
<process-engine>
<deployer-manager>
- <language name="api">
- <check-version />
- <create-id />
- <save-process />
- </language>
+ <assign-file-type>
+ <file extension=".jpdl.xml" type="jpdl" />
+ </assign-file-type>
+ <check-process-version />
+ <check-process-id />
+ <check-problems />
+ <save />
</deployer-manager>
<process-service />
Modified: jbpm4/trunk/modules/task/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/task/src/test/resources/jbpm.cfg.xml 2008-12-01 04:47:28 UTC (rev
3158)
+++ jbpm4/trunk/modules/task/src/test/resources/jbpm.cfg.xml 2008-12-01 16:28:48 UTC (rev
3159)
@@ -5,11 +5,13 @@
<process-engine>
<deployer-manager>
- <language name="api">
- <check-version />
- <create-id />
- <save-process />
- </language>
+ <assign-file-type>
+ <file extension=".jpdl.xml" type="jpdl" />
+ </assign-file-type>
+ <check-process-version />
+ <check-process-id />
+ <check-problems />
+ <save />
</deployer-manager>
<process-service />
Modified: jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java
===================================================================
--- jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java 2008-12-01
04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/test-base/src/main/java/org/jbpm/test/DbTestCase.java 2008-12-01
16:28:48 UTC (rev 3159)
@@ -85,18 +85,22 @@
}
public ProcessDefinition deployJpdlXmlString(String jpdlXmlString) {
- ProcessDefinition deployedProcessDefinition =
+ List<ProcessDefinition> deployedProcessDefinitions =
processService.createDeployment()
- .setLanguage("jpdl")
.addString("xmlstring.jpdl.xml", jpdlXmlString)
- .deploy();
+ .deploy()
+ .getProcessDefinitions();
if (processDefinitions==null) {
processDefinitions = new ArrayList<ProcessDefinition>();
}
- processDefinitions.add(deployedProcessDefinition);
+ processDefinitions.addAll(deployedProcessDefinitions);
- return deployedProcessDefinition;
+ if (deployedProcessDefinitions.size()>=1) {
+ return deployedProcessDefinitions.get(0);
+ }
+
+ return null;
}
}
Modified: jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml 2008-12-01 04:47:28 UTC
(rev 3158)
+++ jbpm4/trunk/modules/test-db/src/test/resources/jbpm.cfg.xml 2008-12-01 16:28:48 UTC
(rev 3159)
@@ -5,13 +5,14 @@
<process-engine>
<deployer-manager>
- <language name="jpdl">
- <parse-jpdl />
- <check-version />
- <create-id />
- <check-problems />
- <save-process />
- </language>
+ <assign-file-type>
+ <file extension=".jpdl.xml" type="jpdl" />
+ </assign-file-type>
+ <parse-jpdl />
+ <check-process-version />
+ <check-process-id />
+ <check-problems />
+ <save />
</deployer-manager>
<process-service />
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch02-Environments.xml
===================================================================
---
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch02-Environments.xml 2008-12-01
04:47:28 UTC (rev 3158)
+++
jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch02-Environments.xml 2008-12-01
16:28:48 UTC (rev 3159)
@@ -15,35 +15,9 @@
<para>TODO</para>
</section>
- <section id="jboss-4.2.2">
- <title>JBoss 4.2.2</title>
+ <section id="jboss-xxx">
+ <title>JBoss xxx</title>
<para>TODO</para>
</section>
- <section id="jboss-4.2.3">
- <title>JBoss 4.2.3</title>
- <para>TODO</para>
- </section>
-
- <section id="jboss-5.0.0">
- <title>JBoss 5.0.0</title>
- <para>TODO</para>
- </section>
-
- <section id="spring">
- <title>Spring</title>
- <para>Usage of jBPM with Spring is only supported when jBPM is configured with
- the jBPM configuration file and when hibernate or JTA is used for transaction
- demarcation. For configuring jBPM in a Spring configuration file and for
- binding jBPM to Spring demarcated transactions, see the non-supported
- developers guide.
- </para>
- </section>
-
- <section id="osgi">
- <title>OSGi</title>
- <para>TODO
- </para>
- </section>
-
</chapter>
\ No newline at end of file
Modified: jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch03-Services.xml
===================================================================
--- jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch03-Services.xml 2008-12-01
04:47:28 UTC (rev 3158)
+++ jbpm4/trunk/modules/userguide/src/main/docbook/en/modules/ch03-Services.xml 2008-12-01
16:28:48 UTC (rev 3159)
@@ -1,7 +1,7 @@
<chapter id="services">
<title>Services</title>
- <para>Interacting with jBPM occurs through <link
linkend="services">services</link>.
+ <para>Interacting with jBPM occurs through services.
The service interfaces can be obtained from the
<literal>ProcessEngine</literal>
which is build from a <literal>Configuration</literal>.
</para>