summaryrefslogtreecommitdiffstats
path: root/asdc-controller
diff options
context:
space:
mode:
authorPlummer, Brittany <brittany.plummer@att.com>2020-03-04 21:19:08 -0500
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-03-05 10:43:49 -0500
commit0d63836c2eaa7267d55a4757fd83ea1b4b1c8bb2 (patch)
treee7757b4bae25083a08f2a8c0846f1ca823ef19ed /asdc-controller
parent93fd7052a09fecf632bfde52debc772b1686d634 (diff)
create custom spring aop annotation for logging
Added annotation for setting up scheduled tasks logs Added new annotation to scheduledTasks Moved annotation setup to logging-library Issue-ID: SO-2713 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: I7080c4bb289e454f14167631e2601c954389c0ef
Diffstat (limited to 'asdc-controller')
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java21
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java2
7 files changed, 13 insertions, 20 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
index ecffb683ca..fe166f7942 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
@@ -24,15 +24,13 @@ package org.onap.so.asdc;
import java.security.SecureRandom;
import javax.annotation.PreDestroy;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.asdc.client.ASDCController;
import org.onap.so.asdc.client.exceptions.ASDCControllerException;
-import org.onap.so.logger.ErrorCode;
-import org.onap.so.logger.ScheduledTasksMDCSetup;
-import org.onap.so.utils.Components;
+import org.onap.logging.filter.base.ErrorCode;
+import org.onap.logging.filter.base.ScheduledLogging;
+import org.onap.logging.filter.base.ScheduledTaskException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.Scheduled;
@@ -47,16 +45,13 @@ public class ASDCControllerSingleton {
private final ASDCController asdcController;
@Autowired
- private ScheduledTasksMDCSetup scheduledMDCSetup;
-
- @Autowired
public ASDCControllerSingleton(final ASDCController asdcController) {
this.asdcController = asdcController;
}
+ @ScheduledLogging
@Scheduled(fixedRate = 50000)
- public void periodicControllerTask() {
- scheduledMDCSetup.mdcSetup(Components.ASDC_CONTROLLER, "periodicControllerTask");
+ public void periodicControllerTask() throws ScheduledTaskException {
try {
final int randomNumber = new SecureRandom().nextInt(Integer.MAX_VALUE);
asdcController.setControllerName("mso-controller" + randomNumber);
@@ -66,11 +61,9 @@ public class ASDCControllerSingleton {
asdcController.initASDC();
}
} catch (final ASDCControllerException controllerException) {
- scheduledMDCSetup.errorMDCSetup(ErrorCode.UnknownError, controllerException.getMessage());
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.ERROR.toString());
- logger.error("Exception occurred", controllerException);
+ throw new ScheduledTaskException(ErrorCode.UnknownError, controllerException.getMessage(),
+ controllerException);
}
- scheduledMDCSetup.exitAndClearMDC();
}
@PreDestroy
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
index e084cfec18..ad96e1be4b 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
@@ -74,7 +74,7 @@ import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
import org.onap.so.db.request.beans.WatchdogDistributionStatus;
import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository;
import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java
index a9d06d8e82..42778507f0 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/test/rest/ASDCRestInterface.java
@@ -36,7 +36,7 @@ import org.onap.so.asdc.client.test.emulators.DistributionClientEmulator;
import org.onap.so.asdc.client.test.emulators.JsonStatusData;
import org.onap.so.asdc.client.test.emulators.NotificationDataImpl;
import org.onap.so.asdc.installer.heat.ToscaResourceInstaller;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
index dcb49478f4..04d4b0c2dc 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ToscaResourceStructure.java
@@ -50,7 +50,7 @@ import org.onap.so.db.catalog.beans.ToscaCsar;
import org.onap.so.db.catalog.beans.VfModule;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
index 195aa7e302..433456956d 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/BpmnInstaller.java
@@ -47,7 +47,7 @@ import org.apache.http.entity.mime.content.ByteArrayBody;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.HttpClientBuilder;
import org.onap.so.asdc.client.ASDCConfiguration;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java
index ef4dfa24aa..1f111ba7a0 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/bpmn/WorkflowResource.java
@@ -40,7 +40,7 @@ import org.onap.so.db.catalog.beans.WorkflowActivitySpecSequence;
import org.onap.so.db.catalog.data.repository.ActivitySpecRepository;
import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
import org.onap.so.db.catalog.data.repository.WorkflowRepository;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
index 1c7ebb7d9a..423c1a7ed6 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
@@ -83,7 +83,7 @@ import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup;
import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository;
import org.onap.so.db.request.data.repository.WatchdogDistributionStatusRepository;
import org.onap.so.db.request.data.repository.WatchdogServiceModVerIdLookupRepository;
-import org.onap.so.logger.ErrorCode;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;