Package org.cybergarage.xml

Examples of org.cybergarage.xml.Node


    return null;
  }

  public byte[] getSCPDData()
  {
    Node scpdNode = getSCPDNode();
    if (scpdNode == null)
      return new byte[0];
    // Thanks for Mikael Hakman (04/25/05)
    String desc = new String();
    desc += UPnP.XML_DECLARATION;
    desc += "\n";
    desc += scpdNode.toString();
    return desc.getBytes();
  }
View Full Code Here


  ////////////////////////////////////////////////

  public ActionList getActionList()
  {
    ActionList actionList = new ActionList();
    Node scdpNode = getSCPDNode();
    if (scdpNode == null)
      return actionList;
    Node actionListNode = scdpNode.getNode(ActionList.ELEM_NAME);
    if (actionListNode == null)
      return actionList;
    int nNode = actionListNode.getNNodes();
    for (int n=0; n<nNode; n++) {
      Node node = actionListNode.getNode(n);
      if (Action.isActionNode(node) == false)
        continue;
      Action action = new Action(serviceNode, node);
      actionList.add(action);
    }
View Full Code Here

    while (i.hasNext()) {
      Argument arg = (Argument) i.next();
      arg.setService(this);
    }

    Node scdpNode = getSCPDNode();
    Node actionListNode = scdpNode.getNode(ActionList.ELEM_NAME);
    if (actionListNode == null){     
      actionListNode = new Node(ActionList.ELEM_NAME);
      scdpNode.addNode(actionListNode);
    }
    actionListNode.addNode(a.getActionNode());
  }
View Full Code Here

  ////////////////////////////////////////////////

  public ServiceStateTable getServiceStateTable()
  {
    ServiceStateTable stateTable = new ServiceStateTable();
    Node stateTableNode = getSCPDNode().getNode(ServiceStateTable.ELEM_NAME);
    if (stateTableNode == null)
      return stateTable;
    Node serviceNode = getServiceNode();
    int nNode = stateTableNode.getNNodes();
    for (int n=0; n<nNode; n++) {
      Node node = stateTableNode.getNode(n);
      if (StateVariable.isStateVariableNode(node) == false)
        continue;
      StateVariable serviceVar = new StateVariable(serviceNode, node);
      stateTable.add(serviceVar);
    }
View Full Code Here

  //  UserData
  ////////////////////////////////////////////////

  private ServiceData getServiceData()
  {
    Node node = getServiceNode();
    ServiceData userData = (ServiceData)node.getUserData();
    if (userData == null) {
      userData = new ServiceData();
      node.setUserData(userData);
      userData.setNode(node);
    }
    return userData;
  }
View Full Code Here

   *
   * @author Stefano "Kismet" Lenzi - kismet-sl@users.sourceforge.net  - 2005
   */
  public void addStateVariable(StateVariable var) {
    //TODO Some test are done not stable
    Node stateTableNode = getSCPDNode().getNode(ServiceStateTable.ELEM_NAME);
    if (stateTableNode == null){
      stateTableNode = new Node(ServiceStateTable.ELEM_NAME);
      /*
       * Force the node <serviceStateTable> to be the first node inside <scpd>
       */
      //getSCPDNode().insertNode(stateTableNode,0);
      getSCPDNode().addNode(stateTableNode);   
    }
    var.setServiceNode(getServiceNode());
    stateTableNode.addNode(var.getStateVariableNode());
  }
 
View Full Code Here

* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
public class BuildDevice {
 
  private static Node buildRootNode(){
    Node root = new Node(RootDescription.ROOT_ELEMENT);
    root.setAttribute("xmlns",RootDescription.ROOT_ELEMENT_NAMESPACE);
    Node spec = new Node(RootDescription.SPECVERSION_ELEMENT);
    Node maj =new Node(RootDescription.MAJOR_ELEMENT);
    maj.setValue("1");
    Node min =new Node(RootDescription.MINOR_ELEMENT);
    min.setValue("0");
    spec.addNode(maj);
    spec.addNode(min);
    root.addNode(spec);
    return root;
  }
View Full Code Here

    root.addNode(spec);
    return root;
  }
 
  private static Device buildRootDeviceNode(Node root,ServiceReference sr){   
    Node dev = new Node(Device.ELEM_NAME);
    root.addNode(dev);
    DeviceData dd = new DeviceData();
    dd.setDescriptionURI("/gen-desc.xml");
    dev.setUserData(dd);
    Device devUPnP = new Device(root,dev);


    Object aux = sr.getProperty(UPnPDevice.TYPE);
    if(aux==null){
View Full Code Here

      } catch (InvalidSyntaxException ignored) {}           
    }   
  }

  private static void buildDevice(String id,Device parent, ServiceReference sr) {
    Node dev = new Node(Device.ELEM_NAME);
    DeviceData dd = new DeviceData();
    dd.setDescriptionURI(id+"/gen-desc.xml");
    dev.setUserData(dd);
   
    Device devUPnP = new Device(dev);
   
    devUPnP.setFriendlyName((String) sr.getProperty(UPnPDevice.FRIENDLY_NAME));
    devUPnP.setManufacture((String) sr.getProperty(UPnPDevice.MANUFACTURER));
View Full Code Here

   
   
  }

  public static Device createCyberLinkDevice(ServiceReference sr){
    Node root = buildRootNode();
    Device devUPnP = buildRootDeviceNode(root,sr);
    return devUPnP;
  }
View Full Code Here

TOP

Related Classes of org.cybergarage.xml.Node

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.