|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.teleal.cling.registry.RegistryImpl
public class RegistryImpl
Default implementation of Registry.
| 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. |
|
|
getResource(Class<T> resourceType,
URI pathQuery)
|
|
Resource |
getResource(URI pathQuery)
|
|
Collection<Resource> |
getResources()
|
|
|
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 |
|---|
protected final UpnpService upnpService
protected final RegistryMaintainer registryMaintainer
protected final Set<RegistryListener> registryListeners
protected final Set<org.teleal.cling.registry.RegistryItem<URI,Resource>> resourceItems
protected final List<Runnable> pendingExecutions
protected final org.teleal.cling.registry.RemoteItems remoteItems
protected final org.teleal.cling.registry.LocalItems localItems
| Constructor Detail |
|---|
public RegistryImpl(UpnpService upnpService)
| Method Detail |
|---|
public UpnpService getUpnpService()
getUpnpService in interface Registrypublic UpnpServiceConfiguration getConfiguration()
getConfiguration in interface Registrypublic ProtocolFactory getProtocolFactory()
getProtocolFactory in interface Registryprotected RegistryMaintainer createRegistryMaintainer()
public void addListener(RegistryListener listener)
addListener in interface Registrypublic void removeListener(RegistryListener listener)
removeListener in interface Registrypublic Collection<RegistryListener> getListeners()
getListeners in interface Registrypublic boolean notifyDiscoveryStart(RemoteDevice device)
RegistryThe registry will notify all registered listeners of this event, unless the given device was already been present in the registry.
notifyDiscoveryStart in interface Registrydevice - The half-hydrated (without services) metadata of the discovered device.
false if the device was already registered.
public void notifyDiscoveryFailure(RemoteDevice device,
Exception ex)
RegistryThe registry will notify all registered listeners of this event.
notifyDiscoveryFailure in interface Registrydevice - The half-hydrated (without services) metadata of the discovered device.ex - The cause for the interruption of the discovery protocol.public void addDevice(LocalDevice localDevice)
Registry
addDevice in interface RegistrylocalDevice - The device to add and maintain.public void addDevice(RemoteDevice remoteDevice)
Registry
addDevice in interface Registrypublic boolean update(RemoteDeviceIdentity rdIdentity)
Registry
update in interface Registrypublic boolean removeDevice(LocalDevice localDevice)
Registry
removeDevice in interface Registrytrue if the device was registered and has been removed.public boolean removeDevice(RemoteDevice remoteDevice)
Registry
removeDevice in interface Registrypublic void removeAllLocalDevices()
Registry
removeAllLocalDevices in interface Registrypublic void removeAllRemoteDevices()
Registry
removeAllRemoteDevices in interface Registrypublic boolean removeDevice(UDN udn)
Registry
removeDevice in interface Registrytrue if the device was registered and has been removed.
public Device getDevice(UDN udn,
boolean rootOnly)
getDevice in interface Registryudn - The device name to lookup.rootOnly - If true, only matches of root devices are returned.
null.
public LocalDevice getLocalDevice(UDN udn,
boolean rootOnly)
getLocalDevice in interface Registryudn - The device name to lookup.rootOnly - If true, only matches of root devices are returned.
null.
public RemoteDevice getRemoteDevice(UDN udn,
boolean rootOnly)
getRemoteDevice in interface Registryudn - The device name to lookup.rootOnly - If true, only matches of root devices are returned.
null.public Collection<LocalDevice> getLocalDevices()
getLocalDevices in interface Registrypublic Collection<RemoteDevice> getRemoteDevices()
getRemoteDevices in interface Registrypublic Collection<Device> getDevices()
getDevices in interface Registrypublic Collection<Device> getDevices(DeviceType deviceType)
getDevices in interface Registrypublic Collection<Device> getDevices(ServiceType serviceType)
getDevices in interface Registrypublic Service getService(ServiceReference serviceReference)
getService in interface Registrynull if no service
for the given reference has been registered.
public Resource getResource(URI pathQuery)
throws IllegalArgumentException
getResource in interface RegistrypathQuery - The path and optional query string of the resource's
registration URI (e.g. /dev/somefile.xml?param=value)
IllegalArgumentException - If the given URI was absolute, only path and query are allowed.
public <T extends Resource> T getResource(Class<T> resourceType,
URI pathQuery)
throws IllegalArgumentException
getResource in interface RegistryT - The required subtype of the Resource.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)
IllegalArgumentException - If the given URI was absolute, only path and query are allowed.public Collection<Resource> getResources()
getResources in interface Registrypublic <T extends Resource> Collection<T> getResources(Class<T> resourceType)
getResources in interface RegistryT - The required subtype of the Resource.resourceType - The required subtype of the Resource.
public void addResource(Resource resource)
Registry
addResource in interface Registryresource - The resource to maintain indefinitely (until it is manually removed).
public void addResource(Resource resource,
int maxAgeSeconds)
RegistryCall this method repeatedly to refresh and prevent expiration of the resource.
addResource in interface Registryresource - The resource to maintain.maxAgeSeconds - The time after which the registry will automatically remove the resource.public boolean removeResource(Resource resource)
Registry
removeResource in interface Registryresource - The resource to remove.
true if the resource was registered and has been removed.public void addLocalSubscription(LocalGENASubscription subscription)
Registry
addLocalSubscription in interface Registrypublic LocalGENASubscription getLocalSubscription(String subscriptionId)
Registry
getLocalSubscription in interface Registrypublic boolean updateLocalSubscription(LocalGENASubscription subscription)
Registry
updateLocalSubscription in interface Registrypublic boolean removeLocalSubscription(LocalGENASubscription subscription)
Registry
removeLocalSubscription in interface Registrypublic void addRemoteSubscription(RemoteGENASubscription subscription)
Registry
addRemoteSubscription in interface Registrypublic RemoteGENASubscription getRemoteSubscription(String subscriptionId)
Registry
getRemoteSubscription in interface Registrypublic void updateRemoteSubscription(RemoteGENASubscription subscription)
Registry
updateRemoteSubscription in interface Registrypublic void removeRemoteSubscription(RemoteGENASubscription subscription)
Registry
removeRemoteSubscription in interface Registrypublic void shutdown()
RegistryUnsubscribes all local devices and GENA subscriptions.
shutdown in interface Registrypublic void printDebugLog()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||