[jbpm-commits] JBoss JBPM SVN: r5546 - in projects/demos/trainticket-demo/jbpm-on-rails/trunk: bi-events and 91 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Wed Aug 26 11:25:28 EDT 2009
Author: jbarrez
Date: 2009-08-26 11:25:25 -0400 (Wed, 26 Aug 2009)
New Revision: 5546
Added:
projects/demos/trainticket-demo/jbpm-on-rails/trunk/.classpath
projects/demos/trainticket-demo/jbpm-on-rails/trunk/.project
projects/demos/trainticket-demo/jbpm-on-rails/trunk/bi-events/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/bi-events/pom.xml
projects/demos/trainticket-demo/jbpm-on-rails/trunk/bi-events/src/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/bi-events/src/main/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/bi-events/src/main/java/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/bi-events/src/main/java/org/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/bi-events/src/main/java/org/jbpm/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/bi-events/src/main/java/org/jbpm/trainticketdemo/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/bi-events/src/main/java/org/jbpm/trainticketdemo/event/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/bi-events/src/main/java/org/jbpm/trainticketdemo/event/QuoteSentEvent.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/bi-events/src/main/java/org/jbpm/trainticketdemo/event/TicketRequestReceivedEvent.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/bi-events/src/main/java/org/jbpm/trainticketdemo/event/TicketSoldEvent.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/.classpath
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/.project
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/.settings/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/.settings/org.eclipse.jdt.core.prefs
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/pom.xml
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/main/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/main/java/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/main/java/org/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/main/java/org/jbpm/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/main/java/org/jbpm/trainticketdemo/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/main/java/org/jbpm/trainticketdemo/domain/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/main/java/org/jbpm/trainticketdemo/domain/Quote.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/main/java/org/jbpm/trainticketdemo/domain/TicketRequest.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/main/java/org/jbpm/trainticketdemo/domain/User.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/main/resources/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/main/resources/org/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/main/resources/org/jbpm/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/main/resources/org/jbpm/trainticketdemo/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/main/resources/org/jbpm/trainticketdemo/domain/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/main/resources/org/jbpm/trainticketdemo/domain/User.hbm.xml
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/target/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/target/classes/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/target/classes/org/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/target/classes/org/jbpm/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/target/classes/org/jbpm/trainticketdemo/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/target/classes/org/jbpm/trainticketdemo/domain/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/target/classes/org/jbpm/trainticketdemo/domain/User.hbm.xml
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ear/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ear/.project
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ear/.settings/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ear/.settings/org.eclipse.jdt.core.prefs
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ear/pom.xml
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/.classpath
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/.project
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/.settings/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/.settings/org.eclipse.jdt.core.prefs
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/pom.xml
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/bi/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/bi/esper/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/bi/esper/EpServiceProviderFactory.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/bi/esper/EventQueueProcessor.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/bi/subscriber/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/bi/subscriber/MoneyTrackerSubscriber.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/bi/subscriber/ResponseTimingSubscriber.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/bi/util/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/bi/util/DataSourceUtil.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/business/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/business/TicketServiceImpl.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/business/external/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/business/external/QuoteServiceImpl.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/helper/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/helper/DbSchemaUtil.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/helper/ProcessEngineManagerImpl.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/helper/ProcessEngineUtil.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/helper/ServerConfigManagement.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/helper/ServerConfiguration.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/resources/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/resources/jbpm.hsqldb.create.sql
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/resources/jbpm.hsqldb.drop.sql
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/resources/logging.properties
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/test/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/test/java/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/target/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/jboss-integration/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/jboss-integration/pom.xml
projects/demos/trainticket-demo/jbpm-on-rails/trunk/jboss-integration/src/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/jboss-integration/src/main/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/jboss-integration/src/main/java/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/jboss-integration/src/main/java/org/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/jboss-integration/src/main/java/org/jbpm/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/jboss-integration/src/main/java/org/jbpm/trainticketdemo/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/jboss-integration/src/main/java/org/jbpm/trainticketdemo/integration/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/jboss-integration/src/main/java/org/jbpm/trainticketdemo/integration/ProcessEngineFactory.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/jboss-integration/src/main/java/org/jbpm/trainticketdemo/integration/ProcessEngineObjectFactory.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/jboss-integration/src/main/java/org/jbpm/trainticketdemo/integration/ProcessEngineReference.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/pom.xml
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/.classpath
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/.project
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/.settings/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/.settings/org.eclipse.jdt.core.prefs
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/pom.xml
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/action/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/action/CalculateQuoteAction.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/action/ChargeCustomerAction.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/action/SendQuoteToCustomerAction.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/action/SendRejectionMsgAction.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/business/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/business/ProcessEngineManager.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/business/TicketService.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/business/external/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/business/external/QuoteService.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/constants/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/constants/JmsConstants.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/constants/SmsConstants.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/decision/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/decision/CheckCustomerDecision.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/eventlistener/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/eventlistener/SendEventToQueue.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/util/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/util/EjbUtil.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/util/JmsUtil.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/util/SmsUtil.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/variable/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/variable/ProcessVariable.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/jbpm.cfg.xml
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/jbpm.hibernate.cfg.xml
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/jbpm.mail.properties
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/jndi.properties
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/log4j.properties
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/logging.properties
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/org/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/org/jbpm/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/org/jbpm/trainticketdemo/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/org/jbpm/trainticketdemo/process.jpdl.xml
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/org/jbpm/trainticketdemo/process.png
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/org/jbpm/trainticketdemo/trainticket_startform.ftl
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/jbpm.cfg.xml
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/jbpm.hibernate.cfg.xml
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/jbpm.mail.properties
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/jndi.properties
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/log4j.properties
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/logging.properties
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/org/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/org/jbpm/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/org/jbpm/trainticketdemo/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/org/jbpm/trainticketdemo/process.jpdl.xml
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/org/jbpm/trainticketdemo/process.png
projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/org/jbpm/trainticketdemo/trainticket_startform.ftl
projects/demos/trainticket-demo/jbpm-on-rails/trunk/src/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/src/main/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/src/main/resources/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/.classpath
projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/.project
projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/.settings/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/.settings/org.eclipse.jdt.core.prefs
projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/pom.xml
projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/src/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/src/main/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/src/main/java/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/src/main/java/org/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/src/main/java/org/jbpm/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/src/main/java/org/jbpm/trainticketdemo/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/src/main/java/org/jbpm/trainticketdemo/ReceiveSmsServlet.java
projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/src/main/resources/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/src/main/webapp/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/src/main/webapp/WEB-INF/
projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/src/main/webapp/WEB-INF/web.xml
projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/target/
Modified:
projects/demos/trainticket-demo/jbpm-on-rails/trunk/
Log:
Initial import business logic app
Property changes on: projects/demos/trainticket-demo/jbpm-on-rails/trunk
___________________________________________________________________
Name: svn:ignore
+ .settings
target
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/.classpath
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/.classpath (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/.classpath 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="ejb/target/classes" path="ejb/src/main/java"/>
+ <classpathentry kind="src" output="war/target/classes" path="war/src/main/java"/>
+ <classpathentry excluding="**" kind="src" output="war/target/classes" path="war/src/main/resources"/>
+ <classpathentry kind="src" path="process-logic/src/main/java"/>
+ <classpathentry kind="src" path="process-logic/src/main/resources"/>
+ <classpathentry kind="src" path="ejb/src/main/resources"/>
+ <classpathentry kind="src" path="domain/src/main/java"/>
+ <classpathentry kind="src" path="jboss-integration/src/main/java"/>
+ <classpathentry kind="src" path="domain/src/main/resources"/>
+ <classpathentry kind="src" path="bi-events/src/main/java"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/.project
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/.project (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/.project 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>jbpm-on-rails</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ </natures>
+</projectDescription>
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/bi-events/pom.xml
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/bi-events/pom.xml (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/bi-events/pom.xml 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,13 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jbpm-on-rails-bi-events</artifactId>
+ <packaging>jar</packaging>
+ <name>jbpm-on-rails-bi-events</name>
+
+ <parent>
+ <groupId>org.jbpm.trainticketdemo</groupId>
+ <artifactId>jbpm-on-rails</artifactId>
+ <version>1.0</version>
+ </parent>
+</project>
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/bi-events/src/main/java/org/jbpm/trainticketdemo/event/QuoteSentEvent.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/bi-events/src/main/java/org/jbpm/trainticketdemo/event/QuoteSentEvent.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/bi-events/src/main/java/org/jbpm/trainticketdemo/event/QuoteSentEvent.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,61 @@
+/*
+ * 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.trainticketdemo.event;
+
+import java.io.Serializable;
+
+/**
+ * At the moment, this is a copy of the {@link TicketRequestReceivedEvent}.
+ * We can't use 'extend' since otherwise the event will be recognized as
+ * a 'ticketrequest event' instead of a 'quote sent event'.
+ *
+ * @author Joram Barrez
+ */
+public class QuoteSentEvent implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private String processInstanceId;
+
+ private Long timestamp;
+
+ public QuoteSentEvent() {
+ this.timestamp = System.nanoTime();
+ }
+
+ public String getProcessInstanceId() {
+ return processInstanceId;
+ }
+
+ public void setProcessInstanceId(String processInstanceId) {
+ this.processInstanceId = processInstanceId;
+ }
+
+ public Long getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(Long timestamp) {
+ this.timestamp = timestamp;
+ }
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/bi-events/src/main/java/org/jbpm/trainticketdemo/event/TicketRequestReceivedEvent.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/bi-events/src/main/java/org/jbpm/trainticketdemo/event/TicketRequestReceivedEvent.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/bi-events/src/main/java/org/jbpm/trainticketdemo/event/TicketRequestReceivedEvent.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.trainticketdemo.event;
+
+import java.io.Serializable;
+
+/**
+ * @author Joram Barrez
+ */
+public class TicketRequestReceivedEvent implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private String processInstanceId;
+
+ private Long timestamp;
+
+ public TicketRequestReceivedEvent() {
+ this.timestamp = System.nanoTime();
+ }
+
+ public String getProcessInstanceId() {
+ return processInstanceId;
+ }
+
+ public void setProcessInstanceId(String processInstanceId) {
+ this.processInstanceId = processInstanceId;
+ }
+
+ public Long getTimestamp() {
+ return timestamp;
+ }
+
+ public void setTimestamp(Long timestamp) {
+ this.timestamp = timestamp;
+ }
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/bi-events/src/main/java/org/jbpm/trainticketdemo/event/TicketSoldEvent.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/bi-events/src/main/java/org/jbpm/trainticketdemo/event/TicketSoldEvent.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/bi-events/src/main/java/org/jbpm/trainticketdemo/event/TicketSoldEvent.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,68 @@
+/*
+ * 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.trainticketdemo.event;
+
+import java.io.Serializable;
+
+/**
+ * @author Joram Barrez
+ */
+public class TicketSoldEvent implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private String from;
+
+ private String to;
+
+ private Double amount;
+
+ public TicketSoldEvent() {
+
+ }
+
+ public String getFrom() {
+ return from;
+ }
+
+ public void setFrom(String from) {
+ this.from = from;
+ }
+
+ public String getTo() {
+ return to;
+ }
+
+ public void setTo(String to) {
+ this.to = to;
+ }
+
+ public Double getAmount() {
+ return amount;
+ }
+
+ public void setAmount(Double amount) {
+ this.amount = amount;
+ }
+
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/.classpath
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/.classpath (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/.classpath 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,6 @@
+<classpath>
+ <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
+ <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
+ <classpathentry kind="output" path="target/classes"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+</classpath>
\ No newline at end of file
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/.project
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/.project (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/.project 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,13 @@
+<projectDescription>
+ <name>jbpm-on-rails-domain</name>
+ <comment/>
+ <projects/>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
\ No newline at end of file
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/.settings/org.eclipse.jdt.core.prefs 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,5 @@
+#Fri Aug 14 10:38:10 CEST 2009
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/pom.xml
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/pom.xml (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/pom.xml 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,13 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jbpm-on-rails-domain</artifactId>
+ <packaging>jar</packaging>
+ <name>jbpm-on-rails-domain</name>
+
+ <parent>
+ <groupId>org.jbpm.trainticketdemo</groupId>
+ <artifactId>jbpm-on-rails</artifactId>
+ <version>1.0</version>
+ </parent>
+</project>
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/main/java/org/jbpm/trainticketdemo/domain/Quote.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/main/java/org/jbpm/trainticketdemo/domain/Quote.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/main/java/org/jbpm/trainticketdemo/domain/Quote.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,65 @@
+/*
+ * 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.trainticketdemo.domain;
+
+import java.io.Serializable;
+
+
+/**
+ * Domain model representing a quote for a given train transport.
+ *
+ * @author Joram Barrez
+ */
+public class Quote implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private TicketRequest ticketRequest;
+
+ private Double price;
+
+ public Quote() {
+
+ }
+
+
+ public Quote(TicketRequest ticketRequest) {
+ this.ticketRequest = ticketRequest;
+ }
+
+ public TicketRequest getTicketRequest() {
+ return ticketRequest;
+ }
+
+ public void setTicketRequest(TicketRequest ticketRequest) {
+ this.ticketRequest = ticketRequest;
+ }
+
+ public Double getPrice() {
+ return price;
+ }
+
+ public void setPrice(Double price) {
+ this.price = price;
+ }
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/main/java/org/jbpm/trainticketdemo/domain/TicketRequest.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/main/java/org/jbpm/trainticketdemo/domain/TicketRequest.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/main/java/org/jbpm/trainticketdemo/domain/TicketRequest.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,85 @@
+/*
+ * 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.trainticketdemo.domain;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author Joram Barrez
+ */
+public class TicketRequest implements Serializable{
+
+ private static final long serialVersionUID = 1L;
+
+ private String from;
+
+ private String to;
+
+ private String cellPhoneNr;
+
+ private Date date;
+
+ public TicketRequest() {
+
+ }
+
+ public TicketRequest(String from, String to, String cellPhoneNr, Date date) {
+ this.from = from;
+ this.to = to;
+ this.cellPhoneNr = cellPhoneNr;
+ this.date = date;
+ }
+
+ public String getFrom() {
+ return from;
+ }
+
+ public void setFrom(String from) {
+ this.from = from;
+ }
+
+ public String getTo() {
+ return to;
+ }
+
+ public void setTo(String to) {
+ this.to = to;
+ }
+
+ public String getCellPhoneNr() {
+ return cellPhoneNr;
+ }
+
+ public void setCellPhoneNr(String cellPhoneNr) {
+ this.cellPhoneNr = cellPhoneNr;
+ }
+
+ public Date getDate() {
+ return date;
+ }
+
+ public void setDate(Date date) {
+ this.date = date;
+ }
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/main/java/org/jbpm/trainticketdemo/domain/User.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/main/java/org/jbpm/trainticketdemo/domain/User.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/main/java/org/jbpm/trainticketdemo/domain/User.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.trainticketdemo.domain;
+
+/**
+ * @author Joram Barrez
+ */
+public class User {
+
+ private long id;
+
+ private String name;
+
+ private String cellphoneNr;
+
+ // In real application this should 'int pennies' !
+ private double currentCredit;
+
+ public User() {
+
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getCellphoneNr() {
+ return cellphoneNr;
+ }
+
+ public void setCellphoneNr(String cellphoneNr) {
+ this.cellphoneNr = cellphoneNr;
+ }
+
+ public double getCurrentCredit() {
+ return currentCredit;
+ }
+
+ public void setCurrentCredit(double currentCredit) {
+ this.currentCredit = currentCredit;
+ }
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/main/resources/org/jbpm/trainticketdemo/domain/User.hbm.xml
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/main/resources/org/jbpm/trainticketdemo/domain/User.hbm.xml (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/src/main/resources/org/jbpm/trainticketdemo/domain/User.hbm.xml 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping>
+
+ <class name="org.jbpm.trainticketdemo.domain.User" table="USERS">
+
+ <id name="id" column="ID">
+ <generator class="native" />
+ </id>
+
+ <property name="name" column="NAME" />
+ <property name="cellphoneNr" column="CELL_PHONE" unique="true"/>
+ <property name="currentCredit" column="CREDIT" />
+
+ </class>
+
+</hibernate-mapping>
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/target/classes/org/jbpm/trainticketdemo/domain/User.hbm.xml
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/target/classes/org/jbpm/trainticketdemo/domain/User.hbm.xml (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/domain/target/classes/org/jbpm/trainticketdemo/domain/User.hbm.xml 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,18 @@
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+
+<hibernate-mapping>
+
+ <class name="org.jbpm.trainticketdemo.domain.User" table="USERS">
+
+ <id name="id" column="ID">
+ <generator class="native" />
+ </id>
+
+ <property name="name" column="NAME" />
+ <property name="cellphoneNr" column="CELL_PHONE" unique="true"/>
+ <property name="currentCredit" column="CREDIT" />
+
+ </class>
+
+</hibernate-mapping>
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/ear/.project
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/ear/.project (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/ear/.project 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,10 @@
+<projectDescription>
+ <name>jbpm-on-rails-ear</name>
+ <comment/>
+ <projects>
+ <project>jbpm-on-rails-ejb</project>
+ <project>jbpm-on-rails-war</project>
+ </projects>
+ <buildSpec/>
+ <natures/>
+</projectDescription>
\ No newline at end of file
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/ear/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/ear/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/ear/.settings/org.eclipse.jdt.core.prefs 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,5 @@
+#Fri Aug 14 09:19:23 CEST 2009
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/ear/pom.xml
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/ear/pom.xml (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/ear/pom.xml 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jbpm-on-rails-ear</artifactId>
+ <packaging>ear</packaging>
+ <name>jbpm-on-rails-ear</name>
+
+ <parent>
+ <groupId>org.jbpm.trainticketdemo</groupId>
+ <artifactId>jbpm-on-rails</artifactId>
+ <version>1.0</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jbpm.trainticketdemo</groupId>
+ <artifactId>jbpm-on-rails-ejb</artifactId>
+ <version>1.0</version>
+ <type>ejb</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.trainticketdemo</groupId>
+ <artifactId>jbpm-on-rails-war</artifactId>
+ <version>1.0</version>
+ <type>war</type>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-ear-plugin</artifactId>
+ <configuration>
+ <finalName>jbpm-on-rails</finalName>
+ <modules>
+ <webModule>
+ <groupId>org.jbpm.trainticketdemo</groupId>
+ <artifactId>jbpm-on-rails-war</artifactId>
+ <contextRoot>/jbpm-on-rails</contextRoot>
+ </webModule>
+ <ejbModule>
+ <groupId>org.jbpm.trainticketdemo</groupId>
+ <artifactId>jbpm-on-rails-ejb</artifactId>
+ </ejbModule>
+ </modules>
+ <defaultLibBundleDir>lib</defaultLibBundleDir> <!-- Default folder for shared classpath -->
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/.classpath
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/.classpath (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/.classpath 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,8 @@
+<classpath>
+ <classpathentry kind="src" path="src/test/java" output="target/test-classes" including="**/*.java"/>
+ <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
+ <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
+ <classpathentry kind="output" path="target/classes"/>
+ <classpathentry kind="var" path="M2_REPO/javax/ejb/ejb-api/3.0/ejb-api-3.0.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+</classpath>
\ No newline at end of file
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/.project
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/.project (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/.project 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,13 @@
+<projectDescription>
+ <name>jbpm-on-rails-ejb</name>
+ <comment/>
+ <projects/>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
\ No newline at end of file
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/.settings/org.eclipse.jdt.core.prefs 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,5 @@
+#Fri Aug 14 09:19:23 CEST 2009
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/pom.xml
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/pom.xml (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/pom.xml 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jbpm-on-rails-ejb</artifactId>
+ <packaging>jar</packaging>
+ <name>jbpm-on-rails-ejb</name>
+
+ <parent>
+ <groupId>org.jbpm.trainticketdemo</groupId>
+ <artifactId>jbpm-on-rails</artifactId>
+ <version>1.0</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jbpm.trainticketdemo</groupId>
+ <artifactId>jbpm-on-rails-domain</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.trainticketdemo</groupId>
+ <artifactId>jbpm-on-rails-process-logic</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.trainticketdemo</groupId>
+ <artifactId>jbpm-on-rails-jboss-integration</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.ejb</groupId>
+ <artifactId>ejb-api</artifactId>
+ <version>3.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-annotations-ejb3</artifactId>
+ <version>4.2.3.GA</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.annotation</groupId>
+ <artifactId>jsr250-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-jpdl</artifactId>
+ <version>4.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-spi</artifactId>
+ <version>4.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>com.espertech</groupId>
+ <artifactId>esper</artifactId>
+ <version>3.1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.10</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-ejb-plugin</artifactId>
+ <configuration>
+ <ejbVersion>3.0</ejbVersion>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
+</project>
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/bi/esper/EpServiceProviderFactory.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/bi/esper/EpServiceProviderFactory.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/bi/esper/EpServiceProviderFactory.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,58 @@
+package org.jbpm.trainticketdemo.bi.esper;
+
+import org.jbpm.trainticketdemo.bi.subscriber.MoneyTrackerSubscriber;
+import org.jbpm.trainticketdemo.bi.subscriber.ResponseTimingSubscriber;
+
+import com.espertech.esper.client.Configuration;
+import com.espertech.esper.client.EPAdministrator;
+import com.espertech.esper.client.EPServiceProvider;
+import com.espertech.esper.client.EPServiceProviderManager;
+import com.espertech.esper.client.EPStatement;
+
+
+public class EpServiceProviderFactory {
+
+ private static EPServiceProvider epServiceProvider;
+
+ public static EPServiceProvider getDefaultProvider() {
+
+ if (epServiceProvider == null) {
+
+ synchronized (EpServiceProviderFactory.class) {
+
+ if (epServiceProvider == null) {
+ Configuration config = new Configuration();
+ config.addEventTypeAutoName("org.jbpm.trainticketdemo.event");
+ epServiceProvider = EPServiceProviderManager.getDefaultProvider(config);
+ initStatements(epServiceProvider);
+ }
+
+ }
+ }
+
+ return epServiceProvider;
+ }
+
+ private static void initStatements(EPServiceProvider epServiceProvider) {
+ EPServiceProvider epService = EPServiceProviderManager.getDefaultProvider();
+ EPAdministrator admin = epService.getEPAdministrator();
+
+ // Aggregation of money made the last 15 seconds
+ EPStatement moneyTracking = admin.createEPL(
+ "select count(*) as nrOfTickets, sum(amount) as total, " +
+ "avg(amount) as average, stddev(amount) as stddev " +
+ "from TicketSoldEvent.win:time(15 sec)");
+
+ moneyTracking.setSubscriber(new MoneyTrackerSubscriber());
+
+ // SLA for the time between the ticket request receival and the quote sending
+ EPStatement responseTimings = admin.createEPL(
+ "select TicketRequestReceivedEvent.timestamp as ticketRcvTime, QuoteSentEvent.timestamp as quoteSentTime, " +
+ "TicketRequestReceivedEvent.processInstanceId as processInstanceId " +
+ "from TicketRequestReceivedEvent.win:time(24 hours) inner join QuoteSentEvent.win:time(24 hours) " +
+ "on TicketRequestReceivedEvent.processInstanceId = QuoteSentEvent.processInstanceId");
+
+ responseTimings.setSubscriber(new ResponseTimingSubscriber());
+ }
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/bi/esper/EventQueueProcessor.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/bi/esper/EventQueueProcessor.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/bi/esper/EventQueueProcessor.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,55 @@
+package org.jbpm.trainticketdemo.bi.esper;
+
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import javax.jms.JMSException;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.ObjectMessage;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jbpm.trainticketdemo.constants.JmsConstants;
+
+import com.espertech.esper.client.EPServiceProvider;
+
+/**
+ * Message-Driven Bean implementation class for: EventQueueProcessor
+ *
+ */
+ at MessageDriven(activationConfig =
+{
+ @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
+ @ActivationConfigProperty(propertyName="destination", propertyValue=JmsConstants.EVENT_QUEUE)
+})
+public class EventQueueProcessor implements MessageListener {
+
+ private static Log LOGGER = LogFactory.getLog(EventQueueProcessor.class);
+
+ private EPServiceProvider epsProvider;
+
+ public EventQueueProcessor() {
+ this.epsProvider = EpServiceProviderFactory.getDefaultProvider();
+ }
+
+ /**
+ * When a message arrives:
+ * check if it is an event object and hand it over to the Esper engine, else discard it.
+ */
+ public void onMessage(Message message) {
+
+ try {
+ if (message instanceof ObjectMessage) {
+
+ ObjectMessage objMsg = (ObjectMessage) message;
+ Object obj = objMsg.getObject();
+ epsProvider.getEPRuntime().sendEvent(obj);
+
+ }
+ } catch (JMSException e) {
+ LOGGER.error(e);
+ }
+
+ }
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/bi/subscriber/MoneyTrackerSubscriber.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/bi/subscriber/MoneyTrackerSubscriber.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/bi/subscriber/MoneyTrackerSubscriber.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,76 @@
+/*
+ * 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.trainticketdemo.bi.subscriber;
+
+import java.sql.Connection;
+import java.sql.Date;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.sql.Timestamp;
+
+import org.jbpm.trainticketdemo.bi.util.DataSourceUtil;
+
+/**
+ * @author Joram Barrez
+ */
+public class MoneyTrackerSubscriber {
+
+ public void update(Long nrOfTickets, Double total, Double average, Double stddev) {
+ Connection connection = DataSourceUtil.getConnection();
+
+ try {
+ if (connection != null) {
+
+ if (nrOfTickets == null)
+ nrOfTickets = 1L;
+ if (total == null)
+ total = 0.0;
+ if (average == null)
+ average = 0.0;
+ if (stddev == null || nrOfTickets.equals(new Long(1))) { // Special case: sstdev of 1 sample does not exist
+ stddev = 0.0;
+ }
+
+ PreparedStatement stm = connection
+ .prepareStatement("INSERT INTO TICKET_SALES(NR_SAMPLES, TOTAL_PRICE, AVERAGE_PRICE, STDDEV_PRICE, TIME_STAMP) VALUES(?,?,?,?,?)");
+ stm.setLong(1, nrOfTickets);
+ stm.setDouble(2, total);
+ stm.setDouble(3, average);
+ stm.setDouble(4, stddev);
+ stm.setTimestamp(5, new Timestamp(new java.util.Date().getTime()));
+ stm.executeUpdate();
+ stm.close();
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ if (connection != null) {
+ try {
+ connection.close();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/bi/subscriber/ResponseTimingSubscriber.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/bi/subscriber/ResponseTimingSubscriber.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/bi/subscriber/ResponseTimingSubscriber.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,72 @@
+/*
+ * 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.trainticketdemo.bi.subscriber;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jbpm.trainticketdemo.bi.util.DataSourceUtil;
+
+/**
+ * @author Joram Barrez
+ */
+public class ResponseTimingSubscriber {
+
+ private static final Log LOGGER = LogFactory.getLog(ResponseTimingSubscriber.class);
+
+ public void update(Long ticketRcvTime, Long quoteSentTime, String processInstanceId) {
+ Connection connection = DataSourceUtil.getConnection();
+
+ try {
+
+ Long interval = null;
+ if (ticketRcvTime != null && quoteSentTime != null) {
+ interval = (quoteSentTime - ticketRcvTime) / 1000000;
+ }
+
+ if (interval != null) {
+ if (connection != null) {
+ PreparedStatement stm = connection.prepareStatement(
+ "INSERT INTO TICKET_RESPONSE_TIMINGS(PROC_INST_ID, INTERVAL_TIME) VALUES(?,?)");
+ stm.setString(1, processInstanceId);
+ stm.setLong(2, interval);
+ stm.executeUpdate();
+ stm.close();
+ }
+ }
+ } catch (Exception e) {
+ LOGGER.error(e);
+ } finally {
+ if (connection != null) {
+ try {
+ connection.close();
+ } catch (SQLException e) {
+ LOGGER.error(e);
+ }
+ }
+ }
+ }
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/bi/util/DataSourceUtil.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/bi/util/DataSourceUtil.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/bi/util/DataSourceUtil.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,63 @@
+/*
+ * 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.trainticketdemo.bi.util;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+
+import javax.naming.InitialContext;
+import javax.sql.DataSource;
+
+/**
+ * @author Joram Barrez
+ */
+public class DataSourceUtil {
+
+ private static final String DATASOURCE = "java:JbpmDS";
+
+ private static DataSource cache;
+
+ public static Connection getConnection() {
+
+ if (cache == null) {
+ synchronized (DataSourceUtil.class) {
+ if (cache == null) {
+ try {
+ InitialContext context = new InitialContext();
+ cache = (javax.sql.DataSource) context.lookup(DATASOURCE);
+ } catch (Exception e) {
+ throw new RuntimeException("Couldnt obtain " + DATASOURCE);
+ }
+ }
+ }
+ }
+
+ try {
+ return cache.getConnection();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ return null;
+ }
+
+ }
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/business/TicketServiceImpl.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/business/TicketServiceImpl.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/business/TicketServiceImpl.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,100 @@
+/*
+ * 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.trainticketdemo.business;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Local;
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
+import org.apache.log4j.Logger;
+import org.jbpm.api.ExecutionService;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.TaskService;
+import org.jbpm.api.task.Task;
+import org.jbpm.trainticketdemo.domain.TicketRequest;
+import org.jbpm.trainticketdemo.helper.ProcessEngineUtil;
+import org.jbpm.trainticketdemo.variable.ProcessVariable;
+
+/**
+ * @author Joram Barrez
+ */
+ at Remote(TicketService.class)
+ at Local(TicketService.class)
+ at Stateless
+public class TicketServiceImpl implements TicketService {
+
+ private static final Logger LOG = Logger.getLogger(TicketServiceImpl.class);
+
+ private ExecutionService executionService;
+
+ private TaskService taskService;
+
+ private static final String TICKET_PROCESS = "ticketProcess";
+
+ @PostConstruct
+ private void initServices() {
+ this.executionService = ProcessEngineUtil.getProcessEngine().getExecutionService();
+ this.taskService = ProcessEngineUtil.getProcessEngine().getTaskService();
+ }
+
+ public void handleTicketRequest(TicketRequest ticketRequest) {
+
+ if (LOG.isInfoEnabled()) {
+ LOG.info("TicketService received ticket request from " + ticketRequest.getCellPhoneNr());
+ LOG.info("Starting new Ticket Process ...");
+ }
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put(ProcessVariable.TICKET_REQUEST, ticketRequest);
+ ProcessInstance processInstance = executionService.startProcessInstanceByKey(TICKET_PROCESS, variables);
+
+ if (LOG.isInfoEnabled()) {
+ LOG.info("Ticket Process with process instance id " + processInstance.getId() + " started");
+ }
+ }
+
+ public void handleTicketAcceptance(String acceptanceId, String cellPhoneNr) {
+
+ if (LOG.isInfoEnabled()) {
+ LOG.info("Ticket acceptance message received from " + cellPhoneNr);
+ }
+
+ Task task = taskService.createTaskQuery()
+ .processInstanceId("ticketProcess." + acceptanceId)
+ .assignee(cellPhoneNr)
+ .uniqueResult();
+
+ if (task!= null) {
+ taskService.completeTask(task.getId());
+ if (LOG.isInfoEnabled()) {
+ LOG.info("Task " + task.getId() + " completed by " + cellPhoneNr);
+ }
+ }
+
+
+ }
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/business/external/QuoteServiceImpl.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/business/external/QuoteServiceImpl.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/business/external/QuoteServiceImpl.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,52 @@
+/*
+ * 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.trainticketdemo.business.external;
+
+import java.text.DecimalFormat;
+import java.util.Random;
+
+import javax.ejb.Local;
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+
+import org.jbpm.trainticketdemo.domain.Quote;
+import org.jbpm.trainticketdemo.domain.TicketRequest;
+
+/**
+ * @author Joram Barrez
+ */
+ at Remote(QuoteService.class)
+ at Local(QuoteService.class)
+ at Stateless
+public class QuoteServiceImpl implements QuoteService {
+
+ private Random random = new Random();
+
+ private DecimalFormat df = new DecimalFormat("#.##");
+
+ public Quote calculateQuote(TicketRequest ticketRequest) {
+ Quote quote = new Quote(ticketRequest);
+ quote.setPrice(new Double(df.format(random.nextInt(20) + random.nextDouble())));
+ return quote;
+ }
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/helper/DbSchemaUtil.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/helper/DbSchemaUtil.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/helper/DbSchemaUtil.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,105 @@
+/*
+ * 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.trainticketdemo.helper;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import javax.naming.InitialContext;
+import javax.sql.DataSource;
+
+/**
+ * Utility class to create/drop schema.
+ *
+ * Use only for demo purposes!
+ *
+ * @author Joram Barrez
+ */
+public final class DbSchemaUtil {
+
+ public static final void createSchema() {
+ executeDdl(readFile("/jbpm.hsqldb.create.sql"));
+ }
+
+ public static final void dropSchema() {
+ executeDdl(readFile("/jbpm.hsqldb.drop.sql"));
+ }
+
+ private static final void executeDdl(String ddl) {
+ Connection conn = null;
+ Statement stm = null;
+ try {
+ InitialContext context = new InitialContext();
+ DataSource ds = (DataSource) context.lookup("java:JbpmDS");
+ conn = ds.getConnection();
+ stm = ds.getConnection().createStatement();
+ stm.execute(ddl);
+ stm.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ if (stm != null) {
+ try {
+ stm.close();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+ if (conn != null) {
+ try {
+ conn.close();
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ private static String readFile(String fileName) {
+ BufferedReader br = null;
+ StringBuilder strb = new StringBuilder();
+ try {
+ br = new BufferedReader(new InputStreamReader(DbSchemaUtil.class.getResourceAsStream(fileName)));
+ String line = br.readLine();
+ while (line != null) {
+ strb.append(line);
+ line = br.readLine();
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ if (br != null) {
+ try {
+ br.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ return strb.toString();
+ }
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/helper/ProcessEngineManagerImpl.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/helper/ProcessEngineManagerImpl.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/helper/ProcessEngineManagerImpl.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.trainticketdemo.helper;
+
+import javax.ejb.Local;
+import javax.naming.InitialContext;
+
+import org.apache.log4j.Logger;
+import org.jboss.annotation.ejb.Depends;
+import org.jboss.annotation.ejb.Management;
+import org.jboss.annotation.ejb.Service;
+import org.jbpm.api.NewDeployment;
+import org.jbpm.api.ProcessEngine;
+import org.jbpm.trainticketdemo.business.ProcessEngineManager;
+import org.jbpm.trainticketdemo.integration.ProcessEngineReference;
+
+/**
+ * @author Joram Barrez
+ */
+ at Service
+ at Management(ProcessEngineManager.class)
+ at Local(ProcessEngineManager.class)
+public class ProcessEngineManagerImpl implements ProcessEngineManager {
+
+ private static final Logger LOG = Logger.getLogger(ProcessEngineManagerImpl.class);
+
+ private static final String JNDI_NAME = "java:/ProcessEngine";
+
+ private static ProcessEngine processEngine;
+
+ /**
+ * Service management lifecycle callback.
+ * Will be called when dependencies after object construction
+ * and dependency resolution.
+ */
+ public void start() throws Exception {
+ LOG.info("Binding jBPM ProcessEngine to JNDI ... ");
+ InitialContext context = new InitialContext();
+ context.bind(JNDI_NAME, new ProcessEngineReference());
+ LOG.info("jBPM ProcessEngine bound to " + JNDI_NAME);
+
+ LOG.info("ReCreating DB Schema ...");
+ try {
+ DbSchemaUtil.dropSchema();
+ } catch (Exception e) {} // Assuming that the DB was empty
+ DbSchemaUtil.createSchema();
+
+ LOG.info("Deploying all demo processes");
+ deployProcesses();
+
+ }
+
+ private void deployProcesses() {
+ // Train ticket process
+ NewDeployment deployment = ProcessEngineUtil.getProcessEngine().getRepositoryService().createDeployment();
+ deployment.addResourceFromClasspath("org/jbpm/trainticketdemo/process.jpdl.xml");
+ deployment.addResourceFromClasspath("org/jbpm/trainticketdemo/process.png");
+ deployment.addResourceFromClasspath("org/jbpm/trainticketdemo/trainticket_startform.ftl");
+ deployment.setName("Ticket train DEMO deployment");
+ deployment.deploy();
+ LOG.info("Deployed process: trainTicket");
+ }
+
+ /*
+ private void bindServerConfigToJmx() {
+ MBeanServerLocator mBeanServerLocator = new MBeanServerLocator();
+ MBeanServer mBeanServer = mBeanServerLocator.getMbeanServer();
+ try {
+ mBeanServer.registerMBean(new org.jbpm.trainticketdemo.helper.ServerConfiguration(),
+ new ObjectName("org.jbpm:service=ServerConfig"));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }*/
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/helper/ProcessEngineUtil.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/helper/ProcessEngineUtil.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/helper/ProcessEngineUtil.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.trainticketdemo.helper;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jbpm.api.ProcessEngine;
+
+/**
+ * @author Joram Barrez
+ */
+public final class ProcessEngineUtil {
+
+ public static final ProcessEngine getProcessEngine() {
+ try {
+ InitialContext ctx = new InitialContext();
+ Object obj = ctx.lookup("java:/ProcessEngine");
+ return (ProcessEngine) obj;
+ } catch (NamingException e) {
+ throw new RuntimeException("Couldn't retrieve process engine from JNDI");
+ }
+ }
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/helper/ServerConfigManagement.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/helper/ServerConfigManagement.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/helper/ServerConfigManagement.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.trainticketdemo.helper;
+
+/**
+ * @author Joram Barrez
+ */
+public interface ServerConfigManagement {
+
+ /* ---------------------
+ * Management callbacks
+ * --------------------- */
+
+ void start() throws Exception;
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/helper/ServerConfiguration.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/helper/ServerConfiguration.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/java/org/jbpm/trainticketdemo/helper/ServerConfiguration.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,58 @@
+package org.jbpm.trainticketdemo.helper;
+
+import java.io.File;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.annotation.ejb.Management;
+import org.jboss.annotation.ejb.Service;
+import org.jbpm.integration.spi.mgmt.ServerConfig;
+
+// Extremely simple ServerConfig implementation
+//@Service(objectName = "org.jbpm:service=ServerConfig")
+//@Management(ServerConfigManagement.class)
+public class ServerConfiguration implements ServerConfig, ServerConfigManagement {
+
+ private static final Log LOG = LogFactory.getLog(ServerConfiguration.class);
+
+ private String webServiceHost = "127.0.0.1";
+
+ private int webServicePort = 8080;
+
+ public void start() throws Exception {
+ LOG.info("------------------------ Starting ServerConfiguration");
+ }
+
+ public File getHomeDir() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getImplementationTitle() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getImplementationVersion() {
+ throw new UnsupportedOperationException();
+ }
+
+ public File getServerDataDir() {
+ throw new UnsupportedOperationException();
+ }
+
+ public File getServerTempDir() {
+ throw new UnsupportedOperationException();
+ }
+
+ public String getWebServiceHost() {
+ return webServiceHost;
+ }
+
+ public int getWebServicePort() {
+ return webServicePort;
+ }
+
+ public int getWebServiceSecurePort() {
+ throw new UnsupportedOperationException();
+ }
+
+}
\ No newline at end of file
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/resources/jbpm.hsqldb.create.sql
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/resources/jbpm.hsqldb.create.sql (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/resources/jbpm.hsqldb.create.sql 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,514 @@
+ create table JBPM4_DEPLOYMENT (
+ DBID_ bigint generated by default as identity (start with 1),
+ NAME_ longvarchar,
+ TIMESTAMP_ bigint,
+ STATE_ varchar(255),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_DEPLOYPROP (
+ DBID_ bigint generated by default as identity (start with 1),
+ DEPLOYMENT_ bigint,
+ OBJNAME_ varchar(255),
+ KEY_ varchar(255),
+ STRINGVAL_ varchar(255),
+ LONGVAL_ bigint,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_EXECUTION (
+ DBID_ bigint generated by default as identity (start with 1),
+ CLASS_ varchar(255) not null,
+ DBVERSION_ integer not null,
+ ACTIVITYNAME_ varchar(255),
+ PROCDEFID_ varchar(255),
+ HASVARS_ bit,
+ NAME_ varchar(255),
+ KEY_ varchar(255),
+ ID_ varchar(255),
+ STATE_ varchar(255),
+ SUSPHISTSTATE_ varchar(255),
+ PRIORITY_ integer,
+ HISACTINST_ bigint,
+ PARENT_ bigint,
+ INSTANCE_ bigint,
+ SUPEREXEC_ bigint,
+ SUBPROCINST_ bigint,
+ PARENT_IDX_ integer,
+ primary key (DBID_),
+ unique (ID_)
+ );
+
+ create table JBPM4_HIST_ACTINST (
+ DBID_ bigint generated by default as identity (start with 1),
+ CLASS_ varchar(255) not null,
+ DBVERSION_ integer not null,
+ HPROCI_ bigint,
+ TYPE_ varchar(255),
+ EXECUTION_ varchar(255),
+ ACTIVITY_NAME_ varchar(255),
+ START_ timestamp,
+ END_ timestamp,
+ DURATION_ bigint,
+ TRANSITION_ varchar(255),
+ NEXTIDX_ integer,
+ HTASK_ bigint,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_HIST_DETAIL (
+ DBID_ bigint generated by default as identity (start with 1),
+ CLASS_ varchar(255) not null,
+ DBVERSION_ integer not null,
+ USERID_ varchar(255),
+ TIME_ timestamp,
+ HPROCI_ bigint,
+ HPROCIIDX_ integer,
+ HACTI_ bigint,
+ HACTIIDX_ integer,
+ HTASK_ bigint,
+ HTASKIDX_ integer,
+ HVAR_ bigint,
+ HVARIDX_ integer,
+ MESSAGE_ longvarchar,
+ OLD_INT_ integer,
+ NEW_INT_ integer,
+ OLD_STR_ varchar(255),
+ NEW_STR_ varchar(255),
+ OLD_TIME_ timestamp,
+ NEW_TIME_ timestamp,
+ PARENT_ bigint,
+ PARENT_IDX_ integer,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_HIST_PROCINST (
+ DBID_ bigint not null,
+ DBVERSION_ integer not null,
+ ID_ varchar(255),
+ PROCDEFID_ varchar(255),
+ KEY_ varchar(255),
+ START_ timestamp,
+ END_ timestamp,
+ DURATION_ bigint,
+ STATE_ varchar(255),
+ ENDACTIVITY_ varchar(255),
+ NEXTIDX_ integer,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_HIST_TASK (
+ DBID_ bigint not null,
+ DBVERSION_ integer not null,
+ EXECUTION_ varchar(255),
+ OUTCOME_ varchar(255),
+ ASSIGNEE_ varchar(255),
+ PRIORITY_ integer,
+ STATE_ varchar(255),
+ CREATE_ timestamp,
+ END_ timestamp,
+ DURATION_ bigint,
+ NEXTIDX_ integer,
+ SUPERTASK_ bigint,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_HIST_VAR (
+ DBID_ bigint not null,
+ DBVERSION_ integer not null,
+ PROCINSTID_ varchar(255),
+ EXECUTIONID_ varchar(255),
+ VARNAME_ varchar(255),
+ VALUE_ varchar(255),
+ HPROCI_ bigint,
+ HTASK_ bigint,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_ID_GROUP (
+ DBID_ bigint generated by default as identity (start with 1),
+ DBVERSION_ integer not null,
+ ID_ varchar(255),
+ NAME_ varchar(255),
+ TYPE_ varchar(255),
+ PARENT_ bigint,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_ID_MEMBERSHIP (
+ DBID_ bigint generated by default as identity (start with 1),
+ DBVERSION_ integer not null,
+ USER_ bigint,
+ GROUP_ bigint,
+ NAME_ varchar(255),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_ID_USER (
+ DBID_ bigint generated by default as identity (start with 1),
+ DBVERSION_ integer not null,
+ ID_ varchar(255),
+ PASSWORD_ varchar(255),
+ GIVENNAME_ varchar(255),
+ FAMILYNAME_ varchar(255),
+ BUSINESSEMAIL_ varchar(255),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_JOB (
+ DBID_ bigint generated by default as identity (start with 1),
+ CLASS_ varchar(255) not null,
+ DBVERSION_ integer not null,
+ DUEDATE_ timestamp,
+ STATE_ varchar(255),
+ ISEXCLUSIVE_ bit,
+ LOCKOWNER_ varchar(255),
+ LOCKEXPTIME_ timestamp,
+ EXCEPTION_ longvarchar,
+ RETRIES_ integer,
+ PROCESSINSTANCE_ bigint,
+ EXECUTION_ bigint,
+ CFG_ bigint,
+ SIGNAL_ varchar(255),
+ EVENT_ varchar(255),
+ REPEAT_ varchar(255),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_LOB (
+ DBID_ bigint generated by default as identity (start with 1),
+ DBVERSION_ integer not null,
+ BLOB_VALUE_ longvarbinary,
+ DEPLOYMENT_ bigint,
+ NAME_ longvarchar,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_PARTICIPATION (
+ DBID_ bigint generated by default as identity (start with 1),
+ DBVERSION_ integer not null,
+ GROUPID_ varchar(255),
+ USERID_ varchar(255),
+ TYPE_ varchar(255),
+ TASK_ bigint,
+ SWIMLANE_ bigint,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_SWIMLANE (
+ DBID_ bigint generated by default as identity (start with 1),
+ DBVERSION_ integer not null,
+ NAME_ varchar(255),
+ ASSIGNEE_ varchar(255),
+ EXECUTION_ bigint,
+ primary key (DBID_)
+ );
+
+ create table JBPM4_TASK (
+ DBID_ bigint generated by default as identity (start with 1),
+ CLASS_ char(1) not null,
+ DBVERSION_ integer not null,
+ NAME_ varchar(255),
+ DESCR_ longvarchar,
+ STATE_ varchar(255),
+ SUSPHISTSTATE_ varchar(255),
+ ASSIGNEE_ varchar(255),
+ FORM_ varchar(255),
+ PRIORITY_ integer,
+ CREATE_ timestamp,
+ DUEDATE_ timestamp,
+ PROGRESS_ integer,
+ SIGNALLING_ bit,
+ EXECUTION_ID_ varchar(255),
+ ACTIVITY_NAME_ varchar(255),
+ HASVARS_ bit,
+ SUPERTASK_ bigint,
+ EXECUTION_ bigint,
+ PROCINST_ bigint,
+ SWIMLANE_ bigint,
+ TASKDEFNAME_ varchar(255),
+ primary key (DBID_)
+ );
+
+ create table JBPM4_VARIABLE (
+ DBID_ bigint generated by default as identity (start with 1),
+ CLASS_ varchar(255) not null,
+ DBVERSION_ integer not null,
+ KEY_ varchar(255),
+ CONVERTER_ varchar(255),
+ HIST_ bit,
+ EXECUTION_ bigint,
+ TASK_ bigint,
+ LOB_ bigint,
+ DATE_VALUE_ timestamp,
+ DOUBLE_VALUE_ double,
+ CLASSNAME_ varchar(255),
+ LONG_VALUE_ bigint,
+ STRING_VALUE_ varchar(255),
+ TEXT_VALUE_ longvarchar,
+ EXESYS_ bigint,
+ primary key (DBID_)
+ );
+
+ create index IDX_DEPLPROP_DEPL on JBPM4_DEPLOYPROP (DEPLOYMENT_);
+
+ alter table JBPM4_DEPLOYPROP
+ add constraint FK_DEPLPROP_DEPL
+ foreign key (DEPLOYMENT_)
+ references JBPM4_DEPLOYMENT;
+
+ create index IDX_EXEC_SUBPI on JBPM4_EXECUTION (SUBPROCINST_);
+
+ create index IDX_EXEC_PARENT on JBPM4_EXECUTION (PARENT_);
+
+ create index IDX_EXEC_SUPEREXEC on JBPM4_EXECUTION (SUPEREXEC_);
+
+ create index IDX_EXEC_INSTANCE on JBPM4_EXECUTION (INSTANCE_);
+
+ alter table JBPM4_EXECUTION
+ add constraint FK_EXEC_SUBPI
+ foreign key (SUBPROCINST_)
+ references JBPM4_EXECUTION;
+
+ alter table JBPM4_EXECUTION
+ add constraint FK_EXEC_INSTANCE
+ foreign key (INSTANCE_)
+ references JBPM4_EXECUTION;
+
+ alter table JBPM4_EXECUTION
+ add constraint FK_EXEC_SUPEREXEC
+ foreign key (SUPEREXEC_)
+ references JBPM4_EXECUTION;
+
+ alter table JBPM4_EXECUTION
+ add constraint FK_EXEC_PARENT
+ foreign key (PARENT_)
+ references JBPM4_EXECUTION;
+
+ create index IDX_HTI_HTASK on JBPM4_HIST_ACTINST (HTASK_);
+
+ create index IDX_HACTI_HPROCI on JBPM4_HIST_ACTINST (HPROCI_);
+
+ alter table JBPM4_HIST_ACTINST
+ add constraint FK_HACTI_HPROCI
+ foreign key (HPROCI_)
+ references JBPM4_HIST_PROCINST;
+
+ alter table JBPM4_HIST_ACTINST
+ add constraint FK_HTI_HTASK
+ foreign key (HTASK_)
+ references JBPM4_HIST_TASK;
+
+ create index IDX_HDET_HVAR on JBPM4_HIST_DETAIL (HVAR_);
+
+ create index IDX_HDET_HACTI on JBPM4_HIST_DETAIL (HACTI_);
+
+ create index IDX_HDET_HTASK on JBPM4_HIST_DETAIL (HTASK_);
+
+ create index IDX_HDETAIL_HVAR on JBPM4_HIST_DETAIL (HVAR_);
+
+ create index IDX_HDET_HPROCI on JBPM4_HIST_DETAIL (HPROCI_);
+
+ create index IDX_HDETAIL_HTASK on JBPM4_HIST_DETAIL (HTASK_);
+
+ create index IDX_HDETAIL_HACTI on JBPM4_HIST_DETAIL (HACTI_);
+
+ create index IDX_HDETAIL_HPROCI on JBPM4_HIST_DETAIL (HPROCI_);
+
+ alter table JBPM4_HIST_DETAIL
+ add constraint FK_HDETAIL_HVAR
+ foreign key (HVAR_)
+ references JBPM4_HIST_VAR;
+
+ alter table JBPM4_HIST_DETAIL
+ add constraint FK_HDETAIL_HPROCI
+ foreign key (HPROCI_)
+ references JBPM4_HIST_PROCINST;
+
+ alter table JBPM4_HIST_DETAIL
+ add constraint FK_HDETAIL_HTASK
+ foreign key (HTASK_)
+ references JBPM4_HIST_TASK;
+
+ alter table JBPM4_HIST_DETAIL
+ add constraint FK_HDETAIL_HACTI
+ foreign key (HACTI_)
+ references JBPM4_HIST_ACTINST;
+
+ alter table JBPM4_HIST_TASK
+ add constraint FK_HSUPERT_SUB
+ foreign key (SUPERTASK_)
+ references JBPM4_HIST_TASK;
+
+ create index IDX_HVAR_HTASK on JBPM4_HIST_VAR (HTASK_);
+
+ create index IDX_HVAR_HPROCI on JBPM4_HIST_VAR (HPROCI_);
+
+ alter table JBPM4_HIST_VAR
+ add constraint FK_HVAR_HPROCI
+ foreign key (HPROCI_)
+ references JBPM4_HIST_PROCINST;
+
+ alter table JBPM4_HIST_VAR
+ add constraint FK_HVAR_HTASK
+ foreign key (HTASK_)
+ references JBPM4_HIST_TASK;
+
+ create index IDX_GROUP_PARENT on JBPM4_ID_GROUP (PARENT_);
+
+ alter table JBPM4_ID_GROUP
+ add constraint FK_GROUP_PARENT
+ foreign key (PARENT_)
+ references JBPM4_ID_GROUP;
+
+ create index IDX_MEM_GROUP on JBPM4_ID_MEMBERSHIP (GROUP_);
+
+ create index IDX_MEM_USER on JBPM4_ID_MEMBERSHIP (USER_);
+
+ alter table JBPM4_ID_MEMBERSHIP
+ add constraint FK_MEM_GROUP
+ foreign key (GROUP_)
+ references JBPM4_ID_GROUP;
+
+ alter table JBPM4_ID_MEMBERSHIP
+ add constraint FK_MEM_USER
+ foreign key (USER_)
+ references JBPM4_ID_USER;
+
+ create index IDX_JOBRETRIES on JBPM4_JOB (RETRIES_);
+
+ create index IDX_JOBDUEDATE on JBPM4_JOB (DUEDATE_);
+
+ create index IDX_JOBLOCKEXP on JBPM4_JOB (LOCKEXPTIME_);
+
+ create index IDX_JOB_CFG on JBPM4_JOB (CFG_);
+
+ create index IDX_JOB_EXE on JBPM4_JOB (EXECUTION_);
+
+ create index IDX_JOB_PRINST on JBPM4_JOB (PROCESSINSTANCE_);
+
+ alter table JBPM4_JOB
+ add constraint FK_JOB_CFG
+ foreign key (CFG_)
+ references JBPM4_LOB;
+
+ create index IDX_LOB_DEPLOYMENT on JBPM4_LOB (DEPLOYMENT_);
+
+ alter table JBPM4_LOB
+ add constraint FK_LOB_DEPLOYMENT
+ foreign key (DEPLOYMENT_)
+ references JBPM4_DEPLOYMENT;
+
+ create index IDX_PART_TASK on JBPM4_PARTICIPATION (TASK_);
+
+ alter table JBPM4_PARTICIPATION
+ add constraint FK_PART_SWIMLANE
+ foreign key (SWIMLANE_)
+ references JBPM4_SWIMLANE;
+
+ alter table JBPM4_PARTICIPATION
+ add constraint FK_PART_TASK
+ foreign key (TASK_)
+ references JBPM4_TASK;
+
+ create index IDX_SWIMLANE_EXEC on JBPM4_SWIMLANE (EXECUTION_);
+
+ alter table JBPM4_SWIMLANE
+ add constraint FK_SWIMLANE_EXEC
+ foreign key (EXECUTION_)
+ references JBPM4_EXECUTION;
+
+ create index IDX_TASK_SUPERTASK on JBPM4_TASK (SUPERTASK_);
+
+ alter table JBPM4_TASK
+ add constraint FK_TASK_SWIML
+ foreign key (SWIMLANE_)
+ references JBPM4_SWIMLANE;
+
+ alter table JBPM4_TASK
+ add constraint FK_TASK_SUPERTASK
+ foreign key (SUPERTASK_)
+ references JBPM4_TASK;
+
+ create index IDX_VAR_EXESYS on JBPM4_VARIABLE (EXESYS_);
+
+ create index IDX_VAR_TASK on JBPM4_VARIABLE (TASK_);
+
+ create index IDX_VAR_EXECUTION on JBPM4_VARIABLE (EXECUTION_);
+
+ create index IDX_VAR_LOB on JBPM4_VARIABLE (LOB_);
+
+ alter table JBPM4_VARIABLE
+ add constraint FK_VAR_EXESYS
+ foreign key (EXESYS_)
+ references JBPM4_EXECUTION;
+
+ alter table JBPM4_VARIABLE
+ add constraint FK_VAR_LOB
+ foreign key (LOB_)
+ references JBPM4_LOB;
+
+ alter table JBPM4_VARIABLE
+ add constraint FK_VAR_TASK
+ foreign key (TASK_)
+ references JBPM4_TASK;
+
+ alter table JBPM4_VARIABLE
+ add constraint FK_VAR_EXECUTION
+ foreign key (EXECUTION_)
+ references JBPM4_EXECUTION;
+
+
+INSERT INTO JBPM4_ID_GROUP VALUES (1,0,'manager','manager','security-role',NULL);
+INSERT INTO JBPM4_ID_GROUP VALUES (2,0,'administrator','administrator','security-role',NULL);
+INSERT INTO JBPM4_ID_GROUP VALUES (3,0,'user','user','security-role',NULL);
+INSERT INTO JBPM4_ID_GROUP VALUES (4,0,'sales','sales',NULL,NULL);
+
+INSERT INTO JBPM4_ID_USER VALUES (1,0,'alex','password','Alex',NULL,'alex at jbpm.org');
+INSERT INTO JBPM4_ID_USER VALUES (2,0,'mike','password','Mike',NULL,'mike at jbpm.org');
+INSERT INTO JBPM4_ID_USER VALUES (3,0,'peter','password','Peter',NULL,'peter at jbpm.org');
+INSERT INTO JBPM4_ID_USER VALUES (4,0,'mary','password','Mary',NULL,'mary at jbpm.org');
+INSERT INTO JBPM4_ID_USER VALUES (5,0,'joram','password','Joram',NULL,'jbarrez at redhat.com');
+
+INSERT INTO JBPM4_ID_MEMBERSHIP VALUES (1,0,1,2,NULL);
+INSERT INTO JBPM4_ID_MEMBERSHIP VALUES (2,0,2,1,NULL);
+INSERT INTO JBPM4_ID_MEMBERSHIP VALUES (3,0,3,3,NULL);
+INSERT INTO JBPM4_ID_MEMBERSHIP VALUES (4,0,3,4,NULL);
+INSERT INTO JBPM4_ID_MEMBERSHIP VALUES (5,0,4,3,NULL);
+INSERT INTO JBPM4_ID_MEMBERSHIP VALUES (6,0,4,4,NULL);
+INSERT INTO JBPM4_ID_MEMBERSHIP VALUES (7,0,5,1,NULL);
+INSERT INTO JBPM4_ID_MEMBERSHIP VALUES (8,0,5,2,NULL);
+INSERT INTO JBPM4_ID_MEMBERSHIP VALUES (9,0,5,3,NULL);
+INSERT INTO JBPM4_ID_MEMBERSHIP VALUES (10,0,5,4,NULL);
+
+
+create table USERS (
+ ID bigint generated by default as identity (start with 1),
+ NAME varchar(255),
+ PASSWORD varchar(255),
+ CELL_PHONE varchar(255),
+ CREDIT DOUBLE,
+ primary key (ID),
+ CONSTRAINT UNIQUE_CELLPHONENR UNIQUE (CELL_PHONE)
+ );
+
+INSERT INTO USERS(NAME,CELL_PHONE, PASSWORD, CREDIT) VALUES('jBPMPhone', 'EMULATOR-http://localhost:4321/cellphone_sms_listener', 'test', 100.0);
+
+create table TICKET_RESPONSE_TIMINGS (
+ ID bigint generated by default as identity (start with 1),
+ PROC_INST_ID varchar(255),
+ INTERVAL_TIME BIGINT,
+ primary key (ID),)
+ );
+
+create table TICKET_SALES (
+ ID bigint generated by default as identity (start with 1),
+ NR_SAMPLES BIGINT,
+ TOTAL_PRICE DOUBLE,
+ AVERAGE_PRICE DOUBLE,
+ STDDEV_PRICE DOUBLE,
+ TIME_STAMP timestamp,
+ primary key (ID),)
+ );
+
+
\ No newline at end of file
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/resources/jbpm.hsqldb.drop.sql
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/resources/jbpm.hsqldb.drop.sql (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/resources/jbpm.hsqldb.drop.sql 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,128 @@
+
+
+ alter table JBPM4_DEPLOYPROP
+ drop constraint FK_DEPLPROP_DEPL;
+
+ alter table JBPM4_EXECUTION
+ drop constraint FK_EXEC_SUBPI;
+
+ alter table JBPM4_EXECUTION
+ drop constraint FK_EXEC_INSTANCE;
+
+ alter table JBPM4_EXECUTION
+ drop constraint FK_EXEC_SUPEREXEC;
+
+ alter table JBPM4_EXECUTION
+ drop constraint FK_EXEC_PARENT;
+
+ alter table JBPM4_HIST_ACTINST
+ drop constraint FK_HACTI_HPROCI;
+
+ alter table JBPM4_HIST_ACTINST
+ drop constraint FK_HTI_HTASK;
+
+ alter table JBPM4_HIST_DETAIL
+ drop constraint FK_HDETAIL_HVAR;
+
+ alter table JBPM4_HIST_DETAIL
+ drop constraint FK_HDETAIL_HPROCI;
+
+ alter table JBPM4_HIST_DETAIL
+ drop constraint FK_HDETAIL_HTASK;
+
+ alter table JBPM4_HIST_DETAIL
+ drop constraint FK_HDETAIL_HACTI;
+
+ alter table JBPM4_HIST_TASK
+ drop constraint FK_HSUPERT_SUB;
+
+ alter table JBPM4_HIST_VAR
+ drop constraint FK_HVAR_HPROCI;
+
+ alter table JBPM4_HIST_VAR
+ drop constraint FK_HVAR_HTASK;
+
+ alter table JBPM4_ID_GROUP
+ drop constraint FK_GROUP_PARENT;
+
+ alter table JBPM4_ID_MEMBERSHIP
+ drop constraint FK_MEM_GROUP;
+
+ alter table JBPM4_ID_MEMBERSHIP
+ drop constraint FK_MEM_USER;
+
+ alter table JBPM4_JOB
+ drop constraint FK_JOB_CFG;
+
+ alter table JBPM4_LOB
+ drop constraint FK_LOB_DEPLOYMENT;
+
+ alter table JBPM4_PARTICIPATION
+ drop constraint FK_PART_SWIMLANE;
+
+ alter table JBPM4_PARTICIPATION
+ drop constraint FK_PART_TASK;
+
+ alter table JBPM4_SWIMLANE
+ drop constraint FK_SWIMLANE_EXEC;
+
+ alter table JBPM4_TASK
+ drop constraint FK_TASK_SWIML;
+
+ alter table JBPM4_TASK
+ drop constraint FK_TASK_SUPERTASK;
+
+ alter table JBPM4_VARIABLE
+ drop constraint FK_VAR_EXESYS;
+
+ alter table JBPM4_VARIABLE
+ drop constraint FK_VAR_LOB;
+
+ alter table JBPM4_VARIABLE
+ drop constraint FK_VAR_TASK;
+
+ alter table JBPM4_VARIABLE
+ drop constraint FK_VAR_EXECUTION;
+
+ drop table JBPM4_DEPLOYMENT if exists;
+
+ drop table JBPM4_DEPLOYPROP if exists;
+
+ drop table JBPM4_EXECUTION if exists;
+
+ drop table JBPM4_HIST_ACTINST if exists;
+
+ drop table JBPM4_HIST_DETAIL if exists;
+
+ drop table JBPM4_HIST_PROCINST if exists;
+
+ drop table JBPM4_HIST_TASK if exists;
+
+ drop table JBPM4_HIST_VAR if exists;
+
+ drop table JBPM4_ID_GROUP if exists;
+
+ drop table JBPM4_ID_MEMBERSHIP if exists;
+
+ drop table JBPM4_ID_USER if exists;
+
+ drop table JBPM4_JOB if exists;
+
+ drop table JBPM4_LOB if exists;
+
+ drop table JBPM4_PARTICIPATION if exists;
+
+ drop table JBPM4_SWIMLANE if exists;
+
+ drop table JBPM4_TASK if exists;
+
+ drop table JBPM4_VARIABLE if exists;
+
+
+
+
+ drop table USERS if exists;
+
+ drop table TICKET_RESPONSE_TIMINGS if exists;
+
+ drop table TICKET_SALES if exists;
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/resources/logging.properties
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/resources/logging.properties (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/ejb/src/main/resources/logging.properties 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,18 @@
+handlers= java.util.logging.ConsoleHandler
+redirect.commons.logging = enabled
+
+java.util.logging.ConsoleHandler.level = FINE
+java.util.logging.ConsoleHandler.formatter = org.jbpm.internal.log.LogFormatter
+
+org.jbpm.level=FINEST
+# org.jbpm.pvm.internal.tx.level=FINE
+# org.jbpm.pvm.internal.wire.level=FINE
+# org.jbpm.pvm.internal.util.level=FINE
+
+org.hibernate.level=INFO
+org.hibernate.cfg.SettingsFactory.level=SEVERE
+org.hibernate.cfg.HbmBinder.level=SEVERE
+# org.hibernate.SQL.level=FINEST
+# org.hibernate.type.level=FINEST
+# org.hibernate.tool.hbm2ddl.SchemaExport.level=FINEST
+# org.hibernate.transaction.level=FINEST
\ No newline at end of file
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/jboss-integration/pom.xml
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/jboss-integration/pom.xml (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/jboss-integration/pom.xml 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,28 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jbpm-on-rails-jboss-integration</artifactId>
+ <packaging>jar</packaging>
+ <name>jbpm-on-rails-jboss-integration</name>
+
+ <parent>
+ <groupId>org.jbpm.trainticketdemo</groupId>
+ <artifactId>jbpm-on-rails</artifactId>
+ <version>1.0</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-jpdl</artifactId>
+ <version>4.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.trainticketdemo</groupId>
+ <artifactId>jbpm-on-rails-process-logic</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/jboss-integration/src/main/java/org/jbpm/trainticketdemo/integration/ProcessEngineFactory.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/jboss-integration/src/main/java/org/jbpm/trainticketdemo/integration/ProcessEngineFactory.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/jboss-integration/src/main/java/org/jbpm/trainticketdemo/integration/ProcessEngineFactory.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,53 @@
+/*
+ * 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.trainticketdemo.integration;
+
+import org.apache.log4j.Logger;
+import org.jbpm.api.Configuration;
+import org.jbpm.api.ProcessEngine;
+
+/**
+ * @author Joram Barrez
+ */
+public class ProcessEngineFactory {
+
+ private static final Logger LOG = Logger.getLogger(ProcessEngineFactory.class);
+
+ private static ProcessEngine processEngine;
+
+ public static ProcessEngine createProcessEngine() {
+ if (processEngine == null) {
+ synchronized (ProcessEngineFactory.class) {
+ if (processEngine == null) {
+ LOG.info("No cached ProcessEngine found, retrieving ProcessEngine");
+ processEngine = new Configuration().buildProcessEngine();
+ }
+ }
+ } else {
+ if (LOG.isInfoEnabled()) {
+ LOG.info("Found cached process engine instance");
+ }
+ }
+ return processEngine;
+ }
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/jboss-integration/src/main/java/org/jbpm/trainticketdemo/integration/ProcessEngineObjectFactory.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/jboss-integration/src/main/java/org/jbpm/trainticketdemo/integration/ProcessEngineObjectFactory.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/jboss-integration/src/main/java/org/jbpm/trainticketdemo/integration/ProcessEngineObjectFactory.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.trainticketdemo.integration;
+
+import java.util.Hashtable;
+
+import javax.naming.Context;
+import javax.naming.Name;
+import javax.naming.Reference;
+import javax.naming.spi.ObjectFactory;
+
+import org.jbpm.api.ProcessEngine;
+
+/**
+ * JNDI objectfactory for the jBPM {@link ProcessEngine}
+ *
+ * @author Joram Barrez
+ * @author Heiko Braun (original)
+ */
+public class ProcessEngineObjectFactory implements ObjectFactory {
+
+ public Object getObjectInstance(Object obj, Name name, Context context,
+ Hashtable<?, ?> env) throws Exception {
+
+ if (obj instanceof Reference) {
+ Reference ref = (Reference) obj;
+ if (ref.getClassName().equals(ProcessEngine.class.getName())) {
+ return ProcessEngineFactory.createProcessEngine();
+ }
+ }
+
+ return null;
+ }
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/jboss-integration/src/main/java/org/jbpm/trainticketdemo/integration/ProcessEngineReference.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/jboss-integration/src/main/java/org/jbpm/trainticketdemo/integration/ProcessEngineReference.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/jboss-integration/src/main/java/org/jbpm/trainticketdemo/integration/ProcessEngineReference.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,43 @@
+package org.jbpm.trainticketdemo.integration;
+import javax.naming.NamingException;
+import javax.naming.Reference;
+import javax.naming.Referenceable;
+import javax.naming.StringRefAddr;
+
+import org.jbpm.api.ProcessEngine;
+
+/*
+ * 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.
+ */
+
+/**
+ * @author Joram Barrez
+ * @author Heiko Braun (original)
+ */
+public class ProcessEngineReference implements Referenceable {
+
+ public Reference getReference() throws NamingException {
+ return new Reference(ProcessEngine.class.getName(),
+ new StringRefAddr("processEngine", "default"),
+ ProcessEngineObjectFactory.class.getName(), null);
+ }
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/pom.xml
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/pom.xml (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/pom.xml 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jbpm.trainticketdemo</groupId>
+ <artifactId>jbpm-on-rails</artifactId>
+ <version>1.0</version>
+ <packaging>pom</packaging>
+ <name>jbpm-on-rails</name>
+
+ <modules>
+ <module>domain</module>
+ <module>process-logic</module>
+ <module>ejb</module>
+ <module>war</module>
+ <module>ear</module>
+ <module>jboss-integration</module>
+ <module>bi-events</module>
+ </modules>
+
+ <repositories>
+ <repository>
+ <id>jboss</id>
+ <url>http://repository.jboss.com/maven2/</url>
+ </repository>
+ </repositories>
+
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ <version>1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.14</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>maven.java.net</id>
+ <name>Java.net Maven2 Repository</name>
+ <url>http://download.java.net/maven/2</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </build>
+
+</project>
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/.classpath
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/.classpath (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/.classpath 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,6 @@
+<classpath>
+ <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
+ <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
+ <classpathentry kind="output" path="target/classes"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+</classpath>
\ No newline at end of file
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/.project
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/.project (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/.project 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,13 @@
+<projectDescription>
+ <name>jbpm-on-rails-process-logic</name>
+ <comment/>
+ <projects/>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
\ No newline at end of file
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/.settings/org.eclipse.jdt.core.prefs 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,5 @@
+#Fri Aug 14 09:19:23 CEST 2009
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/pom.xml
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/pom.xml (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/pom.xml 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,36 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jbpm-on-rails-process-logic</artifactId>
+ <packaging>jar</packaging>
+ <name>jbpm-on-rails-process-logic</name>
+
+ <parent>
+ <groupId>org.jbpm.trainticketdemo</groupId>
+ <artifactId>jbpm-on-rails</artifactId>
+ <version>1.0</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-jpdl</artifactId>
+ <version>4.1-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.trainticketdemo</groupId>
+ <artifactId>jbpm-on-rails-domain</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.trainticketdemo</groupId>
+ <artifactId>jbpm-on-rails-bi-events</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.1</version>
+ </dependency>
+ </dependencies>
+</project>
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/action/CalculateQuoteAction.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/action/CalculateQuoteAction.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/action/CalculateQuoteAction.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,75 @@
+/*
+ * 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.trainticketdemo.action;
+
+import java.util.Date;
+
+import org.jbpm.api.activity.ActivityBehaviour;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.trainticketdemo.business.external.QuoteService;
+import org.jbpm.trainticketdemo.domain.Quote;
+import org.jbpm.trainticketdemo.domain.TicketRequest;
+import org.jbpm.trainticketdemo.util.EjbUtil;
+import org.jbpm.trainticketdemo.variable.ProcessVariable;
+
+/**
+ * @author Joram Barrez
+ */
+public class CalculateQuoteAction implements ActivityBehaviour {
+
+ private static final long serialVersionUID = 1L;
+
+ private QuoteService quoteService;
+
+ public CalculateQuoteAction() {
+ this.quoteService = EjbUtil.getQuoteServiceLocal();
+ }
+
+ public void execute(ActivityExecution activityExecution) throws Exception {
+ TicketRequest ticketRequest = getTicketRequest(activityExecution);
+ Quote quote = quoteService.calculateQuote(ticketRequest);
+ activityExecution.setVariable(ProcessVariable.QUOTE, quote);
+ }
+
+ /**
+ * When using the jBPM console, there is currently now way to set a Java
+ * object as a process variable. This methods checks if there is a
+ * {@link TicketRequest} stored as process variable, if so it returns this
+ * object. If not, a new {@link TicketRequest} is created from the console
+ * task form input and stored as a process variable.
+ */
+ private TicketRequest getTicketRequest(ActivityExecution execution) {
+ TicketRequest ticketRequest = (TicketRequest) execution.getVariable(ProcessVariable.TICKET_REQUEST);
+
+ if (ticketRequest == null) {
+ ticketRequest = new TicketRequest();
+ ticketRequest.setFrom((String) execution.getVariable(ProcessVariable.FROM));
+ ticketRequest.setTo((String) execution.getVariable(ProcessVariable.TO));
+ ticketRequest.setCellPhoneNr((String) execution.getVariable(ProcessVariable.CELLPHONE_NUMBER));
+ ticketRequest.setDate(new Date());
+ execution.setVariable(ProcessVariable.TICKET_REQUEST, ticketRequest);
+ }
+
+ return ticketRequest;
+ }
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/action/ChargeCustomerAction.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/action/ChargeCustomerAction.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/action/ChargeCustomerAction.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.trainticketdemo.action;
+
+import org.hibernate.Criteria;
+import org.hibernate.Session;
+import org.hibernate.criterion.Restrictions;
+import org.jbpm.api.activity.ActivityBehaviour;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.api.cmd.Environment;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.trainticketdemo.domain.Quote;
+import org.jbpm.trainticketdemo.domain.User;
+import org.jbpm.trainticketdemo.util.SmsUtil;
+import org.jbpm.trainticketdemo.variable.ProcessVariable;
+
+/**
+ * @author Joram Barrez
+ */
+public class ChargeCustomerAction implements ActivityBehaviour {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) throws Exception {
+
+ Quote quote = (Quote) execution.getVariable(ProcessVariable.QUOTE);
+ User user = getUser(quote);
+
+ // Deduct price of ticket
+ user.setCurrentCredit(user.getCurrentCredit() - quote.getPrice());
+ saveUser(user);
+
+ // Send thank you sms
+ SmsUtil.sendSms(quote, quote.getPrice() + " EUR has been deducted from your account."
+ + "Current balance : " + user.getCurrentCredit() + " EUR."
+ + "Thank you for travelling with jbpm-on-rails!");
+ }
+
+ private User getUser(Quote quote) {
+ Environment env = EnvironmentImpl.getCurrent();
+ Session session = env.get(Session.class);
+
+ Criteria criteria = session.createCriteria(User.class);
+ criteria.add(Restrictions.eq("cellphoneNr", quote.getTicketRequest().getCellPhoneNr()));
+ return (User) criteria.uniqueResult();
+ }
+
+ private void saveUser(User user) {
+ Environment env = EnvironmentImpl.getCurrent();
+ Session session = env.get(Session.class);
+ session.saveOrUpdate(user);
+ }
+
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/action/SendQuoteToCustomerAction.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/action/SendQuoteToCustomerAction.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/action/SendQuoteToCustomerAction.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,51 @@
+/*
+ * 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.trainticketdemo.action;
+
+import org.jbpm.api.activity.ActivityBehaviour;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.trainticketdemo.domain.Quote;
+import org.jbpm.trainticketdemo.util.SmsUtil;
+import org.jbpm.trainticketdemo.variable.ProcessVariable;
+
+/**
+ * @author Joram Barrez
+ */
+public class SendQuoteToCustomerAction implements ActivityBehaviour {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution activityExecution) throws Exception {
+ Quote quote = (Quote) activityExecution.getVariable(ProcessVariable.QUOTE);
+ String fullProcInstId = activityExecution.getProcessInstance().getId();
+ String realId = fullProcInstId.substring(fullProcInstId.indexOf(".") + 1);
+
+ // Send the sms
+ SmsUtil.sendSms(quote,
+ "Ticket from " + quote.getTicketRequest().getFrom()
+ + " - " + quote.getTicketRequest().getTo() + " "
+ + "price is " + quote.getPrice() + " euro. "
+ + "To accept reply with 'ACCEPT " + realId +"'. "
+ + "Regards, jBPM-on-Rails.");
+ }
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/action/SendRejectionMsgAction.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/action/SendRejectionMsgAction.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/action/SendRejectionMsgAction.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.trainticketdemo.action;
+
+import org.jbpm.api.activity.ActivityBehaviour;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.trainticketdemo.domain.Quote;
+import org.jbpm.trainticketdemo.util.SmsUtil;
+import org.jbpm.trainticketdemo.variable.ProcessVariable;
+
+/**
+ * @author Joram Barrez
+ */
+public class SendRejectionMsgAction implements ActivityBehaviour {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) throws Exception {
+ Quote quote = (Quote) execution.getVariable(ProcessVariable.QUOTE);
+ SmsUtil.sendSms(quote, "Ticket request rejected: you do not have enough credits to pay this ticket.");
+ }
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/business/ProcessEngineManager.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/business/ProcessEngineManager.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/business/ProcessEngineManager.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.trainticketdemo.business;
+
+import org.jbpm.api.ProcessEngine;
+
+
+/**
+ * @author Joram Barrez
+ */
+public interface ProcessEngineManager {
+
+ /* ---------------------
+ * Management callbacks
+ * --------------------- */
+
+ void start() throws Exception;
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/business/TicketService.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/business/TicketService.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/business/TicketService.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.trainticketdemo.business;
+
+import org.jbpm.trainticketdemo.domain.TicketRequest;
+
+/**
+ * @author Joram Barrez
+ */
+public interface TicketService {
+
+ /**
+ * Starts the ticket process using the given ticket request.
+ */
+ void handleTicketRequest(TicketRequest ticketRequest);
+
+ /**
+ * Called when an acceptance SMS is received. This operation will continue
+ * the process which was started by the same cellPhoneNr if there currently
+ * exists an open task for that process.
+ */
+ void handleTicketAcceptance(String acceptanceId, String cellPhoneNr);
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/business/external/QuoteService.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/business/external/QuoteService.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/business/external/QuoteService.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.trainticketdemo.business.external;
+
+import org.jbpm.trainticketdemo.domain.Quote;
+import org.jbpm.trainticketdemo.domain.TicketRequest;
+
+/**
+ * Remote service for getting Quote information
+ *
+ * @author Joram Barrez
+ */
+public interface QuoteService {
+
+ Quote calculateQuote(TicketRequest ticketReques);
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/constants/JmsConstants.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/constants/JmsConstants.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/constants/JmsConstants.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.trainticketdemo.constants;
+
+/**
+ * @author Joram Barrez
+ */
+public class JmsConstants {
+
+ public static final String EVENT_QUEUE = "queue/jbpmOnRailsQueue";
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/constants/SmsConstants.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/constants/SmsConstants.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/constants/SmsConstants.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.trainticketdemo.constants;
+
+/**
+ * @author Joram Barrez
+ */
+public class SmsConstants {
+
+ public static final String SERVER_PHONE_NR = "+32123456789";
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/decision/CheckCustomerDecision.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/decision/CheckCustomerDecision.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/decision/CheckCustomerDecision.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,72 @@
+/*
+ * 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.trainticketdemo.decision;
+
+import org.hibernate.Criteria;
+import org.hibernate.Session;
+import org.hibernate.criterion.Restrictions;
+import org.jbpm.api.cmd.Environment;
+import org.jbpm.api.jpdl.DecisionHandler;
+import org.jbpm.api.model.OpenExecution;
+import org.jbpm.pvm.internal.env.EnvironmentImpl;
+import org.jbpm.trainticketdemo.domain.Quote;
+import org.jbpm.trainticketdemo.domain.User;
+import org.jbpm.trainticketdemo.variable.ProcessVariable;
+
+/**
+ * @author Joram Barrez
+ */
+public class CheckCustomerDecision implements DecisionHandler {
+
+ private static final long serialVersionUID = 1L;
+
+ private static final String OK_DECISION = "credit OK";
+
+ private static final String NOT_OK_DECISION = "credit NOK";
+
+ public String decide(OpenExecution execution) {
+
+ Quote quote = (Quote) execution.getVariable(ProcessVariable.QUOTE);
+ User user = getUser(quote);
+
+ if (user != null && hasEnoughCredit(user, quote)) {
+ return OK_DECISION;
+ }
+
+ return NOT_OK_DECISION;
+
+ }
+
+ private User getUser(Quote quote) {
+ Environment env = EnvironmentImpl.getCurrent();
+ Session session = env.get(Session.class);
+
+ Criteria criteria = session.createCriteria(User.class);
+ criteria.add(Restrictions.eq("cellphoneNr", quote.getTicketRequest().getCellPhoneNr()));
+ return (User) criteria.uniqueResult();
+ }
+
+ private boolean hasEnoughCredit(User user, Quote quote) {
+ return user.getCurrentCredit() > quote.getPrice();
+ }
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/eventlistener/SendEventToQueue.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/eventlistener/SendEventToQueue.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/eventlistener/SendEventToQueue.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,86 @@
+/*
+ * 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.trainticketdemo.eventlistener;
+
+import java.beans.IntrospectionException;
+import java.beans.PropertyDescriptor;
+import java.io.Serializable;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Map;
+
+import org.jbpm.api.listener.EventListener;
+import org.jbpm.api.listener.EventListenerExecution;
+import org.jbpm.pvm.internal.script.ScriptManager;
+import org.jbpm.trainticketdemo.util.JmsUtil;
+
+/**
+ * @author Joram Barrez
+ */
+public class SendEventToQueue implements EventListener {
+
+ private static final long serialVersionUID = 1L;
+
+ private String eventClass;
+
+ private Map<String, String> eventContent;
+
+ // Workaround for JBPM-2494
+ private boolean addProcessInstanceId = false;
+
+ public void notify(EventListenerExecution execution) throws Exception {
+
+ // Some Reflection mumbo-jumbo - Not for the faint-of-hearted!
+
+ Object event = this.getClass().getClassLoader().loadClass(eventClass).newInstance();
+
+ if (eventContent != null) {
+ for (String key : eventContent.keySet()) {
+
+ // Could be an expression, so we need to pass it to the script managaer
+ ScriptManager scriptManager = ScriptManager.getDefaultScriptManager();
+ Object obj = scriptManager.evaluateExpression(eventContent.get(key), null);
+ setValue(event, key, obj);
+
+ }
+ }
+
+ if (addProcessInstanceId) {
+ setValue(event, "processInstanceId", execution.getProcessInstance().getId());
+ }
+
+ JmsUtil.SendToEventQueue((Serializable)event);
+
+ }
+
+ private void setValue(Object event, String key, Object value)
+ throws IntrospectionException, IllegalAccessException,
+ InvocationTargetException {
+
+ PropertyDescriptor propertyDescriptor = new PropertyDescriptor(key, event.getClass());
+ Method setter = propertyDescriptor.getWriteMethod();
+ Class paramClass = setter.getParameterTypes() [0];
+ propertyDescriptor.getWriteMethod().invoke(event, paramClass.cast(value));
+
+ }
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/util/EjbUtil.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/util/EjbUtil.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/util/EjbUtil.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,102 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.trainticketdemo.util;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jbpm.trainticketdemo.business.ProcessEngineManager;
+import org.jbpm.trainticketdemo.business.TicketService;
+import org.jbpm.trainticketdemo.business.external.QuoteService;
+
+/**
+ * Utility class for accessing EJB services.
+ *
+ * @author Joram Barrez
+ */
+public final class EjbUtil {
+
+ private static final Map<String, Object> EJB_CACHE = new HashMap<String, Object>();
+
+ private static final String QUOTE_SERVICE_KEY = "quoteService";
+
+ private static final String QUOTE_SERVICE_JNDI_NAME = "jbpm-on-rails/QuoteServiceImpl/remote";
+
+ private static final String QUOTE_SERVICE_KEY_LOCAL = "quoteServiceLocal";
+
+ private static final String QUOTE_SERVICE_JNDI_NAME_LOCAL = "jbpm-on-rails/QuoteServiceImpl/local";
+
+ private static final String TICKET_SERVICE_KEY = "ticketService";
+
+ private static final String TICKET_SERVICE_JNDI_NAME = "jbpm-on-rails/TicketServiceImpl/remote";
+
+ private static final String TICKET_SERVICE_KEY_LOCAL = "ticketServiceLocal";
+
+ private static final String TICKET_SERVICE_JNDI_NAME_LOCAL = "jbpm-on-rails/TicketServiceImpl/local";
+
+ private static final String PROCESS_ENGINE_MGR_LOCAL_KEY = "processEngineManagerLocal";
+
+ private static final String PROCESS_ENGINE_MGR_JNDI_NAME_LOCAL = "jbpm-on-rails/ProcessEngineManagerImpl/local";
+
+ public static QuoteService getQuoteService() {
+ return retrieveEJB(QUOTE_SERVICE_KEY, QUOTE_SERVICE_JNDI_NAME);
+ }
+
+ public static QuoteService getQuoteServiceLocal() {
+ return retrieveEJB(QUOTE_SERVICE_KEY_LOCAL, QUOTE_SERVICE_JNDI_NAME_LOCAL);
+ }
+
+ public static TicketService getTicketService() {
+ return retrieveEJB(TICKET_SERVICE_KEY, TICKET_SERVICE_JNDI_NAME);
+ }
+
+ public static TicketService getTicketServiceLocal() {
+ return retrieveEJB(TICKET_SERVICE_KEY_LOCAL, TICKET_SERVICE_JNDI_NAME_LOCAL);
+ }
+
+ public static ProcessEngineManager getProcessEngineManager() {
+ return retrieveEJB(PROCESS_ENGINE_MGR_LOCAL_KEY, PROCESS_ENGINE_MGR_JNDI_NAME_LOCAL);
+ }
+
+ @SuppressWarnings("unchecked")
+ private static <T> T retrieveEJB(String key, String name) {
+ T ejbBean = null;
+
+ if (EJB_CACHE.containsKey(key)) {
+ ejbBean = (T) EJB_CACHE.get(key);
+ } else {
+ try {
+ InitialContext context = new InitialContext();
+ ejbBean = (T) context.lookup(name);
+ EJB_CACHE.put(key, ejbBean);
+ } catch (NamingException e) {
+ e.printStackTrace();
+ }
+ }
+
+ return ejbBean;
+ }
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/util/JmsUtil.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/util/JmsUtil.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/util/JmsUtil.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,56 @@
+package org.jbpm.trainticketdemo.util;
+
+import java.io.Serializable;
+
+import javax.jms.JMSException;
+import javax.jms.ObjectMessage;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.QueueSender;
+import javax.jms.QueueSession;
+import javax.jms.Session;
+import javax.naming.InitialContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jbpm.trainticketdemo.constants.JmsConstants;
+
+public final class JmsUtil {
+
+ private static final Log LOGGER = LogFactory.getLog(JmsUtil.class);
+
+ private JmsUtil() { }
+
+ @SuppressWarnings("unchecked")
+ public static void SendToEventQueue(Serializable event) {
+ QueueConnection queueConnection = null;
+
+ try {
+ InitialContext context = new InitialContext();
+
+ QueueConnectionFactory connectionFactory = (QueueConnectionFactory) context.lookup("ConnectionFactory");
+ queueConnection = connectionFactory.createQueueConnection();
+ QueueSession queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
+
+ ObjectMessage objMsg = queueSession.createObjectMessage();
+ objMsg.setObject(event);
+
+ Queue queue = (Queue) context.lookup(JmsConstants.EVENT_QUEUE);
+ QueueSender queueSender = queueSession.createSender(queue);
+ queueSender.send(objMsg);
+
+ } catch (Exception e) {
+ LOGGER.error("Error while sending message to refund queue", e);
+ } finally {
+ if (queueConnection != null) {
+ try {
+ queueConnection.close();
+ } catch (JMSException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/util/SmsUtil.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/util/SmsUtil.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/util/SmsUtil.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.trainticketdemo.util;
+
+import java.io.IOException;
+import java.util.Date;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.methods.PostMethod;
+import org.jbpm.trainticketdemo.constants.SmsConstants;
+import org.jbpm.trainticketdemo.domain.Quote;
+
+/**
+ * @author Joram Barrez
+ */
+public final class SmsUtil {
+
+private static final String PARAM_SEND_DATE = "sendDate";
+
+ private static final String PARAM_MSG_CONTENT = "msgContent";
+
+ private static final String PARAM_SENDER_NR = "senderNr";
+
+ public static void sendSms(String url, String textMessage) throws HttpException, IOException {
+ PostMethod post = new PostMethod(url);
+ post.addParameter(PARAM_SEND_DATE, new Date().toString());
+ post.addParameter(PARAM_MSG_CONTENT, textMessage);
+ post.addParameter(PARAM_SENDER_NR, SmsConstants.SERVER_PHONE_NR);
+ HttpClient httpClient = new HttpClient();
+ httpClient.executeMethod(post);
+ }
+
+ public static void sendSms(Quote quote, String textMessage) throws HttpException, IOException {
+ if (isQuoteForEmulator(quote)) {
+ sendSms(getEmulatorUrl(quote.getTicketRequest().getCellPhoneNr()), textMessage);
+ } else {
+ // TODO
+ }
+ }
+
+ public static boolean isMessageFromEmulator(String phoneNr) {
+ return phoneNr.startsWith("EMULATOR-");
+ }
+
+ public static boolean isQuoteForEmulator(Quote quote ) {
+ return isMessageFromEmulator(quote.getTicketRequest().getCellPhoneNr());
+ }
+
+ public static String getEmulatorUrl(String phoneNr) {
+ return phoneNr.substring(9); // EMULATOR- = 9 chars
+ }
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/variable/ProcessVariable.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/variable/ProcessVariable.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/java/org/jbpm/trainticketdemo/variable/ProcessVariable.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jbpm.trainticketdemo.variable;
+
+/**
+ * @author Joram Barrez
+ */
+public class ProcessVariable {
+
+ public static final String TICKET_REQUEST = "ticketRequest";
+
+ public static final String QUOTE = "quote";
+
+ public static final String FROM = "from";
+
+ public static final String TO = "to";
+
+ public static final String CELLPHONE_NUMBER = "cellPhoneNr";
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/jbpm.cfg.xml
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/jbpm.cfg.xml (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/jbpm.cfg.xml 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration>
+
+ <import resource="jbpm.default.cfg.xml" />
+
+ <import resource="jbpm.tx.jta.cfg.xml" />
+
+ <!--
+ <import resource="jbpm.tx.hibernate.cfg.xml" />
+ -->
+
+ <import resource="jbpm.jpdl.cfg.xml" />
+ <import resource="jbpm.identity.cfg.xml" />
+ <import resource="jbpm.businesscalendar.cfg.xml" />
+
+ <process-engine-context>
+ <job-executor threads="3" idle="30000" idle-max="60000" lock-millis="3600000" />
+ </process-engine-context>
+
+
+</jbpm-configuration>
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/jbpm.hibernate.cfg.xml
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/jbpm.hibernate.cfg.xml (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/jbpm.hibernate.cfg.xml 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,37 @@
+<?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>
+
+ <!-- HSQLDB -->
+ <property name="hibernate.connection.datasource">java:JbpmDS</property>
+ <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
+
+ <!--
+ POSTGRES <property
+ name="hibernate.connection.driver_class">org.postgresql.Driver</property>
+ <property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/jbpm</property>
+ <property name="hibernate.connection.username">postgres</property>
+ <property name="hibernate.connection.password">postgres</property>
+ <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
+ <property name="hibernate.hbm2ddl.auto">create-drop</property>
+ -->
+
+ <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
+ <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
+ <property name="jta.UserTransaction">UserTransaction</property>
+
+ <mapping resource="jbpm.repository.hbm.xml" />
+ <mapping resource="jbpm.execution.hbm.xml" />
+ <mapping resource="jbpm.history.hbm.xml" />
+ <mapping resource="jbpm.task.hbm.xml" />
+ <mapping resource="jbpm.identity.hbm.xml" />
+
+ <mapping resource="org/jbpm/trainticketdemo/domain/User.hbm.xml" />
+
+ </session-factory>
+</hibernate-configuration>
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/jbpm.mail.properties
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/jbpm.mail.properties (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/jbpm.mail.properties 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,3 @@
+mail.smtp.host localhost
+mail.smtp.port 2525
+mail.from noreply at jbpm.org
\ No newline at end of file
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/jndi.properties
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/jndi.properties (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/jndi.properties 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,9 @@
+#jboss JNDI properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jnp.interfaces
+
+### The TimedSocketFactory connection timeout in milliseconds (0 == blocking)
+jnp.timeout=10000
+### The TimedSocketFactory read timeout in milliseconds (0 == blocking)
+jnp.sotimeout=20000
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/log4j.properties
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/log4j.properties (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/log4j.properties 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,11 @@
+log4j.rootLogger=INFO,CONSOLE
+
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+
+log4j.appender.CONSOLE.immediateFlush=true
+
+log4j.appender.CONSOLE.target=System.out
+
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{dd-MMM-yyyy HH:mm:ss} %c %t%n[%p]: %m%n
\ No newline at end of file
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/logging.properties
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/logging.properties (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/logging.properties 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,18 @@
+handlers= java.util.logging.ConsoleHandler
+redirect.commons.logging = enabled
+
+java.util.logging.ConsoleHandler.level = FINE
+java.util.logging.ConsoleHandler.formatter = org.jbpm.internal.log.LogFormatter
+
+org.jbpm.level=FINE
+# org.jbpm.pvm.internal.tx.level=FINE
+# org.jbpm.pvm.internal.wire.level=FINE
+# org.jbpm.pvm.internal.util.level=FINE
+
+org.hibernate.level=INFO
+org.hibernate.cfg.SettingsFactory.level=SEVERE
+org.hibernate.cfg.HbmBinder.level=SEVERE
+# org.hibernate.SQL.level=FINEST
+# org.hibernate.type.level=FINEST
+# org.hibernate.tool.hbm2ddl.SchemaExport.level=FINEST
+# org.hibernate.transaction.level=FINEST
\ No newline at end of file
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/org/jbpm/trainticketdemo/process.jpdl.xml
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/org/jbpm/trainticketdemo/process.jpdl.xml (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/org/jbpm/trainticketdemo/process.jpdl.xml 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="ticketProcess" xmlns="http://jbpm.org/4.0/jpdl">
+
+ <on event="start">
+ <event-listener class="org.jbpm.trainticketdemo.eventlistener.SendEventToQueue">
+ <field name="eventClass">
+ <string value="org.jbpm.trainticketdemo.event.TicketRequestReceivedEvent"/>
+ </field>
+ <field name="addProcessInstanceId">
+ <true/>
+ </field>
+ </event-listener>
+ </on>
+
+ <start form="org/jbpm/trainticketdemo/trainticket_startform.ftl" g="21,244,48,48" name="start">
+ <transition to="Calculate quote"/>
+ </start>
+
+ <custom class="org.jbpm.trainticketdemo.action.CalculateQuoteAction" g="109,242,132,52" name="Calculate quote">
+ <transition to="Check customer credit"/>
+ </custom>
+
+ <custom class="org.jbpm.trainticketdemo.action.SendQuoteToCustomerAction" g="393,155,209,52" name="Send price quote to customer">
+ <on event="end">
+ <event-listener class="org.jbpm.trainticketdemo.eventlistener.SendEventToQueue">
+ <field name="eventClass">
+ <string value="org.jbpm.trainticketdemo.event.QuoteSentEvent"/>
+ </field>
+ <field name="addProcessInstanceId">
+ <true/>
+ </field>
+ </event-listener>
+ </on>
+ <transition to="Accept quote"/>
+ </custom>
+
+ <custom class="org.jbpm.trainticketdemo.action.SendRejectionMsgAction" g="391,337,160,52" name="Send reject message">
+ <transition to="cancel"/>
+ </custom>
+
+ <decision g="284,246,48,48" name="Check customer credit">
+ <handler class="org.jbpm.trainticketdemo.decision.CheckCustomerDecision" />
+ <transition g="-67,-16" name="credit OK" to="Send price quote to customer"/>
+ <transition g="-68,5" name="credit NOK" to="Send reject message"/>
+ </decision>
+
+ <task assignee="#{ticketRequest.cellPhoneNr}" g="651,156,107,52" name="Accept quote">
+ <transition to="charge customer"/>
+ <transition g="11,-13" name="timeout" to="cancel">
+ <timer duedate="1 day"/>
+ </transition>
+ </task>
+
+ <custom class="org.jbpm.trainticketdemo.action.ChargeCustomerAction" g="806,157,135,52" name="charge customer">
+ <on event="end">
+ <event-listener class="org.jbpm.trainticketdemo.eventlistener.SendEventToQueue">
+ <field name="eventClass">
+ <string value="org.jbpm.trainticketdemo.event.TicketSoldEvent"/>
+ </field>
+ <field name="eventContent">
+ <map>
+ <entry>
+ <key><string value="from"/></key>
+ <value><string value="#{ticketRequest.from}"/></value>
+ </entry>
+ <entry>
+ <key><string value="to"/></key>
+ <value><string value="#{ticketRequest.to}"/></value>
+ </entry>
+ <entry>
+ <key><string value="amount"/></key>
+ <value><string value="#{quote.price}"/></value>
+ </entry>
+ </map>
+ </field>
+ </event-listener>
+ </on>
+ <transition to="end"/>
+ </custom>
+
+ <end-cancel g="682,337,48,48" name="cancel"/>
+
+ <end g="1001,158,48,48" name="end"/>
+
+</process>
\ No newline at end of file
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/org/jbpm/trainticketdemo/process.png
===================================================================
(Binary files differ)
Property changes on: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/org/jbpm/trainticketdemo/process.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/org/jbpm/trainticketdemo/trainticket_startform.ftl
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/org/jbpm/trainticketdemo/trainticket_startform.ftl (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/src/main/resources/org/jbpm/trainticketdemo/trainticket_startform.ftl 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,26 @@
+<html>
+ <body>
+
+ <form action="${form.action}" method="POST" enctype="multipart/form-data">
+
+ <h3>Send SMS:</h3>
+ <table>
+ <tr>
+ <td>From:</td>
+ <td><input type="text" name="from" /></td>
+ </tr>
+ <tr>
+ <td>To:</td>
+ <td><input type="text" name="to" /></td>
+ </tr>
+ <tr>
+ <td>Source cellphone nr:</td>
+ <td><input type="text" name="cellPhoneNr" value="EMULATOR-http://localhost:4321/cellphone_sms_listener" /></td>
+ </tr>
+ </table>
+
+ <input type="submit" name="Send"/>
+
+ </form>
+ </body>
+</html>
\ No newline at end of file
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/jbpm.cfg.xml
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/jbpm.cfg.xml (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/jbpm.cfg.xml 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration>
+
+ <import resource="jbpm.default.cfg.xml" />
+
+ <import resource="jbpm.tx.jta.cfg.xml" />
+
+ <!--
+ <import resource="jbpm.tx.hibernate.cfg.xml" />
+ -->
+
+ <import resource="jbpm.jpdl.cfg.xml" />
+ <import resource="jbpm.identity.cfg.xml" />
+ <import resource="jbpm.businesscalendar.cfg.xml" />
+
+ <process-engine-context>
+ <job-executor threads="3" idle="30000" idle-max="60000" lock-millis="3600000" />
+ </process-engine-context>
+
+
+</jbpm-configuration>
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/jbpm.hibernate.cfg.xml
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/jbpm.hibernate.cfg.xml (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/jbpm.hibernate.cfg.xml 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,37 @@
+<?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>
+
+ <!-- HSQLDB -->
+ <property name="hibernate.connection.datasource">java:JbpmDS</property>
+ <property name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
+
+ <!--
+ POSTGRES <property
+ name="hibernate.connection.driver_class">org.postgresql.Driver</property>
+ <property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/jbpm</property>
+ <property name="hibernate.connection.username">postgres</property>
+ <property name="hibernate.connection.password">postgres</property>
+ <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
+ <property name="hibernate.hbm2ddl.auto">create-drop</property>
+ -->
+
+ <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
+ <property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
+ <property name="jta.UserTransaction">UserTransaction</property>
+
+ <mapping resource="jbpm.repository.hbm.xml" />
+ <mapping resource="jbpm.execution.hbm.xml" />
+ <mapping resource="jbpm.history.hbm.xml" />
+ <mapping resource="jbpm.task.hbm.xml" />
+ <mapping resource="jbpm.identity.hbm.xml" />
+
+ <mapping resource="org/jbpm/trainticketdemo/domain/User.hbm.xml" />
+
+ </session-factory>
+</hibernate-configuration>
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/jbpm.mail.properties
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/jbpm.mail.properties (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/jbpm.mail.properties 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,3 @@
+mail.smtp.host localhost
+mail.smtp.port 2525
+mail.from noreply at jbpm.org
\ No newline at end of file
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/jndi.properties
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/jndi.properties (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/jndi.properties 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,9 @@
+#jboss JNDI properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jnp.interfaces
+
+### The TimedSocketFactory connection timeout in milliseconds (0 == blocking)
+jnp.timeout=10000
+### The TimedSocketFactory read timeout in milliseconds (0 == blocking)
+jnp.sotimeout=20000
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/log4j.properties
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/log4j.properties (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/log4j.properties 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,11 @@
+log4j.rootLogger=INFO,CONSOLE
+
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+
+log4j.appender.CONSOLE.immediateFlush=true
+
+log4j.appender.CONSOLE.target=System.out
+
+log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
+
+log4j.appender.CONSOLE.layout.ConversionPattern=%d{dd-MMM-yyyy HH:mm:ss} %c %t%n[%p]: %m%n
\ No newline at end of file
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/logging.properties
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/logging.properties (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/logging.properties 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,18 @@
+handlers= java.util.logging.ConsoleHandler
+redirect.commons.logging = enabled
+
+java.util.logging.ConsoleHandler.level = FINE
+java.util.logging.ConsoleHandler.formatter = org.jbpm.internal.log.LogFormatter
+
+org.jbpm.level=FINE
+# org.jbpm.pvm.internal.tx.level=FINE
+# org.jbpm.pvm.internal.wire.level=FINE
+# org.jbpm.pvm.internal.util.level=FINE
+
+org.hibernate.level=INFO
+org.hibernate.cfg.SettingsFactory.level=SEVERE
+org.hibernate.cfg.HbmBinder.level=SEVERE
+# org.hibernate.SQL.level=FINEST
+# org.hibernate.type.level=FINEST
+# org.hibernate.tool.hbm2ddl.SchemaExport.level=FINEST
+# org.hibernate.transaction.level=FINEST
\ No newline at end of file
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/org/jbpm/trainticketdemo/process.jpdl.xml
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/org/jbpm/trainticketdemo/process.jpdl.xml (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/org/jbpm/trainticketdemo/process.jpdl.xml 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process name="ticketProcess" xmlns="http://jbpm.org/4.0/jpdl">
+
+ <on event="start">
+ <event-listener class="org.jbpm.trainticketdemo.eventlistener.SendEventToQueue">
+ <field name="eventClass">
+ <string value="org.jbpm.trainticketdemo.event.TicketRequestReceivedEvent"/>
+ </field>
+ <field name="addProcessInstanceId">
+ <true/>
+ </field>
+ </event-listener>
+ </on>
+
+ <start form="org/jbpm/trainticketdemo/trainticket_startform.ftl" g="21,244,48,48" name="start">
+ <transition to="Calculate quote"/>
+ </start>
+
+ <custom class="org.jbpm.trainticketdemo.action.CalculateQuoteAction" g="109,242,132,52" name="Calculate quote">
+ <transition to="Check customer credit"/>
+ </custom>
+
+ <custom class="org.jbpm.trainticketdemo.action.SendQuoteToCustomerAction" g="393,155,209,52" name="Send price quote to customer">
+ <on event="end">
+ <event-listener class="org.jbpm.trainticketdemo.eventlistener.SendEventToQueue">
+ <field name="eventClass">
+ <string value="org.jbpm.trainticketdemo.event.QuoteSentEvent"/>
+ </field>
+ <field name="addProcessInstanceId">
+ <true/>
+ </field>
+ </event-listener>
+ </on>
+ <transition to="Accept quote"/>
+ </custom>
+
+ <custom class="org.jbpm.trainticketdemo.action.SendRejectionMsgAction" g="391,337,160,52" name="Send reject message">
+ <transition to="cancel"/>
+ </custom>
+
+ <decision g="284,246,48,48" name="Check customer credit">
+ <handler class="org.jbpm.trainticketdemo.decision.CheckCustomerDecision" />
+ <transition g="-67,-16" name="credit OK" to="Send price quote to customer"/>
+ <transition g="-68,5" name="credit NOK" to="Send reject message"/>
+ </decision>
+
+ <task assignee="#{ticketRequest.cellPhoneNr}" g="651,156,107,52" name="Accept quote">
+ <transition to="charge customer"/>
+ <transition g="11,-13" name="timeout" to="cancel">
+ <timer duedate="1 day"/>
+ </transition>
+ </task>
+
+ <custom class="org.jbpm.trainticketdemo.action.ChargeCustomerAction" g="806,157,135,52" name="charge customer">
+ <on event="end">
+ <event-listener class="org.jbpm.trainticketdemo.eventlistener.SendEventToQueue">
+ <field name="eventClass">
+ <string value="org.jbpm.trainticketdemo.event.TicketSoldEvent"/>
+ </field>
+ <field name="eventContent">
+ <map>
+ <entry>
+ <key><string value="from"/></key>
+ <value><string value="#{ticketRequest.from}"/></value>
+ </entry>
+ <entry>
+ <key><string value="to"/></key>
+ <value><string value="#{ticketRequest.to}"/></value>
+ </entry>
+ <entry>
+ <key><string value="amount"/></key>
+ <value><string value="#{quote.price}"/></value>
+ </entry>
+ </map>
+ </field>
+ </event-listener>
+ </on>
+ <transition to="end"/>
+ </custom>
+
+ <end-cancel g="682,337,48,48" name="cancel"/>
+
+ <end g="1001,158,48,48" name="end"/>
+
+</process>
\ No newline at end of file
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/org/jbpm/trainticketdemo/process.png
===================================================================
(Binary files differ)
Property changes on: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/org/jbpm/trainticketdemo/process.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/org/jbpm/trainticketdemo/trainticket_startform.ftl
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/org/jbpm/trainticketdemo/trainticket_startform.ftl (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/process-logic/target/classes/org/jbpm/trainticketdemo/trainticket_startform.ftl 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,26 @@
+<html>
+ <body>
+
+ <form action="${form.action}" method="POST" enctype="multipart/form-data">
+
+ <h3>Send SMS:</h3>
+ <table>
+ <tr>
+ <td>From:</td>
+ <td><input type="text" name="from" /></td>
+ </tr>
+ <tr>
+ <td>To:</td>
+ <td><input type="text" name="to" /></td>
+ </tr>
+ <tr>
+ <td>Source cellphone nr:</td>
+ <td><input type="text" name="cellPhoneNr" value="EMULATOR-http://localhost:4321/cellphone_sms_listener" /></td>
+ </tr>
+ </table>
+
+ <input type="submit" name="Send"/>
+
+ </form>
+ </body>
+</html>
\ No newline at end of file
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/.classpath
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/.classpath (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/.classpath 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,11 @@
+<classpath>
+ <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
+ <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
+ <classpathentry kind="output" path="target/classes"/>
+ <classpathentry kind="var" path="M2_REPO/javax/ejb/ejb-api/3.0/ejb-api-3.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/servlet/jsp/jsp-api/2.1/jsp-api-2.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/servlet/jstl/1.2/jstl-1.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar"/>
+ <classpathentry kind="src" path="/jbpm-on-rails-ejb"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+</classpath>
\ No newline at end of file
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/.project
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/.project (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/.project 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,15 @@
+<projectDescription>
+ <name>jbpm-on-rails-war</name>
+ <comment/>
+ <projects>
+ <project>jbpm-on-rails-ejb</project>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
\ No newline at end of file
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/.settings/org.eclipse.jdt.core.prefs 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,5 @@
+#Fri Aug 14 09:19:23 CEST 2009
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/pom.xml
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/pom.xml (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/pom.xml 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jbpm-on-rails-war</artifactId>
+ <packaging>war</packaging>
+ <name>jbpm-on-rails-war</name>
+
+ <parent>
+ <groupId>org.jbpm.trainticketdemo</groupId>
+ <artifactId>jbpm-on-rails</artifactId>
+ <version>1.0</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jbpm.trainticketdemo</groupId>
+ <artifactId>jbpm-on-rails-ejb</artifactId>
+ <version>1.0</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.ejb</groupId>
+ <artifactId>ejb-api</artifactId>
+ <version>3.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet.jsp</groupId>
+ <artifactId>jsp-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jstl</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/src/main/java/org/jbpm/trainticketdemo/ReceiveSmsServlet.java
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/src/main/java/org/jbpm/trainticketdemo/ReceiveSmsServlet.java (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/src/main/java/org/jbpm/trainticketdemo/ReceiveSmsServlet.java 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,148 @@
+/*
+ * 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.trainticketdemo;
+
+import java.io.IOException;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Map;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.log4j.Logger;
+import org.jbpm.trainticketdemo.business.TicketService;
+import org.jbpm.trainticketdemo.domain.TicketRequest;
+import org.jbpm.trainticketdemo.util.EjbUtil;
+
+/**
+ * @author Joram Barrez
+ */
+public class ReceiveSmsServlet extends HttpServlet {
+
+ private static final Logger LOG = Logger.getLogger(ReceiveSmsServlet.class);
+
+ private TicketService ticketService;
+
+ private static final String PARAM_SEND_DATE = "sendDate";
+
+ private static final String PARAM_MSG_CONTENT = "msgContent";
+
+ private static final String PARAM_SENDER_NR = "senderNr";
+
+ private static final String TICKET_REQUEST_PREFIX = "ticket";
+
+ private static final String TICKET_ACCEPTANCE_PREFIX ="accept";
+
+ @Override
+ public void init() throws ServletException {
+ super.init();
+ ticketService = EjbUtil.getTicketServiceLocal();
+ }
+
+ @Override
+ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+
+ // Get the SMS params
+ String sendDate = req.getParameter(PARAM_SEND_DATE);
+ String msgContent = req.getParameter(PARAM_MSG_CONTENT);
+ String senderNr = req.getParameter(PARAM_SENDER_NR);
+
+ if (LOG.isInfoEnabled()) {
+ LOG.info("Received SMS message from '" + senderNr + "'. Content of message = '" + msgContent + "'");
+ }
+
+
+ if (isTicketRequestMessage(msgContent)) {
+
+ TicketRequest ticketRequest = parseTicketrequestMessage(msgContent, sendDate, senderNr);
+ if (ticketRequest != null) {
+ ticketService.handleTicketRequest(ticketRequest);
+ } else {
+ LOG.warn("SMS message content looked like a ticket request, but it wasn't. Throwing it away.");
+ }
+
+ } else if (isTicketAcceptanceMessage(msgContent)) {
+
+ String acceptanceId = parseTicketAcceptanceMessage(msgContent);
+ if (acceptanceId != null) {
+ ticketService.handleTicketAcceptance(acceptanceId, senderNr);
+ } else {
+ LOG.warn("SMS message content looked like a ticket acceptance, but it wasn't. Throwing it away.");
+ }
+
+ } else {
+
+ LOG.warn("SMS message content invalid. Throwing it away.");
+
+ }
+ }
+
+ private boolean isTicketRequestMessage(String message) {
+ return message.toLowerCase().startsWith(TICKET_REQUEST_PREFIX);
+ }
+
+ private boolean isTicketAcceptanceMessage(String message) {
+ return message.toLowerCase().startsWith(TICKET_ACCEPTANCE_PREFIX);
+ }
+
+
+ private TicketRequest parseTicketrequestMessage(String smsMessage, String sendDate, String senderNr) {
+
+ // Only message of type 'TICKET CITY1 CITY2' are supported
+
+ String[] splitMsg = smsMessage.split(" ");
+ if (splitMsg.length == 3) {
+ if (splitMsg[0].equalsIgnoreCase("ticket")) {
+
+ TicketRequest ticketRequest = new TicketRequest();
+ ticketRequest.setFrom(splitMsg[1]);
+ ticketRequest.setTo(splitMsg[2]);
+ ticketRequest.setCellPhoneNr(senderNr);
+
+ SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd hh:mm:ss z yyyy");
+ try {
+ ticketRequest.setDate(sdf.parse(sendDate));
+ } catch (ParseException e) {
+ e.printStackTrace();
+ return null;
+ }
+ return ticketRequest;
+
+ }
+ }
+ return null;
+ }
+
+ private String parseTicketAcceptanceMessage(String smsMessage) {
+ String[] splitMSg = smsMessage.split(" ");
+ if (splitMSg.length == 2) {
+ if (splitMSg[0].equalsIgnoreCase("accept")) {
+ return splitMSg[1];
+ }
+ }
+ return null;
+ }
+
+}
Added: projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/src/main/webapp/WEB-INF/web.xml
===================================================================
--- projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/src/main/webapp/WEB-INF/web.xml (rev 0)
+++ projects/demos/trainticket-demo/jbpm-on-rails/trunk/war/src/main/webapp/WEB-INF/web.xml 2009-08-26 15:25:25 UTC (rev 5546)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
+
+ <display-name>jbpm-on-rails-web-interface</display-name>
+
+
+ <servlet>
+ <servlet-name>smsServlet</servlet-name>
+ <servlet-class>org.jbpm.trainticketdemo.ReceiveSmsServlet</servlet-class>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>smsServlet</servlet-name>
+ <url-pattern>/receive_sms</url-pattern>
+ </servlet-mapping>
+
+</web-app>
More information about the jbpm-commits
mailing list