updated APS/activiti archetypes

This commit is contained in:
2026-04-22 11:10:18 -04:00
parent 2cd0276915
commit 3f06b1738f
25 changed files with 488 additions and 180 deletions
@@ -6,15 +6,6 @@
<requiredProperty key="shortname"> <requiredProperty key="shortname">
<validationRegex>[A-Za-z0-9]+</validationRegex> <validationRegex>[A-Za-z0-9]+</validationRegex>
</requiredProperty> </requiredProperty>
<requiredProperty key="dockerRegistryHost">
<defaultValue>quay.io</defaultValue>
</requiredProperty>
<requiredProperty key="dockerImagePrefix">
<defaultValue>local</defaultValue>
</requiredProperty>
<requiredProperty key="beedkVersion">
<defaultValue>[1.0.0,2.0.0)</defaultValue>
</requiredProperty>
</requiredProperties> </requiredProperties>
<fileSets> <fileSets>
<fileSet filtered="true" packaged="true"> <fileSet filtered="true" packaged="true">
@@ -1,5 +1,5 @@
# Maven # Maven
/target target/
pom.xml.versionsBackup pom.xml.versionsBackup
# Eclipse # Eclipse
@@ -12,26 +12,43 @@
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>8</maven.compiler.source> <maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target> <maven.compiler.target>11</maven.compiler.target>
<maven.compiler.release>11</maven.compiler.release>
<activiti.version>7.11.0</activiti.version> <!-- This extension will work with all versions of Activiti, as long as the integration point method signatures remain the same. -->
<spring.version>5.3.29</spring.version> <!-- These versions were the latest at the time this archetype was last updated. -->
<activiti.version>8.8.0</activiti.version>
<spring.version>6.2.14</spring.version>
<!-- The following are only used for RAD and integration testing -->
<!--
<tomcat-rad.version>2.3-tomcat11</tomcat-rad.version>
<aps.war.version>26.1.0</aps.war.version>
<aps.tomcat.opts>-Dproperty-to-set=value</aps.tomcat.opts>
-->
</properties> </properties>
<dependencies> <dependencies>
<dependency> <!-- Activiti provided libraries -->
<groupId>org.activiti</groupId>
<artifactId>activiti-engine</artifactId>
<version>${activiti.version}</version>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId> <artifactId>spring-context</artifactId>
<version>${spring.version}</version> <version>${spring.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-engine</artifactId>
<version>${activiti.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>3.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>
@@ -39,7 +56,7 @@
<plugin> <plugin>
<groupId>io.repaint.maven</groupId> <groupId>io.repaint.maven</groupId>
<artifactId>tiles-maven-plugin</artifactId> <artifactId>tiles-maven-plugin</artifactId>
<version>2.40</version> <version>2.43</version>
<extensions>true</extensions> <extensions>true</extensions>
<configuration> <configuration>
<tiles> <tiles>
@@ -50,27 +67,33 @@
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
<profiles> <profiles>
<profile> <profile>
<id>rad</id> <id>wsl</id>
<activation> <activation>
<property> <os>
<name>rad</name> <family>windows</family>
</property> </os>
</activation> </activation>
<properties> <properties>
<aps.version>2.4.6</aps.version> <!-- Using WSL is slower than native containers -->
<!-- add properties here --> <!-- Adjust this timeout for slow computers, VPN, or other slow or high latency scenarios -->
<aps.tomcat.opts>-Dproperty-to-set=value</aps.tomcat.opts> <aps.timeout>120000</aps.timeout>
</properties> </properties>
</profile> </profile>
</profiles> </profiles>
<repositories> <repositories>
<repository> <!-- Used by the Activiti dependencies -->
<id>alfresco-public</id> <repository>
<url>https://artifacts.alfresco.com/nexus/content/groups/public</url> <id>activiti-public-releases</id>
</repository> <url>https://artifacts.alfresco.com/nexus/repository/activiti-releases</url>
</repository>
<!-- Used when performing optional RAD and integration testing -->
<repository>
<id>activiti-enterprise-releases</id>
<url>https://artifacts.alfresco.com/nexus/content/repositories/activiti-enterprise-releases</url>
</repository>
</repositories> </repositories>
</project> </project>
@@ -1,69 +1,71 @@
$script:MAVEN_CMD="mvn"
$script:CONTAINERD_CMD="docker"
function discoverArtifactId { function discoverArtifactId {
$script:ARTIFACT_ID=(mvn -q -Dexpression=project"."artifactId -DforceStdout help:evaluate) $script:ARTIFACT_ID=(Invoke-Expression "${MAVEN_CMD} -q -Dexpression=project"."artifactId -DforceStdout help:evaluate")
} }
function rebuild { function rebuild {
echo "Rebuilding project ..." echo "Rebuilding project ..."
mvn process-test-classes Invoke-Expression "${MAVEN_CMD} process-test-classes"
} }
function start_ { function start_containers {
echo "Rebuilding project and starting Docker containers to support rapid application development ..." echo "Rebuilding project and starting containers to support rapid application development ..."
mvn -Drad process-test-classes Invoke-Expression "${MAVEN_CMD} -Drad process-test-classes"
} }
function start_log { function start_containers_verbose {
echo "Rebuilding project and starting Docker containers to support rapid application development ..." echo "Rebuilding project and starting containers to support rapid application development ..."
mvn -Drad "-Ddocker.showLogs" process-test-classes Invoke-Expression "${MAVEN_CMD} -Drad -Ddocker'.'showLogs process-test-classes"
} }
function stop_ { function stop_containers {
discoverArtifactId discoverArtifactId
echo "Stopping Docker containers that supported rapid application development ..." echo "Stopping Docker containers that supported rapid application development ..."
docker container ls --filter name="^/${ARTIFACT_ID}" Invoke-Expression "${CONTAINERD_CMD} container ls --filter name=${ARTIFACT_ID}-*"
echo "Stopping containers ..." echo "Stopping containers ..."
docker container stop (docker container ls -q --filter name="^/${ARTIFACT_ID}") Invoke-Expression "${CONTAINERD_CMD} container stop (Invoke-Expression '${CONTAINERD_CMD} container ls -q --filter name=${ARTIFACT_ID}-*')"
echo "Removing containers ..." echo "Removing containers ..."
docker container rm (docker container ls -aq --filter name="^/${ARTIFACT_ID}") Invoke-Expression "${CONTAINERD_CMD} container rm (Invoke-Expression '${CONTAINERD_CMD} container ls -aq --filter name=${ARTIFACT_ID}-*')"
} }
function tail_logs { function tail_container {
param ( param (
$container $container
) )
discoverArtifactId discoverArtifactId
docker container logs -f (docker container ls -q --filter name="^/${ARTIFACT_ID}-${container}$") Invoke-Expression "${CONTAINERD_CMD} container logs -f (Invoke-Expression '${CONTAINERD_CMD} container ls -q --filter name=${ARTIFACT_ID}-${container}')"
} }
function list { function list_containers {
discoverArtifactId discoverArtifactId
docker container ls --filter name="^/${ARTIFACT_ID}" Invoke-Expression "${CONTAINERD_CMD} container ls --filter name=${ARTIFACT_ID}-*"
} }
switch ($args[0]) { switch ($args[0]) {
"start" { "start" {
start_ start_containers
} }
"start_log" { "start_log" {
start_log start_containers_verbose
} }
"stop" { "stop" {
stop_ stop_containers
} }
"restart" { "restart" {
stop_ stop_containers
start_ start_containers
} }
"rebuild" { "rebuild" {
rebuild rebuild
} }
"tail" { "tail" {
tail_logs $args[1] tail_container $args[1]
} }
"containers" { "containers" {
list list_containers
} }
default { default {
echo "Usage: .\rad.ps1 [ start | start_log | stop | restart | rebuild | tail {container} | containers ]" echo "Usage: .\rad.ps1 [ start | start_log | stop | restart | rebuild | tail {container} | containers ]"
@@ -1,66 +1,69 @@
#!/bin/sh #!/bin/sh
MAVEN_CMD=mvn
CONTAINERD_CMD=docker
discoverArtifactId() { discoverArtifactId() {
local ARTIFACT_ID=`mvn -q -Dexpression=project.artifactId -DforceStdout help:evaluate` local ARTIFACT_ID=`${MAVEN_CMD} -q -Dexpression=project.artifactId -DforceStdout help:evaluate`
} }
rebuild() { rebuild() {
echo "Rebuilding project ..." echo "Rebuilding project ..."
mvn process-test-classes ${MAVEN_CMD} process-test-classes
} }
start() { start_containers() {
echo "Rebuilding project and starting Docker containers to support rapid application development ..." echo "Rebuilding project and starting containers to support rapid application development ..."
mvn -Drad process-test-classes ${MAVEN_CMD} -Drad process-test-classes
} }
start_log() { start_containers_verbose() {
echo "Rebuilding project and starting Docker containers to support rapid application development ..." echo "Rebuilding project and starting containers to support rapid application development ..."
mvn -Drad -Ddocker.showLogs process-test-classes ${MAVEN_CMD} -Drad -Ddocker.showLogs process-test-classes
} }
stop() { stop_containers() {
discoverArtifactId discoverArtifactId
echo "Stopping Docker containers that supported rapid application development ..." echo "Stopping Docker containers that supported rapid application development ..."
docker container ls --filter name="^/${ARTIFACT_ID}" ${CONTAINERD_CMD} container ls --filter name=${ARTIFACT_ID}-*
echo "Stopping containers ..." echo "Stopping containers ..."
docker container stop `docker container ls -q --filter name="^/${ARTIFACT_ID}"` ${CONTAINERD_CMD} container stop `${CONTAINERD_CMD} container ls -q --filter name=${ARTIFACT_ID}-*`
echo "Removing containers ..." echo "Removing containers ..."
docker container rm `docker container ls -aq --filter name="^/${ARTIFACT_ID}"` ${CONTAINERD_CMD} container rm `${CONTAINERD_CMD} container ls -aq --filter name=${ARTIFACT_ID}-*`
} }
tail_logs() { tail_container() {
discoverArtifactId discoverArtifactId
docker container logs -f `docker container ls -q --filter name="^/${ARTIFACT_ID}-$1$"` ${CONTAINERD_CMD} container logs -f `${CONTAINERD_CMD} container ls -q --filter name=${ARTIFACT_ID}-$1`
} }
list() { list_containers() {
discoverArtifactId discoverArtifactId
docker container ls --filter name="^/${ARTIFACT_ID}" ${CONTAINERD_CMD} container ls --filter name=${ARTIFACT_ID}-*
} }
case "$1" in case "$1" in
start) start)
start start_containers
;; ;;
start_log) start_log)
start_log start_containers_verbose
;; ;;
stop) stop)
stop stop_containers
;; ;;
restart) restart)
stop stop_containers
start start_containers
;; ;;
rebuild) rebuild)
rebuild rebuild
;; ;;
tail) tail)
tail_logs $2 tail_container $2
;; ;;
containers) containers)
list list_containers
;; ;;
*) *)
echo "Usage: ./rad.sh [ start | start_log | stop | restart | rebuild | tail {container} | containers ]" echo "Usage: ./rad.sh [ start | start_log | stop | restart | rebuild | tail {container} | containers ]"
@@ -0,0 +1,38 @@
/*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package ${package};
import org.activiti.engine.delegate.event.ActivitiEvent;
import org.activiti.engine.delegate.event.ActivitiEventListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
* This class is an example of how you can implement an Activiti Event Listener.
*/
@Component
public class ExampleEventListener implements ActivitiEventListener {
private static final Logger LOGGER = LoggerFactory.getLogger(ExampleEventListener.class);
@Override
public void onEvent(ActivitiEvent event) {
LOGGER.trace("onEvent({})", event.getType());
// TODO do some stuff
}
}
@@ -24,21 +24,21 @@ import org.springframework.stereotype.Component;
* This class is an example of how you can implement an Activiti Execution Listener. * This class is an example of how you can implement an Activiti Execution Listener.
* You can reference it in your BPMN with: * You can reference it in your BPMN with:
* <activiti:executionListener delegateExpression="${exampleExecutionListener}" event="start" /> * <activiti:executionListener delegateExpression="${exampleExecutionListener}" event="start" />
* <activiti:executionListener expression="${exampleExecutionListener.exampleMethod('example parameter')}" event="end" /> * <activiti:executionListener expression="${exampleExecutionListener.exampleMethod(execution, 'example parameter')}" event="end" />
*/ */
@Component("exampleExecutionListener") @Component("exampleExecutionListener")
public class ExampleExecutionListener implements ExecutionListener { public class ExampleExecutionListener implements ExecutionListener {
private final Logger logger = LoggerFactory.getLogger(this.getClass()); private static final Logger LOGGER = LoggerFactory.getLogger(ExampleExecutionListener.class);
public void notify(DelegateExecution execution) throws Exception { @Override
if (this.logger.isTraceEnabled()) public void notify(DelegateExecution execution) {
this.logger.trace("execute('" + execution.getId() + "')"); LOGGER.trace("execute({})", execution.getId());
// TODO do some stuff // TODO do some stuff
} }
public void exampleMethod(String param) throws Exception { public void exampleMethod(DelegateExecution execution, String param) {
// another example // another example
} }
@@ -0,0 +1,41 @@
/*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package ${package};
import org.activiti.engine.delegate.DelegateExecution;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
* This class is an example of how you can implement an Activiti script object.
* A scripting object can be used in any expression or Script Task.
*
* You can reference it in your BPMN expression with:
* ${exampleObject.exampleMethod('example parameter')}
*
* You can reference it in your Script Task with:
* exampleObject.exampleMethod('example parameter');
*/
@Component("exampleObject")
public class ExampleServiceTask {
private static final Logger LOGGER = LoggerFactory.getLogger(this.getClass());
public void exampleMethod(String param) throws Exception {
// another example
}
}
@@ -24,21 +24,21 @@ import org.springframework.stereotype.Component;
* This class is an example of how you can implement an Activiti Service Task. * This class is an example of how you can implement an Activiti Service Task.
* You can reference it in your BPMN with: * You can reference it in your BPMN with:
* <serviceTask id="serviceTask" activiti:delegateExpression="${exampleServiceTask}" /> * <serviceTask id="serviceTask" activiti:delegateExpression="${exampleServiceTask}" />
* <serviceTask id="serviceTask" activiti:expression="${exampleServiceTask.exampleMethod('example parameter')}" /> * <serviceTask id="serviceTask" activiti:expression="${exampleServiceTask.exampleMethod(execution, 'example parameter')}" />
*/ */
@Component("exampleServiceTask") @Component("exampleServiceTask")
public class ExampleServiceTask implements JavaDelegate { public class ExampleServiceTask implements JavaDelegate {
private final Logger logger = LoggerFactory.getLogger(this.getClass()); private static final Logger LOGGER = LoggerFactory.getLogger(ExampleServiceTask.class);
@Override
public void execute(DelegateExecution execution) throws Exception { public void execute(DelegateExecution execution) throws Exception {
if (this.logger.isTraceEnabled()) LOGGER.trace("execute({})", execution.getId());
this.logger.trace("execute('" + execution.getId() + "')");
// TODO do some stuff // TODO do some stuff
} }
public void exampleMethod(String param) throws Exception { public void exampleMethod(DelegateExecution execution, String param) throws Exception {
// another example // another example
} }
@@ -0,0 +1,45 @@
/*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package ${package};
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.TaskListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
* This class is an example of how you can implement an Activiti Task Listener.
* You can reference it in your BPMN with:
* <activiti:taskListener delegateExpression="${exampleTaskListener}" event="start" />
* <activiti:taskListener expression="${exampleTaskListener.exampleMethod(task, 'example parameter')}" event="end" />
*/
@Component("exampleTaskListener")
public class ExampleTaskListener implements TaskListener {
private static final Logger LOGGER = LoggerFactory.getLogger(ExampleTaskListener.class);
@Override
public void notify(DelegateTask task) {
LOGGER.trace("execute({})", task.getId());
// TODO do some stuff
}
public void exampleMethod(DelegateTask task, String param) {
// another example
}
}
@@ -16,9 +16,18 @@ package com.activiti.extension.conf;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FullyQualifiedAnnotationBeanNameGenerator;
/**
* A means for injecting packages to scan for the Spring context.
*/
@Configuration @Configuration
@ComponentScan(basePackages = {"${package}"}) @ComponentScan(
basePackages = {
"${package}"
},
nameGenerator = FullyQualifiedAnnotationBeanNameGenerator.class
)
public class ${shortname}SpringComponentScanner { public class ${shortname}SpringComponentScanner {
} }
@@ -6,15 +6,6 @@
<requiredProperty key="shortname"> <requiredProperty key="shortname">
<validationRegex>[A-Za-z0-9]+</validationRegex> <validationRegex>[A-Za-z0-9]+</validationRegex>
</requiredProperty> </requiredProperty>
<requiredProperty key="dockerRegistryHost">
<defaultValue>quay.io</defaultValue>
</requiredProperty>
<requiredProperty key="dockerImagePrefix">
<defaultValue>local</defaultValue>
</requiredProperty>
<requiredProperty key="beedkVersion">
<defaultValue>[1.0.0,2.0.0)</defaultValue>
</requiredProperty>
</requiredProperties> </requiredProperties>
<fileSets> <fileSets>
<fileSet filtered="true" packaged="true"> <fileSet filtered="true" packaged="true">
@@ -1,5 +1,5 @@
# Maven # Maven
/target target/
pom.xml.versionsBackup pom.xml.versionsBackup
# Eclipse # Eclipse
@@ -16,7 +16,21 @@
<maven.compiler.target>11</maven.compiler.target> <maven.compiler.target>11</maven.compiler.target>
<maven.compiler.release>11</maven.compiler.release> <maven.compiler.release>11</maven.compiler.release>
<aps.version>2.4.6</aps.version> <!-- This extension will work with all versions of APS, as long as the integration point method signatures remain the same. -->
<aps.version>26.1.0</aps.version>
<!-- The following are only used for RAD and integration testing -->
<!--
See the following for options:
- https://git.inteligr8.com/inteligr8/ootbee-beedk/src/branch/stable/beedk-aps-ext-rad-tile
- https://git.inteligr8.com/inteligr8/ootbee-beedk/src/branch/stable/beedk-aps-ext-it-tile
-->
<!--
<tomcat-rad.version>2.3-tomcat11</tomcat-rad.version>
<aps.war.version>26.1.0</aps.war.version>
<aps.tomcat.opts>-Dproperty-to-set=value</aps.tomcat.opts>
-->
</properties> </properties>
<dependencies> <dependencies>
@@ -27,6 +41,7 @@
<classifier>classes</classifier> <classifier>classes</classifier>
<scope>provided</scope> <scope>provided</scope>
<exclusions> <exclusions>
<!-- these are in another repository and typically unnecessary -->
<exclusion> <exclusion>
<groupId>com.activiti</groupId> <groupId>com.activiti</groupId>
<artifactId>aspose-transformation</artifactId> <artifactId>aspose-transformation</artifactId>
@@ -44,7 +59,7 @@
<plugin> <plugin>
<groupId>io.repaint.maven</groupId> <groupId>io.repaint.maven</groupId>
<artifactId>tiles-maven-plugin</artifactId> <artifactId>tiles-maven-plugin</artifactId>
<version>2.40</version> <version>2.43</version>
<extensions>true</extensions> <extensions>true</extensions>
<configuration> <configuration>
<tiles> <tiles>
@@ -55,29 +70,32 @@
</plugin> </plugin>
</plugins> </plugins>
</build> </build>
<profiles> <profiles>
<profile> <profile>
<id>rad</id> <id>wsl</id>
<activation> <activation>
<property> <os>
<name>rad</name> <family>windows</family>
</property> </os>
</activation> </activation>
<properties> <properties>
<!-- add properties here --> <!-- Using WSL is slower than native containers -->
<aps.tomcat.opts>-Dproperty-to-set=value</aps.tomcat.opts> <!-- Adjust this timeout for slow computers, VPN, or other slow or high latency scenarios -->
<aps.timeout>120000</aps.timeout>
</properties> </properties>
</profile> </profile>
</profiles> </profiles>
<repositories> <repositories>
<repository> <!-- Used by the Activiti dependencies -->
<id>alfresco-public</id>
<url>https://artifacts.alfresco.com/nexus/content/groups/public</url>
</repository>
<repository> <repository>
<id>activiti-releases</id> <id>activiti-public-releases</id>
<url>https://artifacts.alfresco.com/nexus/repository/activiti-releases</url>
</repository>
<!-- Used when performing optional RAD and integration testing -->
<repository>
<id>activiti-enterprise-releases</id>
<url>https://artifacts.alfresco.com/nexus/content/repositories/activiti-enterprise-releases</url> <url>https://artifacts.alfresco.com/nexus/content/repositories/activiti-enterprise-releases</url>
</repository> </repository>
</repositories> </repositories>
@@ -1,69 +1,71 @@
$script:MAVEN_CMD="mvn"
$script:CONTAINERD_CMD="docker"
function discoverArtifactId { function discoverArtifactId {
$script:ARTIFACT_ID=(mvn -q -Dexpression=project"."artifactId -DforceStdout help:evaluate) $script:ARTIFACT_ID=(Invoke-Expression "${MAVEN_CMD} -q -Dexpression=project"."artifactId -DforceStdout help:evaluate")
} }
function rebuild { function rebuild {
echo "Rebuilding project ..." echo "Rebuilding project ..."
mvn process-test-classes Invoke-Expression "${MAVEN_CMD} process-test-classes"
} }
function start_ { function start_containers {
echo "Rebuilding project and starting Docker containers to support rapid application development ..." echo "Rebuilding project and starting containers to support rapid application development ..."
mvn -Drad process-test-classes Invoke-Expression "${MAVEN_CMD} -Drad process-test-classes"
} }
function start_log { function start_containers_verbose {
echo "Rebuilding project and starting Docker containers to support rapid application development ..." echo "Rebuilding project and starting containers to support rapid application development ..."
mvn -Drad "-Ddocker.showLogs" process-test-classes Invoke-Expression "${MAVEN_CMD} -Drad -Ddocker'.'showLogs process-test-classes"
} }
function stop_ { function stop_containers {
discoverArtifactId discoverArtifactId
echo "Stopping Docker containers that supported rapid application development ..." echo "Stopping Docker containers that supported rapid application development ..."
docker container ls --filter name="^/${ARTIFACT_ID}" Invoke-Expression "${CONTAINERD_CMD} container ls --filter name=${ARTIFACT_ID}-*"
echo "Stopping containers ..." echo "Stopping containers ..."
docker container stop (docker container ls -q --filter name="^/${ARTIFACT_ID}") Invoke-Expression "${CONTAINERD_CMD} container stop (Invoke-Expression '${CONTAINERD_CMD} container ls -q --filter name=${ARTIFACT_ID}-*')"
echo "Removing containers ..." echo "Removing containers ..."
docker container rm (docker container ls -aq --filter name="^/${ARTIFACT_ID}") Invoke-Expression "${CONTAINERD_CMD} container rm (Invoke-Expression '${CONTAINERD_CMD} container ls -aq --filter name=${ARTIFACT_ID}-*')"
} }
function tail_logs { function tail_container {
param ( param (
$container $container
) )
discoverArtifactId discoverArtifactId
docker container logs -f (docker container ls -q --filter name="^/${ARTIFACT_ID}-${container}$") Invoke-Expression "${CONTAINERD_CMD} container logs -f (Invoke-Expression '${CONTAINERD_CMD} container ls -q --filter name=${ARTIFACT_ID}-${container}')"
} }
function list { function list_containers {
discoverArtifactId discoverArtifactId
docker container ls --filter name="^/${ARTIFACT_ID}" Invoke-Expression "${CONTAINERD_CMD} container ls --filter name=${ARTIFACT_ID}-*"
} }
switch ($args[0]) { switch ($args[0]) {
"start" { "start" {
start_ start_containers
} }
"start_log" { "start_log" {
start_log start_containers_verbose
} }
"stop" { "stop" {
stop_ stop_containers
} }
"restart" { "restart" {
stop_ stop_containers
start_ start_containers
} }
"rebuild" { "rebuild" {
rebuild rebuild
} }
"tail" { "tail" {
tail_logs $args[1] tail_container $args[1]
} }
"containers" { "containers" {
list list_containers
} }
default { default {
echo "Usage: .\rad.ps1 [ start | start_log | stop | restart | rebuild | tail {container} | containers ]" echo "Usage: .\rad.ps1 [ start | start_log | stop | restart | rebuild | tail {container} | containers ]"
@@ -1,66 +1,69 @@
#!/bin/sh #!/bin/sh
MAVEN_CMD=mvn
CONTAINERD_CMD=docker
discoverArtifactId() { discoverArtifactId() {
local ARTIFACT_ID=`mvn -q -Dexpression=project.artifactId -DforceStdout help:evaluate` local ARTIFACT_ID=`${MAVEN_CMD} -q -Dexpression=project.artifactId -DforceStdout help:evaluate`
} }
rebuild() { rebuild() {
echo "Rebuilding project ..." echo "Rebuilding project ..."
mvn process-test-classes ${MAVEN_CMD} process-test-classes
} }
start() { start_containers() {
echo "Rebuilding project and starting Docker containers to support rapid application development ..." echo "Rebuilding project and starting containers to support rapid application development ..."
mvn -Drad process-test-classes ${MAVEN_CMD} -Drad process-test-classes
} }
start_log() { start_containers_verbose() {
echo "Rebuilding project and starting Docker containers to support rapid application development ..." echo "Rebuilding project and starting containers to support rapid application development ..."
mvn -Drad -Ddocker.showLogs process-test-classes ${MAVEN_CMD} -Drad -Ddocker.showLogs process-test-classes
} }
stop() { stop_containers() {
discoverArtifactId discoverArtifactId
echo "Stopping Docker containers that supported rapid application development ..." echo "Stopping Docker containers that supported rapid application development ..."
docker container ls --filter name="^/${ARTIFACT_ID}" ${CONTAINERD_CMD} container ls --filter name=${ARTIFACT_ID}-*
echo "Stopping containers ..." echo "Stopping containers ..."
docker container stop `docker container ls -q --filter name="^/${ARTIFACT_ID}"` ${CONTAINERD_CMD} container stop `${CONTAINERD_CMD} container ls -q --filter name=${ARTIFACT_ID}-*`
echo "Removing containers ..." echo "Removing containers ..."
docker container rm `docker container ls -aq --filter name="^/${ARTIFACT_ID}"` ${CONTAINERD_CMD} container rm `${CONTAINERD_CMD} container ls -aq --filter name=${ARTIFACT_ID}-*`
} }
tail_logs() { tail_container() {
discoverArtifactId discoverArtifactId
docker container logs -f `docker container ls -q --filter name="^/${ARTIFACT_ID}-$1$"` ${CONTAINERD_CMD} container logs -f `${CONTAINERD_CMD} container ls -q --filter name=${ARTIFACT_ID}-$1`
} }
list() { list_containers() {
discoverArtifactId discoverArtifactId
docker container ls --filter name="^/${ARTIFACT_ID}" ${CONTAINERD_CMD} container ls --filter name=${ARTIFACT_ID}-*
} }
case "$1" in case "$1" in
start) start)
start start_containers
;; ;;
start_log) start_log)
start_log start_containers_verbose
;; ;;
stop) stop)
stop stop_containers
;; ;;
restart) restart)
stop stop_containers
start start_containers
;; ;;
rebuild) rebuild)
rebuild rebuild
;; ;;
tail) tail)
tail_logs $2 tail_container $2
;; ;;
containers) containers)
list list_containers
;; ;;
*) *)
echo "Usage: ./rad.sh [ start | start_log | stop | restart | rebuild | tail {container} | containers ]" echo "Usage: ./rad.sh [ start | start_log | stop | restart | rebuild | tail {container} | containers ]"
@@ -1,5 +1,8 @@
package ${package}; package ${package};
/**
* An interface to bootstrap APS resources.
*/
public interface Bootstrappable { public interface Bootstrappable {
void onBootstrap(); void onBootstrap();
@@ -10,10 +10,16 @@ import org.springframework.stereotype.Component;
import com.activiti.api.boot.BootstrapConfigurer; import com.activiti.api.boot.BootstrapConfigurer;
/**
* This service is an example. The functionality provided by this example
* service is implemented in the `multiext-activiti-app-ext` extension.
*
* @link https://git.inteligr8.com/inteligr8/multiext-activiti-app-ext
*/
@Component @Component
public class BootstrappingService implements BootstrapConfigurer { public class BootstrappingService implements BootstrapConfigurer {
private final Logger logger = LoggerFactory.getLogger(this.getClass()); private static final Logger LOGGER = LoggerFactory.getLogger(BootstrappingService.class);
@Autowired(required = false) @Autowired(required = false)
private List<Bootstrappable> bootstrappables; private List<Bootstrappable> bootstrappables;
@@ -22,7 +28,7 @@ public class BootstrappingService implements BootstrapConfigurer {
public void applicationContextInitialized(ApplicationContext applicationContext) { public void applicationContextInitialized(ApplicationContext applicationContext) {
if (this.bootstrappables != null) { if (this.bootstrappables != null) {
for (Bootstrappable bootstrappable : this.bootstrappables) { for (Bootstrappable bootstrappable : this.bootstrappables) {
this.logger.debug("Bootstrapping: " + bootstrappable.getClass()); LOGGER.debug("Bootstrapping: " + bootstrappable.getClass());
bootstrappable.onBootstrap(); bootstrappable.onBootstrap();
} }
} }
@@ -0,0 +1,38 @@
/*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package ${package};
import org.activiti.engine.delegate.event.ActivitiEvent;
import org.activiti.engine.delegate.event.ActivitiEventListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
* This class is an example of how you can implement an Activiti Event Listener.
*/
@Component
public class ExampleEventListener implements ActivitiEventListener {
private static final Logger LOGGER = LoggerFactory.getLogger(ExampleEventListener.class);
@Override
public void onEvent(ActivitiEvent event) {
LOGGER.trace("onEvent({})", event.getType());
// TODO do some stuff
}
}
@@ -24,21 +24,21 @@ import org.springframework.stereotype.Component;
* This class is an example of how you can implement an Activiti Execution Listener. * This class is an example of how you can implement an Activiti Execution Listener.
* You can reference it in your BPMN with: * You can reference it in your BPMN with:
* <activiti:executionListener delegateExpression="${exampleExecutionListener}" event="start" /> * <activiti:executionListener delegateExpression="${exampleExecutionListener}" event="start" />
* <activiti:executionListener expression="${exampleExecutionListener.exampleMethod('example parameter')}" event="end" /> * <activiti:executionListener expression="${exampleExecutionListener.exampleMethod(execution, 'example parameter')}" event="end" />
*/ */
@Component("exampleExecutionListener") @Component("exampleExecutionListener")
public class ExampleExecutionListener implements ExecutionListener { public class ExampleExecutionListener implements ExecutionListener {
private final Logger logger = LoggerFactory.getLogger(this.getClass()); private static final Logger LOGGER = LoggerFactory.getLogger(ExampleExecutionListener.class);
public void notify(DelegateExecution execution) throws Exception { @Override
if (this.logger.isTraceEnabled()) public void notify(DelegateExecution execution) {
this.logger.trace("execute('" + execution.getId() + "')"); LOGGER.trace("execute({})", execution.getId());
// TODO do some stuff // TODO do some stuff
} }
public void exampleMethod(String param) throws Exception { public void exampleMethod(DelegateExecution execution, String param) {
// another example // another example
} }
@@ -10,7 +10,7 @@ import org.springframework.stereotype.Component;
@Component @Component
public class ExampleExtension implements Bootstrappable { public class ExampleExtension implements Bootstrappable {
private final Logger logger = LoggerFactory.getLogger(this.getClass()); private static final Logger LOGGER = LoggerFactory.getLogger(ExampleExtension.class);
@Autowired @Autowired
private ProcessEngine services; private ProcessEngine services;
@@ -23,11 +23,11 @@ public class ExampleExtension implements Bootstrappable {
@Override @Override
public void onBootstrap() { public void onBootstrap() {
this.logger.trace("onBootstrap()"); LOGGER.trace("onBootstrap()");
// TODO do some stuff // TODO do some stuff
this.logger.info("Model Share Extension initialized"); LOGGER.info("Model Share Extension initialized");
} }
} }
@@ -0,0 +1,41 @@
/*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package ${package};
import org.activiti.engine.delegate.DelegateExecution;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
* This class is an example of how you can implement an Activiti script object.
* A scripting object can be used in any expression or Script Task.
*
* You can reference it in your BPMN expression with:
* ${exampleObject.exampleMethod('example parameter')}
*
* You can reference it in your Script Task with:
* exampleObject.exampleMethod('example parameter');
*/
@Component("exampleObject")
public class ExampleServiceTask {
private static final Logger LOGGER = LoggerFactory.getLogger(this.getClass());
public void exampleMethod(String param) throws Exception {
// another example
}
}
@@ -24,21 +24,21 @@ import org.springframework.stereotype.Component;
* This class is an example of how you can implement an Activiti Service Task. * This class is an example of how you can implement an Activiti Service Task.
* You can reference it in your BPMN with: * You can reference it in your BPMN with:
* <serviceTask id="serviceTask" activiti:delegateExpression="${exampleServiceTask}" /> * <serviceTask id="serviceTask" activiti:delegateExpression="${exampleServiceTask}" />
* <serviceTask id="serviceTask" activiti:expression="${exampleServiceTask.exampleMethod('example parameter')}" /> * <serviceTask id="serviceTask" activiti:expression="${exampleServiceTask.exampleMethod(execution, 'example parameter')}" />
*/ */
@Component("exampleServiceTask") @Component("exampleServiceTask")
public class ExampleServiceTask implements JavaDelegate { public class ExampleServiceTask implements JavaDelegate {
private final Logger logger = LoggerFactory.getLogger(this.getClass()); private static final Logger LOGGER = LoggerFactory.getLogger(ExampleServiceTask.class);
@Override
public void execute(DelegateExecution execution) throws Exception { public void execute(DelegateExecution execution) throws Exception {
if (this.logger.isTraceEnabled()) LOGGER.trace("execute({})", execution.getId());
this.logger.trace("execute('" + execution.getId() + "')");
// TODO do some stuff // TODO do some stuff
} }
public void exampleMethod(String param) throws Exception { public void exampleMethod(DelegateExecution execution, String param) throws Exception {
// another example // another example
} }
@@ -0,0 +1,45 @@
/*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package ${package};
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.TaskListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
* This class is an example of how you can implement an Activiti Task Listener.
* You can reference it in your BPMN with:
* <activiti:taskListener delegateExpression="${exampleTaskListener}" event="start" />
* <activiti:taskListener expression="${exampleTaskListener.exampleMethod(task, 'example parameter')}" event="end" />
*/
@Component("exampleTaskListener")
public class ExampleTaskListener implements TaskListener {
private static final Logger LOGGER = LoggerFactory.getLogger(ExampleTaskListener.class);
@Override
public void notify(DelegateTask task) {
LOGGER.trace("execute({})", task.getId());
// TODO do some stuff
}
public void exampleMethod(DelegateTask task, String param) {
// another example
}
}
@@ -16,9 +16,18 @@ package com.activiti.extension.conf;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.FullyQualifiedAnnotationBeanNameGenerator;
/**
* A means for injecting packages to scan for the Spring context.
*/
@Configuration @Configuration
@ComponentScan(basePackages = {"${package}"}) @ComponentScan(
basePackages = {
"${package}"
},
nameGenerator = FullyQualifiedAnnotationBeanNameGenerator.class
)
public class ${shortname}SpringComponentScanner { public class ${shortname}SpringComponentScanner {
} }