added APS extension archetype

This commit is contained in:
Brian Long 2024-03-14 17:30:26 -04:00
parent 82b2d4b1fe
commit e1cd5245ef
14 changed files with 536 additions and 0 deletions

9
beedk-aps-ext-archetype/.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
# Maven
/target
pom.xml.versionsBackup
# Eclipse
.settings
.project
.classpath

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>beedk-aps-ext-archetype</artifactId>
<packaging>maven-archetype</packaging>
<parent>
<groupId>com.inteligr8.ootbee</groupId>
<artifactId>beedk-parent</artifactId>
<version>1.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<name>Order of the Bee Development Kit: Project Scaffolding for an APS Extension</name>
<url>https://bitbucket.org/inteligr8/ootbee-beedk</url>
<licenses>
<license>
<name>GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007</name>
<url>https://www.gnu.org/licenses/lgpl-3.0.txt</url>
</license>
</licenses>
<scm>
<connection>scm:git:https://bitbucket.org/inteligr8/ootbee-beedk.git</connection>
<developerConnection>scm:git:git@bitbucket.org:inteligr8/ootbee-beedk.git</developerConnection>
<url>https://bitbucket.org/inteligr8/ootbee-beedk</url>
</scm>
<organization>
<name>Order of the Bee</name>
<url>https://orderofthebee.net</url>
</organization>
<developers>
<developer>
<id>brian.long</id>
<name>Brian Long</name>
<email>brian@inteligr8.com</email>
<organization>Inteligr8</organization>
<organizationUrl>https://www.inteligr8.com</organizationUrl>
<url>https://twitter.com/brianmlong</url>
</developer>
</developers>
<build>
<extensions>
<extension>
<groupId>org.apache.maven.archetype</groupId>
<artifactId>archetype-packaging</artifactId>
<version>${archetype-packaging.version}</version>
</extension>
</extensions>
</build>
</project>

View File

@ -0,0 +1,48 @@
<archetype-descriptor name="${project.artifactId}"
xmlns="https://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.1.0 https://maven.apache.org/xsd/archetype-descriptor-1.1.0.xsd">
<requiredProperties>
<requiredProperty key="shortname">
<validationRegex>[A-Za-z0-9]+</validationRegex>
</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>
<fileSets>
<fileSet filtered="true" packaged="true">
<directory>src/main/java</directory>
<includes>
<include>*.java</include>
</includes>
</fileSet>
<fileSet filtered="true" packaged="true">
<directory>src/test/java</directory>
<includes>
<include>*.java</include>
</includes>
</fileSet>
<fileSet filtered="true">
<directory>src</directory>
<excludes>
<exclude>main/java/*.java</exclude>
<exclude>test/java/*.java</exclude>
</excludes>
</fileSet>
<fileSet filtered="false">
<directory></directory>
<includes>
<include>.gitignore</include>
<include>rad.*</include>
<include>*.md</include>
</includes>
</fileSet>
</fileSets>
</archetype-descriptor>

View File

@ -0,0 +1,8 @@
# Maven
/target
pom.xml.versionsBackup
# Eclipse
.settings
.project
.classpath

View File

@ -0,0 +1,84 @@
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
<packaging>jar</packaging>
<name>${shortname} Activiti App Extension</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.release>11</maven.compiler.release>
<aps.version>2.4.1</aps.version>
</properties>
<dependencies>
<dependency>
<groupId>com.activiti</groupId>
<artifactId>activiti-app</artifactId>
<version>${aps.version}</version>
<classifier>classes</classifier>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>com.activiti</groupId>
<artifactId>aspose-transformation</artifactId>
</exclusion>
<exclusion>
<groupId>org.alfresco.officeservices</groupId>
<artifactId>aoservices</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>io.repaint.maven</groupId>
<artifactId>tiles-maven-plugin</artifactId>
<version>2.40</version>
<extensions>true</extensions>
<configuration>
<tiles>
<!-- Documentation: https://bitbucket.org/inteligr8/ootbee-beedk/src/stable/beedk-aps-ext-rad-tile -->
<tile>com.inteligr8.ootbee:beedk-aps-ext-rad-tile:1.1-SNAPSHOT</tile>
</tiles>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>rad</id>
<activation>
<property>
<name>rad</name>
</property>
</activation>
<properties>
<!-- add properties here -->
<aps.tomcat.opts>-Dproperty-to-set=value</aps.tomcat.opts>
</properties>
</profile>
</profiles>
<repositories>
<repository>
<id>alfresco-public</id>
<url>https://artifacts.alfresco.com/nexus/content/groups/public</url>
</repository>
<repository>
<id>activiti-releases</id>
<url>https://artifacts.alfresco.com/nexus/content/repositories/activiti-enterprise-releases</url>
</repository>
</repositories>
</project>

View File

@ -0,0 +1,74 @@
function discoverArtifactId {
$script:ARTIFACT_ID=(mvn -q -Dexpression=project"."artifactId -DforceStdout help:evaluate)
}
function rebuild {
echo "Rebuilding project ..."
mvn process-test-classes
}
function start_ {
echo "Rebuilding project and starting Docker containers to support rapid application development ..."
mvn -Drad process-test-classes
}
function start_log {
echo "Rebuilding project and starting Docker containers to support rapid application development ..."
mvn -Drad "-Ddocker.showLogs" process-test-classes
}
function stop_ {
discoverArtifactId
echo "Stopping Docker containers that supported rapid application development ..."
docker container ls --filter name="^/${ARTIFACT_ID}"
echo "Stopping containers ..."
docker container stop (docker container ls -q --filter name="^/${ARTIFACT_ID}")
echo "Removing containers ..."
docker container rm (docker container ls -aq --filter name="^/${ARTIFACT_ID}")
}
function tail_logs {
param (
$container
)
discoverArtifactId
docker container logs -f (docker container ls -q --filter name="^/${ARTIFACT_ID}-${container}$")
}
function list {
discoverArtifactId
docker container ls --filter name="^/${ARTIFACT_ID}"
}
switch ($args[0]) {
"start" {
start_
}
"start_log" {
start_log
}
"stop" {
stop_
}
"restart" {
stop_
start_
}
"rebuild" {
rebuild
}
"tail" {
tail_logs $args[1]
}
"containers" {
list
}
default {
echo "Usage: .\rad.ps1 [ start | start_log | stop | restart | rebuild | tail {container} | containers ]"
}
}
echo "Completed!"

View File

@ -0,0 +1,71 @@
#!/bin/sh
discoverArtifactId() {
local ARTIFACT_ID=`mvn -q -Dexpression=project.artifactId -DforceStdout help:evaluate`
}
rebuild() {
echo "Rebuilding project ..."
mvn process-test-classes
}
start() {
echo "Rebuilding project and starting Docker containers to support rapid application development ..."
mvn -Drad process-test-classes
}
start_log() {
echo "Rebuilding project and starting Docker containers to support rapid application development ..."
mvn -Drad -Ddocker.showLogs process-test-classes
}
stop() {
discoverArtifactId
echo "Stopping Docker containers that supported rapid application development ..."
docker container ls --filter name="^/${ARTIFACT_ID}"
echo "Stopping containers ..."
docker container stop `docker container ls -q --filter name="^/${ARTIFACT_ID}"`
echo "Removing containers ..."
docker container rm `docker container ls -aq --filter name="^/${ARTIFACT_ID}"`
}
tail_logs() {
discoverArtifactId
docker container logs -f `docker container ls -q --filter name="^/${ARTIFACT_ID}-$1$"`
}
list() {
discoverArtifactId
docker container ls --filter name="^/${ARTIFACT_ID}"
}
case "$1" in
start)
start
;;
start_log)
start_log
;;
stop)
stop
;;
restart)
stop
start
;;
rebuild)
rebuild
;;
tail)
tail_logs $2
;;
containers)
list
;;
*)
echo "Usage: ./rad.sh [ start | start_log | stop | restart | rebuild | tail {container} | containers ]"
exit 1
esac
echo "Completed!"

View File

@ -0,0 +1,7 @@
package ${package};
public interface Bootstrappable {
void onBootstrap();
}

View File

@ -0,0 +1,31 @@
package ${package};
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;
import com.activiti.api.boot.BootstrapConfigurer;
@Component
public class BootstrappingService implements BootstrapConfigurer {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired(required = false)
private List<Bootstrappable> bootstrappables;
@Override
public void applicationContextInitialized(ApplicationContext applicationContext) {
if (this.bootstrappables != null) {
for (Bootstrappable bootstrappable : this.bootstrappables) {
this.logger.debug("Bootstrapping: " + bootstrappable.getClass());
bootstrappable.onBootstrap();
}
}
}
}

View File

@ -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.DelegateExecution;
import org.activiti.engine.delegate.ExecutionListener;
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 Execution Listener.
* You can reference it in your BPMN with:
* <activiti:executionListener delegateExpression="${exampleExecutionListener}" event="start" />
* <activiti:executionListener expression="${exampleExecutionListener.exampleMethod('example parameter')}" event="end" />
*/
@Component("exampleExecutionListener")
public class ExampleExecutionListener implements ExecutionListener {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
public void notify(DelegateExecution execution) throws Exception {
if (this.logger.isTraceEnabled())
this.logger.trace("execute('" + execution.getId() + "')");
// TODO do some stuff
}
public void exampleMethod(String param) throws Exception {
// another example
}
}

View File

@ -0,0 +1,33 @@
package ${package};
import org.activiti.engine.ProcessEngine;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class ExampleExtension implements Bootstrappable {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private ProcessEngine services;
@Value("${example.config:true}")
private boolean exampleBoolean;
@Value("${example.config:#{null}}")
private String exampleString;
@Override
public void onBootstrap() {
this.logger.trace("onBootstrap()");
// TODO do some stuff
this.logger.info("Model Share Extension initialized");
}
}

View File

@ -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.DelegateExecution;
import org.activiti.engine.delegate.JavaDelegate;
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 Service Task.
* You can reference it in your BPMN with:
* <serviceTask id="serviceTask" activiti:delegateExpression="${exampleServiceTask}" />
* <serviceTask id="serviceTask" activiti:expression="${exampleServiceTask.exampleMethod('example parameter')}" />
*/
@Component("exampleServiceTask")
public class ExampleServiceTask implements JavaDelegate {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
public void execute(DelegateExecution execution) throws Exception {
if (this.logger.isTraceEnabled())
this.logger.trace("execute('" + execution.getId() + "')");
// TODO do some stuff
}
public void exampleMethod(String param) throws Exception {
// another example
}
}

View File

@ -0,0 +1,24 @@
/*
* 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 com.activiti.extension.conf;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan(basePackages = {"${package}"})
public class ${shortname}SpringComponentScanner {
}

View File

@ -126,6 +126,7 @@
<module>beedk-acs-allinone-archetype</module>
<module>beedk-springboot-api-archetype</module>
<module>beedk-activiti-ext-archetype</module>
<module>beedk-aps-ext-archetype</module>
</modules>
<profiles>