diff options
Diffstat (limited to 'bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java')
-rw-r--r-- | bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java index 8d6e133a1c..b39b13e609 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java @@ -39,7 +39,11 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan.Filter; @@ -48,6 +52,12 @@ import org.springframework.context.annotation.Primary; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import javax.annotation.PostConstruct; +import java.util.List; +import java.util.concurrent.Executor; + +import static java.util.Collections.singletonMap; +import static org.springframework.boot.context.config.ConfigFileApplicationListener.*; /** * @since Version 1.0 * @@ -57,10 +67,18 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @EnableAsync @ComponentScan(basePackages = {"org.onap"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = {@Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)}) +@EnableAutoConfiguration(exclude= FreeMarkerAutoConfiguration.class) +public class MSOInfrastructureApplication extends SpringBootServletInitializer { -public class MSOInfrastructureApplication { - + private static final String ADDITIONAL_CONFIG = "file:/camunda/app/config/override.yaml"; private static final Logger logger = LoggerFactory.getLogger(MSOInfrastructureApplication.class); + + @Override + protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { + return application + .sources(MSOInfrastructureApplication.class) + .properties(singletonMap(CONFIG_ADDITIONAL_LOCATION_PROPERTY, ADDITIONAL_CONFIG)); + } @Autowired private ProcessEngine processEngine; @@ -101,17 +119,18 @@ public class MSOInfrastructureApplication { @PostConstruct public void postConstruct() { - try { - DeploymentBuilder deploymentBuilder = processEngine.getRepositoryService().createDeployment(); - deployCustomWorkflows(deploymentBuilder); - } catch (Exception e) { - logger.warn("Unable to invoke deploymentBuilder ", e); - } + DeploymentBuilder deploymentBuilder = processEngine.getRepositoryService().createDeployment(); +// try { +// DeploymentBuilder deploymentBuilder = processEngine.getRepositoryService().createDeployment(); +// deployCustomWorkflows(deploymentBuilder); +// } catch (Exception e) { +// logger.warn("Unable to invoke deploymentBuilder: " + e.getMessage()); +// } } - @PreUndeploy - public void cleanup(ProcessEngine processEngine, ProcessApplicationInfo processApplicationInfo, - List<ProcessEngine> processEngines) {} +// @PreUndeploy +// public void cleanup(ProcessEngine processEngine, ProcessApplicationInfo processApplicationInfo, +// List<ProcessEngine> processEngines) {} @Bean @Primary @@ -127,9 +146,10 @@ public class MSOInfrastructureApplication { } public void deployCustomWorkflows(DeploymentBuilder deploymentBuilder) { - logger.debug("Attempting to deploy custom workflows"); + logger.info("Attempting to deploy custom workflows"); try { List<Workflow> workflows = catalogDbClient.findWorkflowBySource(SDC_SOURCE); + logger.info("SDC workflows: {}", workflows ); if (workflows != null && !workflows.isEmpty()) { for (Workflow workflow : workflows) { String workflowName = workflow.getName(); @@ -146,7 +166,7 @@ public class MSOInfrastructureApplication { deploymentBuilder.deploy(); } } catch (Exception e) { - logger.warn("Unable to deploy custom workflows ", e); + logger.error("Unable to deploy custom workflows ", e); } } } |