JBoss JBPM SVN: r4693 - jbpm4/trunk/qa.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-05-02 12:36:41 -0400 (Sat, 02 May 2009)
New Revision: 4693
Modified:
jbpm4/trunk/qa/build.xml
Log:
fixed copying of specific db jdbc properties
Modified: jbpm4/trunk/qa/build.xml
===================================================================
--- jbpm4/trunk/qa/build.xml 2009-05-02 08:22:17 UTC (rev 4692)
+++ jbpm4/trunk/qa/build.xml 2009-05-02 16:36:41 UTC (rev 4693)
@@ -41,10 +41,17 @@
<target name="integration.testrun.setup" depends="log.properties">
<antcall target="reinstall.jbpm" />
+ <copy file="db/${database}.properties"
+ todir="${jbpm.home}/db/jdbc"
+ overwrite="true"
+ failonerror="false" />
+ <copy file="${user.home}/.jbpm4/db/${database}.properties"
+ todir="${jbpm.home}/db/jdbc"
+ overwrite="true"
+ failonerror="false" />
<ant antfile="${jbpm.home}/jboss/build.xml" target="reinstall.jboss" />
<ant antfile="${jbpm.home}/jboss/build.xml" target="install.jbpm.into.jboss" />
<ant antfile="${jbpm.home}/jboss/build.xml" target="start.jboss" />
- <copy file="db/${database}.properties" tofile="${jbpm.home}/db/jdbc/${database}.properties" overwrite="true" />
<ant antfile="${jbpm.home}/db/build.xml" target="create.jbpm.schema" />
</target>
15 years
JBoss JBPM SVN: r4692 - in jbpm4/trunk: qa and 1 other directory.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-05-02 04:22:17 -0400 (Sat, 02 May 2009)
New Revision: 4692
Added:
jbpm4/trunk/qa/hudson-jbpm4-base.sh
jbpm4/trunk/qa/hudson-jbpm4-jboss.bat
jbpm4/trunk/qa/hudson-jbpm4-jboss.sh
Removed:
jbpm4/trunk/qa/jbpm4-jboss.bat
jbpm4/trunk/qa/jbpm4-jboss.sh
Modified:
jbpm4/trunk/modules/distro/src/main/files/jboss/datasources/jbpm-mysql-ds.xml
jbpm4/trunk/modules/distro/src/main/files/jboss/datasources/jbpm-oracle-ds.xml
jbpm4/trunk/modules/distro/src/main/files/jboss/datasources/jbpm-postgresql-ds.xml
jbpm4/trunk/modules/distro/src/main/files/jboss/datasources/jbpm-sybase-ds.xml
Log:
qa run database fixes and prefixing hudson- to the hudson script in the qa directory
Modified: jbpm4/trunk/modules/distro/src/main/files/jboss/datasources/jbpm-mysql-ds.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/jboss/datasources/jbpm-mysql-ds.xml 2009-05-01 14:59:52 UTC (rev 4691)
+++ jbpm4/trunk/modules/distro/src/main/files/jboss/datasources/jbpm-mysql-ds.xml 2009-05-02 08:22:17 UTC (rev 4692)
@@ -5,11 +5,9 @@
<jndi-name>JbpmDS</jndi-name>
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
- <xa-datasource-property name="ServerName">@jdbc.mysql.server@</xa-datasource-property>
- <xa-datasource-property name="PortNumber">@jdbc.mysql.port@</xa-datasource-property>
- <xa-datasource-property name="DatabaseName">@jdbc.mysql.database@</xa-datasource-property>
- <user-name>@jdbc.mysql.username@</user-name>
- <password>@jdbc.mysql.password@</password>
+ <xa-datasource-property name="URL">@jdbc.url@</xa-datasource-property>
+ <user-name>@jdbc.username@</user-name>
+ <password>@jdbc.password@</password>
<!-- reduce isolation from the default level (repeatable read) -->
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
Modified: jbpm4/trunk/modules/distro/src/main/files/jboss/datasources/jbpm-oracle-ds.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/jboss/datasources/jbpm-oracle-ds.xml 2009-05-01 14:59:52 UTC (rev 4691)
+++ jbpm4/trunk/modules/distro/src/main/files/jboss/datasources/jbpm-oracle-ds.xml 2009-05-02 08:22:17 UTC (rev 4692)
@@ -19,9 +19,9 @@
<!-- uncomment to enable interleaving <interleaving/> -->
<isSameRM-override-value>false</isSameRM-override-value>
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
- <xa-datasource-property name="URL">jdbc:oracle:thin:@jdbc.oracle.username@/@jdbc.oracle.password@@@jdbc.oracle.server@:@jdbc.oracle.port@:@jdbc.oracle.database@</xa-datasource-property>
- <xa-datasource-property name="User">@jdbc.oracle.username@</xa-datasource-property>
- <xa-datasource-property name="Password">@jdbc.oracle.password@</xa-datasource-property>
+ <xa-datasource-property name="URL">@jdbc.url@</xa-datasource-property>
+ <xa-datasource-property name="User">@jdbc.username@</xa-datasource-property>
+ <xa-datasource-property name="Password">@jdbc.password@</xa-datasource-property>
<!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool -->
<!--valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name-->
<!-- Checks the Oracle error codes and messages for fatal errors -->
Modified: jbpm4/trunk/modules/distro/src/main/files/jboss/datasources/jbpm-postgresql-ds.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/jboss/datasources/jbpm-postgresql-ds.xml 2009-05-01 14:59:52 UTC (rev 4691)
+++ jbpm4/trunk/modules/distro/src/main/files/jboss/datasources/jbpm-postgresql-ds.xml 2009-05-02 08:22:17 UTC (rev 4692)
@@ -5,11 +5,9 @@
<jndi-name>JbpmDS</jndi-name>
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
- <xa-datasource-property name="ServerName">@jdbc.postgresql.server@</xa-datasource-property>
- <xa-datasource-property name="PortNumber">@jdbc.postgresql.port@</xa-datasource-property>
- <xa-datasource-property name="DatabaseName">@jdbc.postgresql.database@</xa-datasource-property>
- <user-name>@jdbc.postgresql.username@</user-name>
- <password>@jdbc.postgresql.password@</password>
+ <xa-datasource-property name="URL">@jdbc.url@</xa-datasource-property>
+ <user-name>@jdbc.username@</user-name>
+ <password>@jdbc.password@</password>
<!-- disable transaction interleaving -->
<track-connection-by-tx />
Modified: jbpm4/trunk/modules/distro/src/main/files/jboss/datasources/jbpm-sybase-ds.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/jboss/datasources/jbpm-sybase-ds.xml 2009-05-01 14:59:52 UTC (rev 4691)
+++ jbpm4/trunk/modules/distro/src/main/files/jboss/datasources/jbpm-sybase-ds.xml 2009-05-02 08:22:17 UTC (rev 4692)
@@ -6,11 +6,9 @@
<jndi-name>JbpmDS</jndi-name>
<xa-datasource-class>@jdbc.sybase.datasource@</xa-datasource-class>
- <xa-datasource-property name="ServerName">@jdbc.sybase.server@</xa-datasource-property>
- <xa-datasource-property name="PortNumber">@jdbc.sybase.port@</xa-datasource-property>
- <xa-datasource-property name="DatabaseName">@jdbc.sybase.database@</xa-datasource-property>
- <user-name>@jdbc.sybase.username@</user-name>
- <password>@jdbc.sybase.password@</password>
+ <xa-datasource-property name="URL">@jdbc.url@</xa-datasource-property>
+ <user-name>@jdbc.username@</user-name>
+ <password>@jdbc.password@</password>
<!-- disable transaction interleaving -->
<track-connection-by-tx />
Added: jbpm4/trunk/qa/hudson-jbpm4-base.sh
===================================================================
--- jbpm4/trunk/qa/hudson-jbpm4-base.sh (rev 0)
+++ jbpm4/trunk/qa/hudson-jbpm4-base.sh 2009-05-02 08:22:17 UTC (rev 4692)
@@ -0,0 +1,5 @@
+#!/bin/sh
+#
+# runs the smoke test suite
+
+mvn -U clean install
Copied: jbpm4/trunk/qa/hudson-jbpm4-jboss.bat (from rev 4691, jbpm4/trunk/qa/jbpm4-jboss.bat)
===================================================================
--- jbpm4/trunk/qa/hudson-jbpm4-jboss.bat (rev 0)
+++ jbpm4/trunk/qa/hudson-jbpm4-jboss.bat 2009-05-02 08:22:17 UTC (rev 4692)
@@ -0,0 +1,10 @@
+
+set MAVEN_OPTS=-Xms1024M -Xmx1024M
+
+cmd /C mvn -U -Pdistro -Pschemadocs clean install
+
+cmd /C ant -f qa/build.xml integration.testrun.setup
+
+cmd /C mvn -U -Djboss.bind.address=localhost test
+
+cmd /C ant -f qa/build.xml integration.testrun.teardown
Copied: jbpm4/trunk/qa/hudson-jbpm4-jboss.sh (from rev 4691, jbpm4/trunk/qa/jbpm4-jboss.sh)
===================================================================
--- jbpm4/trunk/qa/hudson-jbpm4-jboss.sh (rev 0)
+++ jbpm4/trunk/qa/hudson-jbpm4-jboss.sh 2009-05-02 08:22:17 UTC (rev 4692)
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# runs the jboss integration test suite
+
+ANT_PROPERTIES="-Ddatabase=$DATABASE -Djboss.version=$JBOSS_VERSION -Djbpm.parent.dir=$WORKSPACE -Djboss.distro.dir=$SOURCE_REPO/jboss"
+
+echo ANT_PROPERTIES=${ANT_PROPERTIES}
+
+echo just in case the previous run didnt complete ok, we stop jboss
+ant -f modules/distro/src/main/files/jboss/build.xml $ANT_PROPERTIES stop.jboss
+
+mvn -U -Pdistro -Pschemadocs clean install
+
+ant -f qa/build.xml $ANT_PROPERTIES integration.testrun.setup
+
+mvn -U -Djboss.bind.address=localhost test
+
+ant -f qa/build.xml $ANT_PROPERTIES integration.testrun.teardown
Deleted: jbpm4/trunk/qa/jbpm4-jboss.bat
===================================================================
--- jbpm4/trunk/qa/jbpm4-jboss.bat 2009-05-01 14:59:52 UTC (rev 4691)
+++ jbpm4/trunk/qa/jbpm4-jboss.bat 2009-05-02 08:22:17 UTC (rev 4692)
@@ -1,10 +0,0 @@
-
-set MAVEN_OPTS=-Xms1024M -Xmx1024M
-
-cmd /C mvn -U -Pdistro -Pschemadocs clean install
-
-cmd /C ant -f qa/build.xml integration.testrun.setup
-
-cmd /C mvn -U -Djboss.bind.address=localhost test
-
-cmd /C ant -f qa/build.xml integration.testrun.teardown
Deleted: jbpm4/trunk/qa/jbpm4-jboss.sh
===================================================================
--- jbpm4/trunk/qa/jbpm4-jboss.sh 2009-05-01 14:59:52 UTC (rev 4691)
+++ jbpm4/trunk/qa/jbpm4-jboss.sh 2009-05-02 08:22:17 UTC (rev 4692)
@@ -1,18 +0,0 @@
-#!/bin/sh
-#
-# runs the jboss integration test suite
-
-ANT_PROPERTIES="-Ddatabase=$DATABASE -Djboss.version=$JBOSS_VERSION -Djbpm.parent.dir=$WORKSPACE -Djboss.distro.dir=$SOURCE_REPO/jboss"
-
-echo ANT_PROPERTIES=${ANT_PROPERTIES}
-
-echo just in case the previous run didnt complete ok, we stop jboss
-ant -f modules/distro/src/main/files/jboss/build.xml $ANT_PROPERTIES stop.jboss
-
-mvn -U -Pdistro -Pschemadocs clean install
-
-ant -f qa/build.xml $ANT_PROPERTIES integration.testrun.setup
-
-mvn -U -Djboss.bind.address=localhost test
-
-ant -f qa/build.xml $ANT_PROPERTIES integration.testrun.teardown
15 years
JBoss JBPM SVN: r4691 - in jbpm4/trunk: modules/distro/src/main/files/gpd and 2 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-05-01 10:59:52 -0400 (Fri, 01 May 2009)
New Revision: 4691
Added:
jbpm4/trunk/qa/manual.testrun.setup.bat
Removed:
jbpm4/trunk/qa/jbossremote/
jbpm4/trunk/qa/test.distribution.bat
Modified:
jbpm4/trunk/modules/distro/src/main/files/examples/build.xml
jbpm4/trunk/modules/distro/src/main/files/gpd/build.xml
jbpm4/trunk/modules/distro/src/main/files/jboss/build.xml
jbpm4/trunk/qa/build.xml
jbpm4/trunk/qa/jbpm4-jboss.sh
Log:
added script to support manual test runs
Modified: jbpm4/trunk/modules/distro/src/main/files/examples/build.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/examples/build.xml 2009-05-01 12:22:18 UTC (rev 4690)
+++ jbpm4/trunk/modules/distro/src/main/files/examples/build.xml 2009-05-01 14:59:52 UTC (rev 4691)
@@ -47,23 +47,24 @@
destdir="${jbpm.home}/examples/target/classes"
classpathref="jbpm.libs.incl.dependencies" />
<copy todir="${jbpm.home}/examples/target/classes">
- <fileset dir="src">
+ <fileset dir="${jbpm.home}/examples/src">
<exclude name="**/*.java" />
</fileset>
</copy>
- <copy tofile="${jbpm.home}/examples/target/classes/jbpm.hibernate.cfg.xml" overwrite="true">
+ <copy file="${jbpm.home}/db/hibernate.cfg/${database}.hibernate.cfg.xml"
+ tofile="${jbpm.home}/examples/target/classes/jbpm.hibernate.cfg.xml"
+ overwrite="true">
<filterset filtersfile="${jbpm.home}/db/jdbc/${database}.properties" />
- <fileset dir="${jbpm.home}/db/hibernate.cfg/${database}.hibernate.cfg.xml" />
</copy>
- <jar destfile="target/examples.bar">
- <fileset dir="src">
+ <jar destfile="${jbpm.home}/examples/target/examples.bar">
+ <fileset dir="${jbpm.home}/examples/src">
<include name="**/*.jpdl.xml" />
</fileset>
</jar>
<taskdef name="jbpm-deploy"
classname="org.jbpm.pvm.internal.ant.JbpmDeployTask"
classpathref="jbpm.libs.incl.dependencies" />
- <jbpm-deploy file="target/examples.bar" />
+ <jbpm-deploy file="${jbpm.home}/examples/target/examples.bar" />
</target>
</project>
Modified: jbpm4/trunk/modules/distro/src/main/files/gpd/build.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/gpd/build.xml 2009-05-01 12:22:18 UTC (rev 4690)
+++ jbpm4/trunk/modules/distro/src/main/files/gpd/build.xml 2009-05-01 14:59:52 UTC (rev 4691)
@@ -9,8 +9,8 @@
<property name="jbpm.parent.dir" value="../.." />
<property name="jbpm.version" value="4.0.0-SNAPSHOT" />
<property name="jbpm.home" value="${jbpm.parent.dir}/jbpm-${jbpm.version}" /> <!-- jbpm.home should not be configured. change jbpm.parent.dir instead -->
- <property name="eclipse.filename" value="eclipse-jee-ganymede-SR1-win32.zip" />
- <property name="eclipse.distro.url" value="http://todo/find/public/eclipse/distro/url" />
+ <property name="eclipse.filename" value="eclipse-jee-ganymede-SR2-win32.zip" />
+ <property name="eclipse.distro.url" value="http://mirror.cc.vt.edu/pub/eclipse/technology/epp/downloads/release/gany..." />
<property name="eclipse.distro.dir" value="${jbpm.home}/downloads" />
<!-- DERIVED PROPERTIES -->
Modified: jbpm4/trunk/modules/distro/src/main/files/jboss/build.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/jboss/build.xml 2009-05-01 12:22:18 UTC (rev 4690)
+++ jbpm4/trunk/modules/distro/src/main/files/jboss/build.xml 2009-05-01 14:59:52 UTC (rev 4691)
@@ -12,6 +12,8 @@
<property name="jbpm.home" value="${jbpm.parent.dir}/jbpm-${jbpm.version}" /> <!-- jbpm.home should not be configured. change jbpm.parent.dir instead -->
<property name="jboss.version" value="5.0.0.GA" />
<property name="jboss.distro.dir" value="${jbpm.home}/downloads" />
+ <property name="jboss.distro.filename" value="jboss-${jboss.version}.zip" />
+ <property name="jboss.distro.url" value="http://downloads.sourceforge.net/jboss/${jboss.distro.filename}" />
<property name="jboss.parent.dir" value="${jbpm.home}" />
<!-- DERIVED PROPERTIES -->
@@ -41,20 +43,29 @@
<equals arg1="${jboss.version}" arg2="5.0.0.GA" />
</condition>
- <!-- ### JBOSS INSTALLATION TARGETS ##################################### -->
+ <!-- ### REINSTALL JBOSS ################################################ -->
<target name="reinstall.jboss"
depends="log.properties, delete.jboss.installation, install.jboss"
description="re-installs jboss and then installs jbpm in there" />
+ <!-- ### DELETE JBOSS ################################################### -->
<target name="delete.jboss.installation" depends="log.properties">
<delete dir="${jboss.home}" />
</target>
- <target name="install.jboss" depends="log.properties">
+ <!-- ### INSTALL JBOSS ################################################## -->
+ <target name="install.jboss" depends="log.properties, get.jboss">
<unzip src="${jboss.distro.path}" dest="${jboss.home}/.." />
<chmod perm="a+x" file="${jboss.home}/bin/run.sh" os="Linux, Mac OS X" />
</target>
+ <!-- ### GET JBOSS ###################################################### -->
+ <condition property="is.jboss.distro.available">
+ <available file="${jboss.distro.path}" />
+ </condition>
+ <target name="get.jboss" unless="is.jboss.distro.available">
+ <get src="${jboss.distro.url}" dest="${jboss.distro.path}" />
+ </target>
<!-- ### MAIN TARGET TO INSTALL JBPM INTO JBOSS ######################### -->
<target name="install.jbpm.into.jboss" depends="log.properties" description="installs jBPM into JBoss">
Modified: jbpm4/trunk/qa/build.xml
===================================================================
--- jbpm4/trunk/qa/build.xml 2009-05-01 12:22:18 UTC (rev 4690)
+++ jbpm4/trunk/qa/build.xml 2009-05-01 14:59:52 UTC (rev 4691)
@@ -45,23 +45,23 @@
<ant antfile="${jbpm.home}/jboss/build.xml" target="install.jbpm.into.jboss" />
<ant antfile="${jbpm.home}/jboss/build.xml" target="start.jboss" />
<copy file="db/${database}.properties" tofile="${jbpm.home}/db/jdbc/${database}.properties" overwrite="true" />
- <ant antfile="${jbpm.home}/db/build.xml" target="create.jbpm.schema" inheritall="false">
- <property name="database" value="${database}" />
- <property name="jbpm.parent.dir" value="${jbpm.parent.dir}" />
- <property name="jboss.version" value="${jboss.version}" />
- <property name="jboss.distro.dir" value="${jboss.distro.dir}" />
- <property name="jboss.parent.dir" value="${jboss.parent.dir}" />
- </ant>
+ <ant antfile="${jbpm.home}/db/build.xml" target="create.jbpm.schema" />
</target>
<target name="integration.testrun.teardown">
- <ant antfile="${jbpm.home}/db/build.xml" target="drop.jbpm.schema" inheritall="false">
- <property name="database" value="${database}" />
- <property name="jbpm.parent.dir" value="${jbpm.parent.dir}" />
- <property name="jboss.version" value="${jboss.version}" />
- <property name="jboss.distro.dir" value="${jboss.distro.dir}" />
- <property name="jboss.parent.dir" value="${jboss.parent.dir}" />
- </ant>
+ <ant antfile="${jbpm.home}/db/build.xml" target="drop.jbpm.schema" />
<ant antfile="${jbpm.home}/jboss/build.xml" target="stop.jboss" />
</target>
+
+ <target name="manual.testrun.setup" depends="log.properties, integration.testrun.setup">
+ <ant antfile="${jbpm.home}/examples/build.xml" target="deploy.examples" />
+ <ant antfile="${jbpm.home}/db/build.xml" target="load.example.identities" />
+ <ant antfile="${jbpm.home}/gpd/build.xml" target="install.eclipse" />
+ <ant antfile="${jbpm.home}/gpd/build.xml" target="start.eclipse" />
+ </target>
+
+ <target name="manual.testrun.teardown" depends="log.properties">
+ <ant antfile="${jbpm.home}/jboss/build.xml" target="stop.jboss" />
+ </target>
+
</project>
Modified: jbpm4/trunk/qa/jbpm4-jboss.sh
===================================================================
--- jbpm4/trunk/qa/jbpm4-jboss.sh 2009-05-01 12:22:18 UTC (rev 4690)
+++ jbpm4/trunk/qa/jbpm4-jboss.sh 2009-05-01 14:59:52 UTC (rev 4691)
@@ -2,12 +2,9 @@
#
# runs the jboss integration test suite
-ANT_PROPERTIES="-Ddatabase=$DATABASE -Djboss.version=$JBOSS_VERSION -Dworkspace=$WORKSPACE -Djboss.distro.dir=$SOURCE_REPO/jboss"
+ANT_PROPERTIES="-Ddatabase=$DATABASE -Djboss.version=$JBOSS_VERSION -Djbpm.parent.dir=$WORKSPACE -Djboss.distro.dir=$SOURCE_REPO/jboss"
-echo database.......... $DATABASE
-echo jboss.version..... $JBOSS_VERSION
-echo workspace......... $WORKSPACE
-echo jboss.distro.dir.. $SOURCE_REPO/jboss
+echo ANT_PROPERTIES=${ANT_PROPERTIES}
echo just in case the previous run didnt complete ok, we stop jboss
ant -f modules/distro/src/main/files/jboss/build.xml $ANT_PROPERTIES stop.jboss
Copied: jbpm4/trunk/qa/manual.testrun.setup.bat (from rev 4690, jbpm4/trunk/qa/test.distribution.bat)
===================================================================
--- jbpm4/trunk/qa/manual.testrun.setup.bat (rev 0)
+++ jbpm4/trunk/qa/manual.testrun.setup.bat 2009-05-01 14:59:52 UTC (rev 4691)
@@ -0,0 +1,2 @@
+cmd /C mvn -Pdistro clean install
+cmd /C ant -f qa/build.xml manual.testrun.setup
Deleted: jbpm4/trunk/qa/test.distribution.bat
===================================================================
--- jbpm4/trunk/qa/test.distribution.bat 2009-05-01 12:22:18 UTC (rev 4690)
+++ jbpm4/trunk/qa/test.distribution.bat 2009-05-01 14:59:52 UTC (rev 4691)
@@ -1,2 +0,0 @@
-cmd /C mvn -Pdistro clean install
-cmd /C ant -f qa/build.xml integration.testrun.setup
15 years
JBoss JBPM SVN: r4690 - in jbpm4/trunk: modules/distro/src/main/files/db and 4 other directories.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-05-01 08:22:18 -0400 (Fri, 01 May 2009)
New Revision: 4690
Added:
jbpm4/trunk/modules/distro/src/main/files/gpd/
jbpm4/trunk/modules/distro/src/main/files/gpd/build.xml
Modified:
jbpm4/trunk/modules/distro/src/main/files/db/build.xml
jbpm4/trunk/modules/distro/src/main/files/examples/build.xml
jbpm4/trunk/modules/distro/src/main/files/jboss/build.xml
jbpm4/trunk/qa/build.xml
Log:
enabling build files for distribution usage
Modified: jbpm4/trunk/modules/distro/src/main/files/db/build.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/db/build.xml 2009-05-01 09:12:16 UTC (rev 4689)
+++ jbpm4/trunk/modules/distro/src/main/files/db/build.xml 2009-05-01 12:22:18 UTC (rev 4690)
@@ -5,14 +5,16 @@
<!-- DEVELOPER SPECIFIC CONFIGURATIONS -->
<property file="${user.home}/.jbpm4/build.properties" />
- <!-- DERIVED PROPERTIES -->
+ <!-- CONFIGURABLE PROPERTIES -->
<property name="database" value="hsqldb" />
+ <property name="jbpm.parent.dir" value="../.." />
<property name="jbpm.version" value="4.0.0-SNAPSHOT" />
- <property name="jbpm.filename" value="jbpm-distro-${jbpm.version}.zip" />
- <property name="jbpm.distro.path" value="../modules/distro/target/jbpm-${jbpm.version}.zip" />
- <property name="jbpm.home" value="${workspace}/jbpm-${jbpm.version}" />
+
+ <!-- DERIVED PROPERTIES -->
+ <property name="jbpm.home" value="${jbpm.parent.dir}/jbpm-${jbpm.version}" />
<!-- JDBC PROPERTIES -->
+ <property name="jbpm.home" value="${jbpm.parent.dir}/jbpm-${jbpm.version}" />
<property file="${jbpm.home}/db/jdbc/${database}.properties" />
@@ -28,7 +30,6 @@
<!-- ### CREATE JBPM SCHEMA ############################################# -->
<target name="create.jbpm.schema" depends="log.properties">
- <fail message="property 'workspace' not specified. workspace is the directory in which jbpm and jboss will be installed. specify -Dworkspace=... on the command line or add workspace=... in your ${user.home}/.jbpm4/build.properties" unless="workspace" />
<sql driver="${jdbc.driver}"
url="${jdbc.url}"
userid="${jdbc.username}"
@@ -45,7 +46,6 @@
<!-- ### DROP JBPM SCHEMA ############################################### -->
<target name="drop.jbpm.schema" depends="log.properties">
- <fail message="property 'workspace' not specified. workspace is the directory in which jbpm and jboss will be installed. specify -Dworkspace=... on the command line or add workspace=... in your ${user.home}/.jbpm4/build.properties" unless="workspace" />
<sql driver="${jdbc.driver}"
url="${jdbc.url}"
userid="${jdbc.username}"
@@ -79,7 +79,6 @@
<!-- ### START HSQLDB DATABASE MGR ##################################### -->
<target name="hsqldb.databasemanager">
- <fail message="property 'workspace' not specified. workspace is the directory in which jbpm and jboss will be installed. specify -Dworkspace=... on the command line or add workspace=... in your ${user.home}/.jbpm4/build.properties" unless="workspace" />
<java classname="org.hsqldb.util.DatabaseManager" fork="true">
<arg line="-url jdbc:hsqldb:hsql://localhost:1701"/>
<classpath>
Modified: jbpm4/trunk/modules/distro/src/main/files/examples/build.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/examples/build.xml 2009-05-01 09:12:16 UTC (rev 4689)
+++ jbpm4/trunk/modules/distro/src/main/files/examples/build.xml 2009-05-01 12:22:18 UTC (rev 4690)
@@ -5,21 +5,19 @@
<!-- DEVELOPER SPECIFIC CONFIGURATIONS -->
<property file="${user.home}/.jbpm4/build.properties" />
- <!-- DEVELOPER SPECIFIC CONFIGURATIONS -->
- <property file="${user.home}/.jbpm4/build.properties" />
-
- <!-- DERIVED PROPERTIES -->
+ <!-- CONFIGURABLE PROPERTIES -->
<property name="database" value="hsqldb" />
<property name="jbpm.version" value="4.0.0-SNAPSHOT" />
- <property name="jbpm.filename" value="jbpm-distro-${jbpm.version}.zip" />
- <property name="jbpm.distro.path" value="../modules/distro/target/jbpm-${jbpm.version}.zip" />
- <property name="jbpm.home" value="${workspace}/jbpm-${jbpm.version}" />
+ <property name="jbpm.filename" value="jbpm-${jbpm.version}.zip" />
<property name="jboss.version" value="5.0.0.GA" />
+
+ <!-- DERIVED PROPERTIES -->
+ <property name="jbpm.distro.dir" value="../modules/distro/target" />
+ <property name="jbpm.distro.path" value="${jbpm.distro.dir}/jbpm-${jbpm.version}.zip" />
+ <property name="jbpm.home" value="${workspace}/jbpm-${jbpm.version}" />
<property name="jboss.filename" value="jboss-${jboss.version}.zip" />
<property name="jboss.home" value="${workspace}/jboss-${jboss.version}" />
<property name="jboss.distro.path" value="${jboss.distro.dir}/${jboss.filename}" />
- <property name="jboss.server.configuration" value="default" />
- <property name="jboss.server.config.dir" value="${jboss.home}/server/${jboss.server.configuration}" />
<!-- JDBC PROPERTIES -->
<property file="${jbpm.home}/db/jdbc/${database}.properties" />
@@ -27,19 +25,11 @@
<!-- ### LOG PROPERTIES ################################################# -->
<target name="log.properties">
<echo message="database: ${database}" />
- <echo message="jdbc.driver: ${jdbc.driver}" />
- <echo message="jdbc.url: ${jdbc.url}" />
- <echo message="jdbc.username: ${jdbc.username}" />
- <echo message="jbpm.version: ${jbpm.version}" />
- <echo message="jbpm.filename: ${jbpm.filename}" />
- <echo message="jbpm.distro.path: ${jbpm.distro.path}" />
- <echo message="jbpm.home: ${jbpm.home}" />
- <echo message="jboss.version: ${jboss.version}" />
- <echo message="jboss.filename: ${jboss.filename}" />
- <echo message="jboss.distro.path: ${jboss.distro.path}" />
- <echo message="jboss.home: ${jboss.home}" />
- <echo message="jboss.server.configuration: ${jboss.server.configuration}" />
- <echo message="jboss.server.config.dir: ${jboss.server.config.dir}" />
+ <echo message="jdbc.driver........ ${jdbc.driver}" />
+ <echo message="jdbc.url........... ${jdbc.url}" />
+ <echo message="jdbc.username...... ${jdbc.username}" />
+ <echo message="jbpm.version....... ${jbpm.version}" />
+ <echo message="jbpm.home.......... ${jbpm.home}" />
</target>
<!-- ### DEPLOY EXAMPLE BUSINESS ARCHIVES ############################### -->
Added: jbpm4/trunk/modules/distro/src/main/files/gpd/build.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/gpd/build.xml (rev 0)
+++ jbpm4/trunk/modules/distro/src/main/files/gpd/build.xml 2009-05-01 12:22:18 UTC (rev 4690)
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<project name="jbpm.eclipse.install">
+
+ <!-- USER SPECIFIC CONFIGURATIONS -->
+ <property file="${user.home}/.jbpm4/build.properties" />
+
+ <!-- CONFIGURABLE PROPERTIES -->
+ <property name="jbpm.parent.dir" value="../.." />
+ <property name="jbpm.version" value="4.0.0-SNAPSHOT" />
+ <property name="jbpm.home" value="${jbpm.parent.dir}/jbpm-${jbpm.version}" /> <!-- jbpm.home should not be configured. change jbpm.parent.dir instead -->
+ <property name="eclipse.filename" value="eclipse-jee-ganymede-SR1-win32.zip" />
+ <property name="eclipse.distro.url" value="http://todo/find/public/eclipse/distro/url" />
+ <property name="eclipse.distro.dir" value="${jbpm.home}/downloads" />
+
+ <!-- DERIVED PROPERTIES -->
+ <property name="eclipse.parent.dir" value="${jbpm.home}" />
+ <property name="eclipse.distro.path" value="${eclipse.distro.dir}/${eclipse.filename}" />
+
+ <!-- ### LOG PROPERTIES ################################################# -->
+ <target name="log.properties">
+ <echo message="jbpm.version......... ${jbpm.version}" />
+ <echo message="jbpm.home............ ${jbpm.home}" />
+ <echo message="eclipse.distro.path.. ${eclipse.distro.path}" />
+ </target>
+
+ <!-- ### INSTALL ECLIPSE ################################################ -->
+ <target name="install.eclipse" depends="log.properties, get.eclipse">
+ <unzip src="${eclipse.distro.path}" dest="${jbpm.home}" />
+ </target>
+
+ <!-- ### GET ECLIPSE ##################################################### -->
+ <condition property="is.eclipse.distro.available">
+ <available file="${eclipse.distro.path}" />
+ </condition>
+ <target name="get.eclipse" unless="is.eclipse.distro.available">
+ <get src="${eclipse.distro.url}" dest="${eclipse.distro.path}" />
+ </target>
+
+ <!-- ### START ECLIPSE ################################################## -->
+ <target name="start.eclipse">
+ <exec executable="cmd" os="Windows Vista, Windows XP,Windows 2000,Windows 98">
+ <arg line="/C start "${jbpm.home}/eclipse/eclipse.exe" "-data" "${jbpm.home}/workspace"" />
+ </exec>
+ </target>
+
+</project>
Property changes on: jbpm4/trunk/modules/distro/src/main/files/gpd/build.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: jbpm4/trunk/modules/distro/src/main/files/jboss/build.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/jboss/build.xml 2009-05-01 09:12:16 UTC (rev 4689)
+++ jbpm4/trunk/modules/distro/src/main/files/jboss/build.xml 2009-05-01 12:22:18 UTC (rev 4690)
@@ -5,49 +5,41 @@
<!-- DEVELOPER SPECIFIC CONFIGURATIONS -->
<property file="${user.home}/.jbpm4/build.properties" />
- <!-- DEVELOPER SPECIFIC CONFIGURATIONS -->
- <property file="${user.home}/.jbpm4/build.properties" />
-
- <!-- DERIVED PROPERTIES -->
+ <!-- CONFIGURABLE PROPERTIES -->
<property name="database" value="hsqldb" />
<property name="jbpm.version" value="4.0.0-SNAPSHOT" />
- <property name="jbpm.filename" value="jbpm-distro-${jbpm.version}.zip" />
- <property name="jbpm.distro.path" value="../modules/distro/target/jbpm-${jbpm.version}.zip" />
- <property name="jbpm.home" value="${workspace}/jbpm-${jbpm.version}" />
+ <property name="jbpm.parent.dir" value="../.." />
+ <property name="jbpm.home" value="${jbpm.parent.dir}/jbpm-${jbpm.version}" /> <!-- jbpm.home should not be configured. change jbpm.parent.dir instead -->
<property name="jboss.version" value="5.0.0.GA" />
+ <property name="jboss.distro.dir" value="${jbpm.home}/downloads" />
+ <property name="jboss.parent.dir" value="${jbpm.home}" />
+
+ <!-- DERIVED PROPERTIES -->
<property name="jboss.filename" value="jboss-${jboss.version}.zip" />
- <property name="jboss.home" value="${workspace}/jboss-${jboss.version}" />
+ <property name="jboss.home" value="${jboss.parent.dir}/jboss-${jboss.version}" />
<property name="jboss.distro.path" value="${jboss.distro.dir}/${jboss.filename}" />
<property name="jboss.server.configuration" value="default" />
<property name="jboss.server.config.dir" value="${jboss.home}/server/${jboss.server.configuration}" />
-
+
<!-- JDBC PROPERTIES -->
<property file="${jbpm.home}/jdbc/${database}.properties" />
-
-
<!-- ### LOG PROPERTIES ################################################# -->
<target name="log.properties">
- <echo message="database: ${database}" />
- <echo message="jbpm.version: ${jbpm.version}" />
- <echo message="jbpm.filename: ${jbpm.filename}" />
- <echo message="jbpm.distro.path: ${jbpm.distro.path}" />
- <echo message="jbpm.home: ${jbpm.home}" />
- <echo message="jboss.version: ${jboss.version}" />
- <echo message="jboss.filename: ${jboss.filename}" />
- <echo message="jboss.distro.path: ${jboss.distro.path}" />
- <echo message="jboss.home: ${jboss.home}" />
- <echo message="jboss.server.configuration: ${jboss.server.configuration}" />
- <echo message="jboss.server.config.dir: ${jboss.server.config.dir}" />
+ <echo message="database.................... ${database}" />
+ <echo message="jbpm.home................... ${jbpm.home}" />
+ <echo message="jboss.version............... ${jboss.version}" />
+ <echo message="jboss.filename.............. ${jboss.filename}" />
+ <echo message="jboss.distro.path........... ${jboss.distro.path}" />
+ <echo message="jboss.home.................. ${jboss.home}" />
+ <echo message="jboss.server.configuration.. ${jboss.server.configuration}" />
+ <echo message="jboss.server.config.dir..... ${jboss.server.config.dir}" />
</target>
<!-- CONDITIONS -->
<condition property="jboss.version.500">
<equals arg1="${jboss.version}" arg2="5.0.0.GA" />
</condition>
- <condition property="database.hsqldb">
- <equals arg1="${database}" arg2="hsqldb" />
- </condition>
<!-- ### JBOSS INSTALLATION TARGETS ##################################### -->
<target name="reinstall.jboss"
@@ -59,8 +51,6 @@
</target>
<target name="install.jboss" depends="log.properties">
- <fail message="property 'jboss.distro.dir' not specified. jboss.distro.dir should point to a directory that contains the jboss distribution zip file(s). specify -Djboss.distro.dir=... on the command line or add jboss.distro.dir=... in your ${user.home}/.jbpm4/build.properties" unless="jboss.distro.dir" />
- <fail message="property 'workspace' not specified. workspace is the directory in which jbpm and jboss will be installed. specify -Dworkspace=... on the command line or add workspace=... in your ${user.home}/.jbpm4/build.properties" unless="workspace" />
<unzip src="${jboss.distro.path}" dest="${jboss.home}/.." />
<chmod perm="a+x" file="${jboss.home}/bin/run.sh" os="Linux, Mac OS X" />
</target>
@@ -75,8 +65,6 @@
<!-- ### THE JBOSS GENERIC PART ######################################### -->
<target name="internal.install.jbpm.into.jboss.common">
- <fail message="property 'workspace' not specified. workspace is the directory in which jbpm and jboss will be installed. specify -Dworkspace=... on the command line or add workspace=... in your ${user.home}/.jbpm4/build.properties" unless="workspace" />
-
<!-- copy static configuration files -->
<copy todir="${jboss.server.config.dir}" overwrite="true">
<fileset dir="${jbpm.home}/jboss/config.common" />
@@ -87,7 +75,15 @@
tofile="${jboss.server.config.dir}/deploy/jbpm/jbpm-service.sar/jbpm.hibernate.cfg.xml"
overwrite="true" />
-
+ <!-- copy the right datasource configuration file and replace the jdbc properties with
+ the values in the jdbc/${database}.properties file -->
+ <copy todir="${jboss.server.config.dir}/deploy/jbpm" overwrite="true">
+ <filterset filtersfile="${jbpm.home}/db/jdbc/${database}.properties" />
+ <fileset dir="${jbpm.home}/jboss/datasources">
+ <include name="jbpm-${database}-ds.xml"/>
+ </fileset>
+ </copy>
+
<copy todir="${jboss.server.config.dir}/lib" overwrite="true">
<fileset dir="${jbpm.home}">
<include name="jbpm.jar" />
@@ -146,22 +142,10 @@
</target>
<!-- ### THE HSQLDB SPECIFIC PART ####################################### -->
- <target name="internal.install.jbpm.into.jboss.db.hsqldb" if="database.hsqldb">
- <copy todir="${jboss.server.config.dir}/deploy/jbpm" overwrite="true">
- <fileset dir="${jbpm.home}/jboss/datasources">
- <include name="jbpm-hsqldb-ds.xml"/>
- </fileset>
- </copy>
- </target>
+ <target name="internal.install.jbpm.into.jboss.db.hsqldb" />
<!-- ### THE MYSQL SPECIFIC PART ####################################### -->
- <target name="internal.install.jbpm.into.jboss.db.mysql" if="database.mysql">
- <copy todir="${jboss.server.config.dir}/deploy/jbpm" overwrite="true">
- <fileset dir="${jbpm.home}/jboss/datasources">
- <!-- TODO define jdbc property filters -->
- <include name="jbpm-mysql-ds.xml"/>
- </fileset>
- </copy>
+ <target name="internal.install.jbpm.into.jboss.db.mysql">
<copy todir="${jboss.server.config.dir}/deploy/jbpm/jbpm-service.sar" overwrite="true">
<fileset dir="${jbpm.home}/lib">
<include name="mysql-connector-java.jar"/>
@@ -170,19 +154,11 @@
</target>
<!-- ### THE ORACLE SPECIFIC PART ####################################### -->
- <target name="internal.install.jbpm.into.jboss.db.oracle" if="database.oracle">
- <copy todir="${jboss.server.config.dir}/deploy/jbpm" overwrite="true">
- <!-- TODO define jdbc property filters -->
- <fileset dir="${jbpm.home}/jboss/datasources">
- <include name="jbpm-oracle-ds.xml"/>
- </fileset>
- </copy>
- </target>
+ <target name="internal.install.jbpm.into.jboss.db.oracle" />
<!-- ### START JBOSS ################################################### -->
- <target name="start.jboss" description="starts jboss and waits till jboss is booted, then lets jboss run in the background">
- <fail message="property 'workspace' not specified. workspace is the directory in which jbpm and jboss will be installed. specify -Dworkspace=... on the command line or add workspace=... in your ${user.home}/.jbpm4/build.properties" unless="workspace" />
+ <target name="start.jboss" depends="log.properties" description="starts jboss and waits till jboss is booted, then lets jboss run in the background">
<taskdef name="start-jboss"
classname="org.jbpm.pvm.internal.ant.StartJBossTask">
<classpath>
@@ -195,8 +171,7 @@
</target>
<!-- ### STOP JBOSS ################################################### -->
- <target name="stop.jboss" description="signals jboss to stop, but doesn't wait till its finished">
- <fail message="property 'workspace' not specified. workspace is the directory in which jbpm and jboss will be installed. specify -Dworkspace=... on the command line or add workspace=... in your ${user.home}/.jbpm4/build.properties" unless="workspace" />
+ <target name="stop.jboss" depends="log.properties" description="signals jboss to stop, but doesn't wait till its finished">
<exec executable="${jboss.home}/bin/shutdown.bat" os="Windows Vista, Windows XP,Windows 2000,Windows 98">
<arg line="-S"/>
</exec>
Modified: jbpm4/trunk/qa/build.xml
===================================================================
--- jbpm4/trunk/qa/build.xml 2009-05-01 09:12:16 UTC (rev 4689)
+++ jbpm4/trunk/qa/build.xml 2009-05-01 12:22:18 UTC (rev 4690)
@@ -4,43 +4,36 @@
<!-- DEVELOPER SPECIFIC CONFIGURATIONS -->
<property file="${user.home}/.jbpm4/build.properties" />
+
+ <fail message="property jbpm.parent.dir must be specified" unless="jbpm.parent.dir" />
- <!-- DERIVED PROPERTIES -->
+ <!-- CONFIGURABLE PROPERTIES -->
<property name="database" value="hsqldb" />
<property name="jbpm.version" value="4.0.0-SNAPSHOT" />
+ <property name="jbpm.home" value="${jbpm.parent.dir}/jbpm-${jbpm.version}" /> <!-- jbpm.home should not be configured. change jbpm.parent.dir instead -->
+ <property name="jboss.version" value="5.0.0.GA" />
+ <property name="jboss.distro.dir" value="${jbpm.home}/downloads" />
+ <property name="jboss.parent.dir" value="${jbpm.home}" />
+
+ <!-- DERIVED PROPERTIES -->
<property name="jbpm.filename" value="jbpm-distro-${jbpm.version}.zip" />
<property name="jbpm.distro.path" value="../modules/distro/target/jbpm-${jbpm.version}.zip" />
<property name="jbpm.home" value="${workspace}/jbpm-${jbpm.version}" />
- <property name="jboss.version" value="5.0.0.GA" />
- <property name="jboss.filename" value="jboss-${jboss.version}.zip" />
- <property name="jboss.home" value="${workspace}/jboss-${jboss.version}" />
- <property name="jboss.distro.path" value="${jboss.distro.dir}/${jboss.filename}" />
- <property name="jboss.server.configuration" value="default" />
- <property name="jboss.server.config.dir" value="${jboss.home}/server/${jboss.server.configuration}" />
<!-- ### LOG PROPERTIES ################################################# -->
<target name="log.properties">
- <echo message="database: ${database}" />
- <echo message="jbpm.version: ${jbpm.version}" />
- <echo message="jbpm.filename: ${jbpm.filename}" />
- <echo message="jbpm.distro.path: ${jbpm.distro.path}" />
- <echo message="jbpm.home: ${jbpm.home}" />
- <echo message="jboss.version: ${jboss.version}" />
- <echo message="jboss.filename: ${jboss.filename}" />
- <echo message="jboss.distro.path: ${jboss.distro.path}" />
- <echo message="jboss.home: ${jboss.home}" />
- <echo message="jboss.server.configuration: ${jboss.server.configuration}" />
- <echo message="jboss.server.config.dir: ${jboss.server.config.dir}" />
+ <echo message="database.......... ${database}" />
+ <echo message="jbpm.version...... ${jbpm.version}" />
+ <echo message="jbpm.home......... ${jbpm.home}" />
+ <echo message="jbpm.distro.path.. ${jbpm.distro.path}" />
</target>
<!-- TARGETS -->
<target name="delete.jbpm.installation">
- <fail message="property 'workspace' not specified. workspace is the directory in which jbpm and jboss will be installed. specify -Dworkspace=... on the command line or add workspace=... in your ${user.home}/.jbpm4/build.properties" unless="workspace" />
<delete dir="${jbpm.home}" />
</target>
<target name="install.jbpm">
- <fail message="property workspace not specified. specify -Dworkspace=... on the command line or add workspace=... in your ${user.home}/.jbpm4/build.properties" unless="workspace" />
<unzip src="${jbpm.distro.path}" dest="${jbpm.home}/.." />
</target>
@@ -52,11 +45,23 @@
<ant antfile="${jbpm.home}/jboss/build.xml" target="install.jbpm.into.jboss" />
<ant antfile="${jbpm.home}/jboss/build.xml" target="start.jboss" />
<copy file="db/${database}.properties" tofile="${jbpm.home}/db/jdbc/${database}.properties" overwrite="true" />
- <ant antfile="${jbpm.home}/db/build.xml" target="create.jbpm.schema" inheritall="false" />
+ <ant antfile="${jbpm.home}/db/build.xml" target="create.jbpm.schema" inheritall="false">
+ <property name="database" value="${database}" />
+ <property name="jbpm.parent.dir" value="${jbpm.parent.dir}" />
+ <property name="jboss.version" value="${jboss.version}" />
+ <property name="jboss.distro.dir" value="${jboss.distro.dir}" />
+ <property name="jboss.parent.dir" value="${jboss.parent.dir}" />
+ </ant>
</target>
<target name="integration.testrun.teardown">
- <ant antfile="${jbpm.home}/db/build.xml" target="drop.jbpm.schema" inheritall="false" />
+ <ant antfile="${jbpm.home}/db/build.xml" target="drop.jbpm.schema" inheritall="false">
+ <property name="database" value="${database}" />
+ <property name="jbpm.parent.dir" value="${jbpm.parent.dir}" />
+ <property name="jboss.version" value="${jboss.version}" />
+ <property name="jboss.distro.dir" value="${jboss.distro.dir}" />
+ <property name="jboss.parent.dir" value="${jboss.parent.dir}" />
+ </ant>
<ant antfile="${jbpm.home}/jboss/build.xml" target="stop.jboss" />
</target>
</project>
15 years
JBoss JBPM SVN: r4689 - in jbpm3/trunk/modules/core/src: main/java/org/jbpm/instantiation and 4 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-05-01 05:12:16 -0400 (Fri, 01 May 2009)
New Revision: 4689
Added:
jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/SharedProcessClassLoaderFactory.java
jbpm3/trunk/modules/core/src/test/java/org/jbpm/instantiation/ConfigurableClassLoadersTest.java
Removed:
jbpm3/trunk/modules/core/src/test/java/org/jbpm/instantiation/ConfigurableClassloadersTest.java
Modified:
jbpm3/trunk/modules/core/src/main/java/org/jbpm/JbpmConfiguration.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/DefaultProcessClassLoaderFactory.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/ProcessClassLoader.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/ProcessClassLoaderFactory.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/util/ClassLoaderUtil.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/util/XmlUtil.java
jbpm3/trunk/modules/core/src/main/resources/org/jbpm/default.jbpm.cfg.xml
jbpm3/trunk/modules/core/src/test/java/org/jbpm/jpdl/par/ProcessClassLoaderTest.java
Log:
[JBPM-2202] introduce ProcessClassLoaderFactory implementation that returns shared class loader per process definition
prevent ProcessClassLoader from keeping a reference to ProcessDefinition if the latter is persistent
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/JbpmConfiguration.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/JbpmConfiguration.java 2009-05-01 09:04:22 UTC (rev 4688)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/JbpmConfiguration.java 2009-05-01 09:12:16 UTC (rev 4689)
@@ -248,71 +248,64 @@
* </tr>
* </table>
*/
-public class JbpmConfiguration implements Serializable
-{
+public class JbpmConfiguration implements Serializable {
private static final long serialVersionUID = 1L;
static ObjectFactory defaultObjectFactory;
static final Map<String, JbpmConfiguration> instances = new HashMap<String, JbpmConfiguration>();
- static final ThreadLocal<List<JbpmConfiguration>> jbpmConfigurationStacks = new StackThreadLocal<JbpmConfiguration>();
+ static final ThreadLocal<List<JbpmConfiguration>> jbpmConfigurationStacks =
+ new StackThreadLocal<JbpmConfiguration>();
private final ObjectFactory objectFactory;
- private final ThreadLocal<List<JbpmContext>> jbpmContextStacks = new StackThreadLocal<JbpmContext>();
+ private final ThreadLocal<List<JbpmContext>> jbpmContextStacks =
+ new StackThreadLocal<JbpmContext>();
private JobExecutor jobExecutor;
private boolean isClosed;
- static class StackThreadLocal<E> extends ThreadLocal<List<E>>
- {
+ static class StackThreadLocal<E> extends ThreadLocal<List<E>> {
@Override
- protected List<E> initialValue()
- {
+ protected List<E> initialValue() {
return new ArrayList<E>();
}
}
- 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)
- {
- if (resource == null)
- {
+ public static JbpmConfiguration getInstance(String resource) {
+ if (resource == null) {
resource = "jbpm.cfg.xml";
}
JbpmConfiguration instance;
- synchronized (instances)
- {
+ synchronized (instances) {
// look for configuration in cache
instance = instances.get(resource);
- if (instance == null)
- {
+ if (instance == null) {
// configuration does not exist or was evicted, construct it
- if (defaultObjectFactory != null)
- {
- if(log.isDebugEnabled()){
- log.debug("creating configuration from default object factory: " + defaultObjectFactory);
+ if (defaultObjectFactory != null) {
+ if (log.isDebugEnabled()) {
+ log
+ .debug("creating configuration from default object factory: "
+ + defaultObjectFactory);
}
instance = new JbpmConfiguration(defaultObjectFactory);
}
- else
- {
+ else {
log.info("using configuration resource: " + resource);
- InputStream jbpmCfgXmlStream = ClassLoaderUtil.getJbpmConfigurationStream(resource);
+ InputStream jbpmCfgXmlStream = ClassLoaderUtil.getStream(resource, false);
/*
- * if a custom resource is specified, but not found in the classpath, log a warning; otherwise, users who want to load custom stuff will not receive any
- * feedback when their resource cannot be found
+ * if a custom resource is specified, but not found in the classpath, log a warning;
+ * otherwise, users who want to load custom stuff will not receive any feedback when their
+ * resource cannot be found
*/
- if (jbpmCfgXmlStream == null && !"jbpm.cfg.xml".equals(resource))
- {
+ if (jbpmCfgXmlStream == null && !"jbpm.cfg.xml".equals(resource)) {
log.warn("configuration resource '" + resource + "' could not be found");
}
ObjectFactory objectFactory = parseObjectFactory(jbpmCfgXmlStream);
@@ -325,20 +318,18 @@
return instance;
}
- public static boolean hasInstance(String resource)
- {
+ public static boolean hasInstance(String resource) {
return instances.containsKey(resource != null ? resource : "jbpm.cfg.xml");
}
- 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);
}
@@ -346,31 +337,26 @@
return objectFactoryImpl;
}
- 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);
// make the bean jbpm.configuration always available
- 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();
}
}
@@ -378,228 +364,184 @@
return jbpmConfiguration;
}
- private static boolean getHideStaleObjectExceptions(ObjectFactory objectFactory)
- {
- if (!objectFactory.hasObject("jbpm.hide.stale.object.exceptions"))
- return true;
+ 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 : true;
+ return object instanceof Boolean ? (Boolean) object : true;
}
- public static JbpmConfiguration parseInputStream(InputStream inputStream)
- {
+ public static JbpmConfiguration parseInputStream(InputStream inputStream) {
log.debug("creating jbpm configuration from input stream");
ObjectFactory objectFactory = parseObjectFactory(inputStream);
return createJbpmConfiguration(objectFactory);
}
- public static JbpmConfiguration parseResource(String resource)
- {
- if(log.isDebugEnabled()){
- log.debug("creating jbpm configuration from resource: " + resource);
+ public static JbpmConfiguration parseResource(String resource) {
+ if (log.isDebugEnabled()) {
+ log.debug("creating jbpm configuration from resource: " + resource);
}
InputStream inputStream = null;
- if (resource != null)
- {
- inputStream = ClassLoaderUtil.getJbpmConfigurationStream(resource);
+ if (resource != null) {
+ inputStream = ClassLoaderUtil.getStream(resource, false);
}
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)
- {
+ public JbpmContext createJbpmContext(String name) {
ensureOpen();
- JbpmContext jbpmContext = (JbpmContext)objectFactory.createObject(name);
+ JbpmContext jbpmContext = (JbpmContext) objectFactory.createObject(name);
jbpmContext.jbpmConfiguration = this;
jbpmContextCreated(jbpmContext);
return jbpmContext;
}
- private void ensureOpen()
- {
- if (isClosed)
- throw new JbpmException("configuration closed");
+ private void ensureOpen() {
+ if (isClosed) throw new JbpmException("configuration closed");
}
- 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)
- {
- ServiceFactory serviceFactory = null;
+ public ServiceFactory getServiceFactory(String serviceName, String jbpmContextName) {
JbpmContext jbpmContext = createJbpmContext(jbpmContextName);
- try
- {
- serviceFactory = jbpmContext.getServices().getServiceFactory(serviceName);
+ try {
+ return jbpmContext.getServices().getServiceFactory(serviceName);
}
- finally
- {
+ finally {
jbpmContext.close();
}
- return serviceFactory;
}
- public static ClassLoader getProcessClassLoader(ProcessDefinition processDefinition)
- {
- ProcessClassLoaderFactory factory = null;
- if (Configs.hasObject("jbpm.processClassLoader"))
- {
- factory = (ProcessClassLoaderFactory)Configs.getObject("jbpm.processClassLoader");
+ public static ClassLoader getProcessClassLoader(ProcessDefinition processDefinition) {
+ ProcessClassLoaderFactory factory;
+ if (Configs.hasObject("process.class.loader.factory")) {
+ factory = (ProcessClassLoaderFactory) Configs.getObject("process.class.loader.factory");
}
- else
- {
+ else {
factory = new DefaultProcessClassLoaderFactory();
}
return factory.getProcessClassLoader(processDefinition);
}
- /*
+ /**
* gives the jbpm domain model access to configuration information via the current JbpmContext.
*/
- public static class Configs
- {
+ public static class Configs {
- private Configs()
- {
+ private Configs() {
// hide default constructor to prevent instantiation
}
- 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) {
getPersistenceServiceFactory(jbpmContextName).cleanSchema();
}
- public void createSchema()
- {
+ public void createSchema() {
createSchema(JbpmContext.DEFAULT_JBPM_CONTEXT_NAME);
}
- public void createSchema(String jbpmContextName)
- {
+ public void createSchema(String jbpmContextName) {
getPersistenceServiceFactory(jbpmContextName).createSchema();
}
- public void dropSchema()
- {
+ public void dropSchema() {
dropSchema(JbpmContext.DEFAULT_JBPM_CONTEXT_NAME);
}
- public void dropSchema(String jbpmContextName)
- {
+ public void dropSchema(String jbpmContextName) {
getPersistenceServiceFactory(jbpmContextName).dropSchema();
}
- private DbPersistenceServiceFactory getPersistenceServiceFactory(String jbpmContextName)
- {
- return (DbPersistenceServiceFactory)getServiceFactory(Services.SERVICENAME_PERSISTENCE, jbpmContextName);
+ private DbPersistenceServiceFactory getPersistenceServiceFactory(String jbpmContextName) {
+ return (DbPersistenceServiceFactory) getServiceFactory(Services.SERVICENAME_PERSISTENCE,
+ jbpmContextName);
}
- public boolean isClosed()
- {
+ public boolean isClosed() {
return isClosed;
}
- public void close()
- {
+ public void close() {
close(JbpmContext.DEFAULT_JBPM_CONTEXT_NAME);
}
- public void close(String jbpmContextName)
- {
+ public void close(String jbpmContextName) {
// prevent configuration from being closed more than once
- if (isClosed)
- return;
+ if (isClosed) return;
// stop job executor
- if (jobExecutor != null)
- {
+ if (jobExecutor != null) {
jobExecutor.stop();
jobExecutor = null;
}
// close service factories
JbpmContext jbpmContext = createJbpmContext(jbpmContextName);
- try
- {
- Map<String, ServiceFactory> serviceFactories = jbpmContext.getServices().getServiceFactories();
- if (serviceFactories != null)
- {
- for (ServiceFactory serviceFactory : serviceFactories.values())
- {
+ try {
+ Map<String, ServiceFactory> serviceFactories =
+ jbpmContext.getServices().getServiceFactories();
+ if (serviceFactories != null) {
+ for (ServiceFactory serviceFactory : serviceFactories.values()) {
serviceFactory.close();
}
}
}
- finally
- {
+ finally {
jbpmContext.close();
}
@@ -610,12 +552,9 @@
jbpmContextStacks.remove();
// remove from configuration cache
- synchronized (instances)
- {
- for (java.util.Iterator<JbpmConfiguration> i = instances.values().iterator(); i.hasNext();)
- {
- if (this == i.next())
- {
+ synchronized (instances) {
+ for (java.util.Iterator<JbpmConfiguration> i = instances.values().iterator(); i.hasNext();) {
+ if (this == i.next()) {
i.remove();
break;
}
@@ -623,34 +562,26 @@
}
}
- static JbpmConfiguration getCurrentJbpmConfiguration()
- {
+ static JbpmConfiguration getCurrentJbpmConfiguration() {
JbpmConfiguration currentJbpmConfiguration = null;
List<JbpmConfiguration> stack = getJbpmConfigurationStack();
- if (!stack.isEmpty())
- {
+ if (!stack.isEmpty()) {
currentJbpmConfiguration = stack.get(stack.size() - 1);
}
return currentJbpmConfiguration;
}
- static List<JbpmConfiguration> getJbpmConfigurationStack()
- {
+ static List<JbpmConfiguration> getJbpmConfigurationStack() {
return jbpmConfigurationStacks.get();
}
- static void clearJbpmConfigurationStack()
- {
+ static void clearJbpmConfigurationStack() {
List<JbpmConfiguration> configStack = getJbpmConfigurationStack();
- if (configStack != null)
- {
- for (JbpmConfiguration config : new ArrayList<JbpmConfiguration>(configStack))
- {
+ if (configStack != null) {
+ for (JbpmConfiguration config : new ArrayList<JbpmConfiguration>(configStack)) {
List<JbpmContext> contextStack = config.getJbpmContextStack();
- if (contextStack != null)
- {
- for (JbpmContext context : new ArrayList<JbpmContext>(contextStack))
- {
+ if (contextStack != null) {
+ for (JbpmContext context : new ArrayList<JbpmContext>(contextStack)) {
context.close();
}
}
@@ -660,85 +591,72 @@
}
}
- synchronized void pushJbpmConfiguration()
- {
+ synchronized void pushJbpmConfiguration() {
getJbpmConfigurationStack().add(this);
}
- synchronized void popJbpmConfiguration()
- {
+ synchronized void popJbpmConfiguration() {
getJbpmConfigurationStack().remove(this);
}
- public JbpmContext getCurrentJbpmContext()
- {
+ public JbpmContext getCurrentJbpmContext() {
ensureOpen();
JbpmContext currentJbpmContext = null;
List<JbpmContext> stack = getJbpmContextStack();
- if (!stack.isEmpty())
- {
+ if (!stack.isEmpty()) {
currentJbpmContext = stack.get(stack.size() - 1);
}
return currentJbpmContext;
}
- List<JbpmContext> getJbpmContextStack()
- {
+ List<JbpmContext> getJbpmContextStack() {
return jbpmContextStacks.get();
}
- void pushJbpmContext(JbpmContext jbpmContext)
- {
+ void pushJbpmContext(JbpmContext jbpmContext) {
getJbpmContextStack().add(jbpmContext);
}
- void popJbpmContext(JbpmContext jbpmContext)
- {
+ void popJbpmContext(JbpmContext jbpmContext) {
List<JbpmContext> stack = getJbpmContextStack();
int size = stack.size();
- if (size == 0)
- {
- log.warn("closed JbpmContext more than once... " + "check your try-finally clauses around JbpmContext blocks");
+ if (size == 0) {
+ log.warn("closed JbpmContext more than once... "
+ + "check your try-finally clauses around JbpmContext blocks");
}
- else if (jbpmContext != stack.remove(size - 1))
- {
+ else if (jbpmContext != stack.remove(size - 1)) {
stack.remove(jbpmContext); // prevent context from remaining in the stack
- log.warn("closed JbpmContext in some order that differs from creation... " + "check your try-finally clauses around JbpmContext blocks");
+ log.warn("closed JbpmContext in some order that differs from creation... "
+ + "check your try-finally clauses around JbpmContext blocks");
}
}
- void jbpmContextCreated(JbpmContext jbpmContext)
- {
+ void jbpmContextCreated(JbpmContext jbpmContext) {
pushJbpmConfiguration();
pushJbpmContext(jbpmContext);
}
- void jbpmContextClosed(JbpmContext jbpmContext)
- {
+ void jbpmContextClosed(JbpmContext jbpmContext) {
popJbpmContext(jbpmContext);
popJbpmConfiguration();
}
- public void startJobExecutor()
- {
+ public void startJobExecutor() {
getJobExecutor().start();
}
- public synchronized JobExecutor getJobExecutor()
- {
+ public synchronized JobExecutor getJobExecutor() {
ensureOpen();
- if (jobExecutor == null)
- {
+ if (jobExecutor == null) {
Object object = objectFactory.createObject("jbpm.job.executor");
- if (object instanceof JobExecutor)
- {
- jobExecutor = (JobExecutor)object;
+ if (object instanceof JobExecutor) {
+ jobExecutor = (JobExecutor) object;
}
- else if (object != null)
- {
- throw new JbpmException("configuration object named 'jbpm.job.executor' is not a " + JobExecutor.class.getSimpleName());
+ else if (object != null) {
+ throw new JbpmException("configuration object named 'jbpm.job.executor' is not a "
+ + JobExecutor.class.getSimpleName());
}
}
return jobExecutor;
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/DefaultProcessClassLoaderFactory.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/DefaultProcessClassLoaderFactory.java 2009-05-01 09:04:22 UTC (rev 4688)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/DefaultProcessClassLoaderFactory.java 2009-05-01 09:12:16 UTC (rev 4689)
@@ -1,7 +1,5 @@
package org.jbpm.instantiation;
-import java.io.Serializable;
-
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.util.ClassLoaderUtil;
@@ -10,7 +8,7 @@
*
* @author bernd.ruecker(a)camunda.com
*/
-public class DefaultProcessClassLoaderFactory implements ProcessClassLoaderFactory, Serializable {
+public class DefaultProcessClassLoaderFactory implements ProcessClassLoaderFactory {
private static final long serialVersionUID = 1L;
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/ProcessClassLoader.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/ProcessClassLoader.java 2009-05-01 09:04:22 UTC (rev 4688)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/ProcessClassLoader.java 2009-05-01 09:12:16 UTC (rev 4689)
@@ -29,35 +29,53 @@
import java.net.URLConnection;
import java.net.URLStreamHandler;
+import org.jbpm.JbpmContext;
import org.jbpm.JbpmException;
import org.jbpm.file.def.FileDefinition;
import org.jbpm.graph.def.ProcessDefinition;
public class ProcessClassLoader extends ClassLoader {
- private ProcessDefinition processDefinition = null;
+ private ProcessDefinition processDefinition;
+ private long processDefinitionId;
public ProcessClassLoader(ClassLoader parent, ProcessDefinition processDefinition) {
super(parent);
- this.processDefinition = processDefinition;
+ // check whether the given process definition is transient
+ long id = processDefinition.getId();
+ if (id != 0) {
+ // persistent, keep id only
+ processDefinitionId = id;
+ }
+ else {
+ // transient, keep full object
+ this.processDefinition = processDefinition;
+ }
}
+ protected ProcessDefinition getProcessDefinition() {
+ return processDefinition != null ? processDefinition : JbpmContext.getCurrentJbpmContext()
+ .getGraphSession()
+ .loadProcessDefinition(processDefinitionId);
+ }
+
public URL findResource(String name) {
- URL url = null;
+ ProcessDefinition processDefinition = getProcessDefinition();
FileDefinition fileDefinition = processDefinition.getFileDefinition();
if (fileDefinition != null) {
- // if the name of the resources starts with a /
- if (name.startsWith("/")) {
- // then we start searching from the root of the process archive
+ // we know that the leading slashes are removed in the names of the
+ // file definitions, therefore we skip the leading slashes
+ int off = 0;
+ for (int len = name.length(); off < len && name.charAt(off) == '/'; off++)
+ /* just increase offset */;
- // we know that the leading slashes are removed in the names of the
- // file definitions, therefore we skip the leading slashes
- while (name.startsWith("/")) {
- name = name.substring(1);
- }
+ // if the name of the resources is absolute (starts with one or more slashes)
+ if (off > 0) {
+ // then start searching from the root of the process archive
+ name = name.substring(off);
}
else {
- // otherwise, (if the resource is relative), we look in the classes
+ // otherwise (if the resource is relative), look in the classes
// directory in the process archive
name = "classes/" + name;
}
@@ -68,7 +86,7 @@
}
if (bytes != null) {
try {
- url = new URL(null, "processresource://"
+ return new URL(null, "processresource://"
+ processDefinition.getName()
+ "/classes/"
+ name, new BytesUrlStreamHandler(bytes));
@@ -78,7 +96,7 @@
}
}
}
- return url;
+ return null;
}
public static class BytesUrlStreamHandler extends URLStreamHandler {
@@ -110,7 +128,7 @@
}
public Class<?> findClass(String className) throws ClassNotFoundException {
- FileDefinition fileDefinition = processDefinition.getFileDefinition();
+ FileDefinition fileDefinition = getProcessDefinition().getFileDefinition();
if (fileDefinition != null) {
String fileName = "classes/" + className.replace('.', '/') + ".class";
byte[] classBytes = fileDefinition.getBytes(fileName);
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/ProcessClassLoaderFactory.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/ProcessClassLoaderFactory.java 2009-05-01 09:04:22 UTC (rev 4688)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/ProcessClassLoaderFactory.java 2009-05-01 09:12:16 UTC (rev 4689)
@@ -1,21 +1,31 @@
package org.jbpm.instantiation;
+import java.io.Serializable;
+
+import org.jbpm.JbpmConfiguration;
import org.jbpm.graph.def.ProcessDefinition;
/**
- * Factory to retrieve the Process{@link ClassLoader} which is then used
- * to load delegation classes used by the process.
+ * <p>
+ * Factory to retrieve the Process {@link ClassLoader} which is then used to load delegation classes
+ * used by the process.
+ * </p>
+ * <p>
+ * Default is the build in {@link ProcessClassLoader}, which tries to load the classes from the jBPM
+ * database first.
+ * </p>
+ * <p>
+ * Can be configured by setting the property <code>jbpm.process.class.loader</code> in the
+ * configuration file to the class name of the custom class loader.
+ * </p>
+ * <p>
+ * Implementations should be serializable, as the {@link JbpmConfiguration} that references them is.
+ * </p>
*
- * Default is the build in {@link ProcessClassLoader}, which
- * tries to load the classes from the jbpm database first.
- *
- * Can be configured by setting the property <b>'jbpm.processClassLoader'</b>
- * in the jbpm.cfg.xml to the class name of the custom class loader.
- *
* @author bernd.ruecker(a)camunda.com
*/
-public interface ProcessClassLoaderFactory {
+public interface ProcessClassLoaderFactory extends Serializable {
public ClassLoader getProcessClassLoader(ProcessDefinition processDefinition);
-
+
}
\ No newline at end of file
Added: jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/SharedProcessClassLoaderFactory.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/SharedProcessClassLoaderFactory.java (rev 0)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/SharedProcessClassLoaderFactory.java 2009-05-01 09:12:16 UTC (rev 4689)
@@ -0,0 +1,66 @@
+/*
+ * 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.instantiation;
+
+import java.lang.ref.WeakReference;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.util.ClassLoaderUtil;
+
+/**
+ * Refined process class loader factory that maintains a cache of the class loaders it returns. The
+ * cache does not prevent class loaders from being discarded by the garbage collector.
+ *
+ * @author Alejandro Guizar
+ */
+public class SharedProcessClassLoaderFactory implements ProcessClassLoaderFactory {
+
+ private transient Map<Long, WeakReference<ProcessClassLoader>> classLoaderRefs =
+ new HashMap<Long, WeakReference<ProcessClassLoader>>();
+
+ private static final long serialVersionUID = 1L;
+
+ public ClassLoader getProcessClassLoader(ProcessDefinition processDefinition) {
+ // determine the key to lookup a cached class loader
+ long id = processDefinition.getId();
+ // observe that the given process definition may be transient
+ Long key = id != 0 ? id : processDefinition.hashCode();
+
+ synchronized (classLoaderRefs) {
+ // lookup the class loader reference
+ WeakReference<ProcessClassLoader> classLoaderRef = classLoaderRefs.get(key);
+ ProcessClassLoader classLoader;
+ // the reference may not exist or may have been cleared already
+ if (classLoaderRef == null || (classLoader = classLoaderRef.get()) == null) {
+ // (re-)create the class loader and the reference
+ classLoader = new ProcessClassLoader(ClassLoaderUtil.getClassLoader(), processDefinition);
+ classLoaderRef = new WeakReference<ProcessClassLoader>(classLoader);
+ // cache the reference
+ classLoaderRefs.put(key, classLoaderRef);
+ }
+ return classLoader;
+ }
+ }
+
+}
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/util/ClassLoaderUtil.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/util/ClassLoaderUtil.java 2009-05-01 09:04:22 UTC (rev 4688)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/util/ClassLoaderUtil.java 2009-05-01 09:12:16 UTC (rev 4689)
@@ -31,131 +31,101 @@
/**
* provides centralized classloader lookup.
*/
-public class ClassLoaderUtil
-{
+public class ClassLoaderUtil {
- private ClassLoaderUtil()
- {
+ private ClassLoaderUtil() {
// hide default constructor to prevent instantiation
}
/**
- * Bad usage of ClassLoader.loadClass() under JDK 6
- * https://jira.jboss.org/jira/browse/JBPM-1976
+ * Bad usage of ClassLoader.loadClass() under JDK 6.
*
- * @deprecated Use ClassLoaderUtil.classForName
+ * @deprecated Use {@linkplain #classForName(String) classForName()} instead
+ * @see <a href="https://jira.jboss.org/jira/browse/JBPM-1976">JBPM-1976</a>
*/
- public static Class<?> loadClass(String className)
- {
- try
- {
+ public static Class<?> loadClass(String className) {
+ try {
return getClassLoader().loadClass(className);
}
- catch (ClassNotFoundException e)
- {
+ catch (ClassNotFoundException e) {
throw new JbpmException("class not found '" + className + "'", e);
}
}
- public static Class<?> classForName(String className)
- {
- try
- {
- return Class.forName(className, false, getClassLoader());
+ public static Class<?> classForName(String className) {
+ try {
+ return Class.forName(className, true, getClassLoader());
}
- catch (ClassNotFoundException e)
- {
+ catch (ClassNotFoundException e) {
throw new JbpmException("class not found '" + className + "'", e);
}
}
+ public static Class<?> classForName(String className, boolean useConfiguredLoader) {
+ if (useConfiguredLoader) return classForName(className);
+
+ // try context class loader first, so that applications can override provided classes
+ try {
+ return Class.forName(className, true, Thread.currentThread().getContextClassLoader());
+ }
+ catch (ClassNotFoundException e) {
+ // try the class loader of the current class
+ try {
+ return Class.forName(className);
+ }
+ catch (ClassNotFoundException e2) {
+ // give up
+ throw new JbpmException("class not found '" + className + "'", e);
+ }
+ }
+ }
+
/**
- * returns the {@link ClassLoader} which is used in jbpm. Can be configured in jbpm.cfg.xml by the
- * property <code>jbpm.classLoader</code>.
+ * Returns the {@link ClassLoader} employed by jBPM to load classes referenced in the
+ * configuration. The class loader can be changed in <code>jbpm.cfg.xml</code> by setting the
+ * string property <code>jbpm.class.loader</code>. The possible values are:
* <ul>
- * <li><code>jbpm</code> (default) uses the {@link ClassLoaderUtil#getClassLoader()}. This
- * was the only behavior available before <a
- * href="https://jira.jboss.org/jira/browse/JBPM-1148">JBPM-1148</a>.</li>
- * <li><code>context</code> uses the {@link Thread#getContextClassLoader()}.</li>
- * <li><code>custom</code> means that a ClassLoader class has to be provided in the property
- * <code>jbpm.classLoader.className</code></li>
+ * <li><code>jbpm</code> (default) indicates the class loader of the jBPM classes. Before <a
+ * href="https://jira.jboss.org/jira/browse/JBPM-1148">JBPM-1148</a> no other behavior was
+ * available</li>
+ * <li><code>context</code> indicates the {@linkplain Thread#getContextClassLoader() context class
+ * loader}</li>
+ * <li>any other value is interpreted as a reference to a class loader bean described in the
+ * configuration</li>
* </ul>
*/
- public static ClassLoader getClassLoader()
- {
- if (JbpmConfiguration.Configs.hasObject("jbpm.classLoader"))
- {
- String jbpmClassloader = JbpmConfiguration.Configs.getString("jbpm.classLoader");
+ public static ClassLoader getClassLoader() {
+ if (JbpmConfiguration.Configs.hasObject("jbpm.class.loader")) {
+ String jbpmClassLoader = JbpmConfiguration.Configs.getString("jbpm.class.loader");
- if (jbpmClassloader.equals("jbpm"))
- {
+ if (jbpmClassLoader.equals("jbpm")) {
+ // use class loader that loaded the jbpm classes
return ClassLoaderUtil.class.getClassLoader();
}
- else if (jbpmClassloader.equals("context"))
- {
+
+ if (jbpmClassLoader.equals("context")) {
+ // use the context class loader
return Thread.currentThread().getContextClassLoader();
}
- else if (jbpmClassloader.equals("custom"))
- {
- String classloaderClassname = null;
- try
- {
- if (!JbpmConfiguration.Configs.hasObject("jbpm.customClassLoader.className"))
- {
- throw new JbpmException(
- "'jbpm.classLoader' property set to 'custom' but 'jbpm.customClassLoader.className' is absent!");
- }
- classloaderClassname = JbpmConfiguration.Configs
- .getString("jbpm.customClassLoader.className");
- if (classloaderClassname == null)
- {
- throw new JbpmException(
- "'jbpm.classloader' property set to 'custom' but 'jbpm.customClassLoader.className' is null!");
- }
- Class<?> clazz = Class.forName(classloaderClassname, false, ClassLoaderUtil.class.getClassLoader());
- if (clazz == null) {
- clazz = Class.forName(classloaderClassname, false, Thread.currentThread().getContextClassLoader());
- }
-
- return (ClassLoader) clazz.newInstance();
- }
- catch (InstantiationException e)
- {
- throw new JbpmException("Error instantiating custom classloader "
- + classloaderClassname, e);
- }
- catch (IllegalAccessException e)
- {
- throw new JbpmException("Error accessing custom classloader " + classloaderClassname,
- e);
- }
- catch (ClassNotFoundException e)
- {
- throw new JbpmException("Custom classloader " + classloaderClassname + " not found ",
- e);
- }
+ // interpret value as a reference to a class loader bean
+ Object bean = JbpmConfiguration.Configs.getObject(jbpmClassLoader);
+ if (!(bean instanceof ClassLoader)) {
+ throw new JbpmException("bean '" + jbpmClassLoader + "' is not a class loader");
}
- else
- {
- throw new JbpmException("'jbpm.classloader' property set to '"
- + jbpmClassloader
- + "' but only the values 'jbpm'/'context'/'custom' are supported!");
- }
+ return (ClassLoader) bean;
}
- else
- {
- // default behavior like before https://jira.jboss.org/jira/browse/JBPM-1148
+ else {
+ // behave like before JBPM-1148
return ClassLoaderUtil.class.getClassLoader();
}
}
- public static InputStream getStream(String resource)
- {
+ public static InputStream getStream(String resource) {
return getClassLoader().getResourceAsStream(resource);
}
- /*
+ /**
* Load jbpm configuration related resources as stream (normally jbpm.cfg.xml). This method first
* tries to load the resource from the {@link ClassLoaderUtil} class loader, if not found it tries
* the context class loader. If this doesn't return any ressource the call is delegated to the
@@ -163,28 +133,27 @@
* loader which has to be used for loading the jbpm.cfg.xml cannot be configured in the
* jbpm.cfg.xml itself.
*/
- public static InputStream getJbpmConfigurationStream(String resource)
- {
- InputStream jbpmCfgStream = ClassLoaderUtil.class.getClassLoader()
- .getResourceAsStream(resource);
- if (jbpmCfgStream == null)
- {
- jbpmCfgStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
+ public static InputStream getStream(String resource, boolean useConfiguredLoader) {
+ if (useConfiguredLoader) return getStream(resource);
+
+ // try context class loader first, so that applications can override provided classes
+ InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(
+ resource);
+ if (stream == null) {
+ // try the class loader of the current class
+ stream = ClassLoaderUtil.class.getClassLoader().getResourceAsStream(resource);
}
- return jbpmCfgStream;
+ return stream;
}
- public static Properties getProperties(String resource)
- {
+ public static Properties getProperties(String resource) {
Properties properties = new Properties();
- try
- {
+ try {
InputStream inStream = getStream(resource);
properties.load(inStream);
inStream.close();
}
- catch (IOException e)
- {
+ catch (IOException e) {
throw new JbpmException("couldn't load properties file '" + resource + "'", e);
}
return properties;
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/util/XmlUtil.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/util/XmlUtil.java 2009-05-01 09:04:22 UTC (rev 4688)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/util/XmlUtil.java 2009-05-01 09:12:16 UTC (rev 4689)
@@ -68,7 +68,7 @@
// configuration (see https://jira.jboss.org/jira/browse/JBPM-1148)
InputStream inputStream = null;
if (isJbpmConfiguration)
- inputStream = ClassLoaderUtil.getJbpmConfigurationStream(resource);
+ inputStream = ClassLoaderUtil.getStream(resource, false);
else
inputStream = ClassLoaderUtil.getStream(resource);
Modified: jbpm3/trunk/modules/core/src/main/resources/org/jbpm/default.jbpm.cfg.xml
===================================================================
--- jbpm3/trunk/modules/core/src/main/resources/org/jbpm/default.jbpm.cfg.xml 2009-05-01 09:04:22 UTC (rev 4688)
+++ jbpm3/trunk/modules/core/src/main/resources/org/jbpm/default.jbpm.cfg.xml 2009-05-01 09:12:16 UTC (rev 4689)
@@ -31,11 +31,8 @@
<string name="resource.mail.templates" value="jbpm.mail.templates.xml" />
<!-- class loading -->
- <!--
- <string name="jbpm.classLoader" value="jbpm" />
- <string name="jbpm.customClassLoader.className" value="org.example.ClassLoader" />
- <bean name="jbpm.processClassLoader" class="org.jbpm.instantiation.DefaultProcessClassLoaderFactory" singleton="true" />
- -->
+ <string name="jbpm.class.loader" value="context" />
+ <bean name="process.class.loader.factory" class="org.jbpm.instantiation.SharedProcessClassLoaderFactory" singleton="true" />
<!-- make sure the block size matches the length in ByteArray.hbm.xml -->
<int name="jbpm.byte.block.size" value="1024" singleton="true" />
Copied: jbpm3/trunk/modules/core/src/test/java/org/jbpm/instantiation/ConfigurableClassLoadersTest.java (from rev 4393, jbpm3/trunk/modules/core/src/test/java/org/jbpm/instantiation/ConfigurableClassloadersTest.java)
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/instantiation/ConfigurableClassLoadersTest.java (rev 0)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/instantiation/ConfigurableClassLoadersTest.java 2009-05-01 09:12:16 UTC (rev 4689)
@@ -0,0 +1,140 @@
+/*
+ * 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.instantiation;
+
+import org.jbpm.AbstractJbpmTestCase;
+import org.jbpm.JbpmConfiguration;
+import org.jbpm.JbpmContext;
+import org.jbpm.JbpmException;
+import org.jbpm.graph.def.ProcessDefinition;
+import org.jbpm.util.ClassLoaderUtil;
+
+/**
+ * {@link ProcessClassLoaderFactory} and class loader can be configured via
+ * {@link JbpmConfiguration} / jbpm.cfg.xml. Test if that works. Introduced with
+ * https://jira.jboss.org/jira/browse/JBPM-1148
+ *
+ * @author bernd.ruecker(a)camunda.com
+ */
+public class ConfigurableClassLoadersTest extends AbstractJbpmTestCase {
+
+ private ProcessDefinition processDefinition = new ProcessDefinition();
+
+ public void testDefaultProcessClassLoaderFactory() {
+ ClassLoader processClassLoader = JbpmConfiguration.getProcessClassLoader(processDefinition);
+ assertSame(ProcessClassLoader.class, processClassLoader.getClass());
+ }
+
+ public void testCustomProcessClassLoaderFactory() {
+ JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString("<jbpm-configuration>"
+ + " <bean name='process.class.loader.factory' class='"
+ + CustomProcessClassLoaderFactory.class.getName()
+ + "' singleton='true' />"
+ + "</jbpm-configuration>");
+ JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
+
+ ClassLoader processClassLoader = JbpmConfiguration.getProcessClassLoader(processDefinition);
+ assertSame(CustomClassLoader.class, processClassLoader.getClass());
+
+ jbpmContext.close();
+ jbpmConfiguration.close();
+ }
+
+ public static class CustomProcessClassLoaderFactory implements ProcessClassLoaderFactory {
+ private static final long serialVersionUID = 1L;
+ public ClassLoader getProcessClassLoader(ProcessDefinition processDefinition) {
+ return new CustomClassLoader();
+ }
+ }
+
+ public void testDefaultClassLoader() {
+ ClassLoader classLoader = ClassLoaderUtil.getClassLoader();
+ assertSame(ClassLoaderUtil.class.getClassLoader(), classLoader);
+ }
+
+ public void testJbpmClassLoader() {
+ JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString("<jbpm-configuration>"
+ + " <string name='jbpm.class.loader' value='jbpm' /> "
+ + "</jbpm-configuration>");
+ JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
+
+ ClassLoader classLoader = ClassLoaderUtil.getClassLoader();
+ assertSame(ClassLoaderUtil.class.getClassLoader(), classLoader);
+
+ jbpmContext.close();
+ jbpmConfiguration.close();
+ }
+
+ public void testContextClassLoader() {
+ JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString("<jbpm-configuration>"
+ + " <string name='jbpm.class.loader' value='context' /> "
+ + "</jbpm-configuration>");
+ JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
+
+ ClassLoader classLoader = ClassLoaderUtil.getClassLoader();
+ assertSame(Thread.currentThread().getContextClassLoader(), classLoader);
+
+ jbpmContext.close();
+ jbpmConfiguration.close();
+ }
+
+ public void testNonExistentClassLoader() {
+ JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString("<jbpm-configuration>"
+ + " <string name='jbpm.class.loader' value='absent' /> "
+ + "</jbpm-configuration>");
+ JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
+
+ try {
+ ClassLoaderUtil.getClassLoader();
+ fail("expected " + JbpmException.class.getName());
+ }
+ catch (JbpmException ex) {
+ // fine, exception was expected
+ }
+
+ jbpmContext.close();
+ jbpmConfiguration.close();
+ }
+
+ public void testCustomClassLoader() {
+ JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString("<jbpm-configuration>"
+ + " <string name='jbpm.class.loader' value='custom.class.loader' />"
+ + " <bean name='custom.class.loader' class='"
+ + CustomClassLoader.class.getName()
+ + "' /> "
+ + "</jbpm-configuration>");
+ JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
+
+ ClassLoader classLoader = ClassLoaderUtil.getClassLoader();
+ assertSame(CustomClassLoader.class, classLoader.getClass());
+
+ jbpmContext.close();
+ jbpmConfiguration.close();
+ }
+
+ public static class CustomClassLoader extends ClassLoader {
+ public CustomClassLoader() {
+ super(Thread.currentThread().getContextClassLoader());
+ }
+ }
+
+}
Deleted: jbpm3/trunk/modules/core/src/test/java/org/jbpm/instantiation/ConfigurableClassloadersTest.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/instantiation/ConfigurableClassloadersTest.java 2009-05-01 09:04:22 UTC (rev 4688)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/instantiation/ConfigurableClassloadersTest.java 2009-05-01 09:12:16 UTC (rev 4689)
@@ -1,135 +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.instantiation;
-
-import org.jbpm.AbstractJbpmTestCase;
-import org.jbpm.JbpmConfiguration;
-import org.jbpm.JbpmContext;
-import org.jbpm.graph.def.ProcessDefinition;
-
-/**
- * {@link ProcessClassLoaderFactory} and class loader can be configured
- * via {@link JbpmConfiguration} / jbpm.cfg.xml. Test if that works.
- *
- * Introduced with https://jira.jboss.org/jira/browse/JBPM-1148
- *
- * @author bernd.ruecker(a)camunda.com
- */
-public class ConfigurableClassloadersTest extends AbstractJbpmTestCase {
-
- public void testDefaultBehavior() {
- JbpmConfiguration.getInstance();
- ClassLoader processClassLoader = JbpmConfiguration.getProcessClassLoader(null);
-
- assertNotNull(processClassLoader);
- assertEquals(ProcessClassLoader.class, processClassLoader.getClass());
- }
-
- public static class MyClassLoader extends ClassLoader {
- public MyClassLoader() {
- }
- public MyClassLoader(ClassLoader parent) {
- super(parent);
- }
- }
-
- public static class TestProcessClassLoaderFactory implements ProcessClassLoaderFactory {
- public ClassLoader getProcessClassLoader(ProcessDefinition processDefinition) {
- return new MyClassLoader(Thread.currentThread().getContextClassLoader());
- }
- }
-
- public void testOwnProcessFactory() {
- JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString(
- "<jbpm-configuration>" +
- " <jbpm-context>" +
- " </jbpm-context>" +
- " <string name='jbpm.classLoader' value='jbpm' /> " +
- " <bean name='jbpm.processClassLoader' class='org.jbpm.instantiation.ConfigurableClassloadersTest$TestProcessClassLoaderFactory' singelton='true' />" +
- "</jbpm-configuration>"
- );
- JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
-
- ClassLoader processClassLoader = JbpmConfiguration.getProcessClassLoader(null);
- assertNotNull(processClassLoader);
- assertEquals(MyClassLoader.class, processClassLoader.getClass());
-
- jbpmContext.close();
- jbpmConfiguration.close();
- }
-
- public void testContextClassloaderFactory() {
- JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString(
- "<jbpm-configuration>" +
- " <jbpm-context>" +
- " </jbpm-context>" +
- " <string name='jbpm.classLoader' value='context' /> " +
- "</jbpm-configuration>"
- );
- JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
-
- assertNotNull(jbpmContext);
-
- jbpmContext.close();
- jbpmConfiguration.close();
- }
-
- public void testCustomClassloaderFactoryWithoutClassname() {
- JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString(
- "<jbpm-configuration>" +
- " <jbpm-context>" +
- " </jbpm-context>" +
- " <string name='jbpm.classLoader' value='custom' /> " +
- "</jbpm-configuration>"
- );
- JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
- try {
- ClassLoader processClassLoader = JbpmConfiguration.getProcessClassLoader(null);
- fail("we should get an exception because custom class loader class not specified");
- }
- catch (Exception ex) {}
-
- jbpmContext.close();
- jbpmConfiguration.close();
- }
-
- public void testCustomClassloaderFactory() {
- JbpmConfiguration jbpmConfiguration = JbpmConfiguration.parseXmlString(
- "<jbpm-configuration>" +
- " <jbpm-context>" +
- " </jbpm-context>" +
- " <string name='jbpm.classLoader' value='custom' /> " +
- " <string name='jbpm.customClassLoader.className' value='org.jbpm.instantiation.ConfigurableClassloadersTest$MyClassLoader' />" +
- "</jbpm-configuration>"
- );
- JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
-
- ClassLoader processClassLoader = JbpmConfiguration.getProcessClassLoader(null);
- assertNotNull(processClassLoader);
- // not configured, must be default
- assertEquals(ProcessClassLoader.class, processClassLoader.getClass());
-
- jbpmContext.close();
- jbpmConfiguration.close();
- }
-
-}
Modified: jbpm3/trunk/modules/core/src/test/java/org/jbpm/jpdl/par/ProcessClassLoaderTest.java
===================================================================
--- jbpm3/trunk/modules/core/src/test/java/org/jbpm/jpdl/par/ProcessClassLoaderTest.java 2009-05-01 09:04:22 UTC (rev 4688)
+++ jbpm3/trunk/modules/core/src/test/java/org/jbpm/jpdl/par/ProcessClassLoaderTest.java 2009-05-01 09:12:16 UTC (rev 4689)
@@ -7,14 +7,14 @@
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ExecutionContext;
import org.jbpm.graph.exe.ProcessInstance;
-import org.jbpm.instantiation.ConfigurableClassloadersTest;
+import org.jbpm.instantiation.ConfigurableClassLoadersTest;
import org.jbpm.instantiation.ProcessClassLoader;
import org.jbpm.util.ClassLoaderUtil;
/**
* Test case for ProcessClassLoader hierarchy and setting the ContextClassLoader correctly.
*
- * Relates to {@link ConfigurableClassloadersTest}.
+ * Relates to {@link ConfigurableClassLoadersTest}.
*
* @author Tom Baeyens, bernd.ruecker(a)camunda.com
*
15 years
JBoss JBPM SVN: r4688 - jbpm3/trunk/modules/simulation/src/main/java/org/jbpm/sim/def.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-05-01 05:04:22 -0400 (Fri, 01 May 2009)
New Revision: 4688
Modified:
jbpm3/trunk/modules/simulation/src/main/java/org/jbpm/sim/def/JbpmSimulationModel.java
Log:
[JBPM-2194] Allow clients to set the UserCodeInterceptor in the configuration file - simulation module
Modified: jbpm3/trunk/modules/simulation/src/main/java/org/jbpm/sim/def/JbpmSimulationModel.java
===================================================================
--- jbpm3/trunk/modules/simulation/src/main/java/org/jbpm/sim/def/JbpmSimulationModel.java 2009-05-01 08:50:05 UTC (rev 4687)
+++ jbpm3/trunk/modules/simulation/src/main/java/org/jbpm/sim/def/JbpmSimulationModel.java 2009-05-01 09:04:22 UTC (rev 4688)
@@ -148,7 +148,7 @@
super(owner, name, true, true);
// "install" the UserCode Intercepter (TODO: may not needed, delete then)
- UserCodeInterceptorConfig.userCodeInterceptor = new SimulationUserCodeInterceptor();
+ UserCodeInterceptorConfig.setUserCodeInterceptor(new SimulationUserCodeInterceptor());
// load special configuration for simulation run
// JbpmConfiguration.getInstance("org/jbpm/sim/simulation.cfg.xml");
15 years
JBoss JBPM SVN: r4687 - in jbpm3/trunk/modules/core/src/main/java/org/jbpm: instantiation and 2 other directories.
by do-not-reply@jboss.org
Author: alex.guizar(a)jboss.com
Date: 2009-05-01 04:50:05 -0400 (Fri, 01 May 2009)
New Revision: 4687
Modified:
jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/def/GraphElement.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/UserCodeInterceptorConfig.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/taskmgmt/def/TaskController.java
jbpm3/trunk/modules/core/src/main/java/org/jbpm/taskmgmt/exe/TaskMgmtInstance.java
Log:
[JBPM-2194] Allow clients to set the UserCodeInterceptor in the configuration file
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/def/GraphElement.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/def/GraphElement.java 2009-05-01 05:24:39 UTC (rev 4686)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/graph/def/GraphElement.java 2009-05-01 08:50:05 UTC (rev 4687)
@@ -281,8 +281,8 @@
token.lock(lockOwnerId);
}
- if (UserCodeInterceptorConfig.userCodeInterceptor != null) {
- UserCodeInterceptorConfig.userCodeInterceptor.executeAction(action, executionContext);
+ if (UserCodeInterceptorConfig.getUserCodeInterceptor() != null) {
+ UserCodeInterceptorConfig.getUserCodeInterceptor().executeAction(action, executionContext);
} else {
action.execute(executionContext);
}
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/UserCodeInterceptorConfig.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/UserCodeInterceptorConfig.java 2009-05-01 05:24:39 UTC (rev 4686)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/instantiation/UserCodeInterceptorConfig.java 2009-05-01 08:50:05 UTC (rev 4687)
@@ -1,9 +1,25 @@
package org.jbpm.instantiation;
-public abstract class UserCodeInterceptorConfig {
+import org.jbpm.JbpmConfiguration;
- public static UserCodeInterceptor userCodeInterceptor = null;
+public class UserCodeInterceptorConfig {
+ private static UserCodeInterceptor userCodeInterceptor;
+
+ private UserCodeInterceptorConfig() {
+ // hide default constructor to prevent instantiation
+ }
+
+ public static UserCodeInterceptor getUserCodeInterceptor() {
+ if (userCodeInterceptor != null) return userCodeInterceptor;
+
+ if (JbpmConfiguration.Configs.hasObject("jbpm.user.code.interceptor")) {
+ return (UserCodeInterceptor) JbpmConfiguration.Configs.getObject("jbpm.user.code.interceptor");
+ }
+
+ return null;
+ }
+
public static void setUserCodeInterceptor(UserCodeInterceptor interceptor) {
userCodeInterceptor = interceptor;
}
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/taskmgmt/def/TaskController.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/taskmgmt/def/TaskController.java 2009-05-01 05:24:39 UTC (rev 4686)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/taskmgmt/def/TaskController.java 2009-05-01 08:50:05 UTC (rev 4687)
@@ -81,8 +81,8 @@
ContextInstance contextInstance = (processInstance != null ? processInstance.getContextInstance() : null);
Token token = taskInstance.getToken();
- if (UserCodeInterceptorConfig.userCodeInterceptor != null) {
- UserCodeInterceptorConfig.userCodeInterceptor.executeTaskControllerInitialization(taskControllerHandler, taskInstance, contextInstance, token);
+ if (UserCodeInterceptorConfig.getUserCodeInterceptor() != null) {
+ UserCodeInterceptorConfig.getUserCodeInterceptor().executeTaskControllerInitialization(taskControllerHandler, taskInstance, contextInstance, token);
} else {
taskControllerHandler.initializeTaskVariables(taskInstance, contextInstance, token);
}
@@ -131,8 +131,8 @@
ContextInstance contextInstance = (processInstance != null ? processInstance.getContextInstance() : null);
Token token = taskInstance.getToken();
- if (UserCodeInterceptorConfig.userCodeInterceptor != null) {
- UserCodeInterceptorConfig.userCodeInterceptor.executeTaskControllerSubmission(taskControllerHandler, taskInstance, contextInstance, token);
+ if (UserCodeInterceptorConfig.getUserCodeInterceptor() != null) {
+ UserCodeInterceptorConfig.getUserCodeInterceptor().executeTaskControllerSubmission(taskControllerHandler, taskInstance, contextInstance, token);
} else {
taskControllerHandler.submitTaskVariables(taskInstance, contextInstance, token);
}
Modified: jbpm3/trunk/modules/core/src/main/java/org/jbpm/taskmgmt/exe/TaskMgmtInstance.java
===================================================================
--- jbpm3/trunk/modules/core/src/main/java/org/jbpm/taskmgmt/exe/TaskMgmtInstance.java 2009-05-01 05:24:39 UTC (rev 4686)
+++ jbpm3/trunk/modules/core/src/main/java/org/jbpm/taskmgmt/exe/TaskMgmtInstance.java 2009-05-01 08:50:05 UTC (rev 4687)
@@ -304,9 +304,9 @@
// instantiate the assignment handler
AssignmentHandler assignmentHandler = (AssignmentHandler)assignmentDelegation.instantiate();
// invoke the assignment handler
- if (UserCodeInterceptorConfig.userCodeInterceptor != null)
+ if (UserCodeInterceptorConfig.getUserCodeInterceptor() != null)
{
- UserCodeInterceptorConfig.userCodeInterceptor.executeAssignment(assignmentHandler, assignable, executionContext);
+ UserCodeInterceptorConfig.getUserCodeInterceptor().executeAssignment(assignmentHandler, assignable, executionContext);
}
else
{
15 years
JBoss JBPM SVN: r4686 - in jbpm4/trunk/modules/distro/src/main/files: examples and 1 other directory.
by do-not-reply@jboss.org
Author: tom.baeyens(a)jboss.com
Date: 2009-05-01 01:24:39 -0400 (Fri, 01 May 2009)
New Revision: 4686
Modified:
jbpm4/trunk/modules/distro/src/main/files/db/build.xml
jbpm4/trunk/modules/distro/src/main/files/examples/build.xml
Log:
JBPM-2176, JBPM-2170 fixed jdbc properties location
Modified: jbpm4/trunk/modules/distro/src/main/files/db/build.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/db/build.xml 2009-04-30 17:46:29 UTC (rev 4685)
+++ jbpm4/trunk/modules/distro/src/main/files/db/build.xml 2009-05-01 05:24:39 UTC (rev 4686)
@@ -13,7 +13,7 @@
<property name="jbpm.home" value="${workspace}/jbpm-${jbpm.version}" />
<!-- JDBC PROPERTIES -->
- <property file="${jbpm.home}/jdbc/${database}.properties" />
+ <property file="${jbpm.home}/db/jdbc/${database}.properties" />
<!-- ### LOG PROPERTIES ################################################# -->
Modified: jbpm4/trunk/modules/distro/src/main/files/examples/build.xml
===================================================================
--- jbpm4/trunk/modules/distro/src/main/files/examples/build.xml 2009-04-30 17:46:29 UTC (rev 4685)
+++ jbpm4/trunk/modules/distro/src/main/files/examples/build.xml 2009-05-01 05:24:39 UTC (rev 4686)
@@ -22,7 +22,7 @@
<property name="jboss.server.config.dir" value="${jboss.home}/server/${jboss.server.configuration}" />
<!-- JDBC PROPERTIES -->
- <property file="${jbpm.home}/jdbc/${database}.properties" />
+ <property file="${jbpm.home}/db/jdbc/${database}.properties" />
<!-- ### LOG PROPERTIES ################################################# -->
<target name="log.properties">
15 years