Loading beedk-acs-allinone-archetype/src/main/resources/archetype-resources/platform-module-A/rad.ps1 +8 −8 Original line number Diff line number Diff line Loading @@ -5,27 +5,27 @@ function discoverArtifactId { function rebuild { echo "Rebuilding project ..." mvn process-classes mvn process-test-classes } function start_ { echo "Rebuilding project and starting Docker containers to support rapid application development ..." mvn -Drad process-classes 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-classes 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}-* docker container ls --filter name="^/${ARTIFACT_ID}" echo "Stopping containers ..." docker container stop (docker container ls -q --filter name=${ARTIFACT_ID}-*) 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}-*) docker container rm (docker container ls -aq --filter name="^/${ARTIFACT_ID}") } function tail_logs { Loading @@ -34,12 +34,12 @@ function tail_logs { ) discoverArtifactId docker container logs -f (docker container ls -q --filter name=${ARTIFACT_ID}-${container}) docker container logs -f (docker container ls -q --filter name="^/${ARTIFACT_ID}-${container}$") } function list { discoverArtifactId docker container ls --filter name=${ARTIFACT_ID}-* docker container ls --filter name="^/${ARTIFACT_ID}" } switch ($args[0]) { Loading beedk-acs-allinone-archetype/src/main/resources/archetype-resources/platform-module-A/rad.sh +9 −9 Original line number Diff line number Diff line #!/bin/sh discoverArtifactId() { ARTIFACT_ID=`mvn -q -Dexpression=project.artifactId -DforceStdout help:evaluate` local ARTIFACT_ID=`mvn -q -Dexpression=project.artifactId -DforceStdout help:evaluate` } rebuild() { echo "Rebuilding project ..." mvn process-classes mvn process-test-classes } start() { echo "Rebuilding project and starting Docker containers to support rapid application development ..." mvn -Drad process-classes mvn -Drad process-test-classes } start_log() { echo "Rebuilding project and starting Docker containers to support rapid application development ..." mvn -Drad -Ddocker.showLogs process-classes 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}-* docker container ls --filter name="^/${ARTIFACT_ID}" echo "Stopping containers ..." docker container stop `docker container ls -q --filter name=${ARTIFACT_ID}-*` 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}-*` 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` docker container logs -f `docker container ls -q --filter name="^/${ARTIFACT_ID}-$1$"` } list() { discoverArtifactId docker container ls --filter name=${ARTIFACT_ID}-* docker container ls --filter name="^/${ARTIFACT_ID}" } case "$1" in Loading beedk-acs-allinone-archetype/src/main/resources/archetype-resources/platform-module-A/src/main/java/ExampleBootstrap.java +37 −13 Original line number Diff line number Diff line Loading @@ -20,16 +20,17 @@ import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransacti import org.alfresco.service.ServiceRegistry; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.ApplicationEvent; import org.springframework.extensions.surf.util.AbstractLifecycleBean; import org.springframework.stereotype.Component; /** * This class is an example of how you can use the Alfresco Java Public API on startup or shutdown. */ @Component public class ExampleBootstrap implements InitializingBean, DisposableBean { public class ExampleBootstrap extends AbstractLifecycleBean { private final Logger logger = LoggerFactory.getLogger(this.getClass()); Loading @@ -37,10 +38,29 @@ public class ExampleBootstrap implements InitializingBean, DisposableBean { @Autowired protected ServiceRegistry serviceRegistry; @Value("${example.config.value:default}") private String configValue; @Value("${example.config.value:#{null}}") private String configValueWithNullDefault; /** * This is called after Spring beans and configuration are injected, but * before ACS services are ready. So don't call any ACS services, start an * ACS transaction, or try to create an authentication context. */ @PostConstruct private void init() { } /** * This is called after @PostConstruct and all the ACS services are * initialized and ready. You will have no authentication or transaction * context. */ @Override public void afterPropertiesSet() throws Exception { if (this.logger.isTraceEnabled()) this.logger.trace("onStartup()"); protected void onBootstrap(ApplicationEvent event) { this.logger.trace("onBootstrap()"); // provide some authority within the Alfresco context AuthenticationUtil.runAsSystem(new RunAsWork<Void>() { Loading @@ -58,9 +78,13 @@ public class ExampleBootstrap implements InitializingBean, DisposableBean { }); } /** * This is called after @PostConstruct and all the ACS services are * initialized and ready. You will have no authentication or transaction * context. */ @Override public void destroy() throws Exception { if (this.logger.isTraceEnabled()) protected void onShutdown(ApplicationEvent event) { this.logger.trace("onShutdown()"); // provide some authority within the Alfresco context Loading beedk-acs-allinone-archetype/src/main/resources/archetype-resources/platform-module-A/src/main/java/ExampleEventListener.java +19 −9 Original line number Diff line number Diff line Loading @@ -21,15 +21,15 @@ import org.alfresco.service.ServiceRegistry; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.extensions.surf.util.AbstractLifecycleBean; import org.springframework.stereotype.Component; /** * This class is an example of how you can use the Alfresco Java Public API when Alfresco triggers an event. */ @Component public class ExampleEventListener implements InitializingBean, OnCreateNodePolicy { public class ExampleEventListener extends AbstractLifecycleBean implements OnCreateNodePolicy { private final Logger logger = LoggerFactory.getLogger(this.getClass()); Loading @@ -38,12 +38,16 @@ public class ExampleEventListener implements InitializingBean, OnCreateNodePolic protected ServiceRegistry serviceRegistry; @Override public void afterPropertiesSet() throws Exception { protected void onBootstrap(ApplicationEvent event) { this.bind(); } /** * This must be called after the `PolicyComponent` is initialized/ready. * So you cannot call it from with `@PostConstruct` or using * `InitializingBean`. */ public void bind() { if (this.logger.isTraceEnabled()) this.logger.trace("bind()"); // example listener Loading @@ -51,9 +55,15 @@ public class ExampleEventListener implements InitializingBean, OnCreateNodePolic new JavaBehaviour(this, OnCreateNodePolicy.QNAME.getLocalName(), NotificationFrequency.TRANSACTION_COMMIT)); } /** * This will execute with the same authentication and transaction context * as was used to create the node, unless the binding is * `TRANSACTION_COMMIT`. Then it will only have the same transaction * context and the authentication context used when starting the * transaction. */ @Override public void onCreateNode(ChildAssociationRef childAssocRef) { if (this.logger.isTraceEnabled()) this.logger.trace("onCreateNode('" + childAssocRef.getChildRef() + "')"); // TODO do some work Loading beedk-acs-allinone-archetype/src/main/resources/archetype-resources/platform-module-A/src/main/java/ExampleGetWebScript.java +5 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,11 @@ public class ExampleGetWebScript extends AbstractWebScript { @Autowired protected ServiceRegistry serviceRegistry; /** * This will have the authentication context of the authenticated user * calling the REST endpoint. The transaction context is defined in the * web script descriptor. */ @Override public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException { if (this.logger.isTraceEnabled()) Loading Loading
beedk-acs-allinone-archetype/src/main/resources/archetype-resources/platform-module-A/rad.ps1 +8 −8 Original line number Diff line number Diff line Loading @@ -5,27 +5,27 @@ function discoverArtifactId { function rebuild { echo "Rebuilding project ..." mvn process-classes mvn process-test-classes } function start_ { echo "Rebuilding project and starting Docker containers to support rapid application development ..." mvn -Drad process-classes 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-classes 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}-* docker container ls --filter name="^/${ARTIFACT_ID}" echo "Stopping containers ..." docker container stop (docker container ls -q --filter name=${ARTIFACT_ID}-*) 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}-*) docker container rm (docker container ls -aq --filter name="^/${ARTIFACT_ID}") } function tail_logs { Loading @@ -34,12 +34,12 @@ function tail_logs { ) discoverArtifactId docker container logs -f (docker container ls -q --filter name=${ARTIFACT_ID}-${container}) docker container logs -f (docker container ls -q --filter name="^/${ARTIFACT_ID}-${container}$") } function list { discoverArtifactId docker container ls --filter name=${ARTIFACT_ID}-* docker container ls --filter name="^/${ARTIFACT_ID}" } switch ($args[0]) { Loading
beedk-acs-allinone-archetype/src/main/resources/archetype-resources/platform-module-A/rad.sh +9 −9 Original line number Diff line number Diff line #!/bin/sh discoverArtifactId() { ARTIFACT_ID=`mvn -q -Dexpression=project.artifactId -DforceStdout help:evaluate` local ARTIFACT_ID=`mvn -q -Dexpression=project.artifactId -DforceStdout help:evaluate` } rebuild() { echo "Rebuilding project ..." mvn process-classes mvn process-test-classes } start() { echo "Rebuilding project and starting Docker containers to support rapid application development ..." mvn -Drad process-classes mvn -Drad process-test-classes } start_log() { echo "Rebuilding project and starting Docker containers to support rapid application development ..." mvn -Drad -Ddocker.showLogs process-classes 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}-* docker container ls --filter name="^/${ARTIFACT_ID}" echo "Stopping containers ..." docker container stop `docker container ls -q --filter name=${ARTIFACT_ID}-*` 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}-*` 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` docker container logs -f `docker container ls -q --filter name="^/${ARTIFACT_ID}-$1$"` } list() { discoverArtifactId docker container ls --filter name=${ARTIFACT_ID}-* docker container ls --filter name="^/${ARTIFACT_ID}" } case "$1" in Loading
beedk-acs-allinone-archetype/src/main/resources/archetype-resources/platform-module-A/src/main/java/ExampleBootstrap.java +37 −13 Original line number Diff line number Diff line Loading @@ -20,16 +20,17 @@ import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransacti import org.alfresco.service.ServiceRegistry; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.ApplicationEvent; import org.springframework.extensions.surf.util.AbstractLifecycleBean; import org.springframework.stereotype.Component; /** * This class is an example of how you can use the Alfresco Java Public API on startup or shutdown. */ @Component public class ExampleBootstrap implements InitializingBean, DisposableBean { public class ExampleBootstrap extends AbstractLifecycleBean { private final Logger logger = LoggerFactory.getLogger(this.getClass()); Loading @@ -37,10 +38,29 @@ public class ExampleBootstrap implements InitializingBean, DisposableBean { @Autowired protected ServiceRegistry serviceRegistry; @Value("${example.config.value:default}") private String configValue; @Value("${example.config.value:#{null}}") private String configValueWithNullDefault; /** * This is called after Spring beans and configuration are injected, but * before ACS services are ready. So don't call any ACS services, start an * ACS transaction, or try to create an authentication context. */ @PostConstruct private void init() { } /** * This is called after @PostConstruct and all the ACS services are * initialized and ready. You will have no authentication or transaction * context. */ @Override public void afterPropertiesSet() throws Exception { if (this.logger.isTraceEnabled()) this.logger.trace("onStartup()"); protected void onBootstrap(ApplicationEvent event) { this.logger.trace("onBootstrap()"); // provide some authority within the Alfresco context AuthenticationUtil.runAsSystem(new RunAsWork<Void>() { Loading @@ -58,9 +78,13 @@ public class ExampleBootstrap implements InitializingBean, DisposableBean { }); } /** * This is called after @PostConstruct and all the ACS services are * initialized and ready. You will have no authentication or transaction * context. */ @Override public void destroy() throws Exception { if (this.logger.isTraceEnabled()) protected void onShutdown(ApplicationEvent event) { this.logger.trace("onShutdown()"); // provide some authority within the Alfresco context Loading
beedk-acs-allinone-archetype/src/main/resources/archetype-resources/platform-module-A/src/main/java/ExampleEventListener.java +19 −9 Original line number Diff line number Diff line Loading @@ -21,15 +21,15 @@ import org.alfresco.service.ServiceRegistry; import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.extensions.surf.util.AbstractLifecycleBean; import org.springframework.stereotype.Component; /** * This class is an example of how you can use the Alfresco Java Public API when Alfresco triggers an event. */ @Component public class ExampleEventListener implements InitializingBean, OnCreateNodePolicy { public class ExampleEventListener extends AbstractLifecycleBean implements OnCreateNodePolicy { private final Logger logger = LoggerFactory.getLogger(this.getClass()); Loading @@ -38,12 +38,16 @@ public class ExampleEventListener implements InitializingBean, OnCreateNodePolic protected ServiceRegistry serviceRegistry; @Override public void afterPropertiesSet() throws Exception { protected void onBootstrap(ApplicationEvent event) { this.bind(); } /** * This must be called after the `PolicyComponent` is initialized/ready. * So you cannot call it from with `@PostConstruct` or using * `InitializingBean`. */ public void bind() { if (this.logger.isTraceEnabled()) this.logger.trace("bind()"); // example listener Loading @@ -51,9 +55,15 @@ public class ExampleEventListener implements InitializingBean, OnCreateNodePolic new JavaBehaviour(this, OnCreateNodePolicy.QNAME.getLocalName(), NotificationFrequency.TRANSACTION_COMMIT)); } /** * This will execute with the same authentication and transaction context * as was used to create the node, unless the binding is * `TRANSACTION_COMMIT`. Then it will only have the same transaction * context and the authentication context used when starting the * transaction. */ @Override public void onCreateNode(ChildAssociationRef childAssocRef) { if (this.logger.isTraceEnabled()) this.logger.trace("onCreateNode('" + childAssocRef.getChildRef() + "')"); // TODO do some work Loading
beedk-acs-allinone-archetype/src/main/resources/archetype-resources/platform-module-A/src/main/java/ExampleGetWebScript.java +5 −0 Original line number Diff line number Diff line Loading @@ -39,6 +39,11 @@ public class ExampleGetWebScript extends AbstractWebScript { @Autowired protected ServiceRegistry serviceRegistry; /** * This will have the authentication context of the authenticated user * calling the REST endpoint. The transaction context is defined in the * web script descriptor. */ @Override public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException { if (this.logger.isTraceEnabled()) Loading