diff options
author | Jim Hahn <jrh3@att.com> | 2018-01-31 17:16:13 -0500 |
---|---|---|
committer | Jim Hahn <jrh3@att.com> | 2018-01-31 17:18:40 -0500 |
commit | d312eaf616aaf0ca15557d935ec1b41e84ced3cc (patch) | |
tree | 2a96a9b89a23fcb726f467076dabcfdfa304ce0d | |
parent | 9e2820c5820b3904e03cb7a4cb4292e864b1ca2b (diff) |
Fix sonar code issues for api-state-management
Renamed constants, adding "DO_" prefix or "_STATE" suffix.
Removed spurious exceptions from "throws" clauses.
Change-Id: I0abd74d736009480614f0653fe5aaf1ddbe77b08
Issue-ID: POLICY-468
Signed-off-by: Jim Hahn <jrh3@att.com>
2 files changed, 12 insertions, 15 deletions
diff --git a/api-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementFeatureAPI.java b/api-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementFeatureAPI.java index 70ad3719..107b207e 100644 --- a/api-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementFeatureAPI.java +++ b/api-state-management/src/main/java/org/onap/policy/drools/statemanagement/StateManagementFeatureAPI.java @@ -25,7 +25,6 @@ import java.util.Observer; import javax.validation.constraints.NotNull; import org.onap.policy.common.im.AllSeemsWellException; -import org.onap.policy.common.im.StandbyStatusException; import org.onap.policy.common.im.StateManagement; import org.onap.policy.drools.properties.Lockable; import org.onap.policy.drools.utils.OrderedService; @@ -42,7 +41,7 @@ import org.onap.policy.drools.utils.OrderedServiceImpl; public interface StateManagementFeatureAPI extends OrderedService, Lockable { - public static final String LOCKED = StateManagement.LOCKED; + public static final String LOCKED = StateManagement.LOCKED; public static final String UNLOCKED = StateManagement.UNLOCKED; public static final String ENABLED = StateManagement.ENABLED; public static final String DISABLED = StateManagement.DISABLED; @@ -54,10 +53,10 @@ public interface StateManagementFeatureAPI extends OrderedService, Lockable public static final String DISABLE_DEPENDENCY = StateManagement.DISABLE_DEPENDENCY; public static final String ENABLE_NO_DEPENDENCY = StateManagement.ENABLE_NO_DEPENDENCY; public static final String NULL_VALUE = StateManagement.NULL_VALUE; - public static final String LOCK = StateManagement.LOCK; - public static final String UNLOCK = StateManagement.UNLOCK; - public static final String PROMOTE = StateManagement.PROMOTE; - public static final String DEMOTE = StateManagement.DEMOTE; + public static final String DO_LOCK = StateManagement.LOCK; + public static final String DO_UNLOCK = StateManagement.UNLOCK; + public static final String DO_PROMOTE = StateManagement.PROMOTE; + public static final String DO_DEMOTE = StateManagement.DEMOTE; public static final String HOT_STANDBY = StateManagement.HOT_STANDBY; public static final String COLD_STANDBY = StateManagement.COLD_STANDBY; public static final String PROVIDING_SERVICE = StateManagement.PROVIDING_SERVICE; @@ -67,8 +66,8 @@ public interface StateManagementFeatureAPI extends OrderedService, Lockable public static final String AVAILABLE_STATUS= StateManagement.AVAILABLE_STATUS; public static final String STANDBY_STATUS = StateManagement.STANDBY_STATUS; - static public final Boolean ALLSEEMSWELL = Boolean.TRUE; - static public final Boolean ALLNOTWELL = Boolean.FALSE; + public static final Boolean ALLSEEMSWELL_STATE = Boolean.TRUE; + public static final Boolean ALLNOTWELL_STATE = Boolean.FALSE; public static final int SEQ_NUM = 0; /** @@ -95,11 +94,10 @@ public interface StateManagementFeatureAPI extends OrderedService, Lockable * @param asw - This is the indicator of health. See constants: ALLSEEMSWELL or ALLNOTWELL * @param msg - A message is required. It should indicate why all is not well or a message indicating * that a component has been restored to health (perhaps indicating the problem that has resolved). - * @throws IllegalArgumentException * @throws AllSeemsWellException */ public void allSeemsWell(@NotNull String key, @NotNull Boolean asw, @NotNull String msg) - throws IllegalArgumentException, AllSeemsWellException; + throws AllSeemsWellException; /** * This method is called to add an Observer to receive notifications of state changes @@ -168,10 +166,9 @@ public interface StateManagementFeatureAPI extends OrderedService, Lockable * to providingservice. If the current value is coldstandby, no change is made. * If the current value is null, it will move to providingservice assuming the * Operational State is enabled and Administrative State is unlocked. - * @throws Exception - * @throws StandbyStatusException + * @throws Exception */ - public void promote() throws StandbyStatusException, Exception; + public void promote() throws Exception; /** * This method moves the X.731 Standby Status for this resource from providingservice diff --git a/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/DroolsPdpsElectionHandler.java b/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/DroolsPdpsElectionHandler.java index 13348c78..2836f92f 100644 --- a/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/DroolsPdpsElectionHandler.java +++ b/feature-active-standby-management/src/main/java/org/onap/policy/drools/activestandby/DroolsPdpsElectionHandler.java @@ -955,7 +955,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { logger.debug("checkWaitTimer: calling allSeemsWell with ALLNOTWELL param"); } stateManagementFeature.allSeemsWell(this.getClass().getName(), - StateManagementFeatureAPI.ALLNOTWELL, + StateManagementFeatureAPI.ALLNOTWELL_STATE, "DesignationWaiter/ElectionHandler has STALLED"); } logger.error("checkWaitTimer: nowMs - waitTimerMs = {}" @@ -964,7 +964,7 @@ public class DroolsPdpsElectionHandler implements ThreadRunningChecker { }else if(allSeemsWell==null || !allSeemsWell){ allSeemsWell = true; stateManagementFeature.allSeemsWell(this.getClass().getName(), - StateManagementFeatureAPI.ALLSEEMSWELL, + StateManagementFeatureAPI.ALLSEEMSWELL_STATE, "DesignationWaiter/ElectionHandler has RESUMED"); logger.info("DesignationWaiter/ElectionHandler has RESUMED"); } |