net.sbbi.upnp.devices
Class UPNPRootDevice

java.lang.Object
  extended bynet.sbbi.upnp.devices.UPNPDevice
      extended bynet.sbbi.upnp.devices.UPNPRootDevice

public class UPNPRootDevice
extends UPNPDevice

Root UPNP device that is contained in a device definition file. Slightly differs from a simple UPNPDevice object. This object will contains all the child devices, this is the top objet in the UPNP device devices hierarchy.

Version:
1.0
Author:
SuperBonBon

Constructor Summary
UPNPRootDevice(java.net.URL deviceDefLoc, java.lang.String maxAge)
          Constructor for the root device, constructs itself from An xml device definition file provided by the UPNP device via http normally.
UPNPRootDevice(java.net.URL deviceDefLoc, java.lang.String maxAge, java.lang.String vendorFirmware)
          Constructor for the root device, constructs itself from An xml device definition file provided by the UPNP device via http normally.
UPNPRootDevice(java.net.URL deviceDefLoc, java.lang.String maxAge, java.lang.String vendorFirmware, java.lang.String discoveryUSN, java.lang.String discoveryUDN)
          Constructor for the root device, constructs itself from An xml device definition file provided by the UPNP device via http normally.
 
Method Summary
 java.net.URL getDeviceDefLoc()
          Retreives the device description file location
 java.lang.String getDeviceDefLocData()
          Retrieves the device definition XML data
 java.lang.String getDiscoveryUDN()
           
 java.lang.String getDiscoveryUSN()
           
 int getSpecVersionMajor()
           
 int getSpecVersionMinor()
           
 org.apache.commons.jxpath.Container getUPNPDevice()
          Used for JXPath parsing, do not use this method
static java.net.URL getURL(java.lang.String url, java.net.URL baseURL)
          Parsing an URL from the descriptionXML file
 java.net.URL getURLBase()
          URL base acces
 long getValidityTime()
          The validity time for this device in milliseconds,
 java.lang.String getVendorFirmware()
           
 void resetValidityTime(java.lang.String newMaxAge)
          Resets the device validity time
 
Methods inherited from class net.sbbi.upnp.devices.UPNPDevice
getChildDevice, getChildDevices, getDeviceIcons, getDeviceType, getDirectParent, getFriendlyName, getManufacturer, getManufacturerURL, getModelDescription, getModelName, getModelNumber, getModelURL, getPresentationURL, getSerialNumber, getService, getServiceByID, getServices, getServices, getTopLevelChildDevices, getUDN, getUPC, getUSN, isRootDevice, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UPNPRootDevice

public UPNPRootDevice(java.net.URL deviceDefLoc,
                      java.lang.String maxAge,
                      java.lang.String vendorFirmware,
                      java.lang.String discoveryUSN,
                      java.lang.String discoveryUDN)
               throws java.net.MalformedURLException,
                      java.lang.IllegalStateException
Constructor for the root device, constructs itself from An xml device definition file provided by the UPNP device via http normally.

Parameters:
deviceDefLoc - the location of the XML device definition file using "the urn:schemas-upnp-org:device-1-0" namespace
maxAge - the maximum age of this UPNP device in secs before considered to be outdated
vendorFirmware - the vendor firmware
discoveryUSN - the discovery USN used to find and create this device
discoveryUDN - the discovery UDN used to find and create this device
Throws:
java.net.MalformedURLException - if the location URL is invalid and cannot be used to populate this root object and its child devices IllegalStateException if the device has an unsupported version, currently only version 1.0 is supported
java.lang.IllegalStateException

UPNPRootDevice

public UPNPRootDevice(java.net.URL deviceDefLoc,
                      java.lang.String maxAge,
                      java.lang.String vendorFirmware)
               throws java.net.MalformedURLException,
                      java.lang.IllegalStateException
Constructor for the root device, constructs itself from An xml device definition file provided by the UPNP device via http normally.

Parameters:
deviceDefLoc - the location of the XML device definition file using "the urn:schemas-upnp-org:device-1-0" namespace
maxAge - the maximum age of this UPNP device in secs before considered to be outdated
vendorFirmware - the vendor firmware
Throws:
java.net.MalformedURLException - if the location URL is invalid and cannot be used to populate this root object and its child devices IllegalStateException if the device has an unsupported version, currently only version 1.0 is supported
java.lang.IllegalStateException

UPNPRootDevice

public UPNPRootDevice(java.net.URL deviceDefLoc,
                      java.lang.String maxAge)
               throws java.net.MalformedURLException,
                      java.lang.IllegalStateException
Constructor for the root device, constructs itself from An xml device definition file provided by the UPNP device via http normally.

Parameters:
deviceDefLoc - the location of the XML device definition file using "the urn:schemas-upnp-org:device-1-0" namespace
maxAge - the maximum age in secs of this UPNP device before considered to be outdated
Throws:
java.net.MalformedURLException - if the location URL is invalid and cannot be used to populate this root object and its child devices IllegalStateException if the device has an unsupported version, currently only version 1.0 is supported
java.lang.IllegalStateException
Method Detail

getValidityTime

public long getValidityTime()
The validity time for this device in milliseconds,

Returns:
the number of milliseconds remaining before the device object that has been build is considered to be outdated, after this delay the UPNP device should resend an advertisement message or a negative value if the device is outdated

resetValidityTime

public void resetValidityTime(java.lang.String newMaxAge)
Resets the device validity time

Parameters:
newMaxAge - the maximum age in secs of this UPNP device before considered to be outdated

getDeviceDefLoc

public java.net.URL getDeviceDefLoc()
Retreives the device description file location

Returns:
an URL

getSpecVersionMajor

public int getSpecVersionMajor()

getSpecVersionMinor

public int getSpecVersionMinor()

getVendorFirmware

public java.lang.String getVendorFirmware()

getDiscoveryUSN

public java.lang.String getDiscoveryUSN()

getDiscoveryUDN

public java.lang.String getDiscoveryUDN()

getURLBase

public java.net.URL getURLBase()
URL base acces

Returns:
URL the URL base, or null if the device does not provide such information

getURL

public static final java.net.URL getURL(java.lang.String url,
                                        java.net.URL baseURL)
                                 throws java.net.MalformedURLException
Parsing an URL from the descriptionXML file

Parameters:
url - the string representation fo the URL
baseURL - the base device URL, needed if the url param is relative
Returns:
an URL object defining the url param
Throws:
java.net.MalformedURLException - if the url param or baseURL.toExternalForm() + url cannot be parsed to create an URL object

getDeviceDefLocData

public java.lang.String getDeviceDefLocData()
Retrieves the device definition XML data

Returns:
the device definition XML data as a String

getUPNPDevice

public org.apache.commons.jxpath.Container getUPNPDevice()
Used for JXPath parsing, do not use this method

Returns:
a Container object for Xpath parsing capabilities


Copyright © 2005 SuperBonBon Industries. All Rights Reserved.