summaryrefslogtreecommitdiff
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
downloadcalamus-bfcfcf5e3b4301bc94c27f47bfda61693edf3595.tar.gz
calamus-bfcfcf5e3b4301bc94c27f47bfda61693edf3595.tar.bz2
calamus-bfcfcf5e3b4301bc94c27f47bfda61693edf3595.tar.xz
calamus-bfcfcf5e3b4301bc94c27f47bfda61693edf3595.zip
wip
-rw-r--r--.gitattributes8
-rwxr-xr-x.gitignore13
-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
-rw-r--r--calamus-jenkins-plugin/.gitignore1
-rw-r--r--calamus-jenkins-plugin/calamus-jenkins-pipeline.ipr107
-rw-r--r--calamus-jenkins-plugin/calamus-jenkins-pipeline.iws418
-rw-r--r--calamus-jenkins-plugin/pom.xml71
-rw-r--r--calamus-jenkins-plugin/src/main/java/org/jenkinsci/plugins/calamus/HelloWorldBuilder.java152
-rw-r--r--calamus-jenkins-plugin/src/main/java/org/jenkinsci/plugins/calamus/JbpmRunListener.java42
-rw-r--r--calamus-jenkins-plugin/src/main/java/org/jenkinsci/plugins/calamus/MqClient.java48
-rw-r--r--calamus-jenkins-plugin/src/main/resources/index.jelly6
-rw-r--r--calamus-jenkins-plugin/src/main/resources/org/jenkinsci/plugins/calamus/HelloWorldBuilder/config.jelly15
-rw-r--r--calamus-jenkins-plugin/src/main/resources/org/jenkinsci/plugins/calamus/HelloWorldBuilder/global.jelly20
-rw-r--r--calamus-jenkins-plugin/src/main/resources/org/jenkinsci/plugins/calamus/HelloWorldBuilder/help-name.html6
-rw-r--r--calamus-jenkins-plugin/src/main/resources/org/jenkinsci/plugins/calamus/HelloWorldBuilder/help-useFrench.html6
-rw-r--r--calamus-nexus-plugin/pom.xml75
-rw-r--r--calamus-nexus-plugin/src/main/java/io/trygvis/calamus/nexus/CalamusConfig.java30
-rw-r--r--calamus-nexus-plugin/src/main/java/io/trygvis/calamus/nexus/CalamusNexusPlugin.java17
-rw-r--r--calamus-nexus-plugin/src/main/java/io/trygvis/calamus/nexus/CalamusUiContributor.java17
-rw-r--r--calamus-nexus-plugin/src/main/java/io/trygvis/calamus/nexus/EventListener.java51
-rw-r--r--calamus-nexus-plugin/src/main/java/io/trygvis/calamus/nexus/MqClient.java51
-rw-r--r--calamus-nexus-plugin/src/main/resources/static/js/Calamus/CalamusConfigPanel.js3
-rw-r--r--calamus-nexus-plugin/src/main/resources/static/js/calamus-nexus-plugin-boot.js3
-rw-r--r--demo/pom.xml12
-rw-r--r--pom.xml23
39 files changed, 2881 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..9a8f287
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,8 @@
+* text=auto
+
+*.java text
+*.scala text
+*.sql text
+
+*.png binary
+*.jpg binary
diff --git a/.gitignore b/.gitignore
new file mode 100755
index 0000000..b64e034
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,13 @@
+target
+.idea
+*.iml
+*.ipw
+*.iws
+.classpath
+.project
+.settings
+
+etc/config.properties
+
+*tmp*
+
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));
+ }
+}
diff --git a/calamus-jenkins-plugin/.gitignore b/calamus-jenkins-plugin/.gitignore
new file mode 100644
index 0000000..b8f99f5
--- /dev/null
+++ b/calamus-jenkins-plugin/.gitignore
@@ -0,0 +1 @@
+work
diff --git a/calamus-jenkins-plugin/calamus-jenkins-pipeline.ipr b/calamus-jenkins-plugin/calamus-jenkins-pipeline.ipr
new file mode 100644
index 0000000..c47dca1
--- /dev/null
+++ b/calamus-jenkins-plugin/calamus-jenkins-pipeline.ipr
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project version="4" relativePaths="false">
+ <component name="ProjectRootManager" version="2" assert-keyword="true" project-jdk-name="JDK1.5" jdk-15="true"/>
+ <component name="CodeStyleManager">
+ <option name="USE_DEFAULT_CODE_STYLE_SCHEME" value="true"/>
+ <option name="CODE_STYLE_SCHEME" value=""/>
+ </component>
+ <component name="libraryTable"/>
+ <component name="CompilerConfiguration">
+ <option name="DEFAULT_COMPILER" value="Javac"/>
+ <option name="CLEAR_OUTPUT_DIRECTORY" value="false"/>
+ <!--
+ <wildcardResourcePatterns>
+ <entry name="${wildcardResourcePattern}"/>
+ </wildcardResourcePatterns>
+ -->
+ <wildcardResourcePatterns>
+ <entry name="!?*.java"/>
+ </wildcardResourcePatterns>
+ </component>
+ <component name="JavacSettings">
+ <option name="DEBUGGING_INFO" value="true"/>
+ <option name="GENERATE_NO_WARNINGS" value="false"/>
+ <option name="DEPRECATION" value="true"/>
+ <option name="ADDITIONAL_OPTIONS_STRING" value=""/>
+ <option name="MAXIMUM_HEAP_SIZE" value="128"/>
+ <option name="USE_GENERICS_COMPILER" value="false"/>
+ </component>
+ <component name="JikesSettings">
+ <option name="DEBUGGING_INFO" value="true"/>
+ <option name="DEPRECATION" value="true"/>
+ <option name="GENERATE_NO_WARNINGS" value="false"/>
+ <option name="GENERATE_MAKE_FILE_DEPENDENCIES" value="false"/>
+ <option name="DO_FULL_DEPENDENCE_CHECK" value="false"/>
+ <option name="IS_INCREMENTAL_MODE" value="false"/>
+ <option name="IS_EMACS_ERRORS_MODE" value="true"/>
+ <option name="ADDITIONAL_OPTIONS_STRING" value=""/>
+ <option name="MAXIMUM_HEAP_SIZE" value="128"/>
+ </component>
+ <component name="AntConfiguration">
+ <option name="IS_AUTOSCROLL_TO_SOURCE" value="false"/>
+ <option name="FILTER_TARGETS" value="false"/>
+ </component>
+ <component name="JavadocGenerationManager">
+ <option name="OUTPUT_DIRECTORY"/>
+ <option name="OPTION_SCOPE" value="protected"/>
+ <option name="OPTION_HIERARCHY" value="false"/>
+ <option name="OPTION_NAVIGATOR" value="false"/>
+ <option name="OPTION_INDEX" value="false"/>
+ <option name="OPTION_SEPARATE_INDEX" value="false"/>
+ <option name="OPTION_USE_1_1" value="false"/>
+ <option name="OPTION_DOCUMENT_TAG_USE" value="false"/>
+ <option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false"/>
+ <option name="OPTION_DOCUMENT_TAG_VERSION" value="false"/>
+ <option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="false"/>
+ <option name="OPTION_DEPRECATED_LIST" value="false"/>
+ <option name="OTHER_OPTIONS"/>
+ <option name="HEAP_SIZE"/>
+ <option name="OPEN_IN_BROWSER" value="false"/>
+ </component>
+ <component name="JUnitProjectSettings">
+ <option name="TEST_RUNNER" value="UI"/>
+ </component>
+ <component name="EntryPointsManager">
+ <entry_points/>
+ </component>
+ <component name="DataSourceManager"/>
+ <component name="ExportToHTMLSettings">
+ <option name="PRINT_LINE_NUMBERS" value="false"/>
+ <option name="OPEN_IN_BROWSER" value="false"/>
+ <option name="OUTPUT_DIRECTORY"/>
+ </component>
+ <component name="ImportConfiguration">
+ <option name="VENDOR"/>
+ <option name="RELEASE_TAG"/>
+ <option name="LOG_MESSAGE"/>
+ <option name="CHECKOUT_AFTER_IMPORT" value="true"/>
+ </component>
+ <component name="ProjectModuleManager">
+ <modules>
+ <!-- module filepath="$$PROJECT_DIR$$/${pom.artifactId}.iml"/ -->
+ <module filepath="$PROJECT_DIR$/calamus-jenkins-pipeline.iml"/>
+ </modules>
+ </component>
+ <UsedPathMacros>
+ <!--<macro name="cargo"></macro>-->
+ </UsedPathMacros>
+</project>
diff --git a/calamus-jenkins-plugin/calamus-jenkins-pipeline.iws b/calamus-jenkins-plugin/calamus-jenkins-pipeline.iws
new file mode 100644
index 0000000..b94e12f
--- /dev/null
+++ b/calamus-jenkins-plugin/calamus-jenkins-pipeline.iws
@@ -0,0 +1,418 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project version="4" relativePaths="false">
+ <component name="LvcsProjectConfiguration">
+ <option name="ADD_LABEL_ON_PROJECT_OPEN" value="true"/>
+ <option name="ADD_LABEL_ON_PROJECT_COMPILATION" value="true"/>
+ <option name="ADD_LABEL_ON_FILE_PACKAGE_COMPILATION" value="true"/>
+ <option name="ADD_LABEL_ON_PROJECT_MAKE" value="true"/>
+ <option name="ADD_LABEL_ON_RUNNING" value="true"/>
+ <option name="ADD_LABEL_ON_DEBUGGING" value="true"/>
+ <option name="ADD_LABEL_ON_UNIT_TEST_PASSED" value="true"/>
+ <option name="ADD_LABEL_ON_UNIT_TEST_FAILED" value="true"/>
+ </component>
+ <component name="PropertiesComponent">
+ <property name="MemberChooser.copyJavadoc" value="false"/>
+ <property name="GoToClass.includeLibraries" value="false"/>
+ <property name="MemberChooser.showClasses" value="true"/>
+ <property name="MemberChooser.sorted" value="false"/>
+ <property name="GoToFile.includeJavaFiles" value="false"/>
+ <property name="GoToClass.toSaveIncludeLibraries" value="false"/>
+ </component>
+ <component name="ToolWindowManager">
+ <frame x="-4" y="-4" width="1032" height="746" extended-state="6"/>
+ <editor active="false"/>
+ <layout>
+ <window_info id="CVS" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="-1"/>
+ <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="7"/>
+ <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="0"/>
+ <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="1"/>
+ <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="1"/>
+ <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="-1"/>
+ <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.4" order="6"/>
+ <window_info id="Aspects" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="-1"/>
+ <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="1"/>
+ <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="2"/>
+ <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="2"/>
+ <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.4" order="4"/>
+ <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="sliding" type="sliding" visible="false" weight="0.4" order="0"/>
+ <window_info id="Web" active="false" anchor="left" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="2"/>
+ <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.33" order="0"/>
+ <window_info id="EJB" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="3"/>
+ <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="docked" type="docked" visible="false" weight="0.25" order="5"/>
+ </layout>
+ </component>
+ <component name="ErrorTreeViewConfiguration">
+ <option name="IS_AUTOSCROLL_TO_SOURCE" value="false"/>
+ <option name="HIDE_WARNINGS" value="false"/>
+ </component>
+ <component name="StructureViewFactory">
+ <option name="SORT_MODE" value="0"/>
+ <option name="GROUP_INHERITED" value="true"/>
+ <option name="AUTOSCROLL_MODE" value="true"/>
+ <option name="SHOW_FIELDS" value="true"/>
+ <option name="AUTOSCROLL_FROM_SOURCE" value="false"/>
+ <option name="GROUP_GETTERS_AND_SETTERS" value="true"/>
+ <option name="SHOW_INHERITED" value="false"/>
+ <option name="HIDE_NOT_PUBLIC" value="false"/>
+ </component>
+ <component name="ProjectViewSettings">
+ <navigator currentView="ProjectPane" flattenPackages="false" showMembers="false" showStructure="false" autoscrollToSource="false" splitterProportion="0.5"/>
+ <view id="ProjectPane">
+ <expanded_node type="directory" url="file://$PROJECT_DIR$"/>
+ </view>
+ <view id="SourcepathPane"/>
+ <view id="ClasspathPane"/>
+ </component>
+ <component name="Commander">
+ <leftPanel view="Project"/>
+ <rightPanel view="Project"/>
+ <splitter proportion="0.5"/>
+ </component>
+ <component name="AspectsView"/>
+ <component name="SelectInManager"/>
+ <component name="HierarchyBrowserManager">
+ <option name="SHOW_PACKAGES" value="false"/>
+ <option name="IS_AUTOSCROLL_TO_SOURCE" value="false"/>
+ <option name="SORT_ALPHABETICALLY" value="false"/>
+ </component>
+ <component name="TodoView" selected-index="0">
+ <todo-panel id="selected-file">
+ <are-packages-shown value="false"/>
+ <flatten-packages value="false"/>
+ <is-autoscroll-to-source value="true"/>
+ </todo-panel>
+ <todo-panel id="all">
+ <are-packages-shown value="true"/>
+ <flatten-packages value="false"/>
+ <is-autoscroll-to-source value="true"/>
+ </todo-panel>
+ </component>
+ <component name="editorManager"/>
+ <component name="editorHistoryManager"/>
+ <component name="DaemonCodeAnalyzer">
+ <disable_hints/>
+ </component>
+ <component name="InspectionManager">
+ <option name="AUTOSCROLL_TO_SOURCE" value="false"/>
+ <option name="SPLITTER_PROPORTION" value="0.5"/>
+ <profile name="Default"/>
+ </component>
+ <component name="BookmarkManager"/>
+ <component name="DebuggerManager">
+ <line_breakpoints/>
+ <exception_breakpoints>
+ <breakpoint_any>
+ <option name="NOTIFY_CAUGHT" value="true"/>
+ <option name="NOTIFY_UNCAUGHT" value="true"/>
+ <option name="ENABLED" value="false"/>
+ <option name="SUSPEND_VM" value="true"/>
+ <option name="COUNT_FILTER_ENABLED" value="false"/>
+ <option name="COUNT_FILTER" value="0"/>
+ <option name="CONDITION_ENABLED" value="false"/>
+ <option name="CONDITION"/>
+ <option name="LOG_ENABLED" value="false"/>
+ <option name="LOG_EXPRESSION_ENABLED" value="false"/>
+ <option name="LOG_MESSAGE"/>
+ <option name="CLASS_FILTERS_ENABLED" value="false"/>
+ <option name="INVERSE_CLASS_FILLTERS" value="false"/>
+ <option name="SUSPEND_POLICY" value="SuspendAll"/>
+ </breakpoint_any>
+ </exception_breakpoints>
+ <field_breakpoints/>
+ <method_breakpoints/>
+ </component>
+ <component name="DebuggerSettings">
+ <option name="TRACING_FILTERS_ENABLED" value="true"/>
+ <option name="TOSTRING_CLASSES_ENABLED" value="false"/>
+ <option name="VALUE_LOOKUP_DELAY" value="700"/>
+ <option name="DEBUGGER_TRANSPORT" value="0"/>
+ <option name="FORCE_CLASSIC_VM" value="true"/>
+ <option name="HIDE_DEBUGGER_ON_PROCESS_TERMINATION" value="false"/>
+ <option name="SKIP_SYNTHETIC_METHODS" value="true"/>
+ <option name="SKIP_CONSTRUCTORS" value="false"/>
+ <option name="STEP_THREAD_SUSPEND_POLICY" value="SuspendThread"/>
+ <default_breakpoint_settings>
+ <option name="NOTIFY_CAUGHT" value="true"/>
+ <option name="NOTIFY_UNCAUGHT" value="true"/>
+ <option name="WATCH_MODIFICATION" value="true"/>
+ <option name="WATCH_ACCESS" value="true"/>
+ <option name="WATCH_ENTRY" value="true"/>
+ <option name="WATCH_EXIT" value="true"/>
+ <option name="ENABLED" value="true"/>
+ <option name="SUSPEND_VM" value="true"/>
+ <option name="COUNT_FILTER_ENABLED" value="false"/>
+ <option name="COUNT_FILTER" value="0"/>
+ <option name="CONDITION_ENABLED" value="false"/>
+ <option name="CONDITION"/>
+ <option name="LOG_ENABLED" value="false"/>
+ <option name="LOG_EXPRESSION_ENABLED" value="false"/>
+ <option name="LOG_MESSAGE"/>
+ <option name="CLASS_FILTERS_ENABLED" value="false"/>
+ <option name="INVERSE_CLASS_FILLTERS" value="false"/>
+ <option name="SUSPEND_POLICY" value="SuspendAll"/>
+ </default_breakpoint_settings>
+ <filter>
+ <option name="PATTERN" value="com.sun.*"/>
+ <option name="ENABLED" value="true"/>
+ </filter>
+ <filter>
+ <option name="PATTERN" value="java.*"/>
+ <option name="ENABLED" value="true"/>
+ </filter>
+ <filter>
+ <option name="PATTERN" value="javax.*"/>
+ <option name="ENABLED" value="true"/>
+ </filter>
+ <filter>
+ <option name="PATTERN" value="org.omg.*"/>
+ <option name="ENABLED" value="true"/>
+ </filter>
+ <filter>
+ <option name="PATTERN" value="sun.*"/>
+ <option name="ENABLED" value="true"/>
+ </filter>
+ <filter>
+ <option name="PATTERN" value="junit.*"/>
+ <option name="ENABLED" value="true"/>
+ </filter>
+ </component>
+ <component name="CompilerWorkspaceConfiguration">
+ <option name="COMPILE_IN_BACKGROUND" value="false"/>
+ <option name="AUTO_SHOW_ERRORS_IN_EDITOR" value="true"/>
+ </component>
+ <component name="RunManager">
+ <activeType name="Application"/>
+ <configuration selected="false" default="true" type="Applet" factoryName="Applet">
+ <module name=""/>
+ <option name="MAIN_CLASS_NAME"/>
+ <option name="HTML_FILE_NAME"/>
+ <option name="HTML_USED" value="false"/>
+ <option name="WIDTH" value="400"/>
+ <option name="HEIGHT" value="300"/>
+ <option name="POLICY_FILE" value="$APPLICATION_HOME_DIR$/bin/appletviewer.policy"/>
+ <option name="VM_PARAMETERS"/>
+ </configuration>
+ <configuration selected="false" default="true" type="Remote" factoryName="Remote">
+ <option name="USE_SOCKET_TRANSPORT" value="true"/>
+ <option name="SERVER_MODE" value="false"/>
+ <option name="SHMEM_ADDRESS" value="javadebug"/>
+ <option name="HOST" value="localhost"/>
+ <option name="PORT" value="5005"/>
+ </configuration>
+ <configuration selected="false" default="true" type="Application" factoryName="Application">
+ <option name="MAIN_CLASS_NAME"/>
+ <option name="VM_PARAMETERS"/>
+ <option name="PROGRAM_PARAMETERS"/>
+ <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$"/>
+ <module name=""/>
+ </configuration>
+ <configuration selected="false" default="true" type="JUnit" factoryName="JUnit">
+ <module name=""/>
+ <option name="PACKAGE_NAME"/>
+ <option name="MAIN_CLASS_NAME"/>
+ <option name="METHOD_NAME"/>
+ <option name="TEST_OBJECT" value="class"/>
+ <option name="VM_PARAMETERS"/>
+ <option name="PARAMETERS"/>
+ <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$"/>
+ <option name="ADDITIONAL_CLASS_PATH"/>
+ <option name="TEST_SEARCH_SCOPE">
+ <value defaultName="wholeProject"/>
+ </option>
+ </configuration>
+ </component>
+ <component name="VcsManagerConfiguration">
+ <option name="ACTIVE_VCS_NAME" value="svn"/>
+ <option name="STATE" value="0"/>
+ </component>
+ <component name="VssConfiguration">
+ <CheckoutOptions>
+ <option name="COMMENT" value=""/>
+ <option name="DO_NOT_GET_LATEST_VERSION" value="false"/>
+ <option name="REPLACE_WRITABLE" value="false"/>
+ <option name="RECURSIVE" value="false"/>
+ </CheckoutOptions>
+ <CheckinOptions>
+ <option name="COMMENT" value=""/>
+ <option name="KEEP_CHECKED_OUT" value="false"/>
+ <option name="RECURSIVE" value="false"/>
+ </CheckinOptions>
+ <AddOptions>
+ <option name="COMMENT" value=""/>
+ <option name="STORE_ONLY_LATEST_VERSION" value="false"/>
+ <option name="CHECK_OUT_IMMEDIATELY" value="false"/>
+ <option name="FILE_TYPE" value="0"/>
+ </AddOptions>
+ <UndocheckoutOptions>
+ <option name="MAKE_WRITABLE" value="false"/>
+ <option name="REPLACE_LOCAL_COPY" value="0"/>
+ <option name="RECURSIVE" value="false"/>
+ </UndocheckoutOptions>
+ <DiffOptions>
+ <option name="IGNORE_WHITE_SPACE" value="false"/>
+ <option name="IGNORE_CASE" value="false"/>
+ </DiffOptions>
+ <GetOptions>
+ <option name="REPLACE_WRITABLE" value="0"/>
+ <option name="MAKE_WRITABLE" value="false"/>
+ <option name="RECURSIVE" value="false"/>
+ </GetOptions>
+ <option name="CLIENT_PATH" value=""/>
+ <option name="SRCSAFEINI_PATH" value=""/>
+ <option name="USER_NAME" value=""/>
+ <option name="PWD" value=""/>
+ <option name="SHOW_CHECKOUT_OPTIONS" value="true"/>
+ <option name="SHOW_ADD_OPTIONS" value="true"/>
+ <option name="SHOW_UNDOCHECKOUT_OPTIONS" value="true"/>
+ <option name="SHOW_DIFF_OPTIONS" value="true"/>
+ <option name="SHOW_GET_OPTIONS" value="true"/>
+ <option name="USE_EXTERNAL_DIFF" value="false"/>
+ <option name="EXTERNAL_DIFF_PATH" value=""/>
+ <option name="REUSE_LAST_COMMENT" value="false"/>
+ <option name="PUT_FOCUS_INTO_COMMENT" value="false"/>
+ <option name="SHOW_CHECKIN_OPTIONS" value="true"/>
+ <option name="LAST_COMMIT_MESSAGE" value=""/>
+ <option name="CHECKIN_DIALOG_SPLITTER_PROPORTION" value="0.8"/>
+ </component>
+ <component name="CheckinPanelState"/>
+ <component name="WebViewSettings">
+ <webview flattenPackages="false" showMembers="false" autoscrollToSource="false"/>
+ </component>
+ <component name="EjbViewSettings">
+ <EjbView showMembers="false" autoscrollToSource="false"/>
+ </component>
+ <component name="AppServerRunManager"/>
+ <component name="StarteamConfiguration">
+ <option name="SERVER" value=""/>
+ <option name="PORT" value="49201"/>
+ <option name="USER" value=""/>
+ <option name="PASSWORD" value=""/>
+ <option name="PROJECT" value=""/>
+ <option name="VIEW" value=""/>
+ <option name="ALTERNATIVE_WORKING_PATH" value=""/>
+ <option name="PUT_FOCUS_INTO_COMMENT" value="false"/>
+ <option name="SHOW_CHECKIN_OPTIONS" value="true"/>
+ <option name="LAST_COMMIT_MESSAGE" value=""/>
+ <option name="CHECKIN_DIALOG_SPLITTER_PROPORTION" value="0.8"/>
+ </component>
+ <component name="Cvs2Configuration">
+ <option name="ON_FILE_ADDING" value="0"/>
+ <option name="ON_FILE_REMOVING" value="0"/>
+ <option name="PRUNE_EMPTY_DIRECTORIES" value="true"/>
+ <option name="SHOW_UPDATE_OPTIONS" value="true"/>
+ <option name="SHOW_ADD_OPTIONS" value="true"/>
+ <option name="SHOW_REMOVE_OPTIONS" value="true"/>
+ <option name="MERGING_MODE" value="0"/>
+ <option name="MERGE_WITH_BRANCH1_NAME" value="HEAD"/>
+ <option name="MERGE_WITH_BRANCH2_NAME" value="HEAD"/>
+ <option name="RESET_STICKY" value="false"/>
+ <option name="CREATE_NEW_DIRECTORIES" value="true"/>
+ <option name="DEFAULT_TEXT_FILE_SUBSTITUTION" value="kv"/>
+ <option name="PROCESS_UNKNOWN_FILES" value="false"/>
+ <option name="PROCESS_DELETED_FILES" value="false"/>
+ <option name="SHOW_EDIT_DIALOG" value="true"/>
+ <option name="RESERVED_EDIT" value="false"/>
+ <option name="FILE_HISTORY_SPLITTER_PROPORTION" value="0.6"/>
+ <option name="SHOW_CHECKOUT_OPTIONS" value="true"/>
+ <option name="CHECKOUT_DATE_OR_REVISION_SETTINGS">
+ <value>
+ <option name="BRANCH" value=""/>
+ <option name="DATE" value=""/>
+ <option name="USE_BRANCH" value="false"/>
+ <option name="USE_DATE" value="false"/>
+ </value>
+ </option>
+ <option name="UPDATE_DATE_OR_REVISION_SETTINGS">
+ <value>
+ <option name="BRANCH" value=""/>
+ <option name="DATE" value=""/>
+ <option name="USE_BRANCH" value="false"/>
+ <option name="USE_DATE" value="false"/>
+ </value>
+ </option>
+ <option name="SHOW_CHANGES_REVISION_SETTINGS">
+ <value>
+ <option name="BRANCH" value=""/>
+ <option name="DATE" value=""/>
+ <option name="USE_BRANCH" value="false"/>
+ <option name="USE_DATE" value="false"/>
+ </value>
+ </option>
+ <option name="SHOW_OUTPUT" value="false"/>
+ <option name="SHOW_FILE_HISTORY_AS_TREE" value="false"/>
+ <option name="UPDATE_GROUP_BY_PACKAGES" value="false"/>
+ <option name="ADD_WATCH_INDEX" value="0"/>
+ <option name="REMOVE_WATCH_INDEX" value="0"/>
+ <option name="UPDATE_KEYWORD_SUBSTITUTION"/>
+ <option name="MAKE_NEW_FILES_READONLY" value="false"/>
+ <option name="SHOW_CORRUPTED_PROJECT_FILES" value="0"/>
+ <option name="TAG_AFTER_FILE_COMMIT" value="false"/>
+ <option name="TAG_AFTER_FILE_COMMIT_NAME" value=""/>
+ <option name="TAG_AFTER_PROJECT_COMMIT" value="false"/>
+ <option name="TAG_AFTER_PROJECT_COMMIT_NAME" value=""/>
+ <option name="PUT_FOCUS_INTO_COMMENT" value="false"/>
+ <option name="SHOW_CHECKIN_OPTIONS" value="true"/>
+ <option name="FORCE_NON_EMPTY_COMMENT" value="false"/>
+ <option name="LAST_COMMIT_MESSAGE" value=""/>
+ <option name="SAVE_LAST_COMMIT_MESSAGE" value="true"/>
+ <option name="CHECKIN_DIALOG_SPLITTER_PROPORTION" value="0.8"/>
+ <option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false"/>
+ <option name="OPTIMIZE_IMPORTS_BEFORE_FILE_COMMIT" value="false"/>
+ <option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false"/>
+ <option name="REFORMAT_BEFORE_FILE_COMMIT" value="false"/>
+ <option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8"/>
+ <option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5"/>
+ </component>
+ <component name="CvsTabbedWindow"/>
+ <component name="SvnConfiguration">
+ <option name="USER" value=""/>
+ <option name="PASSWORD" value=""/>
+ <option name="AUTO_ADD_FILES" value="0"/>
+ <option name="AUTO_DEL_FILES" value="0"/>
+ </component>
+ <component name="PerforceConfiguration">
+ <option name="PORT" value="magic:1666"/>
+ <option name="USER" value=""/>
+ <option name="PASSWORD" value=""/>
+ <option name="CLIENT" value=""/>
+ <option name="TRACE" value="false"/>
+ <option name="PERFORCE_STATUS" value="true"/>
+ <option name="CHANGELIST_OPTION" value="false"/>
+ <option name="SYSTEMROOT" value=""/>
+ <option name="P4_EXECUTABLE" value="p4"/>
+ <option name="SHOW_BRANCH_HISTORY" value="false"/>
+ <option name="GENERATE_COMMENT" value="false"/>
+ <option name="SYNC_OPTION" value="Sync"/>
+ <option name="PUT_FOCUS_INTO_COMMENT" value="false"/>
+ <option name="SHOW_CHECKIN_OPTIONS" value="true"/>
+ <option name="FORCE_NON_EMPTY_COMMENT" value="true"/>
+ <option name="LAST_COMMIT_MESSAGE" value=""/>
+ <option name="SAVE_LAST_COMMIT_MESSAGE" value="true"/>
+ <option name="CHECKIN_DIALOG_SPLITTER_PROPORTION" value="0.8"/>
+ <option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="false"/>
+ <option name="OPTIMIZE_IMPORTS_BEFORE_FILE_COMMIT" value="false"/>
+ <option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="false"/>
+ <option name="REFORMAT_BEFORE_FILE_COMMIT" value="false"/>
+ <option name="FILE_HISTORY_DIALOG_COMMENTS_SPLITTER_PROPORTION" value="0.8"/>
+ <option name="FILE_HISTORY_DIALOG_SPLITTER_PROPORTION" value="0.5"/>
+ </component>
+</project>
diff --git a/calamus-jenkins-plugin/pom.xml b/calamus-jenkins-plugin/pom.xml
new file mode 100644
index 0000000..42cc378
--- /dev/null
+++ b/calamus-jenkins-plugin/pom.xml
@@ -0,0 +1,71 @@
+<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>
+ <!--
+ <parent>
+ <groupId>io.trygvis.calamus</groupId>
+ <artifactId>calamus</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ -->
+ <parent>
+ <groupId>org.jenkins-ci.plugins</groupId>
+ <artifactId>plugin</artifactId>
+ <version>1.558</version>
+ </parent>
+ <artifactId>calamus-jenkins-pipeline</artifactId>
+ <packaging>${hpi.type}</packaging>
+
+ <properties>
+ <version.activemq>5.9.1</version.activemq>
+ <hpi.type>hpi</hpi.type>
+ </properties>
+
+ <dependencies>
+ <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>
+ </dependencies>
+
+ <repositories>
+ <repository>
+ <id>repo.jenkins-ci.org</id>
+ <url>http://repo.jenkins-ci.org/public/</url>
+ </repository>
+ </repositories>
+
+ <pluginRepositories>
+ <pluginRepository>
+ <id>repo.jenkins-ci.org</id>
+ <url>http://repo.jenkins-ci.org/public/</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.7</source>
+ <target>1.7</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>idea</id>
+ <properties>
+ <hpi.type>jar</hpi.type>
+ </properties>
+ </profile>
+ </profiles>
+</project>
diff --git a/calamus-jenkins-plugin/src/main/java/org/jenkinsci/plugins/calamus/HelloWorldBuilder.java b/calamus-jenkins-plugin/src/main/java/org/jenkinsci/plugins/calamus/HelloWorldBuilder.java
new file mode 100644
index 0000000..5844a26
--- /dev/null
+++ b/calamus-jenkins-plugin/src/main/java/org/jenkinsci/plugins/calamus/HelloWorldBuilder.java
@@ -0,0 +1,152 @@
+package org.jenkinsci.plugins.calamus;
+
+import hudson.Launcher;
+import hudson.Extension;
+import hudson.util.FormValidation;
+import hudson.model.AbstractBuild;
+import hudson.model.BuildListener;
+import hudson.model.AbstractProject;
+import hudson.tasks.Builder;
+import hudson.tasks.BuildStepDescriptor;
+import net.sf.json.JSONObject;
+import org.kohsuke.stapler.DataBoundConstructor;
+import org.kohsuke.stapler.StaplerRequest;
+import org.kohsuke.stapler.QueryParameter;
+
+import javax.servlet.ServletException;
+import java.io.IOException;
+
+/**
+ * Sample {@link Builder}.
+ *
+ * <p>
+ * When the user configures the project and enables this builder,
+ * {@link DescriptorImpl#newInstance(StaplerRequest)} is invoked
+ * and a new {@link HelloWorldBuilder} is created. The created
+ * instance is persisted to the project configuration XML by using
+ * XStream, so this allows you to use instance fields (like {@link #name})
+ * to remember the configuration.
+ *
+ * <p>
+ * When a build is performed, the {@link #perform(AbstractBuild, Launcher, BuildListener)}
+ * method will be invoked.
+ *
+ * @author Kohsuke Kawaguchi
+ */
+public class HelloWorldBuilder extends Builder {
+
+ private final String name;
+
+ // Fields in config.jelly must match the parameter names in the "DataBoundConstructor"
+ @DataBoundConstructor
+ public HelloWorldBuilder(String name) {
+ this.name = name;
+ }
+
+ /**
+ * We'll use this from the <tt>config.jelly</tt>.
+ */
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public boolean perform(AbstractBuild build, Launcher launcher, BuildListener listener) {
+ // This is where you 'build' the project.
+ // Since this is a dummy, we just say 'hello world' and call that a build.
+
+ // This also shows how you can consult the global configuration of the builder
+ if (getDescriptor().getUseFrench())
+ listener.getLogger().println("Bonjour, "+name+"!");
+ else
+ listener.getLogger().println("Hello, "+name+"!");
+ return true;
+ }
+
+ // Overridden for better type safety.
+ // If your plugin doesn't really define any property on Descriptor,
+ // you don't have to do this.
+ @Override
+ public DescriptorImpl getDescriptor() {
+ return (DescriptorImpl)super.getDescriptor();
+ }
+
+ /**
+ * Descriptor for {@link HelloWorldBuilder}. Used as a singleton.
+ * The class is marked as public so that it can be accessed from views.
+ *
+ * <p>
+ * See <tt>src/main/resources/hudson/plugins/hello_world/HelloWorldBuilder/*.jelly</tt>
+ * for the actual HTML fragment for the configuration screen.
+ */
+ @Extension // This indicates to Jenkins that this is an implementation of an extension point.
+ public static final class DescriptorImpl extends BuildStepDescriptor<Builder> {
+ /**
+ * To persist global configuration information,
+ * simply store it in a field and call save().
+ *
+ * <p>
+ * If you don't want fields to be persisted, use <tt>transient</tt>.
+ */
+ private boolean useFrench;
+
+ /**
+ * In order to load the persisted global configuration, you have to
+ * call load() in the constructor.
+ */
+ public DescriptorImpl() {
+ load();
+ }
+
+ /**
+ * Performs on-the-fly validation of the form field 'name'.
+ *
+ * @param value
+ * This parameter receives the value that the user has typed.
+ * @return
+ * Indicates the outcome of the validation. This is sent to the browser.
+ */
+ public FormValidation doCheckName(@QueryParameter String value)
+ throws IOException, ServletException {
+ if (value.length() == 0)
+ return FormValidation.error("Please set a name");
+ if (value.length() < 4)
+ return FormValidation.warning("Isn't the name too short?");
+ return FormValidation.ok();
+ }
+
+ public boolean isApplicable(Class<? extends AbstractProject> aClass) {
+ // Indicates that this builder can be used with all kinds of project types
+ return true;
+ }
+
+ /**
+ * This human readable name is used in the configuration screen.
+ */
+ public String getDisplayName() {
+ return "Say hello world";
+ }
+
+ @Override
+ public boolean configure(StaplerRequest req, JSONObject formData) throws FormException {
+ // To persist global configuration information,
+ // set that to properties and call save().
+ useFrench = formData.getBoolean("useFrench");
+ // ^Can also use req.bindJSON(this, formData);
+ // (easier when there are many fields; need set* methods for this, like setUseFrench)
+ save();
+ return super.configure(req,formData);
+ }
+
+ /**
+ * This method returns true if the global configuration says we should speak French.
+ *
+ * The method name is bit awkward because global.jelly calls this method to determine
+ * the initial state of the checkbox by the naming convention.
+ */
+ public boolean getUseFrench() {
+ return useFrench;
+ }
+ }
+}
+
diff --git a/calamus-jenkins-plugin/src/main/java/org/jenkinsci/plugins/calamus/JbpmRunListener.java b/calamus-jenkins-plugin/src/main/java/org/jenkinsci/plugins/calamus/JbpmRunListener.java
new file mode 100644
index 0000000..2376516
--- /dev/null
+++ b/calamus-jenkins-plugin/src/main/java/org/jenkinsci/plugins/calamus/JbpmRunListener.java
@@ -0,0 +1,42 @@
+package org.jenkinsci.plugins.calamus;
+
+import hudson.Extension;
+import hudson.model.Build;
+import hudson.model.TaskListener;
+import hudson.model.listeners.RunListener;
+
+import javax.annotation.Nonnull;
+
+@Extension
+public class JbpmRunListener extends RunListener<Build> {
+
+ private final MqClient mqClient;
+
+ public JbpmRunListener() {
+ super(Build.class);
+
+ System.out.println("JbpmRunListener.JbpmRunListener");
+
+ mqClient = new MqClient("tcp://localhost:61616");
+ }
+
+ @Override
+ public void onCompleted(Build build, @Nonnull TaskListener listener) {
+ System.out.println("JbpmRunListener.onCompleted");
+ System.out.println("build = " + build);
+
+ System.out.println("build variables");
+ for (Object o : build.getBuildVariables().entrySet()) {
+ System.out.println(o);
+ }
+
+ mqClient.sendMessage(build.getProject().getName(), build.getNumber(), build.getResult().toString());
+
+// Jenkins jenkins = Jenkins.getInstance();
+// List<AbstractProject> projects = jenkins.getAllItems(AbstractProject.class);
+// for (AbstractProject project : projects) {
+// System.out.println("project.getPronoun() = " + project.getPronoun());
+// System.out.println("project.getName() = " + project.getName());
+// }
+ }
+}
diff --git a/calamus-jenkins-plugin/src/main/java/org/jenkinsci/plugins/calamus/MqClient.java b/calamus-jenkins-plugin/src/main/java/org/jenkinsci/plugins/calamus/MqClient.java
new file mode 100644
index 0000000..6ca4264
--- /dev/null
+++ b/calamus-jenkins-plugin/src/main/java/org/jenkinsci/plugins/calamus/MqClient.java
@@ -0,0 +1,48 @@
+package org.jenkinsci.plugins.calamus;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.MapMessage;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+
+import static javax.jms.Session.AUTO_ACKNOWLEDGE;
+
+public class MqClient {
+
+ ActiveMQConnectionFactory connectionFactory;
+
+ public MqClient(String brokerUrl) {
+ this.connectionFactory = new ActiveMQConnectionFactory(brokerUrl);
+ }
+
+ public void sendMessage(String jobName, int buildNumber, String result) {
+ try {
+ Connection connection = connectionFactory.createConnection();
+ connection.start();
+
+ Session session = connection.createSession(false, AUTO_ACKNOWLEDGE);
+
+ Destination destination = session.createQueue("jenkins.build-result");
+
+ MessageProducer producer = session.createProducer(destination);
+ producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+
+ MapMessage message = session.createMapMessage();
+ message.setString("jobName", jobName);
+ message.setInt("buildNumber", buildNumber);
+ message.setString("result", result);
+
+ producer.send(message);
+
+ session.close();
+ connection.close();
+ } catch (JMSException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/calamus-jenkins-plugin/src/main/resources/index.jelly b/calamus-jenkins-plugin/src/main/resources/index.jelly
new file mode 100644
index 0000000..538998f
--- /dev/null
+++ b/calamus-jenkins-plugin/src/main/resources/index.jelly
@@ -0,0 +1,6 @@
+<!--
+ This view is used to render the installed plugins page.
+-->
+<div>
+ This plugin is a sample to explain how to write a Jenkins plugin.
+</div>
diff --git a/calamus-jenkins-plugin/src/main/resources/org/jenkinsci/plugins/calamus/HelloWorldBuilder/config.jelly b/calamus-jenkins-plugin/src/main/resources/org/jenkinsci/plugins/calamus/HelloWorldBuilder/config.jelly
new file mode 100644
index 0000000..491280c
--- /dev/null
+++ b/calamus-jenkins-plugin/src/main/resources/org/jenkinsci/plugins/calamus/HelloWorldBuilder/config.jelly
@@ -0,0 +1,15 @@
+<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
+ <!--
+ This jelly script is used for per-project configuration.
+
+ See global.jelly for a general discussion about jelly script.
+ -->
+
+ <!--
+ Creates a text field that shows the value of the "name" property.
+ When submitted, it will be passed to the corresponding constructor parameter.
+ -->
+ <f:entry title="Name" field="name">
+ <f:textbox />
+ </f:entry>
+</j:jelly>
diff --git a/calamus-jenkins-plugin/src/main/resources/org/jenkinsci/plugins/calamus/HelloWorldBuilder/global.jelly b/calamus-jenkins-plugin/src/main/resources/org/jenkinsci/plugins/calamus/HelloWorldBuilder/global.jelly
new file mode 100644
index 0000000..068b0c0
--- /dev/null
+++ b/calamus-jenkins-plugin/src/main/resources/org/jenkinsci/plugins/calamus/HelloWorldBuilder/global.jelly
@@ -0,0 +1,20 @@
+<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
+ <!--
+ This Jelly script is used to produce the global configuration option.
+
+ Jenkins uses a set of tag libraries to provide uniformity in forms.
+ To determine where this tag is defined, first check the namespace URI,
+ and then look under $JENKINS/views/. For example, <f:section> is defined
+ in $JENKINS/views/lib/form/section.jelly.
+
+ It's also often useful to just check other similar scripts to see what
+ tags they use. Views are always organized according to its owner class,
+ so it should be straightforward to find them.
+ -->
+ <f:section title="Hello World Builder">
+ <f:entry title="French" field="useFrench"
+ description="Check if we should say hello in French">
+ <f:checkbox />
+ </f:entry>
+ </f:section>
+</j:jelly>
diff --git a/calamus-jenkins-plugin/src/main/resources/org/jenkinsci/plugins/calamus/HelloWorldBuilder/help-name.html b/calamus-jenkins-plugin/src/main/resources/org/jenkinsci/plugins/calamus/HelloWorldBuilder/help-name.html
new file mode 100644
index 0000000..288f214
--- /dev/null
+++ b/calamus-jenkins-plugin/src/main/resources/org/jenkinsci/plugins/calamus/HelloWorldBuilder/help-name.html
@@ -0,0 +1,6 @@
+<div>
+ Help file for fields are discovered through a file name convention. This file is
+ help for the "name" field. You can have <i>arbitrary</i> HTML here. You can write
+ this file as a Jelly script if you need a dynamic content (but if you do so, change
+ the extension to <tt>.jelly</tt>).
+</div>
diff --git a/calamus-jenkins-plugin/src/main/resources/org/jenkinsci/plugins/calamus/HelloWorldBuilder/help-useFrench.html b/calamus-jenkins-plugin/src/main/resources/org/jenkinsci/plugins/calamus/HelloWorldBuilder/help-useFrench.html
new file mode 100644
index 0000000..df2e815
--- /dev/null
+++ b/calamus-jenkins-plugin/src/main/resources/org/jenkinsci/plugins/calamus/HelloWorldBuilder/help-useFrench.html
@@ -0,0 +1,6 @@
+<div>
+ This HTML fragment will be injected into the configuration screen
+ when the user clicks the 'help' icon. See global.jelly for how the
+ form decides which page to load.
+ You can have any <tt>HTML</tt> fragment here.
+</div>
diff --git a/calamus-nexus-plugin/pom.xml b/calamus-nexus-plugin/pom.xml
new file mode 100644
index 0000000..5060827
--- /dev/null
+++ b/calamus-nexus-plugin/pom.xml
@@ -0,0 +1,75 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>io.trygvis.calamus</groupId>
+ <artifactId>calamus</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>calamus-nexus-plugin</artifactId>
+ <name>${project.groupId}:${project.artifactId}</name>
+ <packaging>${nexus-plugin.type}</packaging>
+ <properties>
+ <version.activemq>5.9.1</version.activemq>
+ <version.nexus>2.8.0-01</version.nexus>
+ <!--
+ Support for loading Nexus projects in Intellij IDEA; as it doesn't handle the 'nexus-plugin' packaging WRT to dependency calculations.
+ -->
+ <nexus-plugin.type>nexus-plugin</nexus-plugin.type>
+ </properties>
+ <dependencies>
+ <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.sonatype.nexus</groupId>
+ <artifactId>nexus-plugin-api</artifactId>
+ <version>${version.nexus}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.sonatype.nexus.plugins</groupId>
+ <artifactId>nexus-restlet1x-plugin</artifactId>
+ <version>${version.nexus}</version>
+ <!--<type>${nexus-plugin.type}</type>-->
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.sonatype.nexus.plugins</groupId>
+ <artifactId>nexus-ui-extjs3-plugin</artifactId>
+ <version>${version.nexus}</version>
+ <!--<type>jar</type>-->
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.sonatype.nexus</groupId>
+ <artifactId>nexus-plugin-testsupport</artifactId>
+ <version>${version.nexus}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.sonatype.nexus</groupId>
+ <artifactId>nexus-plugin-bundle-maven-plugin</artifactId>
+ <version>1.2</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </build>
+ <profiles>
+ <profile>
+ <id>idea</id>
+ <properties>
+ <nexus-plugin.type>jar</nexus-plugin.type>
+ </properties>
+ </profile>
+ </profiles>
+</project>
diff --git a/calamus-nexus-plugin/src/main/java/io/trygvis/calamus/nexus/CalamusConfig.java b/calamus-nexus-plugin/src/main/java/io/trygvis/calamus/nexus/CalamusConfig.java
new file mode 100644
index 0000000..a3c09a1
--- /dev/null
+++ b/calamus-nexus-plugin/src/main/java/io/trygvis/calamus/nexus/CalamusConfig.java
@@ -0,0 +1,30 @@
+package io.trygvis.calamus.nexus;
+
+import org.slf4j.Logger;
+import org.sonatype.nexus.configuration.application.ApplicationConfiguration;
+
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import java.io.File;
+
+import static org.slf4j.LoggerFactory.getLogger;
+
+@Singleton
+public class CalamusConfig {
+
+ private final Logger log = getLogger(getClass());
+
+ private final ApplicationConfiguration applicationConfiguration;
+
+ @Inject
+ public CalamusConfig(ApplicationConfiguration applicationConfiguration) {
+ this.applicationConfiguration = applicationConfiguration;
+ log.info("applicationConfiguration = " + applicationConfiguration);
+ File configurationDirectory = applicationConfiguration.getConfigurationDirectory();
+ log.info("configurationDirectory = " + configurationDirectory);
+ }
+
+ public String getBrokerUrl() {
+ return "tcp://localhost:61616";
+ }
+}
diff --git a/calamus-nexus-plugin/src/main/java/io/trygvis/calamus/nexus/CalamusNexusPlugin.java b/calamus-nexus-plugin/src/main/java/io/trygvis/calamus/nexus/CalamusNexusPlugin.java
new file mode 100644
index 0000000..e60fed7
--- /dev/null
+++ b/calamus-nexus-plugin/src/main/java/io/trygvis/calamus/nexus/CalamusNexusPlugin.java
@@ -0,0 +1,17 @@
+package io.trygvis.calamus.nexus;
+
+import org.eclipse.sisu.EagerSingleton;
+import org.sonatype.nexus.plugin.PluginIdentity;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@EagerSingleton
+@Named("calamus")
+public class CalamusNexusPlugin extends PluginIdentity {
+
+ @Inject
+ public CalamusNexusPlugin() throws Exception {
+ super("io.trygvis.calamus", "calamus-nexus-plugin");
+ }
+}
diff --git a/calamus-nexus-plugin/src/main/java/io/trygvis/calamus/nexus/CalamusUiContributor.java b/calamus-nexus-plugin/src/main/java/io/trygvis/calamus/nexus/CalamusUiContributor.java
new file mode 100644
index 0000000..ed2f745
--- /dev/null
+++ b/calamus-nexus-plugin/src/main/java/io/trygvis/calamus/nexus/CalamusUiContributor.java
@@ -0,0 +1,17 @@
+package io.trygvis.calamus.nexus;
+
+import org.sonatype.nexus.plugins.ui.contribution.UiContributorSupport;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+//@Named
+//@Singleton
+public class CalamusUiContributor /*extends UiContributorSupport*/ {
+
+// @Inject
+// public CalamusUiContributor(CalamusNexusPlugin plugin) {
+// super(plugin);
+// }
+}
diff --git a/calamus-nexus-plugin/src/main/java/io/trygvis/calamus/nexus/EventListener.java b/calamus-nexus-plugin/src/main/java/io/trygvis/calamus/nexus/EventListener.java
new file mode 100644
index 0000000..4770974
--- /dev/null
+++ b/calamus-nexus-plugin/src/main/java/io/trygvis/calamus/nexus/EventListener.java
@@ -0,0 +1,51 @@
+package io.trygvis.calamus.nexus;
+
+import com.google.common.eventbus.Subscribe;
+import org.slf4j.Logger;
+import org.sonatype.nexus.events.EventSubscriber;
+import org.sonatype.nexus.proxy.events.RepositoryItemEventStoreCreate;
+import org.sonatype.nexus.proxy.maven.gav.Gav;
+import org.sonatype.nexus.proxy.maven.gav.GavCalculator;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.inject.Singleton;
+
+import static org.slf4j.LoggerFactory.getLogger;
+
+@Singleton
+@Named
+public class EventListener implements EventSubscriber {
+
+ private final Logger log = getLogger(getClass());
+
+ private final MqClient mqClient;
+ private final GavCalculator gavCalculator;
+
+ @Inject
+ public EventListener(CalamusConfig config, @Named("maven2") GavCalculator gavCalculator) {
+ log.info("CalamusNexusPlugin.CalamusNexusPlugin");
+ log.info("gavCalculator = " + gavCalculator);
+
+ this.mqClient = new MqClient(config.getBrokerUrl());
+ this.gavCalculator = gavCalculator;
+ }
+
+ @Subscribe
+ public void onRepositoryItemEventStoreCreate(RepositoryItemEventStoreCreate event) {
+ Gav gav = gavCalculator.pathToGav(event.getItem().getPath());
+
+ if (gav == null) {
+ return;
+ }
+
+ String groupId = gav.getGroupId();
+ String artifactId = gav.getArtifactId();
+ String version = gav.getVersion();
+ String type = gav.getExtension();
+ String classifier = gav.getClassifier();
+ mqClient.sendMessage(event.getRepository().getId(), groupId, artifactId, version, type, classifier);
+
+ log.info("New artifact: groupId={}, artifactId={}, version={}, type={}, classifier={}", groupId, artifactId, version, type, classifier);
+ }
+}
diff --git a/calamus-nexus-plugin/src/main/java/io/trygvis/calamus/nexus/MqClient.java b/calamus-nexus-plugin/src/main/java/io/trygvis/calamus/nexus/MqClient.java
new file mode 100644
index 0000000..51b2b3a
--- /dev/null
+++ b/calamus-nexus-plugin/src/main/java/io/trygvis/calamus/nexus/MqClient.java
@@ -0,0 +1,51 @@
+package io.trygvis.calamus.nexus;
+
+import org.apache.activemq.ActiveMQConnectionFactory;
+
+import javax.jms.Connection;
+import javax.jms.DeliveryMode;
+import javax.jms.Destination;
+import javax.jms.JMSException;
+import javax.jms.MapMessage;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+
+import static javax.jms.Session.AUTO_ACKNOWLEDGE;
+
+public class MqClient {
+
+ ActiveMQConnectionFactory connectionFactory;
+
+ public MqClient(String brokerUrl) {
+ this.connectionFactory = new ActiveMQConnectionFactory(brokerUrl);
+ }
+
+ public void sendMessage(String repository, String groupId, String artifactId, String version, String type, String classifier) {
+ try {
+ Connection connection = connectionFactory.createConnection();
+ connection.start();
+
+ Session session = connection.createSession(false, AUTO_ACKNOWLEDGE);
+
+ Destination destination = session.createQueue("nexus.new-artifact");
+
+ MessageProducer producer = session.createProducer(destination);
+ producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT);
+
+ MapMessage message = session.createMapMessage();
+ message.setString("repository", repository);
+ message.setString("groupId", groupId);
+ message.setString("artifactId", artifactId);
+ message.setString("version", version);
+ message.setString("type", type);
+ message.setString("classifier", classifier);
+
+ producer.send(message);
+
+ session.close();
+ connection.close();
+ } catch (JMSException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/calamus-nexus-plugin/src/main/resources/static/js/Calamus/CalamusConfigPanel.js b/calamus-nexus-plugin/src/main/resources/static/js/Calamus/CalamusConfigPanel.js
new file mode 100644
index 0000000..81a7887
--- /dev/null
+++ b/calamus-nexus-plugin/src/main/resources/static/js/Calamus/CalamusConfigPanel.js
@@ -0,0 +1,3 @@
+define('Sonatype/repoServer/LdapConfigPanel', function () {
+
+});
diff --git a/calamus-nexus-plugin/src/main/resources/static/js/calamus-nexus-plugin-boot.js b/calamus-nexus-plugin/src/main/resources/static/js/calamus-nexus-plugin-boot.js
new file mode 100644
index 0000000..0c454be
--- /dev/null
+++ b/calamus-nexus-plugin/src/main/resources/static/js/calamus-nexus-plugin-boot.js
@@ -0,0 +1,3 @@
+define('calamus-nexus-plugin', [
+ 'Calamus/CalamusConfigPanel'
+]);
diff --git a/demo/pom.xml b/demo/pom.xml
new file mode 100644
index 0000000..d113356
--- /dev/null
+++ b/demo/pom.xml
@@ -0,0 +1,12 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>demo</groupId>
+ <artifactId>demo</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <distributionManagement>
+ <snapshotRepository>
+ <id>nexus</id>
+ <url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
+ </snapshotRepository>
+ </distributionManagement>
+</project>
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..128f850
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,23 @@
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>io.trygvis</groupId>
+ <artifactId>trygvis-parent</artifactId>
+ <version>1</version>
+ </parent>
+ <groupId>io.trygvis.calamus</groupId>
+ <artifactId>calamus</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <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>
+ </properties>
+
+ <modules>
+ <module>calamus-engine</module>
+ <module>calamus-jenkins-plugin</module>
+ <module>calamus-nexus-plugin</module>
+ </modules>
+</project>