2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.controlloop.poligy.guard.builder;
23 import org.onap.policy.controlloop.policy.builder.BuilderException;
24 import org.onap.policy.controlloop.policy.builder.Results;
25 import org.onap.policy.controlloop.policy.guard.Constraint;
26 import org.onap.policy.controlloop.policy.guard.ControlLoopGuard;
27 import org.onap.policy.controlloop.policy.guard.Guard;
28 import org.onap.policy.controlloop.policy.guard.GuardPolicy;
29 import org.onap.policy.controlloop.policy.guard.builder.impl.ControlLoopGuardBuilderImpl;
31 public interface ControlLoopGuardBuilder {
34 * Adds one or more guard policies to the Control Loop Guard
39 * @throws BuilderException
41 public ControlLoopGuardBuilder addGuardPolicy(GuardPolicy... policies) throws BuilderException;
44 * Removes one or more guard policies from the Control Loop Guard
49 * @throws BuilderException
51 public ControlLoopGuardBuilder removeGuardPolicy(GuardPolicy... policies) throws BuilderException;
54 * Removes all guard policies from the Control Loop Guard
59 * @throws BuilderException
61 public ControlLoopGuardBuilder removeAllGuardPolicies() throws BuilderException;
64 * Adds one or more time limit constraints to the guard policy
67 * @param id (guard policy id)
70 * @throws BuilderException
72 public ControlLoopGuardBuilder addLimitConstraint(String id, Constraint... constraints) throws BuilderException;
75 * Removes one or more time limit constraints from the guard policy
78 * @param id (guard policy id)
81 * @throws BuilderException
83 public ControlLoopGuardBuilder removeLimitConstraint(String id, Constraint... constraints) throws BuilderException;
86 * Removes all time limit constraints from the guard policy
89 * @param id (guard policy id)
91 * @throws BuilderException
93 public ControlLoopGuardBuilder removeAllLimitConstraints(String id) throws BuilderException;
96 * Simply return a copy of control loop guard
98 * @return ControlLoopGuard
100 public ControlLoopGuard getControlLoopGuard();
103 * This will compile and build the YAML specification for the Control Loop Guard. Please iterate the Results object for details.
104 * The Results object will contains warnings and errors. If the specification compiled successfully, you will be able to retrieve the
109 public Results buildSpecification();
112 * The Factory is used to build a ControlLoopGuardBuilder implementation.
115 public static class Factory {
119 * @return ControlLoopGuardBuilder object
120 * @throws BuilderException
122 public static ControlLoopGuardBuilder buildControlLoopGuard (Guard guard) throws BuilderException {
124 ControlLoopGuardBuilder builder = new ControlLoopGuardBuilderImpl(guard);