Web Application – Plataforma J2EE

Desarrollo de aplicaciones web bajo entornos Java, frameworks de desarrollo J2EE

  • febrero 2011
    L M X J V S D
     123456
    78910111213
    14151617181920
    21222324252627
    28  

Archive for febrero 2011

Configuración de BD con JBPM5 (Postgres)

Posted by Wilman Chamba Z. en febrero 22, 2011

El instalador de JBPM5 viene con un demo, y  por defecto una base de datos H2. El cual es una BD en memoria confiable para hacer pruebas pequeñas, la presente existen una explicación de como cambiar esa configuración del instalador realizando lo siguiente:

  • En el directorio de db/ del jbpm instaler crear y/o agregar los siguientes archivos con la configuración siguiente:

File: jbpm-human-task-persistence.xml

<?xml version=»1.0″ encoding=»UTF-8″ standalone=»yes»?>

<persistence version=»1.0″

xsi:schemaLocation=»http://java.sun.com/xml/ns/persistence

http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd

http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd«

xmlns:orm=»http://java.sun.com/xml/ns/persistence/orm«

xmlns:xsi=»http://www.w3.org/2001/XMLSchema-instance«

xmlns=»http://java.sun.com/xml/ns/persistence«>

<persistence-unit name=»org.jbpm.task»>

<provider>org.hibernate.ejb.HibernatePersistence</provider>

<class>org.jbpm.task.Attachment</class>

<class>org.jbpm.task.Content</class>

<class>org.jbpm.task.BooleanExpression</class>

<class>org.jbpm.task.Comment</class>

<class>org.jbpm.task.Deadline</class>

<class>org.jbpm.task.Comment</class>

<class>org.jbpm.task.Deadline</class>

<class>org.jbpm.task.Delegation</class>

<class>org.jbpm.task.Escalation</class>

<class>org.jbpm.task.Group</class>

<class>org.jbpm.task.I18NText</class>

<class>org.jbpm.task.Notification</class>

<class>org.jbpm.task.EmailNotification</class>

<class>org.jbpm.task.EmailNotificationHeader</class>

<class>org.jbpm.task.PeopleAssignments</class>

<class>org.jbpm.task.Reassignment</class>

<class>org.jbpm.task.Status</class>

<class>org.jbpm.task.Task</class>

<class>org.jbpm.task.TaskData</class>

<class>org.jbpm.task.SubTasksStrategy</class>

<class>org.jbpm.task.OnParentAbortAllSubTasksEndStrategy</class>

<class>org.jbpm.task.OnAllSubTasksEndParentEndStrategy</class>

<class>org.jbpm.task.User</class>

<properties>

<property name=»hibernate.dialect» value=»org.hibernate.dialect.PostgreSQLDialect»/>

<property name=»hibernate.connection.driver_class» value=»org.postgresql.Driver»/>

<property name=»hibernate.connection.url» value=»jdbc:postgresql://localhost/jbpm5″ />

<property name=»hibernate.connection.username» value=»postgres»/>

<property name=»hibernate.connection.password» value=»pwd»/>

<property name=»hibernate.connection.autocommit» value=»false» />

<property name=»hibernate.max_fetch_depth» value=»3″/>

<property name=»hibernate.hbm2ddl.auto» value=»update» />

<property name=»hibernate.show_sql» value=»false» />

</properties>

</persistence-unit>

</persistence>

+++++++++++++++++++++++++++++++++++++

File: jbpm-bam-hibernate.cfg.xml

+++++++++++++++++++++++++++++++++++++

<?xml version=’1.0′ encoding=’utf-8′?>

<!DOCTYPE hibernate-configuration PUBLIC

«-//Hibernate/Hibernate Configuration DTD 3.0//EN»

«http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd«>

<hibernate-configuration>

<session-factory>

<!– Database connection settings –>

<property name=»connection.driver_class»>org.postgresql.Driver</property>

<property name=»connection.url»>jdbc:postgresql://localhost/jbpm5</property>

<property name=»connection.username»>postgres</property>

<property name=»connection.password»>pwd</property>

<!– JDBC connection pool (use the built-in) –>

<property name=»connection.pool_size»>5</property>

<!– SQL dialect –>

<property name=»dialect»>org.hibernate.dialect.PostgreSQLDialect</property>

<!– Enable Hibernate’s automatic session context management –>

<property name=»current_session_context_class»>thread</property>

<!– Disable the second-level cache  –>

<property name=»cache.provider_class»>org.hibernate.cache.NoCacheProvider</property>

<!– Echo all executed SQL to stdout –>

<property name=»show_sql»>false</property>

<!– Drop and re-create the database schema on startup, update not drop–>

<property name=»hbm2ddl.auto»>update</property>

<mapping resource=»AuditLog.hbm.xml»/>

</session-factory>

</hibernate-configuration>

+++++++++++++++++++++++++++++++++++++

Estos archivos nos servirán para modificar los jars  (jbpm-human-task-5.x.x.jar y jbpm-bam-5.x.x.jar) que hacen referencia a la BD del suite del JBPM.

  • Renombrar el datasource por: jbpmDS-ds.xml

File: jbpmDS-ds.xml

<?xml version=»1.0″ encoding=»UTF-8″?>

<datasources>

<local-tx-datasource>

<jndi-name>jdbc/jbpmDS</jndi-name>

<connection-url>jdbc:postgresql:jbpm5</connection-url>

<driver-class>org.postgresql.Driver</driver-class>

<user-name>postgres</user-name>

<password>pwd</password>

</local-tx-datasource>

</datasources>

+++++++++++++++++++++++++++++++++++++++++++++

Los archivos persistence.xml and hibernate.cfg.xml del directorio db/ deberian ser configurados de acuerdo a los anteriores archivos y datasource, ejemplo:

File: persistence.xml

<?xml version=»1.0″ encoding=»UTF-8″ standalone=»yes»?>

<persistence version=»1.0″

xsi:schemaLocation=»http://java.sun.com/xml/ns/persistence

http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd

http://java.sun.com/xml/ns/persistence/orm

http://java.sun.com/xml/ns/persistence/orm_1_0.xsd«

xmlns:orm=»http://java.sun.com/xml/ns/persistence/orm«

xmlns:xsi=»http://www.w3.org/2001/XMLSchema-instance«

xmlns=»http://java.sun.com/xml/ns/persistence«>

<persistence-unit name=»org.drools.persistence.jpa» transaction-type=»JTA»>

<provider>org.hibernate.ejb.HibernatePersistence</provider>

<jta-data-source>java:jdbc/jbpmDS</jta-data-source>

<class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>

<class>org.drools.persistence.info.SessionInfo</class>

<class>org.drools.persistence.info.WorkItemInfo</class>

<properties>

<property name=»hibernate.dialect» value=»org.hibernate.dialect.PostgreSQLDialect»/>

<property name=»hibernate.max_fetch_depth» value=»3″/>

<property name=»hibernate.hbm2ddl.auto» value=»update» />

<property name=»hibernate.show_sql» value=»false» />

<property name=»hibernate.transaction.manager_lookup_class» value=»org.hibernate.transaction.JBossTransactionManagerLookup» />

</properties>

</persistence-unit>

</persistence>

+++++++++++++++++++++++++++++++++++++++

File: hibernate.cfg.xml

<?xml version=’1.0′ encoding=’utf-8′?>

<!DOCTYPE hibernate-configuration PUBLIC

«-//Hibernate/Hibernate Configuration DTD 3.0//EN»

«http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd«>

<hibernate-configuration>

<session-factory>

<!– Database connection settings –>

<property name=»connection.driver_class»>org.postgresql.Driver</property>

<property name=»connection.url»>jdbc:postgresql://localhost/jbpm5</property>

<property name=»connection.username»>postgres</property>

<property name=»connection.password»>pwd</property>

<!– JDBC connection pool (use the built-in) –>

<property name=»connection.pool_size»>5</property>

<!– SQL dialect –>

<property name=»dialect»>org.hibernate.dialect.PostgreSQLDialect</property>

<!– Enable Hibernate’s automatic session context management –>

<property name=»current_session_context_class»>thread</property>

<!– Disable the second-level cache  –>

<property name=»cache.provider_class»>org.hibernate.cache.NoCacheProvider</property>

<!– Echo all executed SQL to stdout –>

<property name=»show_sql»>false</property>

<!– Drop and re-create the database schema on startup? –>

<property name=»hbm2ddl.auto»>update</property>

<mapping resource=»AuditLog.hbm.xml»/>

</session-factory>

</hibernate-configuration>

++++++++++++++++++++++++++++++++++++++++++++++++

  • Agregar las siguientes propiedades al archivo build.properties ubicado en la raíz del directorio  jbpm-installer

File: build.properties

…..

# Wilman

# define the jar file to conecction bd

driver.connection=postgresql.jar

# define name file DataSource

file.datasource=jbpmDS-ds.xml

++++++++++++++++++++++++

  • Sobre escribir y/o cambiar el archivo build.xml, ubicado en la raíz del directorio  jbpm-installer,  con lo siguiente:

File: build.xml

<?xml version=»1.0″ encoding=»UTF-8″?>

<project name=»jBPM.install»>

<property file=»build.properties» />

<property name=»install.home» value=»./» />

<property name=»jboss.server.conf.dir» value=»${jboss.home}/server/${jboss.server.configuration}/conf» />

<property name=»jboss.server.data.dir» value=»${jboss.home}/server/${jboss.server.configuration}/data» />

<property name=»jboss.server.deploy.dir» value=»${jboss.home}/server/${jboss.server.configuration}/deploy» />

<property name=»jboss.server.lib.dir» value=»${jboss.home}/server/${jboss.server.configuration}/lib» />

<property name=»jboss.server.birt.dir» value=»${jboss.server.data.dir}/birt»/>

<property name=»jboss.bind.address» value=»localhost» />

<property name=»eclipse.workspace.dir» value=»${install.home}/workspace»/>

<property name=»jboss.download.url» value=»http://downloads.sourceforge.net/jboss/jboss-${jboss.server.version}.zip»/>

<property name=»h2.download.url» value=»http://repository.jboss.org/maven2/com/h2database/h2/1.2.124/h2-1.2.124.jar«/>

<property name=»slf4j.download.url» value=»http://repo1.maven.org/maven2/org/slf4j/slf4j-jdk14/1.5.11/slf4j-jdk14-1.5.11.jar«/>

<property name=»birt.download.url» value=»http://www.eclipse.org/downloads/download.php?file=/birt/downloads/drops/R-R1-2_3_2_2-200906011507/birt-runtime-2_3_2_2.zip&url=http://download.eclipse.org/birt/downloads/drops/R-R1-2_3_2_2-200906011507/birt-runtime-2_3_2_2.zip&mirror_id=1«/>

<!– ############ DOWNLOAD ############ –>

<!– Download H2 –>

<target name=»download.h2.check»>

<echo message=»Checking h2 download …» />

<condition property=»h2.not.available»>

<not>

<available file=»${install.home}/db/driver/h2.jar» />

</not>

</condition>

</target>

<target name=»download.h2″ depends=»download.h2.check» if=»h2.not.available»>

<echo message=»Getting h2 …» />

<mkdir dir=»${install.home}/db/driver»/>

<get src=»${h2.download.url}» dest=»${install.home}/db/driver/h2.jar»  />

</target>

<!– Download BIRT engine (gwt-console) –>

<target name=»check.birt»>

<condition property=»birt.download»>

<equals arg1=»${jBPM.birt.download}» arg2=»true» />

</condition>

</target>

<target name=»download.birt.check» depends=»check.birt» if=»birt.download»>

<echo message=»Checking birt reporting engine download …» />

<condition property=»birt.not.available»>

<not>

<available file=»${install.home}/lib/birt-runtime-2_3_2_2.zip» />

</not>

</condition>

</target>

<target name=»download.birt» depends=»download.birt.check» if=»birt.not.available»>

<echo message=»Getting birt reporting engine …» />

<mkdir dir=»${install.home}/lib»/>

<get src=»${birt.download.url}» dest=»${install.home}/lib/birt-runtime-2_3_2_2.zip» />

</target>

<!– Download JBoss AS –>

<target name=»download.jboss.check»>

<echo message=»Checking JBoss AS download …» />

<condition property=»jboss.not.available»>

<not>

<available file=»${install.home}/lib/jboss-${jboss.server.version}.zip» />

</not>

</condition>

</target>

<target name=»download.jboss» depends=»download.jboss.check» if=»jboss.not.available»>

<echo message=»Getting JBoss AS …» />

<mkdir dir=»${install.home}/lib»/>

<get src=»${jboss.download.url}» dest=»${install.home}/lib/jboss-${jboss.server.version}.zip»  />

</target>

<!– Download Eclipse –>

<condition property=»download.type» value=»win32″>

<os family=»windows» />

</condition>

<condition property=»download.type» value=»macosx-carbon»>

<and>

<os family=»mac» />

<os family=»unix» />

</and>

</condition>

<condition property=»download.type» value=»linux-gtk»>

<and>

<not>

<os family=»mac» />

</not>

<os family=»unix» />

<not>

<or>

<os arch=»x86_64″ />

<os arch=»amd64″ />

</or>

</not>

</and>

</condition>

<condition property=»download.type» value=»linux-gtk-x86_64″>

<and>

<not>

<os family=»mac» />

</not>

<os family=»unix» />

<or>

<os arch=»x86_64″ />

<os arch=»amd64″ />

</or>

</and>

</condition>

<condition property=»download.extension» value=»zip»>

<os family=»windows» />

</condition>

<condition property=»download.extension» value=»tar.gz»>

<or>

<os family=»mac» />

<os family=»unix» />

</or>

</condition>

<condition property=»expandTypeZip» value=»true»>

<equals arg1=»${download.extension}» arg2=»zip» />

</condition>

<condition property=»expandTypeTarGz» value=»true»>

<equals arg1=»${download.extension}» arg2=»tar.gz» />

</condition>

<target name=»download.eclipse.check»>

<echo message=»Checking Eclipse download …» />

<condition property=»eclipse.not.available»>

<not>

<available file=»${install.home}/lib/eclipse-java-helios-${download.type}.${download.extension}» />

</not>

</condition>

</target>

<target name=»download.eclipse» depends=»download.eclipse.check» if=»eclipse.not.available»>

<echo message=»Getting Eclipse …» />

<mkdir dir=»${install.home}/lib»/>

<get src=»http://download.eclipse.org/technology/epp/downloads/release/helios/R/eclipse-java-helios-${download.type}.${download.extension}»

dest=»${install.home}/lib/eclipse-java-helios-${download.type}.${download.extension}»  />

</target>

<target name=»download.eclipse.gef.check»>

<echo message=»Checking Eclipse GEF download …» />

<condition property=»eclipse.gef.not.available»>

<not>

<available file=»${install.home}/lib/GEF-SDK-3.6.1.zip» />

</not>

</condition>

</target>

<target name=»download.eclipse.gef» depends=»download.eclipse.gef.check» if=»eclipse.gef.not.available»>

<echo message=»Getting Eclipse GEF …» />

<mkdir dir=»${install.home}/lib»/>

<get src=»http://download.eclipse.org/tools/gef/downloads/drops/3.6.1/R201009132020/GEF-SDK-3.6.1.zip»

dest=»${install.home}/lib/GEF-SDK-3.6.1.zip»  />

</target>

<!– Download jBPM binaries –>

<target name=»download.jBPM.bin.check»>

<echo message=»Checking jBPM binaries download …» />

<condition property=»jBPM.bin.not.available»>

<not>

<available file=»${install.home}/lib/jbpm-${jBPM.version}-bin.zip» />

</not>

</condition>

</target>

<target name=»download.jBPM.bin» depends=»download.jBPM.bin.check» if=»jBPM.bin.not.available»>

<echo message=»Getting jBPM binaries …» />

<mkdir dir=»${install.home}/lib»/>

<get src=»${jBPM.url}/jbpm-${jBPM.version}-bin.zip» dest=»${install.home}/lib/jbpm-${jBPM.version}-bin.zip»  />

</target>

<!– Download Drools Guvnor –>

<target name=»download.drools.guvnor.check»>

<echo message=»Checking Drools Guvnor download …» />

<condition property=»drools.guvnor.not.available»>

<not>

<available file=»${install.home}/lib/drools-${drools.version}-guvnor.war» />

</not>

</condition>

</target>

<target name=»download.drools.guvnor» depends=»download.drools.guvnor.check» if=»drools.guvnor.not.available»>

<echo message=»Getting Drools Guvnor …» />

<mkdir dir=»${install.home}/lib»/>

<get src=»${drools.url}/drools-${drools.version}-guvnor.war» dest=»${install.home}/lib/drools-${drools.version}-guvnor.war»  />

</target>

<!– Download Designer –>

<target name=»download.designer.check»>

<echo message=»Checking Designer download …» />

<condition property=»designer.not.available»>

<not>

<available file=»${install.home}/lib/designer-${designer.version}.war» />

</not>

</condition>

</target>

<target name=»download.designer» depends=»download.designer.check» if=»designer.not.available»>

<echo message=»Getting Designer …» />

<mkdir dir=»${install.home}/lib»/>

<get src=»${designer.url}/designer-${designer.version}.war» dest=»${install.home}/lib/designer-${designer.version}.war»  />

</target>

<!– Download jBPM Eclipse plugins –>

<target name=»download.jBPM.eclipse.check»>

<echo message=»Checking jBPM Eclipse download …» />

<condition property=»jBPM.eclipse.not.available»>

<not>

<available file=»${install.home}/lib/jbpm-${jBPM.version}-eclipse-all.zip» />

</not>

</condition>

</target>

<target name=»download.jBPM.eclipse» depends=»download.jBPM.eclipse.check» if=»jBPM.eclipse.not.available»>

<echo message=»Getting jBPM Eclipse …» />

<mkdir dir=»${install.home}/lib»/>

<get src=»http://community.jboss.org/servlet/JiveServlet/download/15922-6-25925/jbpm-5.0.0-eclipse-all.zip» dest=»${install.home}/lib/jbpm-${jBPM.version}-eclipse-all.zip»  />

</target>

<!– Download Drools Eclipse plugins –>

<target name=»download.drools.eclipse.check»>

<echo message=»Checking Drools Eclipse download …» />

<condition property=»drools.eclipse.not.available»>

<not>

<available file=»${install.home}/lib/drools-${drools.version}-eclipse-all.zip» />

</not>

</condition>

</target>

<target name=»download.drools.eclipse» depends=»download.drools.eclipse.check» if=»drools.eclipse.not.available»>

<echo message=»Getting Drools Eclipse …» />

<mkdir dir=»${install.home}/lib»/>

<get src=»${drools.url}/drools-${drools.version}-eclipse-all.zip» dest=»${install.home}/lib/drools-${drools.version}-eclipse-all.zip»  />

</target>

<!– Download jBPM gwt-console –>

<target name=»download.jBPM.gwt-console.check»>

<echo message=»Checking jBPM gwt-console download …» />

<condition property=»jBPM.gwt-console.not.available»>

<not>

<available file=»${install.home}/lib/jbpm-${jBPM.version}-gwt-console.zip» />

</not>

</condition>

</target>

<target name=»download.jBPM.gwt-console» depends=»download.jBPM.gwt-console.check» if=»jBPM.gwt-console.not.available»>

<echo message=»Getting jBPM gwt-console …» />

<mkdir dir=»${install.home}/lib»/>

<get src=»${jBPM.url}/jbpm-${jBPM.version}-gwt-console.zip» dest=»${install.home}/lib/jbpm-${jBPM.version}-gwt-console.zip»  />

</target>

<!– ############ INSTALL ############ –>

<!– Install JBoss AS –>

<target name=»install.jboss» depends=»download.jboss»>

<unzip src=»${install.home}/lib/jboss-${jboss.server.version}.zip» dest=»${install.home}» />

<chmod perm=»a+x» file=»${install.home}/jboss-${jboss.server.version}/bin/run.sh» />

<chmod perm=»a+x» file=»${install.home}/jboss-${jboss.server.version}/bin/shutdown.sh» />

</target>

<!– Install guvnor –>

<target name=»check.jboss.version»>

<condition property=»jboss.version.is.5″>

<equals arg1=»${jboss.server.version}» arg2=»5.1.0.GA» />

</condition>

</target>

<target name=»install.guvnor.into.jboss» depends=»download.drools.guvnor»>

<antcall target=»install.guvnor.into.jboss.5″ />

<antcall target=»install.guvnor.into.jboss.other» />

</target>

<target name=»install.guvnor.into.jboss.5″ depends=»check.jboss.version» if=»jboss.version.is.5″>

<mkdir dir=»${install.home}/target/drools-guvnor»/>

<unzip src=»${install.home}/lib/drools-${drools.version}-guvnor.war» dest=»${install.home}/target/drools-guvnor» />

<delete>

<fileset dir=»${install.home}/target/drools-guvnor/WEB-INF/lib» includes=»xml-apis-*.jar»/>

</delete>

<zip basedir=»${install.home}/target/drools-guvnor»

destfile=»${install.home}/target/drools-guvnor.war»/>

<copy file=»${install.home}/target/drools-guvnor.war»

tofile=»${jboss.server.deploy.dir}/drools-guvnor.war»

overwrite=»true» />

<delete dir=»${install.home}/target»/>

</target>

<target name=»install.guvnor.into.jboss.other» depends=»check.jboss.version» unless=»jboss.version.is.5″>

<copy file=»${install.home}/lib/drools-${drools.version}-guvnor.war»

tofile=»${jboss.server.deploy.dir}/drools-guvnor.war»

overwrite=»true» />

</target>

<!– Install designer –>

<target name=»install.designer.into.jboss» depends=»download.designer»>

<copy file=»${install.home}/lib/designer-${designer.version}.war»

tofile=»${jboss.server.deploy.dir}/designer.war»

overwrite=»true» />

</target>

<!– Install configuration db file into jars –>

<target name=»install.config.connectionDB.into.jars»>

<mkdir dir=»${install.home}/runtime/target»/>

<!– Wilman: re build jbpm-human-task-5.X.X.jar –>

<mkdir dir=»${install.home}/runtime/target/jbpm-human-task-${jBPM.version}-jar»/>

<unzip src=»${install.home}/runtime/jbpm-human-task-${jBPM.version}.jar» dest=»${install.home}/runtime/target/jbpm-human-task-${jBPM.version}-jar» />

<!– Wilman: Fix for conflicting connection bd in configuration files in jars jbpm–>

<!– Wilman: copy file jbpm-human-task-persistence.xml in jbpm-human-task-5.X.X.jar–>

<copy file=»${install.home}/db/jbpm-human-task-persistence.xml»

tofile=»${install.home}/runtime/target/jbpm-human-task-${jBPM.version}-jar/META-INF/persistence.xml»

overwrite=»true»/>

<!– Wilman: build jbpm-human-task-5.X.X.jar –>

<zip basedir=»${install.home}/runtime/target/jbpm-human-task-${jBPM.version}-jar»

destfile=»${install.home}/runtime/target/jbpm-human-task-${jBPM.version}.jar»/>

<copy file=»${install.home}/runtime/target/jbpm-human-task-${jBPM.version}.jar»

tofile=»${install.home}/runtime/jbpm-human-task-${jBPM.version}.jar»

overwrite=»true» />

<!– Wilman: re build jbpm-bam-5.X.X.jar –>

<mkdir dir=»${install.home}/runtime/target/jbpm-bam-${jBPM.version}-jar»/>

<unzip src=»${install.home}/runtime/jbpm-bam-${jBPM.version}.jar» dest=»${install.home}/runtime/target/jbpm-bam-${jBPM.version}-jar» />

<!– Wilman: copy file jbpm-bam-hibernate.cfg.xml in jbpm-bam-5.X.X.jar–>

<copy file=»${install.home}/db/jbpm-bam-hibernate.cfg.xml»

tofile=»${install.home}/runtime/target/jbpm-bam-${jBPM.version}-jar/hibernate.cfg.xml»

overwrite=»true»/>

<!– Wilman: build jbpm-bam-5.X.X.jar –>

<zip basedir=»${install.home}/runtime/target/jbpm-bam-${jBPM.version}-jar»

destfile=»${install.home}/runtime/target/jbpm-bam-${jBPM.version}.jar»/>

<copy file=»${install.home}/runtime/target/jbpm-bam-${jBPM.version}.jar»

tofile=»${install.home}/runtime/jbpm-bam-${jBPM.version}.jar»

overwrite=»true» />

<delete dir=»${install.home}/runtime/target»/>

</target>

<!– Install gwt-console –>

<target name=»install.jBPM-gwt-console.into.jboss» depends=»download.birt,download.jBPM.gwt-console,install.jBPM.runtime»>

<!– gwt-console –>

<mkdir dir=»${install.home}/target»/>

<unzip src=»${install.home}/lib/jbpm-${jBPM.version}-gwt-console.zip» dest=»${install.home}/target» />

<mkdir dir=»${install.home}/target/jbpm-gwt-console-server-war»/>

<unzip src=»${install.home}/target/jbpm-gwt-console-server-${jBPM.version}.war»

dest=»${install.home}/target/jbpm-gwt-console-server-war»/>

<copy file=»${install.home}/db/hibernate.cfg.xml»

tofile=»${install.home}/target/jbpm-gwt-console-server-war/WEB-INF/classes/hibernate.cfg.xml»

overwrite=»true» />

<copy file=»${install.home}/db/persistence.xml»

tofile=»${install.home}/target/jbpm-gwt-console-server-war/WEB-INF/classes/META-INF/persistence.xml»

overwrite=»true» />

<!–

<antcall target=»install.config.connectionDB.into.jars»/>

–>

<!– Wilman: copy file jbpm-human-task-5.X.X.jar into jbpm-gwt-console-server-war –>

<copy file=»${install.home}/runtime/jbpm-human-task-${jBPM.version}.jar»

tofile=»${install.home}/target/jbpm-gwt-console-server-war/WEB-INF/lib/jbpm-human-task-${jBPM.version}.jar»

overwrite=»true»/>

<!– Wilman: copy file jbpm-bam-5.X.X.jar into jbpm-gwt-console-server-war –>

<copy file=»${install.home}/runtime/jbpm-bam-${jBPM.version}.jar»

tofile=»${install.home}/target/jbpm-gwt-console-server-war/WEB-INF/lib/jbpm-bam-${jBPM.version}.jar»

overwrite=»true»/>

<!– Fix for conflicting javassist jar –>

<delete file=»${install.home}/target/jbpm-gwt-console-server-war/WEB-INF/lib/javassist-3.6.0.GA.jar»/>

<!– Other configuration like work item handlers –>

<copy todir=»${install.home}/target/jbpm-gwt-console-server-war/WEB-INF/classes» overwrite=»true»>

<fileset dir=»${install.home}/conf»/>

</copy>

<zip basedir=»${install.home}/target/jbpm-gwt-console-server-war»

destfile=»${install.home}/target/jbpm-gwt-console-server-${jBPM.version}.war»/>

<copy file=»${install.home}/target/jbpm-gwt-console-server-${jBPM.version}.war»

tofile=»${jboss.server.deploy.dir}/jbpm-gwt-console-server.war»

overwrite=»true» />

<copy file=»${install.home}/target/jbpm-gwt-console-${jBPM.version}.war»

tofile=»${jboss.server.deploy.dir}/jbpm-gwt-console.war»

overwrite=»true» />

<delete dir=»${install.home}/target»/>

<!– db configuration –>

<copy file=»${install.home}/db/${file.datasource}»

tofile=»${jboss.server.deploy.dir}/${file.datasource}»

overwrite=»true» />

<!– wilman: copy driver –>

<copy file=»${install.home}/db/driver/${driver.connection}»

todir=»${jboss.server.lib.dir}»

overwrite=»true» />

<!–

<copy todir=»${jboss.server.lib.dir}» overwrite=»true»>

<fileset dir=»${install.home}/db/driver/*»/>

</copy>

–>

<!– authentication configuration –>

<copy file=»${install.home}/auth/users.properties»

tofile=»${jboss.server.conf.dir}/users.properties»

overwrite=»true» />

<copy file=»${install.home}/auth/roles.properties»

tofile=»${jboss.server.conf.dir}/roles.properties»

overwrite=»true» />

<!– reporting –>

<antcall target=»install.reporting.into.jboss» />

</target>

<target name=»install.reporting.into.jboss» depends=»check.birt» if=»birt.download» >

<mkdir dir=»${install.home}/target»/>

<unzip src=»${install.home}/lib/birt-runtime-2_3_2_2.zip»

dest=»${install.home}/target»/>

<mkdir dir=»${jboss.server.birt.dir}»/>

<mkdir dir=»${jboss.server.birt.dir}/ReportEngine»/>

<copy todir=»${jboss.server.birt.dir}/ReportEngine» overwrite=»true»>

<fileset dir=»${install.home}/target/birt-runtime-2_3_2/ReportEngine»/>

</copy>

<delete dir=»${install.home}/target»/>

<copy file=»${install.home}/report/overall_activity.rptdesign»

tofile=»${jboss.server.birt.dir}/overall_activity.rptdesign»

overwrite=»true»/>

<copy file=»${install.home}/report/process_summary.rptdesign»

tofile=»${jboss.server.birt.dir}/process_summary.rptdesign»

overwrite=»true»/>

<copy todir=»${jboss.server.birt.dir}/ReportEngine/plugins/org.eclipse.birt.report.data.oda.jdbc_2.3.2.r232_v20090212/drivers» overwrite=»true»>

<fileset dir=»${install.home}/db/driver»/>

</copy>

</target>

<!– Install Eclipse –>

<target name=»install.eclipse» depends=»download.eclipse,download.eclipse.gef»>

<antcall target=»unzipEclipse» />

<antcall target=»untarEclipse» />

<unzip dest=»${install.home}» overwrite=»true»

src=»${install.home}/lib/GEF-SDK-3.6.1.zip» />

</target>

<target name=»unzipEclipse» if=»expandTypeZip»>

<unzip dest=»${install.home}» overwrite=»true»

src=»${install.home}/lib/eclipse-java-helios-${download.type}.zip» />

</target>

<target name=»untarEclipse» if=»expandTypeTarGz»>

<gunzip src=»${install.home}/lib/eclipse-java-helios-${download.type}.tar.gz»/>

<untar dest=»${install.home}» src=»${install.home}/lib/eclipse-java-helios-${download.type}.tar» />

<chmod perm=»a+x» file=»${install.home}/eclipse/eclipse» os=»Linux»/>

<chmod perm=»a+x» file=»${install.home}/eclipse/Eclipse.app/Contents/MacOS/eclipse» os=»Mac OS X»/>

</target>

<!– Install Eclipse plugins –>

<target name=»install.jBPM.runtime» depends=»download.jBPM.bin»>

<!– create runtime –>

<mkdir dir=»${install.home}/runtime»/>

<unzip src=»${install.home}/lib/jbpm-${jBPM.version}-bin.zip» dest=»${install.home}/runtime» />

<!– Wilman set new configuration databases–>

<antcall target=»install.config.connectionDB.into.jars»/>

</target>

<!– Install Eclipse plugins –>

<target name=»install.jBPM-eclipse.into.eclipse» depends=»download.jBPM.eclipse»>

<!– install plugins –>

<unzip src=»${install.home}/lib/jbpm-${jBPM.version}-eclipse-all.zip» dest=»${eclipse.home}» />

</target>

<!– Install Eclipse plugins –>

<target name=»install.drools-eclipse.into.eclipse» depends=»download.drools.eclipse»>

<!– install plugins –>

<unzip src=»${install.home}/lib/drools-${drools.version}-eclipse-all.zip» dest=»${eclipse.home}» />

<copy todir=»${eclipse.home}/features» overwrite=»true»>

<fileset dir=»${eclipse.home}/drools-update-site/features»/>

</copy>

<copy todir=»${eclipse.home}/plugins» overwrite=»true»>

<fileset dir=»${eclipse.home}/drools-update-site/plugins»/>

</copy>

<delete dir=»${eclipse.home}/drools-update-site»/>

</target>

<!– Install Demo –>

<target name=»install.demo» depends=»install.jboss,install.guvnor.into.jboss,install.designer.into.jboss,install.jBPM-gwt-console.into.jboss,install.eclipse,install.jBPM-eclipse.into.eclipse,install.jBPM.runtime,install.drools-eclipse.into.eclipse,start.human.task» />

<!– WILMAN –>

<!– Install jbpm5 –>

<target name=»install.jbpm5″ depends=»install.guvnor.into.jboss,install.designer.into.jboss,install.jBPM-gwt-console.into.jboss,install.jBPM.runtime,start.human.task»/>

<!–install.eclipse,install.jBPM-eclipse.into.eclipse,install.jBPM.runtime,install.drools-eclipse.into.eclipse» –>

<!– ############ START/STOP ############ –>

<!– Start H2 server –>

<target name=»start.h2″ depends=»download.h2″>

<java classname=»org.h2.tools.Server» fork=»true» spawn=»true»>

<arg value=»-tcp» />

<classpath location=»${install.home}/db/driver/h2.jar» />

</java>

</target>

<!– Stop H2 server –>

<target name=»stop.h2″ depends=»download.h2″>

<java classname=»org.h2.tools.Server» fork=»true»>

<classpath location=»${install.home}/db/driver/h2.jar» />

<arg value=»-tcpShutdown» />

<arg value=»tcp://localhost:9092″ />

</java>

</target>

<!– Start JBoss AS –>

<target name=»start.jboss»>

<property name=»jboss.full.path.win» location=»${jboss.home}/bin/run.bat» />

<exec executable=»${jboss.full.path.win}» spawn=»yes»

os=»Windows 7,Windows Vista,Windows XP,Windows 2000,Windows 2003″>

<env key=»JAVA_OPTS» value=»-XX:MaxPermSize=256m -Xms256m -Xmx512m» />

<arg value=»-b» />

<arg value=»${jboss.bind.address}» />

<arg value=»-Djbpm.console.directory=${install.home}/sample/evaluation/src/main/resources» />

</exec>

<property name=»jboss.full.path.linux» location=»${jboss.home}/bin/run.sh» />

<exec executable=»${jboss.full.path.linux}» spawn=»yes» os=»Linux,Mac OS X»>

<env key=»JAVA_OPTS» value=»-XX:MaxPermSize=256m -Xms256m -Xmx512m» />

<arg value=»-b» />

<arg value=»${jboss.bind.address}» />

<arg value=»-Djbpm.console.directory=${install.home}/sample/evaluation/src/main/resources» />

</exec>

<waitfor maxwait=»5″ maxwaitunit=»minute» checkevery=»30″

checkeveryunit=»second» timeoutproperty=»jboss.timeout»>

<socket server=»${jboss.bind.address}» port=»8080″ />

</waitfor>

<fail if=»jboss.timeout» message=»jboss did not start within 5 minutes»/>

</target>

<!– Stop JBoss AS –>

<target name=»stop.jboss»>

<exec executable=»${jboss.home}/bin/shutdown.bat»

os=»Windows 7,Windows Vista,Windows XP,Windows 2000,Windows 2003″>

<arg value=»-s» />

<arg value=»jnp://${jboss.bind.address}:1099″ />

<arg value=»-S» />

</exec>

<exec executable=»${jboss.home}/bin/shutdown.sh» os=»Linux,Mac OS X»>

<arg value=»-s» />

<arg value=»jnp://${jboss.bind.address}:1099″ />

<arg value=»-S» />

</exec>

</target>

<!– Start Eclipse –>

<target name=»start.eclipse»>

<exec executable=»${eclipse.home}/eclipse.exe»

spawn=»yes»

os=»Windows 7,Windows Vista,Windows XP,Windows 2000,Windows 2003″>

<arg value=»-data» />

<arg value=»${eclipse.workspace.dir}» />

<arg value=»-plugincustomization» />

<arg value=»./eclipse.preferences.ini» />

</exec>

<exec executable=»${eclipse.home}/eclipse» spawn=»yes» os=»Linux»>

<arg value=»-data» />

<arg value=»${eclipse.workspace.dir}» />

<arg value=»-plugincustomization» />

<arg value=»./eclipse.preferences.ini» />

</exec>

<chmod perm=»a+x» file=»./generate.mac.eclipse.preferences.sh» />

<exec executable=»./generate.mac.eclipse.preferences.sh» os=»Mac OS X»/>

<exec executable=»${eclipse.home}/Eclipse.app/Contents/MacOS/eclipse» spawn=»yes» os=»Mac OS X»>

<arg value=»-data» />

<arg value=»../../../../${eclipse.workspace.dir}» />

<arg value=»-plugincustomization» />

<arg value=»../../../../mac.eclipse.preferences.ini» />

</exec>

</target>

<!– Start Human Task Service –>

<path id=»classpath.human.task»>

<fileset dir=»${install.home}/runtime» includes=»**/*.jar»/>

<fileset dir=»${install.home}/db/driver» includes=»**/*.jar»/>

</path>

<target name=»start.human.task»>

<mkdir dir=»${install.home}/task-service/target»/>

<javac srcdir=»${install.home}/task-service/src» destdir=»${install.home}/task-service/target» classpathref=»classpath.human.task»>

<compilerarg value=»-Xlint:unchecked»/>

</javac>

<copy todir=»${install.home}/task-service/target»>

<fileset dir=»${install.home}/task-service/resources»/>

</copy>

<java classname=»org.jbpm.DemoTaskService» fork=»true»>

<classpath>

<pathelement path=»${install.home}/task-service/target»/>

<path refid=»classpath.human.task» />

</classpath>

</java>

</target>

<!– Start Demo –>

<target name=»start.demo» depends=»start.jboss,start.human.task» />

<!– Stop Demo –>

<target name=»stop.demo» depends=»stop.jboss» />

<!– ############ CLEAN ############ –>

<!– Clean jboss –>

<target name=»clean.jboss»>

<delete dir=»${install.home}/jboss-${jboss.server.version}»/>

<delete dir=»${install.home}/repository»/>

<delete file=»${install.home}/repository.xml»/>

</target>

<!– Clean eclipse –>

<target name=»clean.eclipse»>

<delete dir=»${install.home}/eclipse»/>

<delete dir=»${install.home}/runtime»/>

<delete dir=»${eclipse.workspace.dir}»/>

</target>

<!– Stop Demo –>

<target name=»clean.demo» depends=»clean.jboss,clean.eclipse» />

</project>

++++++++++++++++++++++++++++++++++++++++++++++++

Se debe tener en cuenta que los archivos build.properties y build.xml son configurables y modificables de acuerdo a nuestras necesidades y configuraciones necesarios.

Una vez finalizada esta configuración se pueden ejecutar cualquier target del build.xml; ubicándose en {JBPM-Installer-HOME}/ desde consola.  Por ejemplo:

  • si queremos instalar el demo completamente se puede realizar:

$ant install.demo

  • Si se quiere instalar solo lo necesario para que se ejecute el demo:

$ant install.jbpm5

Por supuesto se debe tener instalado y configurado el path de ant en nuestra máquina para poder ejecutar las sentencias.

Espero con esto aclarar el panorama y ayudar de alguna forma que es y como se debería hacer para configurar para cualquier BD

Posted in J2EE | Leave a Comment »