Changeset 76:b3787089a875

Removed obsolete files
author unexist
date Mon, 16 Aug 2021 18:13:08 +0200
parents 1f804d54614b
children 8e9b37db5564
files todo-service-camunda-quarkus/src/main/java/dev/unexist/showcase/todo/application/RestApplication.java todo-service-camunda-quarkus/src/main/java/dev/unexist/showcase/todo/infrastructure/camunda/CamundaEngine.java todo-service-camunda-quarkus/src/main/java/dev/unexist/showcase/todo/infrastructure/camunda/CamundaEngineProvider.java todo-service-camunda-quarkus/src/main/resources/META-INF/services/org.camunda.bpm.engine.rest.spi.ProcessEngineProvider
diffstat 4 files changed, 0 insertions(+), 237 deletions(-) [+]
line wrap: on
line diff
--- a/todo-service-camunda-quarkus/src/main/java/dev/unexist/showcase/todo/application/RestApplication.java	Mon Aug 16 18:12:50 2021 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/**
- * @package Quarkus-Workflow-Showcase
- *
- * @file Todo application
- * @copyright 2021 Christoph Kappel <christoph@unexist.dev>
- * @version $Id$
- *
- * This program can be distributed under the terms of the Apache License v2.0.
- * See the file LICENSE for details.
- **/
-
-package dev.unexist.showcase.todo.application;
-
-import dev.unexist.showcase.todo.adapter.CamundaResource;
-import dev.unexist.showcase.todo.adapter.TodoResource;
-import dev.unexist.showcase.todo.adapter.tasks.CamundaTodoCheckTask;
-import dev.unexist.showcase.todo.adapter.tasks.CamundaTodoTallyTask;
-import dev.unexist.showcase.todo.infrastructure.camunda.CamundaEngine;
-import org.camunda.bpm.engine.rest.impl.CamundaRestResources;
-
-import javax.ws.rs.core.Application;
-import java.util.HashSet;
-import java.util.Set;
-
-public class RestApplication extends Application {
-
-    @Override
-    public Set<Class<?>> getClasses() {
-        Set<Class<?>> classes = new HashSet<Class<?>>();
-
-        /* Add your own classes */
-        classes.add(TodoResource.class);
-        classes.add(CamundaResource.class);
-        classes.add(CamundaEngine.class);
-
-        /* Add tasks */
-        classes.add(CamundaTodoCheckTask.class);
-        classes.add(CamundaTodoTallyTask.class);
-
-        /* Add all camunda engine rest resources (or just add those that you actually need) */
-        classes.addAll(CamundaRestResources.getResourceClasses());
-
-        /* Mandatory */
-        classes.addAll(CamundaRestResources.getConfigurationClasses());
-
-        return classes;
-    }
-}
--- a/todo-service-camunda-quarkus/src/main/java/dev/unexist/showcase/todo/infrastructure/camunda/CamundaEngine.java	Mon Aug 16 18:12:50 2021 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-/**
- * @package Quarkus-Workflow-Showcase
- *
- * @file Camunda engine helper
- * @copyright 2021 Christoph Kappel <christoph@unexist.dev>
- * @version $Id$
- *
- * This program can be distributed under the terms of the Apache License v2.0.
- * See the file LICENSE for details.
- **/
-
-package dev.unexist.showcase.todo.infrastructure.camunda;
-
-import dev.unexist.showcase.todo.adapter.tasks.CamundaTodoCheckTask;
-import dev.unexist.showcase.todo.adapter.tasks.CamundaTodoTallyTask;
-import io.agroal.api.AgroalDataSource;
-import org.camunda.bpm.engine.ProcessEngine;
-import org.camunda.bpm.engine.ProcessEngineConfiguration;
-import org.camunda.bpm.engine.RepositoryService;
-import org.camunda.bpm.engine.impl.cfg.ProcessEnginePlugin;
-import org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration;
-import org.camunda.bpm.engine.repository.ProcessDefinition;
-import org.camunda.bpm.model.bpmn.Bpmn;
-import org.camunda.bpm.model.bpmn.BpmnModelInstance;
-import org.camunda.spin.plugin.impl.SpinProcessEnginePlugin;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.util.ClassUtils;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-import javax.sql.DataSource;
-import java.io.InputStream;
-import java.util.List;
-import java.util.Map;
-
-@ApplicationScoped
-public class CamundaEngine {
-    private static final Logger LOGGER = LoggerFactory.getLogger(CamundaEngine.class);
-
-    private ProcessEngine processEngine;
-
-    @Inject
-    AgroalDataSource defaultDataSource;
-
-    /**
-     * Get process engine
-     *
-     * @return Either newly created {@link ProcessEngine} or from cache
-     **/
-
-    public ProcessEngine getProcessEngine() {
-        if (null == this.processEngine) {
-            this.createProcessEngineWithDataSource(this.defaultDataSource);
-            this.deployProcess();
-        }
-
-        return this.processEngine;
-    }
-
-    /**
-     * Create new engine with given {@link DataSource}
-     *
-     * @param  dataSource  A {@link DataSource}
-     **/
-
-    private void createProcessEngineWithDataSource(DataSource dataSource) {
-        try {
-            StandaloneProcessEngineConfiguration config =
-                    new StandaloneProcessEngineConfiguration();
-
-            List<ProcessEnginePlugin> pluginList = List.of(new SpinProcessEnginePlugin());
-
-            /* Provide list of beans */
-            Map<Object, Object> beanList = Map.of(
-                    ClassUtils.getShortNameAsProperty(CamundaTodoCheckTask.class),
-                        CamundaTodoCheckTask.class,
-                    ClassUtils.getShortNameAsProperty(CamundaTodoTallyTask.class),
-                        CamundaTodoTallyTask.class
-            );
-
-            config.setDataSource(dataSource);
-            config.setDatabaseSchemaUpdate(
-                    ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
-            config.setJobExecutorActivate(true);
-            config.setProcessEnginePlugins(pluginList);
-            config.setBeans(beanList);
-
-            this.processEngine = config.buildProcessEngine();
-        } catch (Exception e) {
-            LOGGER.error("getProcessEngine", e);
-        }
-    }
-
-    /**
-     * Deploy process on cached engine
-     **/
-
-    private void deployProcess() {
-        RepositoryService repositoryService =
-                this.processEngine.getRepositoryService();
-
-        try {
-            ProcessDefinition process = repositoryService.createProcessDefinitionQuery()
-                    .processDefinitionKey("todo")
-                    .latestVersion()
-                    .singleResult();
-
-            if (null == process) {
-                ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
-
-                InputStream inputStream = classLoader.getResourceAsStream("todo.bpmn");
-
-                BpmnModelInstance todoInstance = Bpmn.readModelFromStream(inputStream);
-                repositoryService.createDeployment()
-                        .addModelInstance("todo.bpmn", todoInstance)
-                        .deploy();
-
-                LOGGER.info("Process definition inputStream deployed");
-            } else {
-                LOGGER.info("Process definition is activated");
-            }
-        } catch (RuntimeException e) {
-            LOGGER.error("deployProcesses", e);
-        }
-    }
-}
--- a/todo-service-camunda-quarkus/src/main/java/dev/unexist/showcase/todo/infrastructure/camunda/CamundaEngineProvider.java	Mon Aug 16 18:12:50 2021 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/**
- * @package Quarkus-Workflow-Showcase
- *
- * @file Camunda engine provider
- * @copyright 2021 Christoph Kappel <christoph@unexist.dev>
- * @version $Id$
- *
- * This program can be distributed under the terms of the Apache License v2.0.
- * See the file LICENSE for details.
- **/
-
-package dev.unexist.showcase.todo.infrastructure.camunda;
-
-import org.camunda.bpm.engine.ProcessEngine;
-import org.camunda.bpm.engine.rest.spi.ProcessEngineProvider;
-
-import javax.inject.Inject;
-import java.util.HashSet;
-import java.util.Set;
-
-public class CamundaEngineProvider implements ProcessEngineProvider {
-
-    @Inject
-    CamundaEngine camundaEngine;
-
-    /**
-     * Get default process engine via SPI
-     *
-     * @return Default {@link ProcessEngine}
-     **/
-
-    public ProcessEngine getDefaultProcessEngine() {
-        return this.camundaEngine.getProcessEngine();
-    }
-
-    /**
-     * Get process engine by name
-     *
-     * @param  name  Name of the engine
-     *
-     * @return Found {@link ProcessEngine}
-     **/
-
-    public ProcessEngine getProcessEngine(String name) {
-        return this.camundaEngine.getProcessEngine();
-    }
-
-    /**
-     * Get list of all engine names
-     *
-     * @return List of known engine names
-     **/
-
-    public Set<String> getProcessEngineNames() {
-        Set<String> names = new HashSet<>();
-
-        names.add(this.camundaEngine.getProcessEngine().getName());
-
-        return names;
-    }
-}
--- a/todo-service-camunda-quarkus/src/main/resources/META-INF/services/org.camunda.bpm.engine.rest.spi.ProcessEngineProvider	Mon Aug 16 18:12:50 2021 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-dev.unexist.showcase.todo.infrastructure.camunda.CamundaEngineProvider
\ No newline at end of file