|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Registry
The core of the UPnP stack, keeping track of known devices and resources.
A running UPnP stack has one Registry
. Any discovered device is added
to this registry, as well as any exposed local device. The registry then maintains
these devices continously (see RegistryMaintainer
) and when needed refreshes
their announcements on the network or removes them when they have expired. The registry
also keeps track of GENA event subscriptions.
UPnP client applications typically monitor activity of the registry
via RegistryListener
, they are inherently asynchronous.
The registry has to be shutdown()
properly, so it can notify all participants
on the network that local devices will no longer be available and cancel all
GENA subscriptions.
An implementation has to be thread-safe.
TODO: Unify all "items" the registry is keeping track of, this API should be narrowed.
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. |
|
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 |
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. |
Method Detail |
---|
UpnpService getUpnpService()
UpnpServiceConfiguration getConfiguration()
ProtocolFactory getProtocolFactory()
void shutdown()
Unsubscribes all local devices and GENA subscriptions.
void addListener(RegistryListener listener)
void removeListener(RegistryListener listener)
Collection<RegistryListener> getListeners()
boolean notifyDiscoveryStart(RemoteDevice device)
The registry will notify all registered listeners of this event, unless the given device was already been present in the registry.
device
- The half-hydrated (without services) metadata of the discovered device.
false
if the device was already registered.void notifyDiscoveryFailure(RemoteDevice device, Exception ex)
The registry will notify all registered listeners of this event.
device
- The half-hydrated (without services) metadata of the discovered device.ex
- The cause for the interruption of the discovery protocol.void addDevice(LocalDevice localDevice) throws RegistrationException
localDevice
- The device to add and maintain.
RegistrationException
- If a conflict with an already registered device was detected.void addDevice(RemoteDevice remoteDevice) throws RegistrationException
RegistrationException
- If a conflict with an already registered device was detected.boolean update(RemoteDeviceIdentity rdIdentity)
boolean removeDevice(LocalDevice localDevice)
true
if the device was registered and has been removed.boolean removeDevice(RemoteDevice remoteDevice)
boolean removeDevice(UDN udn)
true
if the device was registered and has been removed.void removeAllLocalDevices()
void removeAllRemoteDevices()
Device getDevice(UDN udn, boolean rootOnly)
udn
- The device name to lookup.rootOnly
- If true
, only matches of root devices are returned.
null
.LocalDevice getLocalDevice(UDN udn, boolean rootOnly)
udn
- The device name to lookup.rootOnly
- If true
, only matches of root devices are returned.
null
.RemoteDevice getRemoteDevice(UDN udn, boolean rootOnly)
udn
- The device name to lookup.rootOnly
- If true
, only matches of root devices are returned.
null
.Collection<LocalDevice> getLocalDevices()
Collection<RemoteDevice> getRemoteDevices()
Collection<Device> getDevices()
Collection<Device> getDevices(DeviceType deviceType)
Collection<Device> getDevices(ServiceType serviceType)
Service getService(ServiceReference serviceReference)
null
if no service
for the given reference has been registered.void addResource(Resource resource)
resource
- The resource to maintain indefinitely (until it is manually removed).void addResource(Resource resource, int maxAgeSeconds)
Call this method repeatedly to refresh and prevent expiration of the resource.
resource
- The resource to maintain.maxAgeSeconds
- The time after which the registry will automatically remove the resource.boolean removeResource(Resource resource)
resource
- The resource to remove.
true
if the resource was registered and has been removed.Resource getResource(URI pathQuery) throws IllegalArgumentException
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.<T extends Resource> T getResource(Class<T> resourceType, URI pathQuery) throws IllegalArgumentException
T
- 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
)resourceType
- The required subtype of the Resource
.
IllegalArgumentException
- If the given URI was absolute, only path and query are allowed.Collection<Resource> getResources()
<T extends Resource> Collection<T> getResources(Class<T> resourceType)
T
- The required subtype of the Resource
.resourceType
- The required subtype of the Resource
.
void addLocalSubscription(LocalGENASubscription subscription)
LocalGENASubscription getLocalSubscription(String subscriptionId)
boolean updateLocalSubscription(LocalGENASubscription subscription)
boolean removeLocalSubscription(LocalGENASubscription subscription)
void addRemoteSubscription(RemoteGENASubscription subscription)
RemoteGENASubscription getRemoteSubscription(String subscriptionId)
void updateRemoteSubscription(RemoteGENASubscription subscription)
void removeRemoteSubscription(RemoteGENASubscription subscription)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |