java.lang.Object
org.cybergarage.upnp.xml.NodeData
org.cybergarage.upnp.xml.DeviceData

public class DeviceDataextends NodeData
Data container for UPnP device information and metadata.

This class extends NodeData to represent device definitions from UPnP device descriptions. It encapsulates metadata about devices including description files, locations, and advertisement settings.

Key features:

  • Device description file management
  • Multiple location support (I2P enhancement)
  • Advertisement configuration
  • XML node data inheritance
  • Device metadata handling

This class is used by UPnP devices to manage their description data and configuration, enabling proper device advertisement and service discovery functionality.

  • Field Details

    • descriptionURI

      private String descriptionURI
      /////////////////////////////////////////////
    • descriptionFile

      private File descriptionFile
      The device description file.
    • location

      private String location
      /////////////////////////////////////////////
    • location_ipv6

      private String location_ipv6
      The IPv6 location url of the device.
    • leaseTime

      private int leaseTime
      /////////////////////////////////////////////
    • httpServerList

      private HTTPServerList httpServerList
      /////////////////////////////////////////////
    • httpBinds

      private InetAddress[] httpBinds
      The addresses the http server binds to.
    • httpPort

      private int httpPort
      /////////////////////////////////////////////
    • controlActionListenerList

      private ListenerList controlActionListenerList
      /////////////////////////////////////////////
    • ssdpSearchSocketList

      private SSDPSearchSocketList ssdpSearchSocketList
      /////////////////////////////////////////////
    • ssdpMulticastIPv4

      private String ssdpMulticastIPv4
      The IPv4 multicast address for SSDP.
    • ssdpMulticastIPv6

      private String ssdpMulticastIPv6
      The IPv6 multicast address for SSDP.
    • ssdpPort

      private int ssdpPort
      The port used for SSDP.
    • ssdpBinds

      private InetAddress[] ssdpBinds
      The addresses SSDP binds to.
    • ssdpPacket

      private SSDPPacket ssdpPacket
      /////////////////////////////////////////////
    • ssdpPacket_ipv6

      private SSDPPacket ssdpPacket_ipv6
      The IPv6 SSDP packet received.
    • advertiser

      private Advertiser advertiser
      /////////////////////////////////////////////
  • Constructor Details

    • DeviceData

      public DeviceData()
      Creates an empty device data holder.
  • Method Details

    • getDescriptionFile

      public File getDescriptionFile()
      Fetches the file this description was parsed from.
      Returns:
      the local file backing the description, or null if this device was not registered from a file
    • getDescriptionURI

      public String getDescriptionURI()
      Fetches the URL this description was fetched from.
      Returns:
      the URL the description was fetched from, or null if it was parsed from a file
    • setDescriptionFile

      public void setDescriptionFile(File descriptionFile)
      Records the file this description was parsed from.
      Parameters:
      descriptionFile - the local file this description was parsed from, or null when it was fetched over the network
    • setDescriptionURI

      public void setDescriptionURI(String descriptionURI)
      Records the URL this description was fetched from.
      Parameters:
      descriptionURI - the URL this description was fetched from, or null when it was parsed from a file
    • getLocation

      public String getLocation()
      Fetches the control URL this device advertises.
      Returns:
      the control URL of this device, preferring the IPv4 form
    • getLocation

      public String getLocation(boolean preferIPv6)
      I2P for multiple location support.
      Parameters:
      preferIPv6 - whether to prefer IPv6 address
      Returns:
      the location string
    • setLocation

      public void setLocation(String location)
      Records the control URL, filing a bracketed host as the IPv6 location.
      Parameters:
      location - the control URL to advertise; a host in brackets is filed as the IPv6 location, and a malformed URL is rejected with a warning
    • getLeaseTime

      public int getLeaseTime()
      Fetches the advertised lease duration in seconds.
      Returns:
      the advertised lease duration in seconds
    • setLeaseTime

      public void setLeaseTime(int val)
      Records the lease duration advertised in seconds.
      Parameters:
      val - the advertised lease duration in seconds
    • getHTTPServerList

      public HTTPServerList getHTTPServerList()
      Fetches the HTTP server list, building it on first use.
      Returns:
      the HTTP server list, lazily created on first use from the bind addresses and port
    • setHTTPBindAddress

      public void setHTTPBindAddress(InetAddress[] inets)
      Records which addresses the embedded HTTP server binds to.
      Parameters:
      inets - the addresses the embedded HTTP server binds to, or null for the default behaviour
    • getHTTPBindAddress

      public InetAddress[] getHTTPBindAddress()
      Fetches the addresses the embedded HTTP server binds to.
      Returns:
      the addresses the embedded HTTP server binds to, or null when the default behaviour applies
    • getHTTPPort

      public int getHTTPPort()
      Fetches the port the embedded HTTP server listens on.
      Returns:
      the port the embedded HTTP server listens on
    • setHTTPPort

      public void setHTTPPort(int port)
      Records the port the embedded HTTP server should listen on.
      Parameters:
      port - the port the embedded HTTP server should listen on
    • getControlActionListenerList

      public ListenerList getControlActionListenerList()
      Fetches the listeners notified when a control action arrives.
      Returns:
      the list notified when a control action message arrives
    • getSSDPSearchSocketList

      public SSDPSearchSocketList getSSDPSearchSocketList()
      Fetches the SSDP search sockets, building them on first use.
      Returns:
      the SSDP search socket list, lazily created on first use from the bind addresses, port and multicast addresses
    • setSSDPPort

      public void setSSDPPort(int port)
      Sets the SSDP port for binding.
      Parameters:
      port - The port to use for binding the SSDP service. The port will be used as source port for all SSDP messages
    • getSSDPPort

      public int getSSDPPort()
      Returns the SSDP port used for binding.
      Returns:
      The port used for binding the SSDP service. The port will be used as source port for all SSDP messages
    • setSSDPBindAddress

      public void setSSDPBindAddress(InetAddress[] inets)
      Sets the SSDP bind addresses.
      Parameters:
      inets - The InetAddress that will be bound for listing this service. Use null for the default behavior.
      See Also:
    • getSSDPBindAddress

      public InetAddress[] getSSDPBindAddress()
      Returns the SSDP bind addresses.
      Returns:
      The InetAddress that will be bound for this service null means that default behavior will be used
    • setMulticastIPv4Address

      public void setMulticastIPv4Address(String ip)
      Sets the IPv4 multicast address.
      Parameters:
      ip - The IPv4 address used as destination address for Multicast communication
    • getMulticastIPv4Address

      public String getMulticastIPv4Address()
      Returns the IPv4 multicast address.
      Returns:
      The IPv4 address used for Multicast communication
    • setMulticastIPv6Address

      public void setMulticastIPv6Address(String ip)
      Sets the IPv6 multicast address.
      Parameters:
      ip - The IPv6 address used as destination address for Multicast communication
    • getMulticastIPv6Address

      public String getMulticastIPv6Address()
      Returns the IPv6 multicast address.
      Returns:
      The IPv6 address used as destination address for Multicast communication
    • getSSDPPacket

      public SSDPPacket getSSDPPacket()
      Fetches the packet advertising this device.
      Returns:
      the packet describing this device, preferring the IPv4 form
    • getSSDPPacket

      public SSDPPacket getSSDPPacket(boolean preferIPv6)
      I2P for multiple location support.
      Parameters:
      preferIPv6 - whether to prefer IPv6 address
      Returns:
      the SSDP packet
    • setSSDPPacket

      public void setSSDPPacket(SSDPPacket packet)
      Records the advertisement packet, filing a bracketed host as the IPv6 one.
      Parameters:
      packet - the packet to advertise; a bracketed host in its location is filed as the IPv6 packet, and a malformed URL is rejected with a warning
    • setAdvertiser

      public void setAdvertiser(Advertiser adv)
      Records the advertiser that schedules this device's announcements.
      Parameters:
      adv - the advertiser to schedule this device's SSDP announcements with
    • getAdvertiser

      public Advertiser getAdvertiser()
      Fetches the advertiser scheduling this device's announcements.
      Returns:
      the advertiser scheduling this device's SSDP announcements, or null when none has been set