X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=ECOMP-ControlloopPolicy%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenecomp%2Fpolicy%2Fcontrolloop%2Fpolicy%2Fbuilder%2FControlLoopPolicyBuilder.java;h=2fdb6d9df8c56009501599e26f3320581b59657c;hb=87c95be02a8a4d77e165dede90777e811b59dcae;hp=fb10f292c2dac987d57bd7ef118e11c3d8163a5d;hpb=7e547eaa55920dfbc9691eab33bb728395b50cf2;p=policy%2Fengine.git diff --git a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/builder/ControlLoopPolicyBuilder.java b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/builder/ControlLoopPolicyBuilder.java index fb10f292c..2fdb6d9df 100644 --- a/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/builder/ControlLoopPolicyBuilder.java +++ b/ECOMP-ControlloopPolicy/src/main/java/org/openecomp/policy/controlloop/policy/builder/ControlLoopPolicyBuilder.java @@ -22,6 +22,8 @@ package org.openecomp.policy.controlloop.policy.builder; import java.util.Map; +import org.openecomp.policy.asdc.Resource; +import org.openecomp.policy.asdc.Service; import org.openecomp.policy.controlloop.policy.ControlLoop; import org.openecomp.policy.controlloop.policy.OperationsAccumulateParams; import org.openecomp.policy.controlloop.policy.Policy; @@ -31,6 +33,52 @@ import org.openecomp.policy.controlloop.policy.builder.impl.ControlLoopPolicyBui public interface ControlLoopPolicyBuilder { + /** + * Adds one or more services to the ControlLoop + * + * + * @param service + * @return + * @throws BuilderException + */ + public ControlLoopPolicyBuilder addService(Service... services) throws BuilderException; + + /** + * @param services + * @return + * @throws BuilderException + */ + public ControlLoopPolicyBuilder removeService(Service... services) throws BuilderException; + + /** + * @return + * @throws BuilderException + */ + public ControlLoopPolicyBuilder removeAllServices() throws BuilderException; + + /** + * Adds one or more resources to the ControlLoop + * + * + * @param resource + * @return + * @throws BuilderException + */ + public ControlLoopPolicyBuilder addResource(Resource... resources) throws BuilderException; + + /** + * @param resources + * @return + * @throws BuilderException + */ + public ControlLoopPolicyBuilder removeResource(Resource... resources) throws BuilderException; + + /** + * @return + * @throws BuilderException + */ + public ControlLoopPolicyBuilder removeAllResources() throws BuilderException; + /** * @param abatement * @return @@ -186,6 +234,9 @@ public interface ControlLoopPolicyBuilder { * */ public static class Factory { + private Factory(){ + // Private Constructor. + } /** * Builds a basic Control Loop with an overall timeout. Use this method if you wish to create an OpenLoop, or if you @@ -197,12 +248,40 @@ public interface ControlLoopPolicyBuilder { * @throws BuilderException */ public static ControlLoopPolicyBuilder buildControlLoop (String controlLoopName, Integer timeout) throws BuilderException { + return new ControlLoopPolicyBuilderImpl(controlLoopName, timeout); + } + + /** + * Build a Control Loop for a resource and services associated with the resource. + * + * @param controlLoopName - Per Closed Loop AID v1.0, unique string for the closed loop. + * @param timeout - Overall timeout for the Closed Loop to execute. + * @param resource - Resource this closed loop is for. Should come from ASDC, but if not available use resourceName to distinguish. + * @param services - Zero or more services associated with this resource. Should come from ASDC, but if not available use serviceName to distinguish. + * @return ControlLoopPolicyBuilder object + * @throws BuilderException + */ + public static ControlLoopPolicyBuilder buildControlLoop (String controlLoopName, Integer timeout, Resource resource, Service... services) throws BuilderException { - ControlLoopPolicyBuilder builder = new ControlLoopPolicyBuilderImpl(controlLoopName, timeout); + ControlLoopPolicyBuilder builder = new ControlLoopPolicyBuilderImpl(controlLoopName, timeout, resource, services); return builder; - } + } + /** + * @param controlLoopName + * @param timeout + * @param service + * @param resources + * @return + * @throws BuilderException + */ + public static ControlLoopPolicyBuilder buildControlLoop (String controlLoopName, Integer timeout, Service service, Resource... resources) throws BuilderException { + + ControlLoopPolicyBuilder builder = new ControlLoopPolicyBuilderImpl(controlLoopName, timeout, service, resources); + + return builder; + } } }