summaryrefslogtreecommitdiff
path: root/calamus-engine
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2014-04-12 17:55:28 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2014-04-12 17:55:28 +0200
commitbfcfcf5e3b4301bc94c27f47bfda61693edf3595 (patch)
treed6eedd800b1b34fd66ccbd86e5f215aaa40ccd3d /calamus-engine
downloadcalamus-bfcfcf5e3b4301bc94c27f47bfda61693edf3595.tar.gz
calamus-bfcfcf5e3b4301bc94c27f47bfda61693edf3595.tar.bz2
calamus-bfcfcf5e3b4301bc94c27f47bfda61693edf3595.tar.xz
calamus-bfcfcf5e3b4301bc94c27f47bfda61693edf3595.zip
wip
Diffstat (limited to 'calamus-engine')
-rwxr-xr-xcalamus-engine/pom.xml390
-rw-r--r--calamus-engine/src/main/java/io/trygvis/engine/CalamusJbpm.java69
-rw-r--r--calamus-engine/src/main/java/io/trygvis/engine/Main.java13
-rw-r--r--calamus-engine/src/main/java/io/trygvis/engine/MqClient.java73
-rw-r--r--calamus-engine/src/main/java/io/trygvis/engine/RestartAppWorkItemHandler.java24
-rw-r--r--calamus-engine/src/main/java/io/trygvis/engine/UpgradeAppWorkItemHandler.java24
-rw-r--r--calamus-engine/src/main/java/io/trygvis/engine/service/AppInstance.java7
-rw-r--r--calamus-engine/src/main/java/io/trygvis/engine/service/AppService.java15
-rw-r--r--calamus-engine/src/main/resources/Deploy.bpmn2132
-rw-r--r--calamus-engine/src/main/resources/META-INF/AppctlWorkDefinitions.wid19
-rw-r--r--calamus-engine/src/main/resources/META-INF/persistence.xml31
-rw-r--r--calamus-engine/src/main/resources/db/postgresql-jbpm-schema.sql633
-rw-r--r--calamus-engine/src/main/resources/db/quartz_tables_postgres.sql165
-rw-r--r--calamus-engine/src/main/resources/jndi.properties1
-rw-r--r--calamus-engine/src/test/java/io/trygvis/engine/MyTest.java90
15 files changed, 1686 insertions, 0 deletions
diff --git a/calamus-engine/pom.xml b/calamus-engine/pom.xml
new file mode 100755
index 0000000..4923295
--- /dev/null
+++ b/calamus-engine/pom.xml
@@ -0,0 +1,390 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>io.trygvis.calamus</groupId>
+ <artifactId>calamus</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <groupId>io.trygvis.jbpm-sandbox</groupId>
+ <artifactId>calamus-engine</artifactId>
+ <properties>
+ <maven.compiler.source>1.8</maven.compiler.source>
+ <maven.compiler.target>1.8</maven.compiler.target>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+
+ <version.activemq>5.9.1</version.activemq>
+
+ <hibernate.version>4.2.11.Final</hibernate.version>
+ <slf4j.version>1.7.4</slf4j.version>
+ <logback.version>1.0.9</logback.version>
+ <drools.version>6.1.0.Beta2</drools.version>
+ <jbpm.version>6.1.0.Beta2</jbpm.version>
+
+ <arquillian.bom.version>1.1.0.Final</arquillian.bom.version>
+ <jboss.javaee.version>1.0.0.Final</jboss.javaee.version>
+ <seam.tx.version>3.1.0.Final</seam.tx.version>
+ <solder.version>3.2.0.Final</solder.version>
+ <h2.version>1.3.161</h2.version>
+ <btm.version>2.1.4</btm.version>
+ <arquillian.weld.version>1.0.0.CR7</arquillian.weld.version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-bom</artifactId>
+ <type>pom</type>
+ <version>${drools.version}</version>
+ <scope>import</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm</groupId>
+ <artifactId>jbpm-bom</artifactId>
+ <type>pom</type>
+ <version>${drools.version}</version>
+ <scope>import</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian</groupId>
+ <artifactId>arquillian-bom</artifactId>
+ <version>1.1.0.Final</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
+ <version>${hibernate.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ <version>${hibernate.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-provider-api</artifactId>
+ <version>2.4</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.activation</groupId>
+ <artifactId>activation</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ <version>1.1-20130918</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.11</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpcore</artifactId>
+ <version>4.1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.javassist</groupId>
+ <artifactId>javassist</artifactId>
+ <version>3.18.1-GA</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>3.0.8</version>
+ </dependency>
+ <dependency>
+ <groupId>org.sonatype.sisu</groupId>
+ <artifactId>sisu-inject-plexus</artifactId>
+ <version>2.3.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging</artifactId>
+ <version>3.1.0.GA</version>
+ </dependency>
+
+ </dependencies>
+ </dependencyManagement>
+ <dependencies>
+ <!--
+ <dependency>
+ <groupId>org.jbpm</groupId>
+ <artifactId>evaluation</artifactId>
+ <version>1.0</version>
+ <scope>test</scope>
+ </dependency>
+ -->
+
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-client</artifactId>
+ <version>${version.activemq}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-pool</artifactId>
+ <version>${version.activemq}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.kie</groupId>
+ <artifactId>kie-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm</groupId>
+ <artifactId>jbpm-flow</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm</groupId>
+ <artifactId>jbpm-bpmn2</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm</groupId>
+ <artifactId>jbpm-flow-builder</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm</groupId>
+ <artifactId>jbpm-runtime-manager</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.hibernate.javax.persistence</groupId>
+ <artifactId>hibernate-jpa-2.0-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm</groupId>
+ <artifactId>jbpm-human-task-core</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.hibernate.javax.persistence</groupId>
+ <artifactId>hibernate-jpa-2.0-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm</groupId>
+ <artifactId>jbpm-workitems</artifactId>
+ <version>${jbpm.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm</groupId>
+ <artifactId>jbpm-audit</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.hibernate.javax.persistence</groupId>
+ <artifactId>hibernate-jpa-2.0-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jbpm</groupId>
+ <artifactId>jbpm-shared-services</artifactId>
+ <version>${jbpm.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.hibernate.javax.persistence</groupId>
+ <artifactId>hibernate-jpa-2.0-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm</groupId>
+ <artifactId>jbpm-test</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.hibernate.javax.persistence</groupId>
+ <artifactId>hibernate-jpa-2.0-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <!--
+ <dependency>
+ <groupId>org.jboss.solder</groupId>
+ <artifactId>solder-api</artifactId>
+ <version>3.2.1.Final</version>
+ </dependency>
+ -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>1.0.9</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.weld.se</groupId>
+ <artifactId>weld-se-core</artifactId>
+ <version>1.1.13.Final</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <version>1.3.168</version>
+ </dependency>
+ <dependency>
+ <groupId>org.postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ <version>9.3-1101-jdbc41</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.btm</groupId>
+ <artifactId>btm</artifactId>
+ <version>${btm.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <!--
+ <dependency>
+ <groupId>org.jboss.seam.transaction</groupId>
+ <artifactId>seam-transaction</artifactId>
+ <version>${seam.tx.version}</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>solder-api</artifactId>
+ <groupId>org.jboss.solder</groupId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ -->
+
+ <!-- test: arquillian -->
+ <!--
+ <dependency>
+ <groupId>org.jboss.arquillian.junit</groupId>
+ <artifactId>arquillian-junit-container</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-weld-se-embedded-1.1</artifactId>
+ <version>${arquillian.weld.version}</version>
+ </dependency>
+ -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ </dependencies>
+
+<!--
+ <repositories>
+ <repository>
+ <id>jboss-public-repository-group</id>
+ <name>JBoss Public Repository Group</name>
+ <url>http://repository.jboss.org/nexus/content/groups/public/</url>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>daily</updatePolicy>
+ </snapshots>
+ </repository>
+ </repositories>
+-->
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <dependencyConvergence/>
+ <bannedDependencies>
+ <excludes>
+ <exclude>org.hibernate.javax.persistence:hibernate-jpa-2.1-api</exclude>
+ <exclude>javax.transaction:jta</exclude>
+ <exclude>commons-logging:commons-logging</exclude>
+ <exclude>org.slf4j:slf4j-log4j12</exclude>
+ <exclude>log4j:log4j</exclude>
+ <exclude>postgresql:postgresql</exclude>
+ </excludes>
+ </bannedDependencies>
+ </rules>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/calamus-engine/src/main/java/io/trygvis/engine/CalamusJbpm.java b/calamus-engine/src/main/java/io/trygvis/engine/CalamusJbpm.java
new file mode 100644
index 0000000..0a7be62
--- /dev/null
+++ b/calamus-engine/src/main/java/io/trygvis/engine/CalamusJbpm.java
@@ -0,0 +1,69 @@
+package io.trygvis.engine;
+
+import bitronix.tm.TransactionManagerServices;
+import bitronix.tm.resource.jdbc.PoolingDataSource;
+import org.jbpm.bpmn2.handler.ServiceTaskHandler;
+import org.jbpm.process.audit.AuditLoggerFactory;
+import org.kie.api.KieBase;
+import org.kie.api.runtime.Environment;
+import org.kie.api.runtime.EnvironmentName;
+import org.kie.api.runtime.process.ProcessInstance;
+import org.kie.internal.KnowledgeBaseFactory;
+import org.kie.internal.io.ResourceFactory;
+import org.kie.internal.persistence.jpa.JPAKnowledgeService;
+import org.kie.internal.runtime.StatefulKnowledgeSession;
+import org.kie.internal.utils.KieHelper;
+
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+
+public class CalamusJbpm {
+ private final StatefulKnowledgeSession session;
+
+ public static enum CalamusProcess {
+ DEPLOY("io.trygvis.bpm.Deploy");
+
+ private String name;
+
+ CalamusProcess(String name) {
+ this.name = name;
+ }
+ }
+
+ public CalamusJbpm() {
+ PoolingDataSource ds = new PoolingDataSource();
+ ds.setUniqueName("jdbc/jbpm-ds");
+ ds.setClassName(bitronix.tm.resource.jdbc.lrc.LrcXADataSource.class.getCanonicalName());
+ ds.setMaxPoolSize(3);
+ ds.setAllowLocalTransactions(true);
+ ds.getDriverProperties().put("user", "jbpm");
+ ds.getDriverProperties().put("password", "jbpm");
+ ds.getDriverProperties().put("url", "jdbc:postgresql://localhost/jbpm");
+ ds.getDriverProperties().put("driverClassName", org.postgresql.Driver.class.getCanonicalName());
+ ds.init();
+
+ EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.jbpm.persistence.jpa");
+ Environment env = KnowledgeBaseFactory.newEnvironment();
+ env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
+ env.set(EnvironmentName.TRANSACTION_MANAGER, TransactionManagerServices.getTransactionManager());
+
+ KieBase kieBase = new KieHelper()
+ .addResource(ResourceFactory.newClassPathResource("Deploy.bpmn2"))
+ .build();
+
+ session = JPAKnowledgeService.newStatefulKnowledgeSession(kieBase, null, env);
+ session.addEventListener(AuditLoggerFactory.newJPAInstance(env));
+
+ session.getWorkItemManager().registerWorkItemHandler("Service Task", new ServiceTaskHandler());
+ session.getWorkItemManager().registerWorkItemHandler("Upgrade App", new UpgradeAppWorkItemHandler());
+ session.getWorkItemManager().registerWorkItemHandler("Restart App", new RestartAppWorkItemHandler());
+ }
+
+ public StatefulKnowledgeSession getSession() {
+ return session;
+ }
+
+ public void startProcess(CalamusProcess process) {
+ ProcessInstance processInstance = session.startProcess(process.name);
+ }
+}
diff --git a/calamus-engine/src/main/java/io/trygvis/engine/Main.java b/calamus-engine/src/main/java/io/trygvis/engine/Main.java
new file mode 100644
index 0000000..bc322e8
--- /dev/null
+++ b/calamus-engine/src/main/java/io/trygvis/engine/Main.java
@@ -0,0 +1,13 @@
+package io.trygvis.engine;
+
+import static io.trygvis.engine.CalamusJbpm.CalamusProcess.DEPLOY;
+
+public class Main {
+ public static void main(String[] args) {
+ CalamusJbpm jbpm = new CalamusJbpm();
+
+ MqClient mqClient = new MqClient(jbpm.getSession(), "tcp://localhost:61616");
+
+ jbpm.startProcess(DEPLOY);
+ }
+}
diff --git a/calamus-engine/src/main/java/io/trygvis/engine/MqClient.java b/calamus-engine/src/main/java/io/trygvis/engine/MqClient.java
new file mode 100644
index 0000000..b609c9f
--- /dev/null
+++ b/calamus-engine/src/main/java/io/trygvis/engine/MqClient.java
@@ -0,0 +1,73 @@
+package io.trygvis.engine;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.kie.internal.runtime.StatefulKnowledgeSession;
+
+import javax.jms.Connection;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.MapMessage;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageListener;
+import javax.jms.Session;
+
+import static javax.jms.Session.AUTO_ACKNOWLEDGE;
+
+public class MqClient implements AutoCloseable {
+
+ private Connection connection;
+// private final ActiveMQConnectionFactory connectionFactory;
+// private final StatefulKnowledgeSession jbpm;
+
+ public MqClient(final StatefulKnowledgeSession jbpm, String brukerUrl) {
+// this.jbpm = jbpm;
+ ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(brukerUrl);
+
+ try {
+ connection = connectionFactory.createConnection();
+ connection.start();
+
+ Session session = connection.createSession(false, AUTO_ACKNOWLEDGE);
+
+ Destination destination = session.createQueue("jenkins.build-result");
+
+ MessageConsumer consumer = session.createConsumer(destination);
+ consumer.setMessageListener(new MessageListener() {
+ @Override
+ public void onMessage(Message message) {
+ if (!(message instanceof MapMessage)) {
+ return;
+ }
+
+ MapMessage m = (MapMessage) message;
+
+ try {
+ String jobName = m.getString("jobName");
+ int buildNumber = m.getInt("buildNumber");
+ String result = m.getString("result");
+
+/*
+ String type;
+ Object event;
+ long processInstanceId;
+ jbpm.signalEvent(type, event, processInstanceId);
+*/
+ } catch (JMSException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ } catch (JMSException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void close() throws Exception {
+ if (connection != null) {
+ connection.close();
+ this.connection = null;
+ }
+ }
+}
diff --git a/calamus-engine/src/main/java/io/trygvis/engine/RestartAppWorkItemHandler.java b/calamus-engine/src/main/java/io/trygvis/engine/RestartAppWorkItemHandler.java
new file mode 100644
index 0000000..98733c7
--- /dev/null
+++ b/calamus-engine/src/main/java/io/trygvis/engine/RestartAppWorkItemHandler.java
@@ -0,0 +1,24 @@
+package io.trygvis.engine;
+
+import org.kie.api.runtime.process.WorkItem;
+import org.kie.api.runtime.process.WorkItemHandler;
+import org.kie.api.runtime.process.WorkItemManager;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class RestartAppWorkItemHandler implements WorkItemHandler {
+
+ @Override
+ public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
+ System.out.println("RestartAppWorkItemHandler.executeWorkItem");
+
+ Map<String, Object> results = new HashMap<>();
+ manager.completeWorkItem(workItem.getId(), results);
+ }
+
+ @Override
+ public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
+ System.out.println("RestartAppWorkItemHandler.abortWorkItem");
+ }
+}
diff --git a/calamus-engine/src/main/java/io/trygvis/engine/UpgradeAppWorkItemHandler.java b/calamus-engine/src/main/java/io/trygvis/engine/UpgradeAppWorkItemHandler.java
new file mode 100644
index 0000000..6202d6b
--- /dev/null
+++ b/calamus-engine/src/main/java/io/trygvis/engine/UpgradeAppWorkItemHandler.java
@@ -0,0 +1,24 @@
+package io.trygvis.engine;
+
+import org.kie.api.runtime.process.WorkItem;
+import org.kie.api.runtime.process.WorkItemHandler;
+import org.kie.api.runtime.process.WorkItemManager;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class UpgradeAppWorkItemHandler implements WorkItemHandler {
+
+ @Override
+ public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
+ System.out.println("UpgradeAppWorkItemHandler.executeWorkItem");
+
+ Map<String, Object> results = new HashMap<>();
+ manager.completeWorkItem(workItem.getId(), results);
+ }
+
+ @Override
+ public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
+ System.out.println("UpgradeAppWorkItemHandler.abortWorkItem");
+ }
+}
diff --git a/calamus-engine/src/main/java/io/trygvis/engine/service/AppInstance.java b/calamus-engine/src/main/java/io/trygvis/engine/service/AppInstance.java
new file mode 100644
index 0000000..0badb8c
--- /dev/null
+++ b/calamus-engine/src/main/java/io/trygvis/engine/service/AppInstance.java
@@ -0,0 +1,7 @@
+package io.trygvis.engine.service;
+
+public class AppInstance {
+ private String name;
+ private String host;
+ private String path;
+}
diff --git a/calamus-engine/src/main/java/io/trygvis/engine/service/AppService.java b/calamus-engine/src/main/java/io/trygvis/engine/service/AppService.java
new file mode 100644
index 0000000..3ccde2b
--- /dev/null
+++ b/calamus-engine/src/main/java/io/trygvis/engine/service/AppService.java
@@ -0,0 +1,15 @@
+package io.trygvis.engine.service;
+
+public class AppService {
+ public void installApp(AppInstance instance) {
+ System.out.println("AppService.installApp");
+ }
+
+ public void restartApp(AppInstance instance) {
+ System.out.println("AppService.restartApp");
+ }
+
+ public void waitForUp(AppInstance instance) {
+ System.out.println("AppService.waitForAppUp");
+ }
+}
diff --git a/calamus-engine/src/main/resources/Deploy.bpmn2 b/calamus-engine/src/main/resources/Deploy.bpmn2
new file mode 100644
index 0000000..2e29859
--- /dev/null
+++ b/calamus-engine/src/main/resources/Deploy.bpmn2
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:tns="http://www.jboss.org/drools" xmlns="http://www.jboss.org/drools" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd http://www.jboss.org/drools drools.xsd http://www.bpsim.org/schemas/1.0 bpsim.xsd" id="Definition" expressionLanguage="http://www.mvel.org/2.0" targetNamespace="http://www.jboss.org/drools" typeLanguage="http://www.java.com/javaTypes">
+ <bpmn2:itemDefinition id="_ItemDefinition_118" structureRef="io.trygvis.engine.service.AppService"/>
+ <bpmn2:itemDefinition id="ItemDefinition_1" structureRef="io.trygvis.engine.service.AppInstance"/>
+ <bpmn2:itemDefinition id="ItemDefinition_2" structureRef="StringDataType"/>
+ <bpmn2:signal id="Signal_1" name="New build available"/>
+ <bpmn2:message id="AppInstance" itemRef="ItemDefinition_1" name="AppInstance"/>
+ <bpmn2:interface id="Interface_2" implementationRef="io.trygvis.engine.service.AppService" name="io.trygvis.jbpm.service.AppService">
+ <bpmn2:operation id="_Operation_70" name="installApp">
+ <bpmn2:inMessageRef>AppInstance</bpmn2:inMessageRef>
+ </bpmn2:operation>
+ <bpmn2:operation id="_Operation_71" name="restartApp">
+ <bpmn2:inMessageRef>AppInstance</bpmn2:inMessageRef>
+ </bpmn2:operation>
+ <bpmn2:operation id="_Operation_72" name="waitForUp">
+ <bpmn2:inMessageRef>AppInstance</bpmn2:inMessageRef>
+ </bpmn2:operation>
+ </bpmn2:interface>
+ <bpmn2:process id="io.trygvis.bpm.Deploy" tns:version="1" tns:packageName="io.trygvis.bpm" tns:adHoc="false" name="Deploy" isExecutable="true" processType="Private">
+ <bpmn2:documentation id="Documentation_79">asd</bpmn2:documentation>
+ <bpmn2:extensionElements>
+ <tns:import name="io.trygvis.jbpm.service.AppService"/>
+ <tns:import name="io.trygvis.jbpm.service.AppInstance"/>
+ </bpmn2:extensionElements>
+ <bpmn2:property id="appInstance" itemSubjectRef="ItemDefinition_1"/>
+ <bpmn2:startEvent id="StartEvent_2" name="">
+ <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
+ <bpmn2:outputSet id="OutputSet_4" name="Output Set 4"/>
+ </bpmn2:startEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_1" tns:priority="1" sourceRef="StartEvent_2" targetRef="Task_1"/>
+ <bpmn2:task id="Task_1" tns:taskName="Upgrade App" tns:displayName="Upgrade app" tns:icon="task.png" name="Upgrade App">
+ <bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
+ <bpmn2:ioSpecification id="_InputOutputSpecification_5">
+ <bpmn2:dataInput id="_DataInput_18" itemSubjectRef="ItemDefinition_2" name="Host"/>
+ <bpmn2:dataInput id="_DataInput_19" itemSubjectRef="ItemDefinition_2" name="Path"/>
+ <bpmn2:inputSet id="_InputSet_5" name="New Input Set">
+ <bpmn2:dataInputRefs>_DataInput_18</bpmn2:dataInputRefs>
+ <bpmn2:dataInputRefs>_DataInput_19</bpmn2:dataInputRefs>
+ </bpmn2:inputSet>
+ <bpmn2:outputSet id="OutputSet_1" name="Output Set 1"/>
+ </bpmn2:ioSpecification>
+ <bpmn2:dataInputAssociation id="_DataInputAssociation_18">
+ <bpmn2:targetRef>_DataInput_18</bpmn2:targetRef>
+ </bpmn2:dataInputAssociation>
+ <bpmn2:dataInputAssociation id="_DataInputAssociation_19">
+ <bpmn2:targetRef>_DataInput_19</bpmn2:targetRef>
+ </bpmn2:dataInputAssociation>
+ </bpmn2:task>
+ <bpmn2:sequenceFlow id="SequenceFlow_3" tns:priority="1" sourceRef="Task_1" targetRef="Task_2"/>
+ <bpmn2:task id="Task_2" tns:taskName="Restart App" tns:displayName="Restart app" tns:icon="task.png" name="Restart App">
+ <bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
+ <bpmn2:ioSpecification id="_InputOutputSpecification_6">
+ <bpmn2:dataInput id="_DataInput_20" itemSubjectRef="ItemDefinition_2" name="Host"/>
+ <bpmn2:dataInput id="_DataInput_21" itemSubjectRef="ItemDefinition_2" name="Path"/>
+ <bpmn2:inputSet id="_InputSet_6" name="New Input Set">
+ <bpmn2:dataInputRefs>_DataInput_20</bpmn2:dataInputRefs>
+ <bpmn2:dataInputRefs>_DataInput_21</bpmn2:dataInputRefs>
+ </bpmn2:inputSet>
+ <bpmn2:outputSet id="OutputSet_2" name="Output Set 2"/>
+ </bpmn2:ioSpecification>
+ <bpmn2:dataInputAssociation id="_DataInputAssociation_20">
+ <bpmn2:targetRef>_DataInput_20</bpmn2:targetRef>
+ </bpmn2:dataInputAssociation>
+ <bpmn2:dataInputAssociation id="_DataInputAssociation_21">
+ <bpmn2:targetRef>_DataInput_21</bpmn2:targetRef>
+ </bpmn2:dataInputAssociation>
+ </bpmn2:task>
+ <bpmn2:sequenceFlow id="SequenceFlow_4" tns:priority="1" sourceRef="Task_2" targetRef="IntermediateCatchEvent_3"/>
+ <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_3" name="Wait for application to start">
+ <bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing>
+ <bpmn2:dataOutput id="DataOutput_4" itemSubjectRef="ItemDefinition_1" name="Message_3_Output"/>
+ <bpmn2:dataOutputAssociation id="DataOutputAssociation_4">
+ <bpmn2:sourceRef>DataOutput_4</bpmn2:sourceRef>
+ <bpmn2:targetRef>appInstance</bpmn2:targetRef>
+ </bpmn2:dataOutputAssociation>
+ <bpmn2:outputSet id="OutputSet_7" name="Output Set 7">
+ <bpmn2:dataOutputRefs>DataOutput_4</bpmn2:dataOutputRefs>
+ </bpmn2:outputSet>
+ <bpmn2:messageEventDefinition id="MessageEventDefinition_3" messageRef="AppInstance"/>
+ </bpmn2:intermediateCatchEvent>
+ <bpmn2:sequenceFlow id="SequenceFlow_5" tns:priority="1" sourceRef="IntermediateCatchEvent_3" targetRef="EndEvent_1"/>
+ <bpmn2:endEvent id="EndEvent_1" name="">
+ <bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
+ </bpmn2:endEvent>
+ </bpmn2:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_Process_1" bpmnElement="io.trygvis.bpm.Deploy">
+ <bpmndi:BPMNShape id="BPMNShape_StartEvent_2" bpmnElement="StartEvent_2">
+ <dc:Bounds height="36.0" width="36.0" x="40.0" y="205.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="BPMNShape_EndEvent_1" bpmnElement="EndEvent_1">
+ <dc:Bounds height="36.0" width="36.0" x="730.0" y="205.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="BPMNShape_IntermediateCatchEvent_3" bpmnElement="IntermediateCatchEvent_3">
+ <dc:Bounds height="36.0" width="36.0" x="620.0" y="205.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="BPMNShape_Task_1" bpmnElement="Task_1">
+ <dc:Bounds height="50.0" width="110.0" x="180.0" y="198.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="BPMNShape_Task_2" bpmnElement="Task_2">
+ <dc:Bounds height="50.0" width="110.0" x="408.0" y="198.0"/>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="BPMNShape_StartEvent_2" targetElement="BPMNShape_Task_1">
+ <di:waypoint xsi:type="dc:Point" x="76.0" y="223.0"/>
+ <di:waypoint xsi:type="dc:Point" x="122.0" y="223.0"/>
+ <di:waypoint xsi:type="dc:Point" x="122.0" y="223.0"/>
+ <di:waypoint xsi:type="dc:Point" x="180.0" y="223.0"/>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="BPMNShape_Task_1" targetElement="BPMNShape_Task_2">
+ <di:waypoint xsi:type="dc:Point" x="290.0" y="223.0"/>
+ <di:waypoint xsi:type="dc:Point" x="343.0" y="223.0"/>
+ <di:waypoint xsi:type="dc:Point" x="343.0" y="223.0"/>
+ <di:waypoint xsi:type="dc:Point" x="408.0" y="223.0"/>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="BPMNShape_Task_2" targetElement="BPMNShape_IntermediateCatchEvent_3">
+ <di:waypoint xsi:type="dc:Point" x="518.0" y="223.0"/>
+ <di:waypoint xsi:type="dc:Point" x="563.0" y="223.0"/>
+ <di:waypoint xsi:type="dc:Point" x="563.0" y="223.0"/>
+ <di:waypoint xsi:type="dc:Point" x="620.0" y="223.0"/>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="BPMNShape_IntermediateCatchEvent_3" targetElement="BPMNShape_EndEvent_1">
+ <di:waypoint xsi:type="dc:Point" x="656.0" y="223.0"/>
+ <di:waypoint xsi:type="dc:Point" x="689.0" y="223.0"/>
+ <di:waypoint xsi:type="dc:Point" x="689.0" y="223.0"/>
+ <di:waypoint xsi:type="dc:Point" x="730.0" y="223.0"/>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn2:definitions> \ No newline at end of file
diff --git a/calamus-engine/src/main/resources/META-INF/AppctlWorkDefinitions.wid b/calamus-engine/src/main/resources/META-INF/AppctlWorkDefinitions.wid
new file mode 100644
index 0000000..62ce4a1
--- /dev/null
+++ b/calamus-engine/src/main/resources/META-INF/AppctlWorkDefinitions.wid
@@ -0,0 +1,19 @@
+import org.drools.core.process.core.datatype.impl.type.StringDataType;
+[
+ [
+ "name" : "Upgrade App",
+ "parameters" : [
+ "Host" : new StringDataType(),
+ "Path" : new StringDataType(),
+ ],
+ "displayName" : "Upgrade app"
+ ],
+ [
+ "name" : "Restart App",
+ "parameters" : [
+ "Host" : new StringDataType(),
+ "Path" : new StringDataType(),
+ ],
+ "displayName" : "Restart app"
+ ]
+]
diff --git a/calamus-engine/src/main/resources/META-INF/persistence.xml b/calamus-engine/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..a8a11af
--- /dev/null
+++ b/calamus-engine/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<persistence version="2.0"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
+ xmlns="http://java.sun.com/xml/ns/persistence"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <persistence-unit name="org.jbpm.persistence.jpa" transaction-type="JTA">
+ <provider>org.hibernate.ejb.HibernatePersistence</provider>
+ <jta-data-source>jdbc/jbpm-ds</jta-data-source>
+ <mapping-file>META-INF/JBPMorm.xml</mapping-file>
+ <class>org.drools.persistence.info.SessionInfo</class>
+ <class>org.drools.persistence.info.WorkItemInfo</class>
+ <class>org.jbpm.persistence.processinstance.ProcessInstanceInfo</class>
+ <class>org.jbpm.persistence.correlation.CorrelationKeyInfo</class>
+ <class>org.jbpm.persistence.correlation.CorrelationPropertyInfo</class>
+ <class>org.jbpm.process.audit.ProcessInstanceLog</class>
+ <class>org.jbpm.process.audit.NodeInstanceLog</class>
+ <class>org.jbpm.process.audit.VariableInstanceLog</class>
+ <class>org.jbpm.runtime.manager.impl.jpa.ContextMappingInfo</class>
+ <properties>
+ <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL82Dialect"/>
+ <property name="hibernate.max_fetch_depth" value="3"/>
+ <property name="hibernate.hbm2ddl.auto" value="update"/>
+ <property name="hibernate.show_sql" value="true"/>
+ <!--
+ <property name="hibernate.jdbc.use_streams_for_binary" value="true"/>
+ -->
+ <property name="hibernate.transaction.jta.platform"
+ value="org.hibernate.service.jta.platform.internal.BitronixJtaPlatform"/>
+ </properties>
+ </persistence-unit>
+</persistence>
diff --git a/calamus-engine/src/main/resources/db/postgresql-jbpm-schema.sql b/calamus-engine/src/main/resources/db/postgresql-jbpm-schema.sql
new file mode 100644
index 0000000..e13e6fb
--- /dev/null
+++ b/calamus-engine/src/main/resources/db/postgresql-jbpm-schema.sql
@@ -0,0 +1,633 @@
+CREATE TABLE Attachment (
+ AttachmentId INT8 NOT NULL,
+ accessType INT4,
+ attachedAt TIMESTAMP,
+ attachmentContentId INT8 NOT NULL,
+ contentType VARCHAR(255),
+ name VARCHAR(255),
+ attachment_size INT4,
+ attachedBy_id VARCHAR(255),
+ TaskData_Attachments_Id INT8,
+ PRIMARY KEY (AttachmentId)
+);
+
+CREATE TABLE BAMTaskSummary (
+ BAMTaskId INT8 NOT NULL,
+ createdDate TIMESTAMP,
+ duration INT8,
+ endDate TIMESTAMP,
+ processInstanceId INT8 NOT NULL,
+ startDate TIMESTAMP,
+ status VARCHAR(255),
+ taskId INT8 NOT NULL,
+ taskName VARCHAR(255),
+ userId VARCHAR(255),
+ PRIMARY KEY (BAMTaskId)
+);
+
+CREATE TABLE BooleanExpression (
+ id INT8 NOT NULL,
+ expression TEXT,
+ type VARCHAR(255),
+ Escalation_Constraints_Id INT8,
+ PRIMARY KEY (id)
+);
+
+CREATE TABLE Content (
+ id INT8 NOT NULL,
+ content OID,
+-- content BYTEA,
+ PRIMARY KEY (id)
+);
+
+CREATE TABLE ContextMappingInfo (
+ mappingId INT8 NOT NULL,
+ CONTEXT_ID VARCHAR(255) NOT NULL,
+ KSESSION_ID INT4 NOT NULL,
+ OPTLOCK INT4,
+ PRIMARY KEY (mappingId)
+);
+
+CREATE TABLE CorrelationKeyInfo (
+ keyId INT8 NOT NULL,
+ name VARCHAR(255),
+ processInstanceId INT8 NOT NULL,
+ OPTLOCK INT4,
+ PRIMARY KEY (keyId)
+);
+
+CREATE TABLE CorrelationPropertyInfo (
+ propertyId INT8 NOT NULL,
+ name VARCHAR(255),
+ value VARCHAR(255),
+ OPTLOCK INT4,
+ correlationKey_keyId INT8,
+ PRIMARY KEY (propertyId)
+);
+
+CREATE TABLE Deadline (
+ id INT8 NOT NULL,
+ deadline_date TIMESTAMP,
+ escalated INT2,
+ Deadlines_StartDeadLine_Id INT8,
+ Deadlines_EndDeadLine_Id INT8,
+ PRIMARY KEY (id)
+);
+
+CREATE TABLE Delegation_delegates (
+ task_id INT8 NOT NULL,
+ entity_id VARCHAR(255) NOT NULL
+);
+
+CREATE TABLE ErrorInfo (
+ id INT8 NOT NULL,
+ message VARCHAR(255),
+ stacktrace VARCHAR(5000),
+ timestamp TIMESTAMP,
+ REQUEST_ID INT8 NOT NULL,
+ PRIMARY KEY (id)
+);
+
+CREATE TABLE Escalation (
+ id INT8 NOT NULL,
+ name VARCHAR(255),
+ Deadline_Escalation_Id INT8,
+ PRIMARY KEY (id)
+);
+
+CREATE TABLE EventTypes (
+ InstanceId INT8 NOT NULL,
+ eventTypes VARCHAR(255)
+);
+
+CREATE TABLE I18NText (
+ I18NTextId INT8 NOT NULL,
+ language VARCHAR(255),
+ shortText VARCHAR(255),
+ text TEXT,
+ Task_Subjects_Id INT8,
+ Task_Names_Id INT8,
+ Task_Descriptions_Id INT8,
+ Reassignment_Documentation_Id INT8,
+ Notification_Subjects_Id INT8,
+ Notification_Names_Id INT8,
+ Notification_Documentation_Id INT8,
+ Notification_Descriptions_Id INT8,
+ Deadline_Documentation_Id INT8,
+ PRIMARY KEY (I18NTextId)
+);
+
+CREATE TABLE NodeInstanceLog (
+ id INT8 NOT NULL,
+ connection VARCHAR(255),
+ log_date TIMESTAMP,
+ externalId VARCHAR(255),
+ nodeId VARCHAR(255),
+ nodeInstanceId VARCHAR(255),
+ nodeName VARCHAR(255),
+ nodeType VARCHAR(255),
+ processId VARCHAR(255),
+ processInstanceId INT8 NOT NULL,
+ type INT4 NOT NULL,
+ workItemId INT8,
+ PRIMARY KEY (id)
+);
+
+CREATE TABLE Notification (
+ DTYPE VARCHAR(31) NOT NULL,
+ NotificationId INT8 NOT NULL,
+ priority INT4 NOT NULL,
+ Escalation_Notifications_Id INT8,
+ PRIMARY KEY (NotificationId)
+);
+
+CREATE TABLE Notification_BAs (
+ task_id INT8 NOT NULL,
+ entity_id VARCHAR(255) NOT NULL
+);
+
+CREATE TABLE Notification_Recipients (
+ task_id INT8 NOT NULL,
+ entity_id VARCHAR(255) NOT NULL
+);
+
+CREATE TABLE Notification_email_header (
+ Notification_NotificationId INT8 NOT NULL,
+ emailHeaders_id INT8 NOT NULL,
+ mapkey VARCHAR(255) NOT NULL,
+ PRIMARY KEY (Notification_NotificationId, mapkey)
+);
+
+CREATE TABLE OrganizationalEntity (
+ DTYPE VARCHAR(31) NOT NULL,
+ id VARCHAR(255) NOT NULL,
+ PRIMARY KEY (id)
+);
+
+CREATE TABLE PeopleAssignments_BAs (
+ task_id INT8 NOT NULL,
+ entity_id VARCHAR(255) NOT NULL
+);
+
+CREATE TABLE PeopleAssignments_ExclOwners (
+ task_id INT8 NOT NULL,
+ entity_id VARCHAR(255) NOT NULL
+);
+
+CREATE TABLE PeopleAssignments_PotOwners (
+ task_id INT8 NOT NULL,
+ entity_id VARCHAR(255) NOT NULL
+);
+
+CREATE TABLE PeopleAssignments_Recipients (
+ task_id INT8 NOT NULL,
+ entity_id VARCHAR(255) NOT NULL
+);
+
+CREATE TABLE PeopleAssignments_Stakeholders (
+ task_id INT8 NOT NULL,
+ entity_id VARCHAR(255) NOT NULL
+);
+
+CREATE TABLE ProcessInstanceInfo (
+ InstanceId INT8 NOT NULL,
+ lastModificationDate TIMESTAMP,
+ lastReadDate TIMESTAMP,
+ processId VARCHAR(255),
+ processInstanceByteArray OID,
+-- processInstanceByteArray BYTEA,
+ startDate TIMESTAMP,
+ state INT4 NOT NULL,
+ OPTLOCK INT4,
+ PRIMARY KEY (InstanceId)
+);
+
+CREATE TABLE ProcessInstanceLog (
+ id INT8 NOT NULL,
+ duration INT8,
+ end_date TIMESTAMP,
+ externalId VARCHAR(255),
+ user_identity VARCHAR(255),
+ outcome VARCHAR(255),
+ parentProcessInstanceId INT8,
+ processId VARCHAR(255),
+ processInstanceId INT8 NOT NULL,
+ processName VARCHAR(255),
+ processVersion VARCHAR(255),
+ start_date TIMESTAMP,
+ status INT4,
+ PRIMARY KEY (id)
+);
+
+CREATE TABLE Reassignment (
+ id INT8 NOT NULL,
+ Escalation_Reassignments_Id INT8,
+ PRIMARY KEY (id)
+);
+
+CREATE TABLE Reassignment_potentialOwners (
+ task_id INT8 NOT NULL,
+ entity_id VARCHAR(255) NOT NULL
+);
+
+CREATE TABLE RequestInfo (
+ id INT8 NOT NULL,
+ commandName VARCHAR(255),
+ deploymentId VARCHAR(255),
+ executions INT4 NOT NULL,
+ businessKey VARCHAR(255),
+ message VARCHAR(255),
+ requestData OID,
+-- requestData BYTEA,
+ responseData OID,
+-- responseData BYTEA,
+ retries INT4 NOT NULL,
+ status VARCHAR(255),
+ timestamp TIMESTAMP,
+ PRIMARY KEY (id)
+);
+
+CREATE TABLE SessionInfo (
+ id INT4 NOT NULL,
+ lastModificationDate TIMESTAMP,
+ rulesByteArray OID,
+-- rulesByteArray BYTEA,
+ startDate TIMESTAMP,
+ OPTLOCK INT4,
+ PRIMARY KEY (id)
+);
+
+CREATE TABLE Task (
+ TaskId INT8 NOT NULL,
+ archived INT2,
+ allowedToDelegate VARCHAR(255),
+ formName VARCHAR(255),
+ priority INT4 NOT NULL,
+ subTaskStrategy VARCHAR(255),
+ activationTime TIMESTAMP,
+ createdOn TIMESTAMP,
+ deploymentId VARCHAR(255),
+ documentAccessType INT4,
+ documentContentId INT8 NOT NULL,
+ documentType VARCHAR(255),
+ expirationTime TIMESTAMP,
+ faultAccessType INT4,
+ faultContentId INT8 NOT NULL,
+ faultName VARCHAR(255),
+ faultType VARCHAR(255),
+ outputAccessType INT4,
+ outputContentId INT8 NOT NULL,
+ outputType VARCHAR(255),
+ parentId INT8 NOT NULL,
+ previousStatus INT4,
+ processId VARCHAR(255),
+ processInstanceId INT8 NOT NULL,
+ processSessionId INT4 NOT NULL,
+ skipable BOOLEAN NOT NULL,
+ status VARCHAR(255),
+ workItemId INT8 NOT NULL,
+ taskType VARCHAR(255),
+ OPTLOCK INT4,
+ taskInitiator_id VARCHAR(255),
+ actualOwner_id VARCHAR(255),
+ createdBy_id VARCHAR(255),
+ PRIMARY KEY (TaskId)
+);
+
+CREATE TABLE TaskDef (
+ TaskDefId INT8 NOT NULL,
+ name VARCHAR(255),
+ priority INT4 NOT NULL,
+ PRIMARY KEY (TaskDefId)
+);
+
+CREATE TABLE TaskEvent (
+ id INT8 NOT NULL,
+ logTime TIMESTAMP,
+ taskId INT8,
+ type VARCHAR(255),
+ userId VARCHAR(255),
+ PRIMARY KEY (id)
+);
+
+CREATE TABLE VariableInstanceLog (
+ id INT8 NOT NULL,
+ log_date TIMESTAMP,
+ externalId VARCHAR(255),
+ oldValue VARCHAR(255),
+ processId VARCHAR(255),
+ processInstanceId INT8 NOT NULL,
+ value VARCHAR(255),
+ variableId VARCHAR(255),
+ variableInstanceId VARCHAR(255),
+ PRIMARY KEY (id)
+);
+
+CREATE TABLE WorkItemInfo (
+ workItemId INT8 NOT NULL,
+ creationDate TIMESTAMP,
+ name VARCHAR(255),
+ processInstanceId INT8 NOT NULL,
+ state INT8 NOT NULL,
+ OPTLOCK INT4,
+ workItemByteArray OID,
+-- workItemByteArray BYTEA,
+ PRIMARY KEY (workItemId)
+);
+
+CREATE TABLE email_header (
+ id INT8 NOT NULL,
+ body TEXT,
+ fromAddress VARCHAR(255),
+ language VARCHAR(255),
+ replyToAddress VARCHAR(255),
+ subject VARCHAR(255),
+ PRIMARY KEY (id)
+);
+
+CREATE TABLE task_comment (
+ id INT8 NOT NULL,
+ addedAt TIMESTAMP,
+ text TEXT,
+ addedBy_id VARCHAR(255),
+ TaskData_Comments_Id INT8,
+ PRIMARY KEY (id)
+);
+
+ALTER TABLE Attachment
+ADD CONSTRAINT FK1C93543D937BFB5
+FOREIGN KEY (attachedBy_id)
+REFERENCES OrganizationalEntity;
+
+ALTER TABLE Attachment
+ADD CONSTRAINT FK1C9354333CA892A
+FOREIGN KEY (TaskData_Attachments_Id)
+REFERENCES Task;
+
+ALTER TABLE BooleanExpression
+ADD CONSTRAINT FKE3D208C06C97C90E
+FOREIGN KEY (Escalation_Constraints_Id)
+REFERENCES Escalation;
+
+ALTER TABLE CorrelationPropertyInfo
+ADD CONSTRAINT FK761452A5D87156ED
+FOREIGN KEY (correlationKey_keyId)
+REFERENCES CorrelationKeyInfo;
+
+ALTER TABLE Deadline
+ADD CONSTRAINT FK21DF3E78A9FE0EF4
+FOREIGN KEY (Deadlines_StartDeadLine_Id)
+REFERENCES Task;
+
+ALTER TABLE Deadline
+ADD CONSTRAINT FK21DF3E78695E4DDB
+FOREIGN KEY (Deadlines_EndDeadLine_Id)
+REFERENCES Task;
+
+ALTER TABLE Delegation_delegates
+ADD CONSTRAINT FK47485D5772B3A123
+FOREIGN KEY (entity_id)
+REFERENCES OrganizationalEntity;
+
+ALTER TABLE Delegation_delegates
+ADD CONSTRAINT FK47485D57786553A5
+FOREIGN KEY (task_id)
+REFERENCES Task;
+
+ALTER TABLE ErrorInfo
+ADD CONSTRAINT FK8B1186B6724A467
+FOREIGN KEY (REQUEST_ID)
+REFERENCES RequestInfo;
+
+ALTER TABLE Escalation
+ADD CONSTRAINT FK67B2C6B5D1E5CC1
+FOREIGN KEY (Deadline_Escalation_Id)
+REFERENCES Deadline;
+
+ALTER TABLE EventTypes
+ADD CONSTRAINT FKB0E5621F7665489A
+FOREIGN KEY (InstanceId)
+REFERENCES ProcessInstanceInfo;
+
+ALTER TABLE I18NText
+ADD CONSTRAINT FK2349686BF4ACCD69
+FOREIGN KEY (Task_Subjects_Id)
+REFERENCES Task;
+
+ALTER TABLE I18NText
+ADD CONSTRAINT FK2349686B424B187C
+FOREIGN KEY (Task_Names_Id)
+REFERENCES Task;
+
+ALTER TABLE I18NText
+ADD CONSTRAINT FK2349686BAB648139
+FOREIGN KEY (Task_Descriptions_Id)
+REFERENCES Task;
+
+ALTER TABLE I18NText
+ADD CONSTRAINT FK2349686BB340A2AA
+FOREIGN KEY (Reassignment_Documentation_Id)
+REFERENCES Reassignment;
+
+ALTER TABLE I18NText
+ADD CONSTRAINT FK2349686BF0CDED35
+FOREIGN KEY (Notification_Subjects_Id)
+REFERENCES Notification;
+
+ALTER TABLE I18NText
+ADD CONSTRAINT FK2349686BCC03ED3C
+FOREIGN KEY (Notification_Names_Id)
+REFERENCES Notification;
+
+ALTER TABLE I18NText
+ADD CONSTRAINT FK2349686B77C1C08A
+FOREIGN KEY (Notification_Documentation_Id)
+REFERENCES Notification;
+
+ALTER TABLE I18NText
+ADD CONSTRAINT FK2349686B18DDFE05
+FOREIGN KEY (Notification_Descriptions_Id)
+REFERENCES Notification;
+
+ALTER TABLE I18NText
+ADD CONSTRAINT FK2349686B78AF072A
+FOREIGN KEY (Deadline_Documentation_Id)
+REFERENCES Deadline;
+
+ALTER TABLE Notification
+ADD CONSTRAINT FK2D45DD0BC0C0F29C
+FOREIGN KEY (Escalation_Notifications_Id)
+REFERENCES Escalation;
+
+ALTER TABLE Notification_BAs
+ADD CONSTRAINT FK2DD68EE072B3A123
+FOREIGN KEY (entity_id)
+REFERENCES OrganizationalEntity;
+
+ALTER TABLE Notification_BAs
+ADD CONSTRAINT FK2DD68EE093F2090B
+FOREIGN KEY (task_id)
+REFERENCES Notification;
+
+ALTER TABLE Notification_Recipients
+ADD CONSTRAINT FK98FD214E72B3A123
+FOREIGN KEY (entity_id)
+REFERENCES OrganizationalEntity;
+
+ALTER TABLE Notification_Recipients
+ADD CONSTRAINT FK98FD214E93F2090B
+FOREIGN KEY (task_id)
+REFERENCES Notification;
+
+ALTER TABLE Notification_email_header
+ADD CONSTRAINT UK_F30FE3446CEA0510 UNIQUE (emailHeaders_id);
+
+ALTER TABLE Notification_email_header
+ADD CONSTRAINT FKF30FE3448BED1339
+FOREIGN KEY (emailHeaders_id)
+REFERENCES email_header;
+
+ALTER TABLE Notification_email_header
+ADD CONSTRAINT FKF30FE344DD2D7416
+FOREIGN KEY (Notification_NotificationId)
+REFERENCES Notification;
+
+ALTER TABLE PeopleAssignments_BAs
+ADD CONSTRAINT FK9D8CF4EC72B3A123
+FOREIGN KEY (entity_id)
+REFERENCES OrganizationalEntity;
+
+ALTER TABLE PeopleAssignments_BAs
+ADD CONSTRAINT FK9D8CF4EC786553A5
+FOREIGN KEY (task_id)
+REFERENCES Task;
+
+ALTER TABLE PeopleAssignments_ExclOwners
+ADD CONSTRAINT FKC77B97E472B3A123
+FOREIGN KEY (entity_id)
+REFERENCES OrganizationalEntity;
+
+ALTER TABLE PeopleAssignments_ExclOwners
+ADD CONSTRAINT FKC77B97E4786553A5
+FOREIGN KEY (task_id)
+REFERENCES Task;
+
+ALTER TABLE PeopleAssignments_PotOwners
+ADD CONSTRAINT FK1EE418D72B3A123
+FOREIGN KEY (entity_id)
+REFERENCES OrganizationalEntity;
+
+ALTER TABLE PeopleAssignments_PotOwners
+ADD CONSTRAINT FK1EE418D786553A5
+FOREIGN KEY (task_id)
+REFERENCES Task;
+
+ALTER TABLE PeopleAssignments_Recipients
+ADD CONSTRAINT FKC6F615C272B3A123
+FOREIGN KEY (entity_id)
+REFERENCES OrganizationalEntity;
+
+ALTER TABLE PeopleAssignments_Recipients
+ADD CONSTRAINT FKC6F615C2786553A5
+FOREIGN KEY (task_id)
+REFERENCES Task;
+
+ALTER TABLE PeopleAssignments_Stakeholders
+ADD CONSTRAINT FK482F79D572B3A123
+FOREIGN KEY (entity_id)
+REFERENCES OrganizationalEntity;
+
+ALTER TABLE PeopleAssignments_Stakeholders
+ADD CONSTRAINT FK482F79D5786553A5
+FOREIGN KEY (task_id)
+REFERENCES Task;
+
+ALTER TABLE Reassignment
+ADD CONSTRAINT FK724D056062A1E871
+FOREIGN KEY (Escalation_Reassignments_Id)
+REFERENCES Escalation;
+
+ALTER TABLE Reassignment_potentialOwners
+ADD CONSTRAINT FK90B59CFF72B3A123
+FOREIGN KEY (entity_id)
+REFERENCES OrganizationalEntity;
+
+ALTER TABLE Reassignment_potentialOwners
+ADD CONSTRAINT FK90B59CFF35D2FEE0
+FOREIGN KEY (task_id)
+REFERENCES Reassignment;
+
+ALTER TABLE Task
+ADD CONSTRAINT FK27A9A53C55C806
+FOREIGN KEY (taskInitiator_id)
+REFERENCES OrganizationalEntity;
+
+ALTER TABLE Task
+ADD CONSTRAINT FK27A9A5B723BE8B
+FOREIGN KEY (actualOwner_id)
+REFERENCES OrganizationalEntity;
+
+ALTER TABLE Task
+ADD CONSTRAINT FK27A9A55427E8F1
+FOREIGN KEY (createdBy_id)
+REFERENCES OrganizationalEntity;
+
+ALTER TABLE task_comment
+ADD CONSTRAINT FK61F475A57A3215D9
+FOREIGN KEY (addedBy_id)
+REFERENCES OrganizationalEntity;
+
+ALTER TABLE task_comment
+ADD CONSTRAINT FK61F475A5F510CB46
+FOREIGN KEY (TaskData_Comments_Id)
+REFERENCES Task;
+
+CREATE SEQUENCE ATTACHMENT_ID_SEQ;
+
+CREATE SEQUENCE BAM_TASK_ID_SEQ;
+
+CREATE SEQUENCE BOOLEANEXPR_ID_SEQ;
+
+CREATE SEQUENCE COMMENT_ID_SEQ;
+
+CREATE SEQUENCE CONTENT_ID_SEQ;
+
+CREATE SEQUENCE CONTEXT_MAPPING_INFO_ID_SEQ;
+
+CREATE SEQUENCE CORRELATION_KEY_ID_SEQ;
+
+CREATE SEQUENCE CORRELATION_PROP_ID_SEQ;
+
+CREATE SEQUENCE DEADLINE_ID_SEQ;
+
+CREATE SEQUENCE EMAILNOTIFHEAD_ID_SEQ;
+
+CREATE SEQUENCE ERROR_INFO_ID_SEQ;
+
+CREATE SEQUENCE ESCALATION_ID_SEQ;
+
+CREATE SEQUENCE I18NTEXT_ID_SEQ;
+
+CREATE SEQUENCE NODE_INST_LOG_ID_SEQ;
+
+CREATE SEQUENCE NOTIFICATION_ID_SEQ;
+
+CREATE SEQUENCE PROCESS_INSTANCE_INFO_ID_SEQ;
+
+CREATE SEQUENCE PROC_INST_LOG_ID_SEQ;
+
+CREATE SEQUENCE REASSIGNMENT_ID_SEQ;
+
+CREATE SEQUENCE REQUEST_INFO_ID_SEQ;
+
+CREATE SEQUENCE SESSIONINFO_ID_SEQ;
+
+CREATE SEQUENCE TASK_DEF_ID_SEQ;
+
+CREATE SEQUENCE TASK_EVENT_ID_SEQ;
+
+CREATE SEQUENCE TASK_ID_SEQ;
+
+CREATE SEQUENCE VAR_INST_LOG_ID_SEQ;
+
+CREATE SEQUENCE WORKITEMINFO_ID_SEQ;
diff --git a/calamus-engine/src/main/resources/db/quartz_tables_postgres.sql b/calamus-engine/src/main/resources/db/quartz_tables_postgres.sql
new file mode 100644
index 0000000..fd4466f
--- /dev/null
+++ b/calamus-engine/src/main/resources/db/quartz_tables_postgres.sql
@@ -0,0 +1,165 @@
+-- Thanks to Patrick Lightbody for submitting this...
+--
+-- In your Quartz properties file, you'll need to set
+-- org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
+
+
+CREATE TABLE qrtz_job_details
+ (
+ JOB_NAME VARCHAR(200) NOT NULL,
+ JOB_GROUP VARCHAR(200) NOT NULL,
+ DESCRIPTION VARCHAR(250) NULL,
+ JOB_CLASS_NAME VARCHAR(250) NOT NULL,
+ IS_DURABLE BOOL NOT NULL,
+ IS_VOLATILE BOOL NOT NULL,
+ IS_STATEFUL BOOL NOT NULL,
+ REQUESTS_RECOVERY BOOL NOT NULL,
+ JOB_DATA BYTEA NULL,
+ PRIMARY KEY (JOB_NAME,JOB_GROUP)
+);
+
+CREATE TABLE qrtz_job_listeners
+ (
+ JOB_NAME VARCHAR(200) NOT NULL,
+ JOB_GROUP VARCHAR(200) NOT NULL,
+ JOB_LISTENER VARCHAR(200) NOT NULL,
+ PRIMARY KEY (JOB_NAME,JOB_GROUP,JOB_LISTENER),
+ FOREIGN KEY (JOB_NAME,JOB_GROUP)
+ REFERENCES QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)
+);
+
+CREATE TABLE qrtz_triggers
+ (
+ TRIGGER_NAME VARCHAR(200) NOT NULL,
+ TRIGGER_GROUP VARCHAR(200) NOT NULL,
+ JOB_NAME VARCHAR(200) NOT NULL,
+ JOB_GROUP VARCHAR(200) NOT NULL,
+ IS_VOLATILE BOOL NOT NULL,
+ DESCRIPTION VARCHAR(250) NULL,
+ NEXT_FIRE_TIME BIGINT NULL,
+ PREV_FIRE_TIME BIGINT NULL,
+ PRIORITY INTEGER NULL,
+ TRIGGER_STATE VARCHAR(16) NOT NULL,
+ TRIGGER_TYPE VARCHAR(8) NOT NULL,
+ START_TIME BIGINT NOT NULL,
+ END_TIME BIGINT NULL,
+ CALENDAR_NAME VARCHAR(200) NULL,
+ MISFIRE_INSTR SMALLINT NULL,
+ JOB_DATA BYTEA NULL,
+ PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP),
+ FOREIGN KEY (JOB_NAME,JOB_GROUP)
+ REFERENCES QRTZ_JOB_DETAILS(JOB_NAME,JOB_GROUP)
+);
+
+CREATE TABLE qrtz_simple_triggers
+ (
+ TRIGGER_NAME VARCHAR(200) NOT NULL,
+ TRIGGER_GROUP VARCHAR(200) NOT NULL,
+ REPEAT_COUNT BIGINT NOT NULL,
+ REPEAT_INTERVAL BIGINT NOT NULL,
+ TIMES_TRIGGERED BIGINT NOT NULL,
+ PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP),
+ FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP)
+ REFERENCES QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)
+);
+
+CREATE TABLE qrtz_cron_triggers
+ (
+ TRIGGER_NAME VARCHAR(200) NOT NULL,
+ TRIGGER_GROUP VARCHAR(200) NOT NULL,
+ CRON_EXPRESSION VARCHAR(120) NOT NULL,
+ TIME_ZONE_ID VARCHAR(80),
+ PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP),
+ FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP)
+ REFERENCES QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)
+);
+
+CREATE TABLE qrtz_blob_triggers
+ (
+ TRIGGER_NAME VARCHAR(200) NOT NULL,
+ TRIGGER_GROUP VARCHAR(200) NOT NULL,
+ BLOB_DATA BYTEA NULL,
+ PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP),
+ FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP)
+ REFERENCES QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)
+);
+
+CREATE TABLE qrtz_trigger_listeners
+ (
+ TRIGGER_NAME VARCHAR(200) NOT NULL,
+ TRIGGER_GROUP VARCHAR(200) NOT NULL,
+ TRIGGER_LISTENER VARCHAR(200) NOT NULL,
+ PRIMARY KEY (TRIGGER_NAME,TRIGGER_GROUP,TRIGGER_LISTENER),
+ FOREIGN KEY (TRIGGER_NAME,TRIGGER_GROUP)
+ REFERENCES QRTZ_TRIGGERS(TRIGGER_NAME,TRIGGER_GROUP)
+);
+
+
+CREATE TABLE qrtz_calendars
+ (
+ CALENDAR_NAME VARCHAR(200) NOT NULL,
+ CALENDAR BYTEA NOT NULL,
+ PRIMARY KEY (CALENDAR_NAME)
+);
+
+
+CREATE TABLE qrtz_paused_trigger_grps
+ (
+ TRIGGER_GROUP VARCHAR(200) NOT NULL,
+ PRIMARY KEY (TRIGGER_GROUP)
+);
+
+CREATE TABLE qrtz_fired_triggers
+ (
+ ENTRY_ID VARCHAR(95) NOT NULL,
+ TRIGGER_NAME VARCHAR(200) NOT NULL,
+ TRIGGER_GROUP VARCHAR(200) NOT NULL,
+ IS_VOLATILE BOOL NOT NULL,
+ INSTANCE_NAME VARCHAR(200) NOT NULL,
+ FIRED_TIME BIGINT NOT NULL,
+ PRIORITY INTEGER NOT NULL,
+ STATE VARCHAR(16) NOT NULL,
+ JOB_NAME VARCHAR(200) NULL,
+ JOB_GROUP VARCHAR(200) NULL,
+ IS_STATEFUL BOOL NULL,
+ REQUESTS_RECOVERY BOOL NULL,
+ PRIMARY KEY (ENTRY_ID)
+);
+
+CREATE TABLE qrtz_scheduler_state
+ (
+ INSTANCE_NAME VARCHAR(200) NOT NULL,
+ LAST_CHECKIN_TIME BIGINT NOT NULL,
+ CHECKIN_INTERVAL BIGINT NOT NULL,
+ PRIMARY KEY (INSTANCE_NAME)
+);
+
+CREATE TABLE qrtz_locks
+ (
+ LOCK_NAME VARCHAR(40) NOT NULL,
+ PRIMARY KEY (LOCK_NAME)
+);
+
+
+INSERT INTO qrtz_locks values('TRIGGER_ACCESS');
+INSERT INTO qrtz_locks values('JOB_ACCESS');
+INSERT INTO qrtz_locks values('CALENDAR_ACCESS');
+INSERT INTO qrtz_locks values('STATE_ACCESS');
+INSERT INTO qrtz_locks values('MISFIRE_ACCESS');
+
+create index idx_qrtz_j_req_recovery on qrtz_job_details(REQUESTS_RECOVERY);
+create index idx_qrtz_t_next_fire_time on qrtz_triggers(NEXT_FIRE_TIME);
+create index idx_qrtz_t_state on qrtz_triggers(TRIGGER_STATE);
+create index idx_qrtz_t_nft_st on qrtz_triggers(NEXT_FIRE_TIME,TRIGGER_STATE);
+create index idx_qrtz_t_volatile on qrtz_triggers(IS_VOLATILE);
+create index idx_qrtz_ft_trig_name on qrtz_fired_triggers(TRIGGER_NAME);
+create index idx_qrtz_ft_trig_group on qrtz_fired_triggers(TRIGGER_GROUP);
+create index idx_qrtz_ft_trig_nm_gp on qrtz_fired_triggers(TRIGGER_NAME,TRIGGER_GROUP);
+create index idx_qrtz_ft_trig_volatile on qrtz_fired_triggers(IS_VOLATILE);
+create index idx_qrtz_ft_trig_inst_name on qrtz_fired_triggers(INSTANCE_NAME);
+create index idx_qrtz_ft_job_name on qrtz_fired_triggers(JOB_NAME);
+create index idx_qrtz_ft_job_group on qrtz_fired_triggers(JOB_GROUP);
+create index idx_qrtz_ft_job_stateful on qrtz_fired_triggers(IS_STATEFUL);
+create index idx_qrtz_ft_job_req_recovery on qrtz_fired_triggers(REQUESTS_RECOVERY);
+
+commit;
diff --git a/calamus-engine/src/main/resources/jndi.properties b/calamus-engine/src/main/resources/jndi.properties
new file mode 100644
index 0000000..ae8a6fb
--- /dev/null
+++ b/calamus-engine/src/main/resources/jndi.properties
@@ -0,0 +1 @@
+java.naming.factory.initial=bitronix.tm.jndi.BitronixInitialContextFactory
diff --git a/calamus-engine/src/test/java/io/trygvis/engine/MyTest.java b/calamus-engine/src/test/java/io/trygvis/engine/MyTest.java
new file mode 100644
index 0000000..8c170ea
--- /dev/null
+++ b/calamus-engine/src/test/java/io/trygvis/engine/MyTest.java
@@ -0,0 +1,90 @@
+package io.trygvis.engine;
+
+import bitronix.tm.TransactionManagerServices;
+import bitronix.tm.resource.jdbc.PoolingDataSource;
+import org.jbpm.bpmn2.handler.ServiceTaskHandler;
+import org.jbpm.process.audit.AuditLoggerFactory;
+import org.junit.Before;
+import org.junit.Test;
+import org.kie.api.KieBase;
+import org.kie.api.definition.process.Process;
+import org.kie.api.runtime.Environment;
+import org.kie.api.runtime.EnvironmentName;
+import org.kie.api.runtime.KieSession;
+import org.kie.api.runtime.process.ProcessInstance;
+import org.kie.internal.KnowledgeBaseFactory;
+import org.kie.internal.io.ResourceFactory;
+import org.kie.internal.persistence.jpa.JPAKnowledgeService;
+import org.kie.internal.runtime.StatefulKnowledgeSession;
+import org.kie.internal.utils.KieHelper;
+
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+public class MyTest {
+
+ StatefulKnowledgeSession session;
+
+// @Before
+// public void setUp() throws Exception {
+// PoolingDataSource ds = new PoolingDataSource();
+// ds.setUniqueName("jdbc/jbpm-ds");
+// ds.setClassName(bitronix.tm.resource.jdbc.lrc.LrcXADataSource.class.getCanonicalName());
+// ds.setMaxPoolSize(3);
+// ds.setAllowLocalTransactions(true);
+// ds.getDriverProperties().put("user", "jbpm");
+// ds.getDriverProperties().put("password", "jbpm");
+// ds.getDriverProperties().put("url", "jdbc:postgresql://localhost/jbpm");
+// ds.getDriverProperties().put("driverClassName", org.postgresql.Driver.class.getCanonicalName());
+// ds.init();
+//
+// EntityManagerFactory emf = Persistence.createEntityManagerFactory("org.jbpm.persistence.jpa");
+// Environment env = KnowledgeBaseFactory.newEnvironment();
+// env.set(EnvironmentName.ENTITY_MANAGER_FACTORY, emf);
+// env.set(EnvironmentName.TRANSACTION_MANAGER, TransactionManagerServices.getTransactionManager());
+//
+// KieBase kieBase = new KieHelper()
+// .addResource(ResourceFactory.newClassPathResource("Deploy.bpmn2"))
+// .build();
+//
+// // create a new knowledge session that uses JPA to store the runtime state
+// session = JPAKnowledgeService.newStatefulKnowledgeSession(kieBase, null, env);
+// session.addEventListener(AuditLoggerFactory.newJPAInstance(env));
+//
+// session.getWorkItemManager().registerWorkItemHandler("Service Task", new ServiceTaskHandler());
+// session.getWorkItemManager().registerWorkItemHandler("Upgrade App", new UpgradeAppWorkItemHandler());
+// session.getWorkItemManager().registerWorkItemHandler("Restart App", new RestartAppWorkItemHandler());
+// }
+
+ @Test
+ public void testDeploy() {
+/*
+ ProcessInstance processInstance = session.startProcess("io.trygvis.bpm.Deploy");
+
+// assertProcessInstanceCompleted(processInstance.getId(), session);
+
+ System.out.println("processInstance = " + processInstance);
+ System.out.println("processInstance.getProcessId() = " + processInstance.getProcessId());
+ System.out.println("processInstance.getState() = " + processInstance.getState());
+
+ Process process = session.getKieBase().getProcess(processInstance.getProcessId());
+ System.out.println("process = " + process);
+ System.out.println("process.getType() = " + process.getType());
+*/
+ }
+
+ public static void assertProcessInstanceCompleted(long processInstanceId, KieSession ksession) {
+ assertNull(ksession.getProcessInstance(processInstanceId));
+ }
+
+ public static void assertProcessInstanceAborted(long processInstanceId, KieSession ksession) {
+ assertNull(ksession.getProcessInstance(processInstanceId));
+ }
+
+ public static void assertProcessInstanceActive(long processInstanceId, KieSession ksession) {
+ assertNotNull(ksession.getProcessInstance(processInstanceId));
+ }
+}