Package org.jboss.util.state

Examples of org.jboss.util.state.State


/*     */
/*  87 */     String description = root.getAttribute("description");
/*  88 */     HashMap nameToStateMap = new HashMap();
/*  89 */     HashMap nameToTransitionsMap = new HashMap();
/*  90 */     HashSet states = new HashSet();
/*  91 */     State startState = null;
/*     */
/*  94 */     NodeList stateList = root.getChildNodes();
/*  95 */     for (int i = 0; i < stateList.getLength(); i++)
/*     */     {
/*  97 */       Node stateNode = stateList.item(i);
/*  98 */       if (!stateNode.getNodeName().equals("state"))
/*     */         continue;
/* 100 */       Element stateElement = (Element)stateNode;
/* 101 */       String stateName = stateElement.getAttribute("name");
/* 102 */       State s = new State(stateName);
/* 103 */       states.add(s);
/* 104 */       nameToStateMap.put(stateName, s);
/* 105 */       HashMap transitions = new HashMap();
/*     */
/* 108 */       NodeList transitionList = stateElement.getChildNodes();
/* 109 */       for (int j = 0; j < transitionList.getLength(); j++)
/*     */       {
/* 111 */         Node transitionNode = transitionList.item(j);
/* 112 */         if (!transitionNode.getNodeName().equals("transition"))
/*     */           continue;
/* 114 */         Element transitionElement = (Element)transitionNode;
/* 115 */         String name = transitionElement.getAttribute("name");
/* 116 */         String targetName = transitionElement.getAttribute("target");
/* 117 */         transitions.put(name, targetName);
/*     */       }
/*     */
/* 120 */       nameToTransitionsMap.put(stateName, transitions);
/* 121 */       if (Boolean.valueOf(stateElement.getAttribute("isStartState")) == Boolean.TRUE) {
/* 122 */         startState = s;
/*     */       }
/*     */
/*     */     }
/*     */
/* 127 */     Iterator transitions = nameToTransitionsMap.keySet().iterator();
/* 128 */     StringBuffer resolveFailed = new StringBuffer();
/* 129 */     while (transitions.hasNext())
/*     */     {
/* 131 */       String stateName = (String)transitions.next();
/* 132 */       State s = (State)nameToStateMap.get(stateName);
/* 133 */       HashMap stateTransitions = (HashMap)nameToTransitionsMap.get(stateName);
/* 134 */       Iterator it = stateTransitions.keySet().iterator();
/* 135 */       while (it.hasNext())
/*     */       {
/* 137 */         String name = (String)it.next();
/* 138 */         String targetName = (String)stateTransitions.get(name);
/* 139 */         State target = (State)nameToStateMap.get(targetName);
/* 140 */         if (target == null)
/*     */         {
/* 142 */           String msg = "Failed to resolve target state: " + targetName + " for transition: " + name;
/* 143 */           resolveFailed.append(msg);
/* 144 */           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

      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

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.