Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.teleal.cling.registry
Class RegistryImpl

    java.lang.Object
      org.teleal.cling.registry.RegistryImpl

All Implemented Interfaces:
  Registry

    public class RegistryImpl

extends Object
implements Registry

Default implementation of `Registry`.

Author:
  Christian Bauer

Field Summary
`protected org.teleal.cling.registry.LocalItems` | `localItems`
`protected List<Runnable>` | `pendingExecutions`
`protected Set<RegistryListener>` | `registryListeners`
`protected RegistryMaintainer` | `registryMaintainer`
`protected org.teleal.cling.registry.RemoteItems` | `remoteItems`
`protected Set<org.teleal.cling.registry.RegistryItem<URI,Resource>>` | `resourceItems`
`protected UpnpService` | `upnpService`

Constructor Summary
`RegistryImpl(UpnpService upnpService)` Starts background maintenance immediately.

Method Summary
`void` | `addDevice(LocalDevice localDevice)` Call this method to add your local device metadata.
`void` | `addDevice(RemoteDevice remoteDevice)` Called internally by the UPnP discovery protocol.
`void` | `addListener(RegistryListener listener)`
`void` | `addLocalSubscription(LocalGENASubscription subscription)` Called internally by the UPnP stack, during GENA protocol execution.
`void` | `addRemoteSubscription(RemoteGENASubscription subscription)` Called internally by the UPnP stack, during GENA protocol execution.
`void` | `addResource(Resource resource)` Stores an arbitrary resource in the registry.
`void` | `addResource(Resource resource, int maxAgeSeconds)` Stores an arbitrary resource in the registry.
`protected RegistryMaintainer` | `createRegistryMaintainer()`
`UpnpServiceConfiguration` | `getConfiguration()`
`Device` | `getDevice(UDN udn, boolean rootOnly)`
`Collection<Device>` | `getDevices()`
`Collection<Device>` | `getDevices(DeviceType deviceType)`
`Collection<Device>` | `getDevices(ServiceType serviceType)`
`Collection<RegistryListener>` | `getListeners()`
`LocalDevice` | `getLocalDevice(UDN udn, boolean rootOnly)`
`Collection<LocalDevice>` | `getLocalDevices()`
`LocalGENASubscription` | `getLocalSubscription(String subscriptionId)` Called internally by the UPnP stack, during GENA protocol execution.
`ProtocolFactory` | `getProtocolFactory()`
`RemoteDevice` | `getRemoteDevice(UDN udn, boolean rootOnly)`
`Collection<RemoteDevice>` | `getRemoteDevices()`
`RemoteGENASubscription` | `getRemoteSubscription(String subscriptionId)` Called internally by the UPnP stack, during GENA protocol execution.
`
`<T extends Resource> T`
` | `getResource(Class<T> resourceType, URI pathQuery)`
`Resource` | `getResource(URI pathQuery)`
`Collection<Resource>` | `getResources()`
`
`<T extends Resource> Collection<T>`
` | `getResources(Class<T> resourceType)`
`Service` | `getService(ServiceReference serviceReference)`
`UpnpService` | `getUpnpService()`
`void` | `notifyDiscoveryFailure(RemoteDevice device, Exception ex)` Called internally by the UPnP stack when the discovery protocol stopped abnormaly.
`boolean` | `notifyDiscoveryStart(RemoteDevice device)` Called internally by the UPnP stack when the discovery protocol starts.
`void` | `printDebugLog()`
`void` | `removeAllLocalDevices()` Clear the registry of all locally registered device metadata.
`void` | `removeAllRemoteDevices()` Clear the registry of all discovered remote device metadata.
`boolean` | `removeDevice(LocalDevice localDevice)` Call this to remove your local device metadata.
`boolean` | `removeDevice(RemoteDevice remoteDevice)` Called internally by the UPnP discovery protocol.
`boolean` | `removeDevice(UDN udn)` Call this to remove any device metadata with the given UDN.
`void` | `removeListener(RegistryListener listener)`
`boolean` | `removeLocalSubscription(LocalGENASubscription subscription)` Called internally by the UPnP stack, during GENA protocol execution.
`void` | `removeRemoteSubscription(RemoteGENASubscription subscription)` Called internally by the UPnP stack, during GENA protocol execution.
`boolean` | `removeResource(Resource resource)` Removes a resource from the registry.
`void` | `shutdown()` Typically called internally when the UPnP stack is stopping.
`boolean` | `update(RemoteDeviceIdentity rdIdentity)` Called internally by the UPnP discovery protocol.
`boolean` | `updateLocalSubscription(LocalGENASubscription subscription)` Called internally by the UPnP stack, during GENA protocol execution.
`void` | `updateRemoteSubscription(RemoteGENASubscription subscription)` Called internally by the UPnP stack, during GENA protocol execution.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### upnpService

    protected final UpnpService upnpService

### registryMaintainer

    protected final RegistryMaintainer registryMaintainer

### registryListeners

    protected final Set<RegistryListener> registryListeners

### resourceItems

    protected final Set<org.teleal.cling.registry.RegistryItem<URI,Resource>> resourceItems

### pendingExecutions

    protected final List<Runnable> pendingExecutions

### remoteItems

    protected final org.teleal.cling.registry.RemoteItems remoteItems

### localItems

    protected final org.teleal.cling.registry.LocalItems localItems

Constructor Detail

### RegistryImpl

    public RegistryImpl(UpnpService upnpService)

  Starts background maintenance immediately.

Method Detail

### getUpnpService

    public UpnpService getUpnpService()

  Specified by:
    `getUpnpService` in interface `Registry`

### getConfiguration

    public UpnpServiceConfiguration getConfiguration()

  Specified by:
    `getConfiguration` in interface `Registry`

### getProtocolFactory

    public ProtocolFactory getProtocolFactory()

  Specified by:
    `getProtocolFactory` in interface `Registry`

### createRegistryMaintainer

    protected RegistryMaintainer createRegistryMaintainer()

### addListener

    public void addListener(RegistryListener listener)

  Specified by:
    `addListener` in interface `Registry`

### removeListener

    public void removeListener(RegistryListener listener)

  Specified by:
    `removeListener` in interface `Registry`

### getListeners

    public Collection<RegistryListener> getListeners()

  Specified by:
    `getListeners` in interface `Registry`

### notifyDiscoveryStart

    public boolean notifyDiscoveryStart(RemoteDevice device)

  Description copied from interface: `Registry`
  Called internally by the UPnP stack when the discovery protocol starts.

  The registry will notify all registered listeners of this event, unless the given device was already been present in the registry.

  Specified by:
    `notifyDiscoveryStart` in interface `Registry`
  Parameters:
    `device` - The half-hydrated (without services) metadata of the discovered device.
  Returns:
    `false` if the device was already registered.

### notifyDiscoveryFailure

    public void notifyDiscoveryFailure(RemoteDevice device,
                                       Exception ex)

  Description copied from interface: `Registry`
  Called internally by the UPnP stack when the discovery protocol stopped abnormaly.

  The registry will notify all registered listeners of this event.

  Specified by:
    `notifyDiscoveryFailure` in interface `Registry`
  Parameters:
    `device` - The half-hydrated (without services) metadata of the discovered device.
    `ex` - The cause for the interruption of the discovery protocol.

### addDevice

    public void addDevice(LocalDevice localDevice)

  Description copied from interface: `Registry`
  Call this method to add your local device metadata.

  Specified by:
    `addDevice` in interface `Registry`
  Parameters:
    `localDevice` - The device to add and maintain.

### addDevice

    public void addDevice(RemoteDevice remoteDevice)

  Description copied from interface: `Registry`
  Called internally by the UPnP discovery protocol.

  Specified by:
    `addDevice` in interface `Registry`

### update

    public boolean update(RemoteDeviceIdentity rdIdentity)

  Description copied from interface: `Registry`
  Called internally by the UPnP discovery protocol.

  Specified by:
    `update` in interface `Registry`

### removeDevice

    public boolean removeDevice(LocalDevice localDevice)

  Description copied from interface: `Registry`
  Call this to remove your local device metadata.

  Specified by:
    `removeDevice` in interface `Registry`
  Returns:
    `true` if the device was registered and has been removed.

### removeDevice

    public boolean removeDevice(RemoteDevice remoteDevice)

  Description copied from interface: `Registry`
  Called internally by the UPnP discovery protocol.

  Specified by:
    `removeDevice` in interface `Registry`

### removeAllLocalDevices

    public void removeAllLocalDevices()

  Description copied from interface: `Registry`
  Clear the registry of all locally registered device metadata.

  Specified by:
    `removeAllLocalDevices` in interface `Registry`

### removeAllRemoteDevices

    public void removeAllRemoteDevices()

  Description copied from interface: `Registry`
  Clear the registry of all discovered remote device metadata.

  Specified by:
    `removeAllRemoteDevices` in interface `Registry`

### removeDevice

    public boolean removeDevice(UDN udn)

  Description copied from interface: `Registry`
  Call this to remove any device metadata with the given UDN.

  Specified by:
    `removeDevice` in interface `Registry`
  Returns:
    `true` if the device was registered and has been removed.

### getDevice

    public Device getDevice(UDN udn,
                            boolean rootOnly)

  Specified by:
    `getDevice` in interface `Registry`
  Parameters:
    `udn` - The device name to lookup.
    `rootOnly` - If `true`, only matches of root devices are returned.
  Returns:
    The registered root or embedded device metadata, or `null`.

### getLocalDevice

    public LocalDevice getLocalDevice(UDN udn,
                                      boolean rootOnly)

  Specified by:
    `getLocalDevice` in interface `Registry`
  Parameters:
    `udn` - The device name to lookup.
    `rootOnly` - If `true`, only matches of root devices are returned.
  Returns:
    The registered root or embedded device metadata, or `null`.

### getRemoteDevice

    public RemoteDevice getRemoteDevice(UDN udn,
                                        boolean rootOnly)

  Specified by:
    `getRemoteDevice` in interface `Registry`
  Parameters:
    `udn` - The device name to lookup.
    `rootOnly` - If `true`, only matches of root devices are returned.
  Returns:
    The registered root or embedded device metadata, or `null`.

### getLocalDevices

    public Collection<LocalDevice> getLocalDevices()

  Specified by:
    `getLocalDevices` in interface `Registry`
  Returns:
    All locally registered device metadata, in no particular order, or an empty collection.

### getRemoteDevices

    public Collection<RemoteDevice> getRemoteDevices()

  Specified by:
    `getRemoteDevices` in interface `Registry`
  Returns:
    All discovered remote device metadata, in no particular order, or an empty collection.

### getDevices

    public Collection<Device> getDevices()

  Specified by:
    `getDevices` in interface `Registry`
  Returns:
    All device metadata, in no particular order, or an empty collection.

### getDevices

    public Collection<Device> getDevices(DeviceType deviceType)

  Specified by:
    `getDevices` in interface `Registry`
  Returns:
    All device metadata of devices which implement the given type, in no particular order, or an empty collection.

### getDevices

    public Collection<Device> getDevices(ServiceType serviceType)

  Specified by:
    `getDevices` in interface `Registry`
  Returns:
    All device metadata of devices which have a service that implements the given type, in no particular order, or an empty collection.

### getService

    public Service getService(ServiceReference serviceReference)

  Specified by:
    `getService` in interface `Registry`
  Returns:
    Complete service metadata.for a service reference or `null` if no service for the given reference has been registered.

### getResource

    public Resource getResource(URI pathQuery)
                         throws IllegalArgumentException

  Specified by:
    `getResource` in interface `Registry`
  Parameters:
    `pathQuery` - The path and optional query string of the resource's registration URI (e.g. `/dev/somefile.xml?param=value`)
  Returns:
    Any registered resource that matches the given URI path.
  Throws:
    `IllegalArgumentException` - If the given URI was absolute, only path and query are allowed.

### getResource

    public <T extends Resource> T getResource(Class<T> resourceType,
                                              URI pathQuery)
                                   throws IllegalArgumentException

  Specified by:
    `getResource` in interface `Registry`
  Type Parameters:
    `T` - The required subtype of the `Resource`.
  Parameters:
    `resourceType` - The required subtype of the `Resource`.
    `pathQuery` - The path and optional query string of the resource's registration URI (e.g. `/dev/somefile.xml?param=value`)
  Returns:
    Any registered resource that matches the given URI path and subtype.
  Throws:
    `IllegalArgumentException` - If the given URI was absolute, only path and query are allowed.

### getResources

    public Collection<Resource> getResources()

  Specified by:
    `getResources` in interface `Registry`
  Returns:
    All registered resources, in no particular order, or an empty collection.

### getResources

    public <T extends Resource> Collection<T> getResources(Class<T> resourceType)

  Specified by:
    `getResources` in interface `Registry`
  Type Parameters:
    `T` - The required subtype of the `Resource`.
  Parameters:
    `resourceType` - The required subtype of the `Resource`.
  Returns:
    Any registered resource that matches the given subtype.

### addResource

    public void addResource(Resource resource)

  Description copied from interface: `Registry`
  Stores an arbitrary resource in the registry.

  Specified by:
    `addResource` in interface `Registry`
  Parameters:
    `resource` - The resource to maintain indefinitely (until it is manually removed).

### addResource

    public void addResource(Resource resource,
                            int maxAgeSeconds)

  Description copied from interface: `Registry`
  Stores an arbitrary resource in the registry.

  Call this method repeatedly to refresh and prevent expiration of the resource.

  Specified by:
    `addResource` in interface `Registry`
  Parameters:
    `resource` - The resource to maintain.
    `maxAgeSeconds` - The time after which the registry will automatically remove the resource.

### removeResource

    public boolean removeResource(Resource resource)

  Description copied from interface: `Registry`
  Removes a resource from the registry.

  Specified by:
    `removeResource` in interface `Registry`
  Parameters:
    `resource` - The resource to remove.
  Returns:
    `true` if the resource was registered and has been removed.

### addLocalSubscription

    public void addLocalSubscription(LocalGENASubscription subscription)

  Description copied from interface: `Registry`
  Called internally by the UPnP stack, during GENA protocol execution.

  Specified by:
    `addLocalSubscription` in interface `Registry`

### getLocalSubscription

    public LocalGENASubscription getLocalSubscription(String subscriptionId)

  Description copied from interface: `Registry`
  Called internally by the UPnP stack, during GENA protocol execution.

  Specified by:
    `getLocalSubscription` in interface `Registry`

### updateLocalSubscription

    public boolean updateLocalSubscription(LocalGENASubscription subscription)

  Description copied from interface: `Registry`
  Called internally by the UPnP stack, during GENA protocol execution.

  Specified by:
    `updateLocalSubscription` in interface `Registry`

### removeLocalSubscription

    public boolean removeLocalSubscription(LocalGENASubscription subscription)

  Description copied from interface: `Registry`
  Called internally by the UPnP stack, during GENA protocol execution.

  Specified by:
    `removeLocalSubscription` in interface `Registry`

### addRemoteSubscription

    public void addRemoteSubscription(RemoteGENASubscription subscription)

  Description copied from interface: `Registry`
  Called internally by the UPnP stack, during GENA protocol execution.

  Specified by:
    `addRemoteSubscription` in interface `Registry`

### getRemoteSubscription

    public RemoteGENASubscription getRemoteSubscription(String subscriptionId)

  Description copied from interface: `Registry`
  Called internally by the UPnP stack, during GENA protocol execution.

  Specified by:
    `getRemoteSubscription` in interface `Registry`

### updateRemoteSubscription

    public void updateRemoteSubscription(RemoteGENASubscription subscription)

  Description copied from interface: `Registry`
  Called internally by the UPnP stack, during GENA protocol execution.

  Specified by:
    `updateRemoteSubscription` in interface `Registry`

### removeRemoteSubscription

    public void removeRemoteSubscription(RemoteGENASubscription subscription)

  Description copied from interface: `Registry`
  Called internally by the UPnP stack, during GENA protocol execution.

  Specified by:
    `removeRemoteSubscription` in interface `Registry`

### shutdown

    public void shutdown()

  Description copied from interface: `Registry`
  Typically called internally when the UPnP stack is stopping.

  Unsubscribes all local devices and GENA subscriptions.

  Specified by:
    `shutdown` in interface `Registry`

### printDebugLog

    public void printDebugLog()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2010 Teleal GmbH, Switzerland. All Rights Reserved.