From 506267bf7e9d961f1a6b2a989ee8a23ca67b9d61 Mon Sep 17 00:00:00 2001 From: Charles Cole Date: Mon, 16 Oct 2017 12:05:08 -0500 Subject: Add support for AAI Named Query error handling Errors from AAI after a Named query now throw an AAIEXception. This is caught in the template to allow the resources to be removed from memory and a final failure to be thrown. Issue-ID: POLICY-314 Change-Id: I319d29ef537b2d01ca288622aac1d9dbbe05f5eb Signed-off-by: Charles Cole --- .../controlloop/eventmanager/ControlLoopEventManager.java | 3 ++- .../controlloop/eventmanager/ControlLoopOperationManager.java | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'controlloop/common/eventmanager/src/main/java/org') diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java index f8f3b4cc8..2fc43a01c 100644 --- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java +++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java @@ -265,8 +265,9 @@ public class ControlLoopEventManager implements LockCallback, Serializable { } switch (result) { - case FINAL_FAILURE: case FINAL_FAILURE_EXCEPTION: + notification.message = "Exception in processing closed loop"; + case FINAL_FAILURE: case FINAL_FAILURE_RETRIES: case FINAL_FAILURE_TIMEOUT: case FINAL_FAILURE_GUARD: diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java index 608d2c00d..edb6356d9 100644 --- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java +++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java @@ -31,6 +31,7 @@ import java.util.Properties; import javax.persistence.EntityManager; import javax.persistence.Persistence; +import org.onap.policy.aai.util.AAIException; import org.onap.policy.appc.Response; import org.onap.policy.appc.ResponseCode; import org.onap.policy.appclcm.LCMResponseWrapper; @@ -145,7 +146,7 @@ public class ControlLoopOperationManager implements Serializable { } } - public Object startOperation(/*VirtualControlLoopEvent*/ControlLoopEvent onset) { + public Object startOperation(/*VirtualControlLoopEvent*/ControlLoopEvent onset) throws AAIException { // // They shouldn't call us if we currently running something // @@ -206,6 +207,7 @@ public class ControlLoopOperationManager implements Serializable { * request is constructed. Otherwise an LCMRequest * is constructed. */ + this.currentOperation = operation; if ("ModifyConfig".equalsIgnoreCase(policy.getRecipe())) { this.operationRequest = APPCActorServiceProvider.constructRequest((VirtualControlLoopEvent)onset, operation.operation, this.policy); @@ -216,7 +218,7 @@ public class ControlLoopOperationManager implements Serializable { // // Save the operation // - this.currentOperation = operation; + return operationRequest; case "SO": SOActorServiceProvider SOAsp = new SOActorServiceProvider(); @@ -482,6 +484,10 @@ public class ControlLoopOperationManager implements Serializable { // this.completeOperation(this.attempts, "Operation denied by Guard", PolicyResult.FAILURE_GUARD); } + + public void setOperationHasException(String message) { + this.completeOperation(this.attempts, message, PolicyResult.FAILURE_EXCEPTION); + } public boolean isOperationComplete() { // -- cgit 1.2.3-korg