aboutsummaryrefslogtreecommitdiffstats
path: root/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java
diff options
context:
space:
mode:
Diffstat (limited to 'integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java')
-rw-r--r--integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java47
1 files changed, 32 insertions, 15 deletions
diff --git a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java
index 03f6f4e3..3f690187 100644
--- a/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java
+++ b/integrity-monitor/src/main/java/org/onap/policy/common/im/StateTransition.java
@@ -24,15 +24,15 @@ import java.util.*;
import org.onap.policy.common.im.StateElement;
-import org.onap.policy.common.im.StateManagement;
-import org.onap.policy.common.logging.flexlogger.FlexLogger;
-import org.onap.policy.common.logging.flexlogger.Logger;
+import org.onap.policy.common.im.StateManagement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* The StateTransition class coordinates all state transitions.
*/
public class StateTransition {
- private static final Logger logger = FlexLogger.getLogger(StateTransition.class);
+ private static final Logger logger = LoggerFactory.getLogger(StateTransition.class);
public static final String ADMIN_STATE = "adminState";
public static final String OPERATION_STATE = "opState";
@@ -48,14 +48,18 @@ public class StateTransition {
*/
public StateTransition() throws StateTransitionException
{
- logger.debug("StateTransition constructor");
+ if(logger.isDebugEnabled()){
+ logger.debug("StateTransition constructor");
+ }
try {
- logger.debug("Load StateTable started");
+ if(logger.isDebugEnabled()){
+ logger.debug("Load StateTable started");
+ }
setupStateTable();
} catch(Exception ex) {
- logger.debug(ex);
+ logger.error("StateTransition threw exception.", ex);
throw new StateTransitionException("StateTransition Exception: " + ex.toString());
}
}
@@ -73,9 +77,17 @@ public class StateTransition {
public StateElement getEndingState(String adminState, String opState, String availStatus,
String standbyStatus, String actionName) throws StateTransitionException
{
- logger.info("getEndingState");
- logger.info("adminState=[" + adminState + "], opState=[" + opState + "], availStatus=[" +
- availStatus + "], standbyStatus=[" + standbyStatus + "], actionName=[" + actionName + "]");
+ if(logger.isDebugEnabled()){
+ logger.debug("getEndingState");
+ }
+ if(logger.isDebugEnabled()){
+ logger.debug("adminState=[{}], opState=[{}], availStatus=[{}], standbyStatus=[{}], actionName[{}]",
+ adminState,
+ opState,
+ availStatus,
+ standbyStatus,
+ actionName);
+ }
if(availStatus==null){
availStatus="null";
}
@@ -124,7 +136,9 @@ public class StateTransition {
availStatus2 = availStatus.replace(",", ".");
}
String key = adminState + "," + opState + "," + availStatus2 + "," + standbyStatus + "," + actionName;
- logger.debug("Ending State search key: " + key);
+ if(logger.isDebugEnabled()){
+ logger.debug("Ending State search key: {}", key);
+ }
String value = StateTable.get(key);
if (value != null) {
@@ -143,17 +157,17 @@ public class StateTransition {
stateElement.displayStateElement();
} catch(Exception ex) {
- logger.error("String split exception: " + ex);
+ logger.error("String split exception: {}", ex.toString(), ex);
}
} else {
String msg = "Ending state not found, adminState=[" + adminState + "], opState=[" + opState + "], availStatus=[" +
availStatus + "], standbyStatus=[" + standbyStatus + "], actionName=[" + actionName + "]";
- logger.error(msg);
+ logger.error("{}", msg);
throw new StateTransitionException(msg);
}
} catch (Exception ex) {
- logger.debug(ex);
+ logger.error("StateTransition threw exception.", ex);
throw new StateTransitionException("Exception: " + ex.toString() + ", adminState=[" + adminState + "], opState=[" + opState + "], availStatus=[" +
availStatus + "], standbyStatus=[" + standbyStatus + "], actionName=[" + actionName + "]");
}
@@ -720,7 +734,10 @@ public class StateTransition {
while(iter.hasNext()) {
Map.Entry<?, ?> me = (Map.Entry<?, ?>)iter.next();
- logger.debug((String)me.getKey() + ((String)me.getValue()).replace(".", ","));
+ String key = (String)me.getKey() + ((String)me.getValue()).replace(".", ",");
+ if(logger.isDebugEnabled()){
+ logger.debug("{}", key);
+ }
}
}
}