/** Make a copy of the StateMachine maintaining the current state. * * @return a copy of the StateMachine. */ public Object clone() { StateMachine clone = new StateMachine(states, startState, description); clone.currentState = currentState; return clone; }
protected void validateState(String action) throws PolicyContextException { try { configStateMachine.nextState(action); } catch(IllegalTransitionException e) { log.debug("validateState failure", e); throw new PolicyContextException("Operation not allowed", e); } } }
public PolicyConfiguration getPolicyConfiguration(String contextID, boolean remove) throws PolicyContextException { JBossPolicyConfiguration pc = (JBossPolicyConfiguration) policyConfigMap.get(contextID); if( pc == null ) { StateMachine sm = (StateMachine) configStateMachine.clone(); pc = new JBossPolicyConfiguration(contextID, policy, sm); policyConfigMap.put(contextID, pc); } pc.initPolicyConfiguration(remove); return pc; }
public boolean inService() throws PolicyContextException { validateState("inService"); State state = configStateMachine.getCurrentState(); boolean inService = state.getName().equals("inService"); return inService; }
/** * Create a new StateMachine that follows the ServiceMBean * lifecycle, initialized to the STATE_UNREGISTERED state. * * @param description A string description for this state machine, or null * @return the StateMachine */ public static StateMachine createStateMachine(String description) { return new StateMachine(STATES, STATE_UNREGISTERED, description); }
/** * Create a new StateMachine that follows the ServiceMBean * lifecycle, initialized to the STATE_UNREGISTERED state. * * @param description A string description for this state machine, or null * @return the StateMachine */ public static StateMachine createStateMachine(String description) { return new StateMachine(STATES, STATE_UNREGISTERED, description); }
throw new Exception("Failed to resolve transition targets: " + resolveFailed); StateMachine sm = new StateMachine(states, startState, description); return sm;