Examples of XmlPullNode


Examples of org.gjt.xpp.XmlPullNode

    try {
      XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
      XmlPullParser pp = factory.newPullParser();
      pp.setInput(new StringReader(xmlState));
      pp.next();
      XmlPullNode stateTree = factory.newPullNode(pp);

      while(true) {
  // get the next child and check if we are done
  XmlPullNode nextChild = (XmlPullNode) stateTree.readNextChild();
  if (nextChild == null)
    break;

  // check the type of the child node, and act appropriately
  if (nextChild.getLocalName().equals("servicesInfo")) {
    // set the state of the services object
    ((MobileServices) services).setState(XmlUtil.xmlNode2String(nextChild));
  } else if (nextChild.getLocalName().equals("localState")) {
    // set the state of the component and ports
    Object localState = nextChild.readNextChild();
    if (localState != null) {
      StringWriter sw = new StringWriter();
      Util.readXMLEscapedString(sw, (String) localState);
      ((MobileServices) services).getComponent().
        setComponentState(services, sw.toString());
    } else {
      ((MobileServices) services).getComponent().
        setComponentState(services, null);
    }
  } else if (nextChild.getLocalName().equals("serviceData")) {
    // set the state of the Service Data
    ServiceDataManagerInterface sdm = getServiceDataManager();
    ServiceDataElementFactory sdeFactory = ServiceDataElementFactory.getDefault();
    while (true) {
      XmlPullNode sdeNode = (XmlPullNode) nextChild.readNextChild();
      if (sdeNode == null)
        break;
      // get the value of SDE as a String
      String sdeString = (String) sdeNode.readNextChild();

      // create an SDE from the current entry
      StringWriter sw = new StringWriter();
      Util.readXMLEscapedString(sw, sdeString);
      ServiceDataElement nextSDE =
View Full Code Here

Examples of org.gjt.xpp.XmlPullNode

    try {
      XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
      XmlPullParser pp = factory.newPullParser();
      pp.setInput(new StringReader(sInfo));
      pp.next();
      XmlPullNode stateTree = factory.newPullNode(pp);

      while(true) {
  // get the next child and check if we are done
  XmlPullNode nextChild = (XmlPullNode) stateTree.readNextChild();
  if (nextChild == null)
    break;

  // check the type of the child node, and act appropriately
  if (nextChild.getLocalName().equals("componentIDInfo")) {
    // ignore, because this information has already been set
  } else if (nextChild.getLocalName().equals("properties")) {
    // set the compProperties TypeMap from XML
    setPropertiesFromXML(nextChild, compProperties);
  } else if (nextChild.getLocalName().equals("usesPortMap")) {
      // add an entry for every uses port
    while (true) {
      // get the next entry
      XmlPullNode entryNode = (XmlPullNode) nextChild.readNextChild();
      if (entryNode == null)
        break;
     
      // parse every <usesPortEntry/>
      while (true) {
        // get the next child for the usesPortEntry
        XmlPullNode entryChild = (XmlPullNode) entryNode.readNextChild();
        if (entryChild == null)
    break;

        // initialize values
        String portName = null;
        String portType = null;
        TypeMap tMap = createTypeMap();
        boolean inUse = false;
        XCATConnectionID connID = null;
        boolean unregistered = false;
        int migrationStatus = 0;

        if (entryChild.getLocalName().equals("portName")) {
    // get the portName
    portName = (String) entryChild.readNextChild();
        } else { // is a <usesPortRecord/>
    // read all the values for the UsesPortInfo object
    while (true) {
      XmlPullNode nextItem = (XmlPullNode) entryChild.readNextChild();
      if (nextItem == null)
        break;
     
      if (nextItem.getLocalName().equals("portName")) {
        portName = (String) nextItem.readNextChild();
      } else if (nextItem.getLocalName().equals("portType")) {
        portType = (String) nextItem.readNextChild();
      } else if (nextItem.getLocalName().equals("properties")) {
        setPropertiesFromXML(nextItem, tMap);
      } else if (nextItem.getLocalName().equals("inUse")) {
        inUse = Boolean.valueOf((String) nextItem.readNextChild()).booleanValue();
      } else if (nextItem.getLocalName().equals("connectionID")) {
        connID = xmlToConnectionID(nextItem);
      } else if (nextItem.getLocalName().equals("unregistered")) {
        unregistered =
          Boolean.valueOf((String) nextItem.readNextChild()).booleanValue();
      } else { // (nextItem.getLocalName().equals("migrationStatus"))
        migrationStatus = Integer.parseInt((String) nextItem.readNextChild());
      }
    }

    // create a UsesPortInfo entry
    UsesPortInfo uInfo = new UsesPortInfo(portName,
                  portType,
                  tMap);
    uInfo.setInUse(inUse);
    if (unregistered)
      uInfo.unregisterPort();
    uInfo.setMigrationStatus(migrationStatus);
    if (connID != null)
      uInfo.setConnectionID(connID);

    // add this uses port to the HashMap
    usesPortMap.put(portName, uInfo);
        }
      }
    }
  } else if (nextChild.getLocalName().equals("wsPortMap")) {
      // add an entry for every WS port
    while (true) {
      // get the next entry
      XmlPullNode entryNode = (XmlPullNode) nextChild.readNextChild();
      if (entryNode == null)
        break;
     
      // parse every <wsPortEntry/>
      while (true) {
        // get the next child for the wsPortEntry
        XmlPullNode entryChild = (XmlPullNode) entryNode.readNextChild();
        if (entryChild == null)
    break;

        // initialize values
        String portName = null;
        String portType = null;
        TypeMap tMap = createTypeMap();
        boolean inUse = false;
        boolean unregistered = false;
        String endPointLocation = null;

        if (entryChild.getLocalName().equals("portName")) {
    // get the portName
    portName = (String) entryChild.readNextChild();
        } else { // is a <wsPortRecord/>
    // read all the values for the WSPortInfo object
    while (true) {
      XmlPullNode nextItem = (XmlPullNode) entryChild.readNextChild();
      if (nextItem == null)
        break;
     
      if (nextItem.getLocalName().equals("portName")) {
        portName = (String) nextItem.readNextChild();
      } else if (nextItem.getLocalName().equals("portType")) {
        portType = (String) nextItem.readNextChild();
      } else if (nextItem.getLocalName().equals("properties")) {
        setPropertiesFromXML(nextItem, tMap);
      } else if (nextItem.getLocalName().equals("inUse")) {
        inUse = Boolean.valueOf((String) nextItem.readNextChild()).booleanValue();
      } else if (nextItem.getLocalName().equals("endPointLocation")) {
        endPointLocation = (String) nextItem.readNextChild();
      } else { // if (nextItem.getLocalName().equals("unregistered")) {
        unregistered =
          Boolean.valueOf((String) nextItem.readNextChild()).booleanValue();
      }
    }
   
    // create a WSPortInfo entry
    WSPortInfo wInfo = new WSPortInfo(portName,
              portType,
              tMap);
    wInfo.setInUse(inUse);
    if (unregistered)
      wInfo.unregisterPort();
    if (endPointLocation != null)
      wInfo.setEndPointLocation(endPointLocation);

    // add this WS port to the HashMap
    wsPortMap.put(portName, wInfo);
        }
      }
    }
  } else { // (nextChild.getLocalName().equals("providesPortMap"))
    // add an entry for every provides port
    while (true) {
      // get the next entry
      XmlPullNode entryNode = (XmlPullNode) nextChild.readNextChild();
      if (entryNode == null)
        break;
     
      // parse every <providesPortEntry/>
      while (true) {
        // get the next child for the providesPortEntry
        XmlPullNode entryChild = (XmlPullNode) entryNode.readNextChild();
        if (entryChild == null)
    break;
       
        // initialize values
        String portName = null;
        String portType = null;
        TypeMap tMap = createTypeMap();
        boolean inUse = false;
        int numConnections = 0;
        String providesPortHandle = null;
        boolean removed = false;

        if (entryChild.getLocalName().equals("portName")) {
    // get the portName
    portName = (String) entryChild.readNextChild();
        } else { // is a <providesPortRecord/>
    // read all the values for the ProvidesPortInfo object
    while (true) {
      XmlPullNode nextItem = (XmlPullNode) entryChild.readNextChild();
      if (nextItem == null)
        break;
     
      if (nextItem.getLocalName().equals("portName")) {
        portName = (String) nextItem.readNextChild();
      } else if (nextItem.getLocalName().equals("portType")) {
        portType = (String) nextItem.readNextChild();
      } else if (nextItem.getLocalName().equals("properties")) {
        setPropertiesFromXML(nextItem, tMap);
      } else if (nextItem.getLocalName().equals("inUse")) {
        inUse = Boolean.valueOf((String) nextItem.readNextChild()).booleanValue();
      } else if (nextItem.getLocalName().equals("numConnections")) {
        numConnections = Integer.parseInt((String) nextItem.readNextChild());
      } else if (nextItem.getLocalName().equals("providesPortHandle")) {
        providesPortHandle = (String) nextItem.readNextChild();
      } else { // (nextItem.getLocalName().equals("removed"))
        removed = Boolean.valueOf((String) nextItem.readNextChild()).booleanValue();
      }
    }

    // create a ProvidesPortInfo entry
    ProvidesPortInfo pInfo = new ProvidesPortInfo(portName,
View Full Code Here

Examples of org.gjt.xpp.XmlPullNode

  private void setPropertiesFromXML(XmlPullNode propertiesNode,
            TypeMap tMap)
    throws Exception {
    while (true) {
      // read the next <propertiesEntry/>
      XmlPullNode entryNode = (XmlPullNode) propertiesNode.readNextChild();
      if (entryNode == null)
  break;

      String key = null;
      String value = null;
      String type = null;
      // process the entry
      while (true) {
  XmlPullNode nextChild = (XmlPullNode) entryNode.readNextChild();
  if (nextChild == null)
    break;
 
  // get the key, value, and type
  if (nextChild.getLocalName().equals("key")) {
    key = (String) nextChild.readNextChild();
  } else if (nextChild.getLocalName().equals("value")) {
    value = (String) nextChild.readNextChild();
  } else { // (nextChild.getLocalName().equals("type"))
    type = (String) nextChild.readNextChild();
  }
      }
      // add the entry to the typeMap
      TypeUtil.put(tMap, key, value, type);
    }
View Full Code Here

Examples of org.gjt.xpp.XmlPullNode

   * Convert the XML representation to a ConnectionID object
   */
  private XCATConnectionID xmlToConnectionID (XmlPullNode connNode)
    throws Exception {
    while (true) {
      XmlPullNode nextNode = (XmlPullNode) connNode.readNextChild();
      if (nextNode == null)
  break;

      if (nextNode.getLocalName().equals("providerIntfName")) {
  // ignore - for mobile components, this is always MobileComponentID
      } else if (nextNode.getLocalName().equals("userIntfName")) {
  // ignore - for mobile components, this is always MobileComponentID
      } else { // nextNode.getLocalName().equals("connectionIDInfo")
  String providerName = null;
  String providerIDHandle = null;
  String userName = null;
  String userIDHandle = null;
  String providerPortName = null;
  String userPortName = null;
  String providesPortHandle = null;
  while (true) {
    XmlPullNode nextItem = (XmlPullNode) nextNode.readNextChild();
    if (nextItem == null)
      break;

    if (nextItem.getLocalName().equals("providerName")) {
      providerName = (String) nextItem.readNextChild();
    } else if (nextItem.getLocalName().equals("providerIDHandle")) {
      providerIDHandle = (String) nextItem.readNextChild();
    } else if (nextItem.getLocalName().equals("userName")) {
      userName = (String) nextItem.readNextChild();
    } else if (nextItem.getLocalName().equals("userIDHandle")) {
      userIDHandle = (String) nextItem.readNextChild();
    } else if (nextItem.getLocalName().equals("providerPortName")) {
      providerPortName = (String) nextItem.readNextChild();
    } else if (nextItem.getLocalName().equals("userPortName")) {
      userPortName = (String) nextItem.readNextChild();
    } else { // nextItem.getLocalName().equals("providesPortHandle")
      providesPortHandle = (String) nextItem.readNextChild();
    }
  }

  MobileComponentIDClientImpl provider =
    new MobileComponentIDClientImpl(providerName, providerIDHandle);
View Full Code Here

Examples of org.gjt.xpp.XmlPullNode

      // convert the properties object to an XmlPullNode
      XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
      XmlPullParser pp = factory.newPullParser();
      pp.setInput(new StringReader(properties));
      pp.next();
      XmlPullNode propertiesNode = factory.newPullNode(pp);
      while (true) {
  // read the next <propertiesEntry/>
  XmlPullNode entryNode = (XmlPullNode) propertiesNode.readNextChild();
  if (entryNode == null)
    break;
 
  String key = null;
  String value = null;
  String type = null;
  // process the entry
  while (true) {
    XmlPullNode nextChild = (XmlPullNode) entryNode.readNextChild();
    if (nextChild == null)
      break;
   
    // get the key, value, and type
    if (nextChild.getLocalName().equals("key")) {
      key = (String) nextChild.readNextChild();
    } else if (nextChild.getLocalName().equals("value")) {
      value = (String) nextChild.readNextChild();
    } else { // (nextChild.getLocalName().equals("type"))
      type = (String) nextChild.readNextChild();
    }
  }
  // add the entry to the typeMap
  put(tMap, key, value, type);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.