Package org.cybergarage.xml

Examples of org.cybergarage.xml.Node


* @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


      return "";
    }       
  }
 
  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);

    devUPnP.setDeviceType(extractDeviceType(sr));
    devUPnP.setFriendlyName((String) sr.getProperty(UPnPDevice.FRIENDLY_NAME));
    devUPnP.setManufacture((String) sr.getProperty(UPnPDevice.MANUFACTURER));
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.setDeviceType(extractDeviceType(sr));
    devUPnP.setFriendlyName((String) sr.getProperty(UPnPDevice.FRIENDLY_NAME));
View Full Code Here

   
   
  }

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

  // //////////////////////////////////////////////
  // NMPR
  // //////////////////////////////////////////////

  public void setNMPRMode(boolean flag) {
    Node devNode = getDeviceNode();
    if (devNode == null)
      return;
    if (flag == true) {
      devNode.setNode(UPnP.INMPR03, UPnP.INMPR03_VERSION);
      devNode.removeNode(Device.URLBASE_NAME);
    } else {
      devNode.removeNode(UPnP.INMPR03);
    }
  }
View Full Code Here

      devNode.removeNode(UPnP.INMPR03);
    }
  }

  public boolean isNMPRMode() {
    Node devNode = getDeviceNode();
    if (devNode == null)
      return false;
    return (devNode.getNode(UPnP.INMPR03) != null) ? true : false;
  }
View Full Code Here

      service.updateConfigId();
      configId += service.getConfigId();
      configId &= UPnP.CONFIGID_UPNP_ORG_MAX;
    }

    Node devNode = getDeviceNode();
    if (devNode == null)
      return;

    String devDescXml = devNode.toString();
    configId += UPnP.caluculateConfigId(devDescXml);
    configId &= UPnP.CONFIGID_UPNP_ORG_MAX;
    devNode.setAttribute(CONFIG_ID, configId);
  }
View Full Code Here

  public void updateConfigId() {
    updateConfigId(this);
  }

  public int getConfigId() {
    Node devNode = getDeviceNode();
    if (devNode == null)
      return 0;
    return devNode.getAttributeIntegerValue(CONFIG_ID);
  }
View Full Code Here

  // //////////////////////////////////////////////
  // Root Device
  // //////////////////////////////////////////////

  public Device getRootDevice() {
    Node rootNode = getRootNode();
    if (rootNode == null)
      return null;
    Node devNode = rootNode.getNode(Device.ELEM_NAME);
    if (devNode == null)
      return null;
    return new Device(rootNode, devNode);
  }
View Full Code Here

   * @author Stefano "Kismet" Lenzi
   */
  public Device getParentDevice() {
    if (isRootDevice())
      return null;
    Node devNode = getDeviceNode();
    Node aux = null;
    // <device><deviceList><device>
    aux = devNode.getParentNode().getParentNode();
    return new Device(aux);
  }
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.