Replaced all tabs with spaces in java and pom.xml
[so.git] / bpmn / mso-infrastructure-bpmn / src / main / java / org / onap / so / bpmn / infrastructure / MSOInfrastructureApplication.java
index db2304d..bd430fd 100644 (file)
@@ -4,6 +4,8 @@
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
@@ -22,14 +24,14 @@ package org.onap.so.bpmn.infrastructure;
 
 import java.util.List;
 import java.util.concurrent.Executor;
-
 import org.camunda.bpm.application.PostDeploy;
 import org.camunda.bpm.application.PreUndeploy;
 import org.camunda.bpm.application.ProcessApplicationInfo;
 import org.camunda.bpm.engine.ProcessEngine;
-import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication;
 import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator;
-import org.onap.so.logger.MsoLogger;
+import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -47,67 +49,54 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
  */
 
 @SpringBootApplication
-@EnableProcessApplication("MSO Infrastructure Application")
 @EnableAsync
-@ComponentScan(basePackages = { "org.onap" }, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = {
-                               @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class) })
+@ComponentScan(basePackages = {"org.onap"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class,
+        excludeFilters = {@Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)})
 public class MSOInfrastructureApplication {
 
-       private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,
-                       MSOInfrastructureApplication.class);
-
-       @Value("${mso.async.core-pool-size}")
-       private int corePoolSize;
-
-       @Value("${mso.async.max-pool-size}")
-       private int maxPoolSize;
-
-       @Value("${mso.async.queue-capacity}")
-       private int queueCapacity;
-
-       private static final String LOGS_DIR = "logs_dir";
+    private static final Logger logger = LoggerFactory.getLogger(MSOInfrastructureApplication.class);
 
+    @Value("${mso.async.core-pool-size}")
+    private int corePoolSize;
 
-       private static void setLogsDir() {
-               if (System.getProperty(LOGS_DIR) == null) {
-                       System.getProperties().setProperty(LOGS_DIR, "./logs/bpmn/");
-               }
-       }
+    @Value("${mso.async.max-pool-size}")
+    private int maxPoolSize;
 
-       public static void main(String... args) {
-               SpringApplication.run(MSOInfrastructureApplication.class, args);
-               System.getProperties().setProperty("mso.config.path", ".");
-               setLogsDir();
-       }
+    @Value("${mso.async.queue-capacity}")
+    private int queueCapacity;
 
-       @PostDeploy
-       public void postDeploy(ProcessEngine processEngineInstance) {
-               long startTime = System.currentTimeMillis();
+    private static final String LOGS_DIR = "logs_dir";
 
-               msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
-                               "Post deployment complete...");
-       }
 
-       @PreUndeploy
-       public void cleanup(ProcessEngine processEngine, ProcessApplicationInfo processApplicationInfo,
-                       List<ProcessEngine> processEngines) {
-               long startTime = System.currentTimeMillis();
+    private static void setLogsDir() {
+        if (System.getProperty(LOGS_DIR) == null) {
+            System.getProperties().setProperty(LOGS_DIR, "./logs/bpmn/");
+        }
+    }
 
-               msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
-                               "Pre Undeploy complete...");
+    public static void main(String... args) {
+        SpringApplication.run(MSOInfrastructureApplication.class, args);
+        System.getProperties().setProperty("mso.config.path", ".");
+        setLogsDir();
+    }
 
-       }
+    @PostDeploy
+    public void postDeploy(ProcessEngine processEngineInstance) {}
 
-       @Bean
-       @Primary
-       public Executor asyncExecutor() {
-               ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+    @PreUndeploy
+    public void cleanup(ProcessEngine processEngine, ProcessApplicationInfo processApplicationInfo,
+            List<ProcessEngine> processEngines) {}
 
-               executor.setCorePoolSize(corePoolSize);
-               executor.setMaxPoolSize(maxPoolSize);
-               executor.setQueueCapacity(queueCapacity);
-               executor.setThreadNamePrefix("Camunda-");
-               executor.initialize();
-               return executor;
-       }
-}
\ No newline at end of file
+    @Bean
+    @Primary
+    public Executor asyncExecutor() {
+        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+        executor.setTaskDecorator(new MDCTaskDecorator());
+        executor.setCorePoolSize(corePoolSize);
+        executor.setMaxPoolSize(maxPoolSize);
+        executor.setQueueCapacity(queueCapacity);
+        executor.setThreadNamePrefix("Camunda-");
+        executor.initialize();
+        return executor;
+    }
+}