diff options
author | Jim Hahn <jrh3@att.com> | 2020-03-03 16:42:25 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-03-03 16:42:25 +0000 |
commit | bbcf7265e9b74e689bd8974f9684a6cd5c95fd9f (patch) | |
tree | 25249cb04888d1581536247bebdfb941f7e73bd4 /feature-lifecycle/src/main | |
parent | d9289d8c8fe1a89269cd8086582f668c0dfbb084 (diff) | |
parent | 53b503a4986cc5733e10d4ac05238fe3c20aa73d (diff) |
Merge "Undeploy support for drools policies."
Diffstat (limited to 'feature-lifecycle/src/main')
-rw-r--r-- | feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeController.java | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeController.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeController.java index 2d9ca514..1b5e7c47 100644 --- a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeController.java +++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeController.java @@ -23,10 +23,16 @@ package org.onap.policy.drools.lifecycle; import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Getter; import org.onap.policy.common.gson.annotation.GsonJsonIgnore; +import org.onap.policy.common.utils.coder.CoderException; +import org.onap.policy.drools.domain.models.controller.ControllerPolicy; +import org.onap.policy.drools.system.PolicyControllerConstants; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class PolicyTypeNativeController implements PolicyTypeController { + private static final Logger logger = LoggerFactory.getLogger(PolicyTypeNativeController.class); @Getter protected final ToscaPolicyTypeIdentifier policyType; @@ -48,7 +54,13 @@ public class PolicyTypeNativeController implements PolicyTypeController { @Override public boolean undeploy(ToscaPolicy policy) { - // TODO - return true; + try { + ControllerPolicy nativePolicy = fsm.getDomainMaker().convertTo(policy, ControllerPolicy.class); + PolicyControllerConstants.getFactory().destroy(nativePolicy.getProperties().getControllerName()); + return true; + } catch (RuntimeException | CoderException e) { + logger.warn("failed undeploy of policy: {}", policy); + return false; + } } } |