Package org.jboss.util.state

Examples of org.jboss.util.state.State


      String description = root.getAttribute("description");
      HashMap nameToStateMap = new HashMap();
      HashMap nameToTransitionsMap = new HashMap();
      HashSet states = new HashSet();
      State startState = null;

      // parse states
      NodeList stateList = root.getChildNodes();
      for (int i = 0; i < stateList.getLength(); i++)
      {
         Node stateNode = stateList.item(i);
         if (stateNode.getNodeName().equals("state"))
         {
            Element stateElement = (Element)stateNode;
            String stateName = stateElement.getAttribute("name");
            State s = new State(stateName);
            states.add(s);
            nameToStateMap.put(stateName, s);
            HashMap transitions = new HashMap();
           
            // parse transitions
            NodeList transitionList = stateElement.getChildNodes();
            for (int j = 0; j < transitionList.getLength(); j++)
            {
               Node transitionNode = transitionList.item(j);
               if (transitionNode.getNodeName().equals("transition"))
               {
                  Element transitionElement = (Element)transitionNode;
                  String name = transitionElement.getAttribute("name");
                  String targetName = transitionElement.getAttribute("target");
                  transitions.put(name, targetName);
               }
            }
            nameToTransitionsMap.put(stateName, transitions);
            if (Boolean.valueOf(stateElement.getAttribute("isStartState")) == Boolean.TRUE)
               startState = s;
         }
      }
     
      // Resolve all transition targets
      Iterator transitions = nameToTransitionsMap.keySet().iterator();
      StringBuffer resolveFailed = new StringBuffer();
      while (transitions.hasNext())
      {
         String stateName = (String)transitions.next();
         State s = (State)nameToStateMap.get(stateName);
         HashMap stateTransitions = (HashMap)nameToTransitionsMap.get(stateName);
         Iterator it = stateTransitions.keySet().iterator();
         while (it.hasNext())
         {
            String name = (String)it.next();
            String targetName = (String)stateTransitions.get(name);
            State target = (State)nameToStateMap.get(targetName);
            if (target == null)
            {
               String msg = "Failed to resolve target state: " + targetName + " for transition: " + name;
               resolveFailed.append(msg);
               log.debug(msg);
View Full Code Here


      String description = root.getAttribute("description");
      HashMap nameToStateMap = new HashMap();
      HashMap nameToTransitionsMap = new HashMap();
      HashSet states = new HashSet();
      State startState = null;

      // parse states
      NodeList stateList = root.getChildNodes();
      for (int i = 0; i < stateList.getLength(); i++)
      {
         Node stateNode = stateList.item(i);
         if (stateNode.getNodeName().equals("state"))
         {
            Element stateElement = (Element)stateNode;
            String stateName = stateElement.getAttribute("name");
            State s = new State(stateName);
            states.add(s);
            nameToStateMap.put(stateName, s);
            HashMap transitions = new HashMap();
           
            // parse transitions
            NodeList transitionList = stateElement.getChildNodes();
            for (int j = 0; j < transitionList.getLength(); j++)
            {
               Node transitionNode = transitionList.item(j);
               if (transitionNode.getNodeName().equals("transition"))
               {
                  Element transitionElement = (Element)transitionNode;
                  String name = transitionElement.getAttribute("name");
                  String targetName = transitionElement.getAttribute("target");
                  transitions.put(name, targetName);
               }
            }
            nameToTransitionsMap.put(stateName, transitions);
            if (Boolean.valueOf(stateElement.getAttribute("isStartState")) == Boolean.TRUE)
               startState = s;
         }
      }
     
      // Resolve all transition targets
      Iterator transitions = nameToTransitionsMap.keySet().iterator();
      StringBuffer resolveFailed = new StringBuffer();
      while (transitions.hasNext())
      {
         String stateName = (String)transitions.next();
         State s = (State)nameToStateMap.get(stateName);
         HashMap stateTransitions = (HashMap)nameToTransitionsMap.get(stateName);
         Iterator it = stateTransitions.keySet().iterator();
         while (it.hasNext())
         {
            String name = (String)it.next();
            String targetName = (String)stateTransitions.get(name);
            State target = (State)nameToStateMap.get(targetName);
            if (target == null)
            {
               String msg = "Failed to resolve target state: " + targetName + " for transition: " + name;
               resolveFailed.append(msg);
               log.debug(msg);
View Full Code Here

   public boolean inService()
      throws PolicyContextException
   {
      validateState("inService");
      State state = configStateMachine.getCurrentState();
      boolean inService = state.getName().equals("inService");
      return inService;
   }
View Full Code Here

   public boolean inService()
      throws PolicyContextException
   {
      validateState("inService");
      State state = configStateMachine.getCurrentState();
      boolean inService = state.getName().equals("inService");
      return inService;
   }
View Full Code Here

      for (int i = 0; i < script.length; i++)
      {
         getLog().debug("Current State: " + sm.getCurrentState().getName() + ", Action: " + script[i]);
         try
         {
            State stateAfter = sm.nextState(script[i]);
         }
         catch (IllegalTransitionException e)
         {
            if (exceptionExpected)
            {
View Full Code Here

   public boolean inService()
      throws PolicyContextException
   {
      validateState("inService");
      State state = configStateMachine.getCurrentState();
      boolean inService = state.getName().equals("inService");
      return inService;
   }
View Full Code Here

      String description = root.getAttribute("description");
      HashMap nameToStateMap = new HashMap();
      HashMap nameToTransitionsMap = new HashMap();
      HashSet states = new HashSet();
      State startState = null;

      // parse states
      NodeList stateList = root.getChildNodes();
      for (int i = 0; i < stateList.getLength(); i++)
      {
         Node stateNode = stateList.item(i);
         if (stateNode.getNodeName().equals("state"))
         {
            Element stateElement = (Element)stateNode;
            String stateName = stateElement.getAttribute("name");
            State s = new State(stateName);
            states.add(s);
            nameToStateMap.put(stateName, s);
            HashMap transitions = new HashMap();
           
            // parse transitions
            NodeList transitionList = stateElement.getChildNodes();
            for (int j = 0; j < transitionList.getLength(); j++)
            {
               Node transitionNode = transitionList.item(j);
               if (transitionNode.getNodeName().equals("transition"))
               {
                  Element transitionElement = (Element)transitionNode;
                  String name = transitionElement.getAttribute("name");
                  String targetName = transitionElement.getAttribute("target");
                  transitions.put(name, targetName);
               }
            }
            nameToTransitionsMap.put(stateName, transitions);
            if (Boolean.valueOf(stateElement.getAttribute("isStartState")) == Boolean.TRUE)
               startState = s;
         }
      }
     
      // Resolve all transition targets
      Iterator transitions = nameToTransitionsMap.keySet().iterator();
      StringBuffer resolveFailed = new StringBuffer();
      while (transitions.hasNext())
      {
         String stateName = (String)transitions.next();
         State s = (State)nameToStateMap.get(stateName);
         HashMap stateTransitions = (HashMap)nameToTransitionsMap.get(stateName);
         Iterator it = stateTransitions.keySet().iterator();
         while (it.hasNext())
         {
            String name = (String)it.next();
            String targetName = (String)stateTransitions.get(name);
            State target = (State)nameToStateMap.get(targetName);
            if (target == null)
            {
               String msg = "Failed to resolve target state: " + targetName + " for transition: " + name;
               resolveFailed.append(msg);
               log.debug(msg);
View Full Code Here

      String description = root.attributeValue("description");
      Iterator i = root.elementIterator();
      HashMap nameToStateMap = new HashMap();
      HashMap nameToTransitionsMap = new HashMap();
      HashSet states = new HashSet();
      State startState = null;
      while( i.hasNext() )
      {
         Element stateElement = (Element) i.next();
         String stateName = stateElement.attributeValue("name");
         State s = new State(stateName);
         states.add(s);
         nameToStateMap.put(stateName, s);
         HashMap transitions = new HashMap();
         Iterator it = stateElement.elementIterator();
         while( it.hasNext() )
         {
            Element transElement = (Element) it.next();
            String name = transElement.attributeValue("name");
            String targetName = transElement.attributeValue("target");
            transitions.put(name, targetName);
         }
         nameToTransitionsMap.put(stateName, transitions);
         if( Boolean.valueOf(stateElement.attributeValue("isStartState")) == Boolean.TRUE )
            startState = s;
      }

      // Resolve all transition targets
      Iterator transitions = nameToTransitionsMap.keySet().iterator();
      StringBuffer resolveFailed = new StringBuffer();
      while( transitions.hasNext() )
      {
         String stateName = (String) transitions.next();
         State s = (State) nameToStateMap.get(stateName);
         HashMap stateTransitions = (HashMap) nameToTransitionsMap.get(stateName);
         Iterator it = stateTransitions.keySet().iterator();
         while( it.hasNext() )
         {
            String name = (String) it.next();
            String targetName = (String) stateTransitions.get(name);
            State target = (State) nameToStateMap.get(targetName);
            if( target == null )
            {
               String msg = "Failed to resolve target state: "+targetName+" for transition: "+name;
               resolveFailed.append(msg);
               log.debug(msg);
View Full Code Here

   public boolean inService()
      throws PolicyContextException
   {
      validateState("inService");
      State state = configStateMachine.getCurrentState();
      boolean inService = state.getName().equals("inService");
      return inService;
   }
View Full Code Here

/*     */
/*     */   public boolean inService()
/*     */     throws PolicyContextException
/*     */   {
/* 164 */     validateState("inService");
/* 165 */     State state = this.configStateMachine.getCurrentState();
/* 166 */     boolean inService = state.getName().equals("inService");
/* 167 */     return inService;
/*     */   }
View Full Code Here

TOP

Related Classes of org.jboss.util.state.State

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.