[jbpm-commits] JBoss JBPM SVN: r3040 - in jbpm3/trunk/modules: core/src/main/java/org/jbpm/command and 7 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Fri Nov 21 12:38:10 EST 2008
Author: thomas.diesler at jboss.com
Date: 2008-11-21 12:38:10 -0500 (Fri, 21 Nov 2008)
New Revision: 3040
Added:
jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/DeleteProcessDefinitionCommand.java
jbpm3/trunk/modules/integration/jboss42/scripts/
jbpm3/trunk/modules/integration/jboss42/scripts/assembly-config.xml
Removed:
jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/DeleteProcessdefinitionCommand.java
Modified:
jbpm3/trunk/modules/core/src/main/java/org/jbpm/JbpmConfiguration.java
jbpm3/trunk/modules/distribution/pom.xml
jbpm3/trunk/modules/distribution/scripts/assembly-deploy-artifacts.xml
jbpm3/trunk/modules/distribution/src/main/resources/installer/install-definition.xml
jbpm3/trunk/modules/enterprise/ear/pom.xml
jbpm3/trunk/modules/integration/jboss42/pom.xml
jbpm3/trunk/modules/integration/jboss42/src/main/java/org/jbpm/integration/jboss42/PARSubDeployer.java
Log:
Integrate PAR deployer with installer
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/JbpmConfiguration.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/JbpmConfiguration.java 2008-11-21 16:18:49 UTC (rev 3039)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/JbpmConfiguration.java 2008-11-21 17:38:10 UTC (rev 3040)
@@ -50,16 +50,14 @@
* configuration of one jBPM instance.
*
* <p>
- * During process execution, jBPM might need to use some services. A
- * JbpmConfiguration contains the knowledge on how to create those services.
+ * During process execution, jBPM might need to use some services. A JbpmConfiguration contains the knowledge on how to
+ * create those services.
* </p>
*
* <p>
- * A JbpmConfiguration is a thread safe object and serves as a factory for
- * {@link org.jbpm.JbpmContext}s, which means one JbpmConfiguration can be used
- * to create {@link org.jbpm.JbpmContext}s for all threads. The single
- * JbpmConfiguration can be maintained in a static member or in the JNDI tree if
- * that is available.
+ * A JbpmConfiguration is a thread safe object and serves as a factory for {@link org.jbpm.JbpmContext}s, which means
+ * one JbpmConfiguration can be used to create {@link org.jbpm.JbpmContext}s for all threads. The single
+ * JbpmConfiguration can be maintained in a static member or in the JNDI tree if that is available.
* </p>
*
* <p>
@@ -90,9 +88,8 @@
* </pre>
*
* </li>
- * <li>By specifying a custom implementation of an object factory. This can be
- * used to specify a JbpmConfiguration in other bean-style notations such as
- * used by JBoss Microcontainer or Spring.
+ * <li>By specifying a custom implementation of an object factory. This can be used to specify a JbpmConfiguration in
+ * other bean-style notations such as used by JBoss Microcontainer or Spring.
*
* <pre>
* ObjectFactory of = new <i>MyCustomObjectFactory</i>();
@@ -105,8 +102,7 @@
* </p>
*
* <p>
- * JbpmConfigurations can be configured using a spring-like XML notation (in
- * relax ng compact notation):
+ * JbpmConfigurations can be configured using a spring-like XML notation (in relax ng compact notation):
* </p>
*
* <pre>
@@ -240,7 +236,8 @@
* </p>
*
* <p>
- * Other configuration properties <table>
+ * Other configuration properties
+ * <table>
* <tr>
* <td>jbpm.files.dir</td>
* <td></td>
@@ -252,7 +249,8 @@
* </table>
* </p>
*/
-public class JbpmConfiguration implements Serializable {
+public class JbpmConfiguration implements Serializable
+{
private static final long serialVersionUID = 1L;
@@ -264,34 +262,41 @@
private ThreadLocal jbpmContextStacks = new ThreadLocal();
private JobExecutor jobExecutor;
- public JbpmConfiguration(ObjectFactory objectFactory) {
+ public JbpmConfiguration(ObjectFactory objectFactory)
+ {
this.objectFactory = objectFactory;
}
- public static JbpmConfiguration getInstance() {
+ public static JbpmConfiguration getInstance()
+ {
return getInstance(null);
}
- public static JbpmConfiguration getInstance(String resource) {
+ public static JbpmConfiguration getInstance(String resource)
+ {
JbpmConfiguration instance = null;
- synchronized (instances) {
- if (resource == null) {
+ synchronized (instances)
+ {
+ if (resource == null)
+ {
resource = "jbpm.cfg.xml";
}
- instance = (JbpmConfiguration) instances.get(resource);
- if (instance == null) {
+ instance = (JbpmConfiguration)instances.get(resource);
+ if (instance == null)
+ {
- if (defaultObjectFactory != null) {
- log.debug("creating jbpm configuration from given default object factory '"
- + defaultObjectFactory
- + "'");
+ if (defaultObjectFactory != null)
+ {
+ log.debug("creating jbpm configuration from given default object factory '" + defaultObjectFactory + "'");
instance = new JbpmConfiguration(defaultObjectFactory);
}
- else {
+ else
+ {
- try {
+ try
+ {
log.info("using jbpm configuration resource '" + resource + "'");
InputStream jbpmCfgXmlStream = ClassLoaderUtil.getJbpmConfigurationStream(resource);
@@ -301,7 +306,8 @@
// will be confused if the resource is not found and not loaded,
// without
// any notice)
- if (jbpmCfgXmlStream == null && !"jbpm.cfg.xml".equals(resource)) {
+ if (jbpmCfgXmlStream == null && !"jbpm.cfg.xml".equals(resource))
+ {
log.warn("jbpm configuration resource '" + resource + "' is not available");
}
@@ -309,10 +315,9 @@
instance = createJbpmConfiguration(objectFactory);
}
- catch (RuntimeException e) {
- throw new JbpmException("couldn't parse jbpm configuration from resource '"
- + resource
- + "'", e);
+ catch (RuntimeException e)
+ {
+ throw new JbpmException("couldn't parse jbpm configuration from resource '" + resource + "'", e);
}
}
@@ -323,25 +328,29 @@
return instance;
}
- public static boolean hasInstance(String resource) {
+ public static boolean hasInstance(String resource)
+ {
boolean hasInstance = false;
- if (resource == null) {
+ if (resource == null)
+ {
resource = "jbpm.cfg.xml";
}
- if ((instances != null) && (instances.containsKey(resource))) {
+ if ((instances != null) && (instances.containsKey(resource)))
+ {
hasInstance = true;
}
return hasInstance;
}
- protected static ObjectFactory parseObjectFactory(InputStream inputStream) {
+ protected static ObjectFactory parseObjectFactory(InputStream inputStream)
+ {
log.debug("loading defaults in jbpm configuration");
ObjectFactoryParser objectFactoryParser = new ObjectFactoryParser();
ObjectFactoryImpl objectFactoryImpl = new ObjectFactoryImpl();
- objectFactoryParser.parseElementsFromResource("org/jbpm/default.jbpm.cfg.xml",
- objectFactoryImpl);
+ objectFactoryParser.parseElementsFromResource("org/jbpm/default.jbpm.cfg.xml", objectFactoryImpl);
- if (inputStream != null) {
+ if (inputStream != null)
+ {
log.debug("loading specific configuration...");
objectFactoryParser.parseElementsStream(inputStream, objectFactoryImpl);
}
@@ -352,26 +361,31 @@
/**
* create an ObjectFacotory from an XML string.
*/
- public static JbpmConfiguration parseXmlString(String xml) {
+ public static JbpmConfiguration parseXmlString(String xml)
+ {
log.debug("creating jbpm configuration from xml string");
InputStream inputStream = null;
- if (xml != null) {
+ if (xml != null)
+ {
inputStream = new ByteArrayInputStream(xml.getBytes());
}
ObjectFactory objectFactory = parseObjectFactory(inputStream);
return createJbpmConfiguration(objectFactory);
}
- protected static JbpmConfiguration createJbpmConfiguration(ObjectFactory objectFactory) {
+ protected static JbpmConfiguration createJbpmConfiguration(ObjectFactory objectFactory)
+ {
JbpmConfiguration jbpmConfiguration = new JbpmConfiguration(objectFactory);
// now we make the bean jbpm.configuration always availble
- if (objectFactory instanceof ObjectFactoryImpl) {
- ObjectFactoryImpl objectFactoryImpl = (ObjectFactoryImpl) objectFactory;
+ if (objectFactory instanceof ObjectFactoryImpl)
+ {
+ ObjectFactoryImpl objectFactoryImpl = (ObjectFactoryImpl)objectFactory;
ObjectInfo jbpmConfigurationInfo = new ValueInfo("jbpmConfiguration", jbpmConfiguration);
objectFactoryImpl.addObjectInfo(jbpmConfigurationInfo);
- if (getHideStaleObjectExceptions(objectFactory)) {
+ if (getHideStaleObjectExceptions(objectFactory))
+ {
StaleObjectLogConfigurer.hideStaleObjectExceptions();
}
}
@@ -379,286 +393,350 @@
return jbpmConfiguration;
}
- private static boolean getHideStaleObjectExceptions(ObjectFactory objectFactory) {
- if (!objectFactory.hasObject("jbpm.hide.stale.object.exceptions")) {
+ private static boolean getHideStaleObjectExceptions(ObjectFactory objectFactory)
+ {
+ if (!objectFactory.hasObject("jbpm.hide.stale.object.exceptions"))
+ {
return true;
}
Object object = objectFactory.createObject("jbpm.hide.stale.object.exceptions");
- return object instanceof Boolean ? ((Boolean) object).booleanValue() : true;
+ return object instanceof Boolean ? ((Boolean)object).booleanValue() : true;
}
- public static JbpmConfiguration parseInputStream(InputStream inputStream) {
+ public static JbpmConfiguration parseInputStream(InputStream inputStream)
+ {
ObjectFactory objectFactory = parseObjectFactory(inputStream);
log.debug("creating jbpm configuration from input stream");
return createJbpmConfiguration(objectFactory);
}
- public static JbpmConfiguration parseResource(String resource) {
+ public static JbpmConfiguration parseResource(String resource)
+ {
InputStream inputStream = null;
log.debug("creating jbpm configuration from resource '" + resource + "'");
- if (resource != null) {
+ if (resource != null)
+ {
inputStream = ClassLoaderUtil.getJbpmConfigurationStream(resource);
}
ObjectFactory objectFactory = parseObjectFactory(inputStream);
return createJbpmConfiguration(objectFactory);
}
- public JbpmContext createJbpmContext() {
+ public JbpmContext createJbpmContext()
+ {
return createJbpmContext(JbpmContext.DEFAULT_JBPM_CONTEXT_NAME);
}
- public JbpmContext createJbpmContext(String name) {
- JbpmContext jbpmContext = (JbpmContext) objectFactory.createObject(name);
+ public JbpmContext createJbpmContext(String name)
+ {
+ JbpmContext jbpmContext = (JbpmContext)objectFactory.createObject(name);
jbpmContext.jbpmConfiguration = this;
jbpmContextCreated(jbpmContext);
return jbpmContext;
}
- public ServiceFactory getServiceFactory(String serviceName) {
+ public ServiceFactory getServiceFactory(String serviceName)
+ {
return getServiceFactory(serviceName, JbpmContext.DEFAULT_JBPM_CONTEXT_NAME);
}
- public ServiceFactory getServiceFactory(String serviceName, String jbpmContextName) {
+ public ServiceFactory getServiceFactory(String serviceName, String jbpmContextName)
+ {
ServiceFactory serviceFactory = null;
JbpmContext jbpmContext = createJbpmContext(jbpmContextName);
- try {
+ try
+ {
serviceFactory = jbpmContext.getServices().getServiceFactory(serviceName);
}
- finally {
+ finally
+ {
jbpmContext.close();
}
return serviceFactory;
}
- public static ClassLoader getProcessClassLoader(ProcessDefinition processDefinition) {
+ public static ClassLoader getProcessClassLoader(ProcessDefinition processDefinition)
+ {
ProcessClassLoaderFactory factory = null;
- if (Configs.hasObject("jbpm.processClassLoader")) {
- factory = (ProcessClassLoaderFactory) Configs.getObject("jbpm.processClassLoader");
+ if (Configs.hasObject("jbpm.processClassLoader"))
+ {
+ factory = (ProcessClassLoaderFactory)Configs.getObject("jbpm.processClassLoader");
}
- else {
+ else
+ {
factory = new DefaultProcessClassLoaderFactory();
}
return factory.getProcessClassLoader(processDefinition);
}
/**
- * gives the jbpm domain model access to configuration information via the
- * current JbpmContext.
+ * gives the jbpm domain model access to configuration information via the current JbpmContext.
*/
- public abstract static class Configs {
+ public abstract static class Configs
+ {
- public static ObjectFactory getObjectFactory() {
+ public static ObjectFactory getObjectFactory()
+ {
ObjectFactory objectFactory = null;
JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
- if (jbpmContext != null) {
+ if (jbpmContext != null)
+ {
objectFactory = jbpmContext.objectFactory;
}
- else {
+ else
+ {
objectFactory = getInstance().objectFactory;
}
return objectFactory;
}
- public static void setDefaultObjectFactory(ObjectFactory objectFactory) {
+ public static void setDefaultObjectFactory(ObjectFactory objectFactory)
+ {
defaultObjectFactory = objectFactory;
}
- public static boolean hasObject(String name) {
+ public static boolean hasObject(String name)
+ {
ObjectFactory objectFactory = getObjectFactory();
return objectFactory.hasObject(name);
}
- public static synchronized Object getObject(String name) {
+ public static synchronized Object getObject(String name)
+ {
ObjectFactory objectFactory = getObjectFactory();
return objectFactory.createObject(name);
}
- public static String getString(String name) {
- return (String) getObject(name);
+ public static String getString(String name)
+ {
+ return (String)getObject(name);
}
- public static long getLong(String name) {
- return ((Long) getObject(name)).longValue();
+ public static long getLong(String name)
+ {
+ return ((Long)getObject(name)).longValue();
}
- public static int getInt(String name) {
- return ((Integer) getObject(name)).intValue();
+ public static int getInt(String name)
+ {
+ return ((Integer)getObject(name)).intValue();
}
- public static boolean getBoolean(String name) {
- return ((Boolean) getObject(name)).booleanValue();
+ public static boolean getBoolean(String name)
+ {
+ return ((Boolean)getObject(name)).booleanValue();
}
}
- public void cleanSchema() {
+ public void cleanSchema()
+ {
cleanSchema(JbpmContext.DEFAULT_JBPM_CONTEXT_NAME);
}
- public void cleanSchema(String jbpmContextName) {
+ public void cleanSchema(String jbpmContextName)
+ {
JbpmContext jbpmContext = createJbpmContext(jbpmContextName);
- try {
+ try
+ {
Services services = jbpmContext.getServices();
- DbPersistenceServiceFactory persistenceServiceFactory = (DbPersistenceServiceFactory) services.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
+ DbPersistenceServiceFactory persistenceServiceFactory = (DbPersistenceServiceFactory)services.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
persistenceServiceFactory.cleanSchema();
}
- finally {
+ finally
+ {
jbpmContext.close();
}
}
- public void createSchema() {
+ public void createSchema()
+ {
createSchema(JbpmContext.DEFAULT_JBPM_CONTEXT_NAME);
}
- public void createSchema(String jbpmContextName) {
+ public void createSchema(String jbpmContextName)
+ {
JbpmContext jbpmContext = createJbpmContext(jbpmContextName);
- try {
+ try
+ {
Services services = jbpmContext.getServices();
- DbPersistenceServiceFactory persistenceServiceFactory = (DbPersistenceServiceFactory) services.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
+ DbPersistenceServiceFactory persistenceServiceFactory = (DbPersistenceServiceFactory)services.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
persistenceServiceFactory.createSchema();
}
- finally {
+ finally
+ {
jbpmContext.close();
}
}
- public void dropSchema() {
+ public void dropSchema()
+ {
dropSchema(JbpmContext.DEFAULT_JBPM_CONTEXT_NAME);
}
- public void dropSchema(String jbpmContextName) {
+ public void dropSchema(String jbpmContextName)
+ {
log.warn("Dropping schema: " + jbpmContextName);
JbpmContext jbpmContext = createJbpmContext(jbpmContextName);
- try {
+ try
+ {
Services services = jbpmContext.getServices();
- DbPersistenceServiceFactory persistenceServiceFactory = (DbPersistenceServiceFactory) services.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
+ DbPersistenceServiceFactory persistenceServiceFactory = (DbPersistenceServiceFactory)services.getServiceFactory(Services.SERVICENAME_PERSISTENCE);
persistenceServiceFactory.dropSchema();
}
- finally {
+ finally
+ {
jbpmContext.close();
}
}
- public void close() {
+ public void close()
+ {
close(JbpmContext.DEFAULT_JBPM_CONTEXT_NAME);
}
- public void close(String jbpmContextName) {
+ public void close(String jbpmContextName)
+ {
JbpmContext jbpmContext = createJbpmContext(jbpmContextName);
- try {
+ try
+ {
- synchronized (instances) {
+ synchronized (instances)
+ {
Iterator iter = instances.keySet().iterator();
- while (iter.hasNext()) {
- String resource = (String) iter.next();
- if (this == instances.get(resource)) {
+ while (iter.hasNext())
+ {
+ String resource = (String)iter.next();
+ if (this == instances.get(resource))
+ {
instances.remove(resource);
break;
}
}
}
- if (jobExecutor != null) {
+ if (jobExecutor != null)
+ {
jobExecutor.stop();
}
Map serviceFactories = jbpmContext.getServices().getServiceFactories();
- if (serviceFactories != null) {
+ if (serviceFactories != null)
+ {
Iterator iter = serviceFactories.values().iterator();
- while (iter.hasNext()) {
- ServiceFactory serviceFactory = (ServiceFactory) iter.next();
+ while (iter.hasNext())
+ {
+ ServiceFactory serviceFactory = (ServiceFactory)iter.next();
serviceFactory.close();
}
}
}
- finally {
+ finally
+ {
jbpmContext.close();
}
}
- static JbpmConfiguration getCurrentJbpmConfiguration() {
+ static JbpmConfiguration getCurrentJbpmConfiguration()
+ {
JbpmConfiguration currentJbpmConfiguration = null;
Stack stack = getJbpmConfigurationStack();
- if (!stack.isEmpty()) {
- currentJbpmConfiguration = (JbpmConfiguration) stack.peek();
+ if (!stack.isEmpty())
+ {
+ currentJbpmConfiguration = (JbpmConfiguration)stack.peek();
}
return currentJbpmConfiguration;
}
- static synchronized Stack getJbpmConfigurationStack() {
- Stack stack = (Stack) jbpmConfigurationsStacks.get();
- if (stack == null) {
+ static synchronized Stack getJbpmConfigurationStack()
+ {
+ Stack stack = (Stack)jbpmConfigurationsStacks.get();
+ if (stack == null)
+ {
stack = new Stack();
jbpmConfigurationsStacks.set(stack);
}
return stack;
}
- synchronized void pushJbpmConfiguration() {
+ synchronized void pushJbpmConfiguration()
+ {
getJbpmConfigurationStack().push(this);
}
- synchronized void popJbpmConfiguration() {
+ synchronized void popJbpmConfiguration()
+ {
getJbpmConfigurationStack().remove(this);
}
- public JbpmContext getCurrentJbpmContext() {
+ public JbpmContext getCurrentJbpmContext()
+ {
JbpmContext currentJbpmContext = null;
Stack stack = getJbpmContextStack();
- if (!stack.isEmpty()) {
- currentJbpmContext = (JbpmContext) stack.peek();
+ if (!stack.isEmpty())
+ {
+ currentJbpmContext = (JbpmContext)stack.peek();
}
return currentJbpmContext;
}
- Stack getJbpmContextStack() {
- Stack stack = (Stack) jbpmContextStacks.get();
- if (stack == null) {
+ Stack getJbpmContextStack()
+ {
+ Stack stack = (Stack)jbpmContextStacks.get();
+ if (stack == null)
+ {
stack = new Stack();
jbpmContextStacks.set(stack);
}
return stack;
}
- void pushJbpmContext(JbpmContext jbpmContext) {
+ void pushJbpmContext(JbpmContext jbpmContext)
+ {
getJbpmContextStack().push(jbpmContext);
}
- void popJbpmContext(JbpmContext jbpmContext) {
+ void popJbpmContext(JbpmContext jbpmContext)
+ {
Stack stack = getJbpmContextStack();
- if (stack.isEmpty()) {
- throw new JbpmException(
- "closed JbpmContext more then once... check your try-finally's around JbpmContexts blocks");
+ if (stack.isEmpty())
+ {
+ throw new JbpmException("closed JbpmContext more then once... check your try-finally's around JbpmContexts blocks");
}
- JbpmContext popped = (JbpmContext) stack.pop();
- if (jbpmContext != popped) {
- throw new JbpmException(
- "closed JbpmContext in different order then they were created... check your try-finally's around JbpmContexts blocks");
+ JbpmContext popped = (JbpmContext)stack.pop();
+ if (jbpmContext != popped)
+ {
+ throw new JbpmException("closed JbpmContext in different order then they were created... check your try-finally's around JbpmContexts blocks");
}
}
- void jbpmContextCreated(JbpmContext jbpmContext) {
+ void jbpmContextCreated(JbpmContext jbpmContext)
+ {
pushJbpmConfiguration();
pushJbpmContext(jbpmContext);
}
- void jbpmContextClosed(JbpmContext jbpmContext) {
+ void jbpmContextClosed(JbpmContext jbpmContext)
+ {
popJbpmConfiguration();
popJbpmContext(jbpmContext);
}
- public void startJobExecutor() {
+ public void startJobExecutor()
+ {
getJobExecutor().start();
}
- public synchronized JobExecutor getJobExecutor() {
- if (jobExecutor == null) {
- try {
- jobExecutor = (JobExecutor) this.objectFactory.createObject("jbpm.job.executor");
+ public synchronized JobExecutor getJobExecutor()
+ {
+ if (jobExecutor == null)
+ {
+ try
+ {
+ jobExecutor = (JobExecutor)this.objectFactory.createObject("jbpm.job.executor");
}
- catch (ClassCastException e) {
- throw new JbpmException("jbpm configuration object under key 'jbpm.job.executor' is not a "
- + JobExecutor.class.getName(), e);
+ catch (ClassCastException e)
+ {
+ throw new JbpmException("jbpm configuration object under key 'jbpm.job.executor' is not a " + JobExecutor.class.getName(), e);
}
}
return jobExecutor;
Copied: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/DeleteProcessDefinitionCommand.java (from rev 3038, jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/DeleteProcessdefinitionCommand.java)
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/DeleteProcessDefinitionCommand.java (rev 0)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/DeleteProcessDefinitionCommand.java 2008-11-21 17:38:10 UTC (rev 3040)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.command;
+
+import org.jbpm.JbpmContext;
+
+/**
+ * Delete a proces definition by ID
+ *
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class DeleteProcessDefinitionCommand extends AbstractGetObjectBaseCommand
+{
+
+ private static final long serialVersionUID = -1908847549444051495L;
+
+ private long id;
+
+ public DeleteProcessDefinitionCommand(long id)
+ {
+ super();
+ this.id = id;
+ }
+
+ public Object execute(JbpmContext jbpmContext) throws Exception
+ {
+ jbpmContext.getGraphSession().deleteProcessDefinition(id);
+ return Boolean.TRUE;
+ }
+
+}
Deleted: jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/DeleteProcessdefinitionCommand.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/DeleteProcessdefinitionCommand.java 2008-11-21 16:18:49 UTC (rev 3039)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/command/DeleteProcessdefinitionCommand.java 2008-11-21 17:38:10 UTC (rev 3040)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.command;
-
-import org.jbpm.JbpmContext;
-
-/**
- * Delete a proces definition by ID
- *
- * @author Heiko.Braun <heiko.braun at jboss.com>
- */
-public class DeleteProcessdefinitionCommand extends AbstractGetObjectBaseCommand
-{
-
- private static final long serialVersionUID = -1908847549444051495L;
-
- private long id;
-
- public DeleteProcessdefinitionCommand(long id)
- {
- super();
- this.id = id;
- }
-
- public Object execute(JbpmContext jbpmContext) throws Exception
- {
- jbpmContext.getGraphSession().deleteProcessDefinition(id);
- return Boolean.TRUE;
- }
-
-}
Modified: jbpm3/trunk/modules/distribution/pom.xml
===================================================================
--- jbpm3/trunk/modules/distribution/pom.xml 2008-11-21 16:18:49 UTC (rev 3039)
+++ jbpm3/trunk/modules/distribution/pom.xml 2008-11-21 17:38:10 UTC (rev 3040)
@@ -30,17 +30,11 @@
<dependencies>
<dependency>
<groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-jpdl</artifactId>
+ <artifactId>jbpm-db</artifactId>
<version>${version}</version>
</dependency>
<dependency>
<groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-jpdl</artifactId>
- <classifier>config</classifier>
- <version>${version}</version>
- </dependency>
- <dependency>
- <groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm-enterprise-beans</artifactId>
<version>${version}</version>
<type>ejb</type>
@@ -59,19 +53,19 @@
</dependency>
<dependency>
<groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-identity</artifactId>
+ <artifactId>jbpm-examples</artifactId>
+ <classifier>examples</classifier>
<version>${version}</version>
</dependency>
<dependency>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jbpm-identity</artifactId>
- <classifier>config</classifier>
<version>${version}</version>
</dependency>
<dependency>
<groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-examples</artifactId>
- <classifier>examples</classifier>
+ <artifactId>jbpm-identity</artifactId>
+ <classifier>config</classifier>
<version>${version}</version>
</dependency>
<dependency>
@@ -83,15 +77,32 @@
</dependency>
<dependency>
<groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-userguide</artifactId>
+ <artifactId>jbpm-integration-jboss42</artifactId>
<version>${version}</version>
- <type>jdocbook</type>
</dependency>
<dependency>
<groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-db</artifactId>
+ <artifactId>jbpm-integration-jboss42</artifactId>
+ <classifier>config</classifier>
<version>${version}</version>
</dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jbpm-jpdl</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jbpm-jpdl</artifactId>
+ <classifier>config</classifier>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jbpm-userguide</artifactId>
+ <version>${version}</version>
+ <type>jdocbook</type>
+ </dependency>
<!-- jBPM Projects -->
<dependency>
Modified: jbpm3/trunk/modules/distribution/scripts/assembly-deploy-artifacts.xml
===================================================================
--- jbpm3/trunk/modules/distribution/scripts/assembly-deploy-artifacts.xml 2008-11-21 16:18:49 UTC (rev 3039)
+++ jbpm3/trunk/modules/distribution/scripts/assembly-deploy-artifacts.xml 2008-11-21 17:38:10 UTC (rev 3040)
@@ -50,6 +50,14 @@
</includes>
<unpack>true</unpack>
</dependencySet>
+ <dependencySet>
+ <outputDirectory>resources/jbpm-integration-config</outputDirectory>
+ <useStrictFiltering>true</useStrictFiltering>
+ <includes>
+ <include>*:jbpm-integration-jboss42:jar:config</include>
+ </includes>
+ <unpack>true</unpack>
+ </dependencySet>
<!-- examples -->
<dependencySet>
Modified: jbpm3/trunk/modules/distribution/src/main/resources/installer/install-definition.xml
===================================================================
--- jbpm3/trunk/modules/distribution/src/main/resources/installer/install-definition.xml 2008-11-21 16:18:49 UTC (rev 3039)
+++ jbpm3/trunk/modules/distribution/src/main/resources/installer/install-definition.xml 2008-11-21 17:38:10 UTC (rev 3040)
@@ -144,6 +144,7 @@
<include name="jbpm-enterprise-bundle.ear" />
<include name="jbpm-jpdl.jar" />
<include name="jbpm-identity.jar" />
+ <include name="jbpm-integration-jboss42.jar" />
<include name="jsf-console.war" />
<include name="activation.jar" />
<include name="antlr.jar" />
@@ -173,11 +174,18 @@
<description>The jBPM3 Server Components</description>
<!-- jbpm/jbpm-service.sar -->
- <fileset dir="@{deploy.artifacts.dir}/resources/jbpm-enterprise-config" targetdir="${installPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar"
- override="true">
+ <fileset dir="@{deploy.artifacts.dir}/resources/jbpm-enterprise-config" targetdir="${installPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar" override="true">
<include name="jbpm.cfg.xml" />
<include name="hibernate.extra.hbm.xml" />
</fileset>
+ <fileset dir="@{deploy.artifacts.dir}/resources/jbpm-integration-config" targetdir="${installPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar" override="true">
+ <include name="par-deployer.xml" />
+ </fileset>
+ <fileset dir="@{deploy.artifacts.dir}/lib" targetdir="${installPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar" override="true">
+ <include name="jbpm-jpdl.jar" />
+ <include name="jbpm-identity.jar" />
+ <include name="jbpm-integration-jboss42.jar" />
+ </fileset>
<file src="@{deploy.artifacts.dir}/lib/jbpm-identity-service.zip" targetdir="${installPath}/server/${jbossTargetServer}/deploy/jbpm/jbpm-service.sar"
unpack="true" override="true" />
Modified: jbpm3/trunk/modules/enterprise/ear/pom.xml
===================================================================
--- jbpm3/trunk/modules/enterprise/ear/pom.xml 2008-11-21 16:18:49 UTC (rev 3039)
+++ jbpm3/trunk/modules/enterprise/ear/pom.xml 2008-11-21 17:38:10 UTC (rev 3040)
@@ -44,48 +44,6 @@
<artifactId>jsf-console</artifactId>
<type>war</type>
</dependency>
- <dependency>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-jpdl</artifactId>
- <version>${version}</version>
- <exclusions>
- <exclusion>
- <groupId>bsh</groupId>
- <artifactId>bsh</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>dom4j</groupId>
- <artifactId>dom4j</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.ant</groupId>
- <artifactId>ant</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.jackrabbit</groupId>
- <artifactId>jackrabbit-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-identity</artifactId>
- <version>${version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-jpdl</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
</dependencies>
<!-- Plugins -->
@@ -102,18 +60,6 @@
<bundleFileName>jbpm-enterprise-beans.jar</bundleFileName>
<unpack>true</unpack>
</ejbModule>
- <jarModule>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-jpdl</artifactId>
- <bundleFileName>jbpm-jpdl.jar</bundleFileName>
- <includeInApplicationXml>true</includeInApplicationXml>
- </jarModule>
- <jarModule>
- <groupId>org.jbpm.jbpm3</groupId>
- <artifactId>jbpm-identity</artifactId>
- <bundleFileName>jbpm-identity.jar</bundleFileName>
- <includeInApplicationXml>true</includeInApplicationXml>
- </jarModule>
<webModule>
<groupId>org.jbpm.jbpm3</groupId>
<artifactId>jsf-console</artifactId>
Modified: jbpm3/trunk/modules/integration/jboss42/pom.xml
===================================================================
--- jbpm3/trunk/modules/integration/jboss42/pom.xml 2008-11-21 16:18:49 UTC (rev 3039)
+++ jbpm3/trunk/modules/integration/jboss42/pom.xml 2008-11-21 17:38:10 UTC (rev 3040)
@@ -36,8 +36,14 @@
<!-- Dependencies -->
<dependencies>
- <!-- jboss thirdparty dependencies -->
+ <!-- jBPM Dependencies -->
<dependency>
+ <groupId>org.jbpm.jbpm3</groupId>
+ <artifactId>jbpm-jpdl</artifactId>
+ <version>${version}</version>
+ </dependency>
+
+ <dependency>
<groupId>jboss</groupId>
<artifactId>jboss-system</artifactId>
<version>${jboss.version}</version>
@@ -63,4 +69,28 @@
<version>${jboss.common.version}</version>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>assembly-config</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <finalName>${project.build.finalName}</finalName>
+ <appendAssemblyId>true</appendAssemblyId>
+ <descriptors>
+ <descriptor>scripts/assembly-config.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
Added: jbpm3/trunk/modules/integration/jboss42/scripts/assembly-config.xml
===================================================================
--- jbpm3/trunk/modules/integration/jboss42/scripts/assembly-config.xml (rev 0)
+++ jbpm3/trunk/modules/integration/jboss42/scripts/assembly-config.xml 2008-11-21 17:38:10 UTC (rev 3040)
@@ -0,0 +1,17 @@
+<assembly xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/assembly-1.1.0-SNAPSHOT.xsd">
+ <id>config</id>
+ <formats>
+ <format>jar</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>${basedir}/src/main/etc</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>par-deployer.xml</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+</assembly>
\ No newline at end of file
Property changes on: jbpm3/trunk/modules/integration/jboss42/scripts/assembly-config.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm3/trunk/modules/integration/jboss42/src/main/java/org/jbpm/integration/jboss42/PARSubDeployer.java
===================================================================
--- jbpm3/trunk/modules/integration/jboss42/src/main/java/org/jbpm/integration/jboss42/PARSubDeployer.java 2008-11-21 16:18:49 UTC (rev 3039)
+++ jbpm3/trunk/modules/integration/jboss42/src/main/java/org/jbpm/integration/jboss42/PARSubDeployer.java 2008-11-21 17:38:10 UTC (rev 3040)
@@ -23,66 +23,138 @@
//$Id$
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.URL;
+
import org.jboss.deployment.DeploymentException;
import org.jboss.deployment.DeploymentInfo;
import org.jboss.deployment.SubDeployerSupport;
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.JbpmContext;
+import org.jbpm.command.DeleteProcessDefinitionCommand;
+import org.jbpm.command.DeployProcessCommand;
+import org.jbpm.graph.def.ProcessDefinition;
/**
* A deployer service that manages jBPM Process Archive Deployments
- *
+ *
* @author Thomas.Diesler at jboss.org
* @since 03-May-2007
*/
public class PARSubDeployer extends SubDeployerSupport implements PARSubDeployerMBean
{
/** The suffixes we accept, along with their relative order */
- private static final String[] DEFAULT_ENHANCED_SUFFIXES = new String[] {
- "900:-process.xml"
- };
-
+ private static final String[] DEFAULT_ENHANCED_SUFFIXES = new String[] { "900:-process.xml" };
+
+ private JbpmConfiguration jbpmConfiguration;
+
public PARSubDeployer()
{
setEnhancedSuffixes(DEFAULT_ENHANCED_SUFFIXES);
}
@Override
- public boolean accepts(DeploymentInfo di)
+ protected void startService() throws Exception
{
- boolean accepts = super.accepts(di);
- if (accepts == true)
- {
- log.info("Accept: " + di);
- }
- return accepts;
+ super.startService();
+
+ // Deployer works with the default configuration
+ jbpmConfiguration = JbpmConfiguration.getInstance();
}
@Override
+ @SuppressWarnings("unchecked")
public void create(DeploymentInfo di) throws DeploymentException
{
super.create(di);
+
+ URL pdURL = getProcessDefinitionURL(di);
+ log.info("Deploy ProcessDefinition: " + pdURL);
+
+ JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
+ try
+ {
+ // Get the process definition from the URL
+ String pdXML = getProcessDefinition(pdURL);
+
+ // Deploy through the DeployProcessCommand
+ DeployProcessCommand command = new DeployProcessCommand(pdXML);
+ ProcessDefinition procDef = (ProcessDefinition)command.execute(jbpmContext);
+
+ // Remember the procDef ID
+ di.context.put(ProcessDefinition.class.getName(), new Long(procDef.getId()));
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new DeploymentException("Cannot deploy: " + pdURL, ex);
+ }
+ finally
+ {
+ jbpmContext.close();
+ }
}
@Override
public void destroy(DeploymentInfo di) throws DeploymentException
{
+ URL pdURL = getProcessDefinitionURL(di);
+ log.info("Undeploy ProcessDefinition: " + pdURL);
+
+ Long procID = (Long)di.context.get(ProcessDefinition.class.getName());
+ if (procID != null)
+ {
+ JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
+ try
+ {
+ // Undeploy through the DeleteProcessDefinitionCommand
+ DeleteProcessDefinitionCommand command = new DeleteProcessDefinitionCommand(procID);
+ command.execute(jbpmContext);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new DeploymentException("Cannot deploy: " + pdURL, ex);
+ }
+ finally
+ {
+ jbpmContext.close();
+ }
+ }
super.destroy(di);
}
- @Override
- public void init(DeploymentInfo di) throws DeploymentException
+ private URL getProcessDefinitionURL(DeploymentInfo di)
{
- super.init(di);
+ URL pdURL = di.localUrl != null ? di.localUrl : di.url;
+ if (pdURL == null)
+ throw new IllegalStateException("Cannot obtain process definition URL");
+
+ return pdURL;
}
- @Override
- public void start(DeploymentInfo di) throws DeploymentException
+ private String getProcessDefinition(URL pdURL) throws IOException
{
- super.start(di);
+ BufferedReader br = new BufferedReader(new InputStreamReader(pdURL.openStream()));
+ StringWriter strwr = new StringWriter();
+ PrintWriter pwr = new PrintWriter(strwr);
+ String line = br.readLine();
+ while (line != null)
+ {
+ pwr.println(line);
+ line = br.readLine();
+ }
+ String pdXML = strwr.toString();
+ return pdXML;
}
-
- @Override
- public void stop(DeploymentInfo di) throws DeploymentException
- {
- super.stop(di);
- }
}
\ No newline at end of file
More information about the jbpm-commits
mailing list