Klasse RegistryImpl
- Alle implementierten Schnittstellen:
Registry
Registry.- Autor:
- Christian Bauer
-
Feldübersicht
FelderModifizierer und TypFeldBeschreibungprotected final org.jupnp.registry.LocalItemsprotected final ReentrantReadWriteLockprotected Objectprotected final Set<RemoteGENASubscription> protected final Set<RegistryListener> protected RegistryMaintainerprotected final org.jupnp.registry.RemoteItemsprotected final ReentrantReadWriteLockprotected UpnpService -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungRegistryImpl(UpnpService upnpService) Starts background maintenance immediately. -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoidaddDevice(LocalDevice localDevice) Call this method to add your local device metadata.voidaddDevice(LocalDevice localDevice, DiscoveryOptions options) Call this method to add your local device metadata.voidaddDevice(RemoteDevice remoteDevice) Called internally by the UPnP discovery protocol.voidaddListener(RegistryListener listener) voidaddLocalSubscription(LocalGENASubscription subscription) Called internally by the UPnP stack, during GENA protocol execution.voidaddRemoteSubscription(RemoteGENASubscription subscription) Called internally by the UPnP stack, during GENA protocol execution.voidaddResource(Resource resource) Stores an arbitrary resource in the registry.voidaddResource(Resource resource, int maxAgeSeconds) Stores an arbitrary resource in the registry.voidManually trigger advertisement messages for all local devices.protected RegistryMaintainergetDevices(DeviceType deviceType) getDevices(ServiceType serviceType) getDiscoveryOptions(UDN udn) Get the currently activeDiscoveryOptionsfor the given (local device) UDN.getLocalDevice(UDN udn, boolean rootOnly) getLocalSubscription(String subscriptionId) Called internally by the UPnP stack, during GENA protocol execution.getRemoteDevice(UDN udn, boolean rootOnly) getRemoteSubscription(String subscriptionId) Called internally by the UPnP stack, during GENA protocol execution.<T extends Resource>
TgetResource(Class<T> resourceType, URI pathQuery) getResource(URI pathQuery) <T extends Resource>
Collection<T> getResources(Class<T> resourceType) getService(ServiceReference serviceReference) getWaitRemoteSubscription(String subscriptionId) Called internally by the UPnP stack, during GENA protocol execution.booleanisPaused()voidnotifyDiscoveryFailure(RemoteDevice device, Exception e) Called internally by the UPnP stack when the discovery protocol stopped abnormaly.booleannotifyDiscoveryStart(RemoteDevice device) Called internally by the UPnP stack when the discovery protocol starts.voidpause()Stops background maintenance (thread) of registered items.voidvoidregisterPendingRemoteSubscription(RemoteGENASubscription subscription) Called internally by the UPnP stack, during GENA protocol execution.voidClear the registry of all locally registered device metadata.voidClear the registry of all discovered remote device metadata.booleanremoveDevice(LocalDevice localDevice) Call this to remove your local device metadata.booleanremoveDevice(RemoteDevice remoteDevice) Called internally by the UPnP discovery protocol.booleanremoveDevice(UDN udn) Call this to remove any device metadata with the given UDN.voidremoveListener(RegistryListener listener) booleanremoveLocalSubscription(LocalGENASubscription subscription) Called internally by the UPnP stack, during GENA protocol execution.voidremoveRemoteSubscription(RemoteGENASubscription subscription) Called internally by the UPnP stack, during GENA protocol execution.booleanremoveResource(Resource resource) Removes a resource from the registry.voidresume()Resumes background maintenance (thread) of registered items.voidsetDiscoveryOptions(UDN udn, DiscoveryOptions options) Change the activeDiscoveryOptionsfor the given (local device) UDN.voidshutdown()Typically called internally when the UPnP stack is stopping.voidunregisterPendingRemoteSubscription(RemoteGENASubscription subscription) Called internally by the UPnP stack, during GENA protocol execution.booleanupdate(RemoteDeviceIdentity rdIdentity) Called internally by the UPnP discovery protocol.booleanupdateLocalSubscription(LocalGENASubscription subscription) Called internally by the UPnP stack, during GENA protocol execution.voidupdateRemoteSubscription(RemoteGENASubscription subscription) Called internally by the UPnP stack, during GENA protocol execution.
-
Felddetails
-
upnpService
-
registryMaintainer
-
pendingSubscriptionsLock
-
lock
-
registryListeners
-
resourceItems
-
pendingExecutions
-
remoteItemsLock
-
localItemsLock
-
remoteItems
protected final org.jupnp.registry.RemoteItems remoteItems -
localItems
protected final org.jupnp.registry.LocalItems localItems
-
-
Konstruktordetails
-
RegistryImpl
public RegistryImpl() -
RegistryImpl
Starts background maintenance immediately.
-
-
Methodendetails
-
getUpnpService
- Angegeben von:
getUpnpServicein SchnittstelleRegistry
-
getConfiguration
- Angegeben von:
getConfigurationin SchnittstelleRegistry
-
getProtocolFactory
- Angegeben von:
getProtocolFactoryin SchnittstelleRegistry
-
createRegistryMaintainer
-
addListener
- Angegeben von:
addListenerin SchnittstelleRegistry
-
removeListener
- Angegeben von:
removeListenerin SchnittstelleRegistry
-
getListeners
- Angegeben von:
getListenersin SchnittstelleRegistry
-
notifyDiscoveryStart
Beschreibung aus Schnittstelle kopiert:RegistryCalled 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.
- Angegeben von:
notifyDiscoveryStartin SchnittstelleRegistry- Parameter:
device- The half-hydrated (without services) metadata of the discovered device.- Gibt zurück:
falseif the device was already registered.
-
notifyDiscoveryFailure
Beschreibung aus Schnittstelle kopiert:RegistryCalled internally by the UPnP stack when the discovery protocol stopped abnormaly.The registry will notify all registered listeners of this event.
- Angegeben von:
notifyDiscoveryFailurein SchnittstelleRegistry- Parameter:
device- The half-hydrated (without services) metadata of the discovered device.e- The cause for the interruption of the discovery protocol.
-
addDevice
Beschreibung aus Schnittstelle kopiert:RegistryCall this method to add your local device metadata. -
addDevice
Beschreibung aus Schnittstelle kopiert:RegistryCall this method to add your local device metadata. -
setDiscoveryOptions
Beschreibung aus Schnittstelle kopiert:RegistryChange the activeDiscoveryOptionsfor the given (local device) UDN.- Angegeben von:
setDiscoveryOptionsin SchnittstelleRegistry- Parameter:
options- Set tonullto disable any options.
-
getDiscoveryOptions
Beschreibung aus Schnittstelle kopiert:RegistryGet the currently activeDiscoveryOptionsfor the given (local device) UDN.- Angegeben von:
getDiscoveryOptionsin SchnittstelleRegistry- Gibt zurück:
nullif there are no active discovery options for the given UDN.
-
addDevice
Beschreibung aus Schnittstelle kopiert:RegistryCalled internally by the UPnP discovery protocol. -
update
Beschreibung aus Schnittstelle kopiert:RegistryCalled internally by the UPnP discovery protocol. -
removeDevice
Beschreibung aus Schnittstelle kopiert:RegistryCall this to remove your local device metadata.- Angegeben von:
removeDevicein SchnittstelleRegistry- Gibt zurück:
trueif the device was registered and has been removed.
-
removeDevice
Beschreibung aus Schnittstelle kopiert:RegistryCalled internally by the UPnP discovery protocol.- Angegeben von:
removeDevicein SchnittstelleRegistry
-
removeAllLocalDevices
public void removeAllLocalDevices()Beschreibung aus Schnittstelle kopiert:RegistryClear the registry of all locally registered device metadata.- Angegeben von:
removeAllLocalDevicesin SchnittstelleRegistry
-
removeAllRemoteDevices
public void removeAllRemoteDevices()Beschreibung aus Schnittstelle kopiert:RegistryClear the registry of all discovered remote device metadata.- Angegeben von:
removeAllRemoteDevicesin SchnittstelleRegistry
-
removeDevice
Beschreibung aus Schnittstelle kopiert:RegistryCall this to remove any device metadata with the given UDN.- Angegeben von:
removeDevicein SchnittstelleRegistry- Gibt zurück:
trueif the device was registered and has been removed.
-
getDevice
-
getLocalDevice
- Angegeben von:
getLocalDevicein SchnittstelleRegistry- Parameter:
udn- The device name to lookup.rootOnly- Iftrue, only matches of root devices are returned.- Gibt zurück:
- The registered root or embedded device metadata, or
null.
-
getRemoteDevice
- Angegeben von:
getRemoteDevicein SchnittstelleRegistry- Parameter:
udn- The device name to lookup.rootOnly- Iftrue, only matches of root devices are returned.- Gibt zurück:
- The registered root or embedded device metadata, or
null.
-
getLocalDevices
- Angegeben von:
getLocalDevicesin SchnittstelleRegistry- Gibt zurück:
- All locally registered device metadata, in no particular order, or an empty collection.
-
getRemoteDevices
- Angegeben von:
getRemoteDevicesin SchnittstelleRegistry- Gibt zurück:
- All discovered remote device metadata, in no particular order, or an empty collection.
-
getDevices
- Angegeben von:
getDevicesin SchnittstelleRegistry- Gibt zurück:
- All device metadata, in no particular order, or an empty collection.
-
getDevices
- Angegeben von:
getDevicesin SchnittstelleRegistry- Gibt zurück:
- All device metadata of devices which implement the given type, in no particular order, or an empty collection.
-
getDevices
- Angegeben von:
getDevicesin SchnittstelleRegistry- Gibt zurück:
- All device metadata of devices which have a service that implements the given type, in no particular order, or an empty collection.
-
getService
- Angegeben von:
getServicein SchnittstelleRegistry- Gibt zurück:
- Complete service metadata.for a service reference or
nullif no service for the given reference has been registered.
-
getResource
- Angegeben von:
getResourcein SchnittstelleRegistry- Parameter:
pathQuery- The path and optional query string of the resource's registration URI (e.g./dev/somefile.xml?param=value)- Gibt zurück:
- Any registered resource that matches the given URI path.
- Löst aus:
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 - Angegeben von:
getResourcein SchnittstelleRegistry- Typparameter:
T- The required subtype of theResource.- Parameter:
resourceType- The required subtype of theResource.pathQuery- The path and optional query string of the resource's registration URI (e.g./dev/somefile.xml?param=value)- Gibt zurück:
- Any registered resource that matches the given URI path and subtype.
- Löst aus:
IllegalArgumentException- If the given URI was absolute, only path and query are allowed.
-
getResources
- Angegeben von:
getResourcesin SchnittstelleRegistry- Gibt zurück:
- All registered resources, in no particular order, or an empty collection.
-
getResources
- Angegeben von:
getResourcesin SchnittstelleRegistry- Typparameter:
T- The required subtype of theResource.- Parameter:
resourceType- The required subtype of theResource.- Gibt zurück:
- Any registered resource that matches the given subtype.
-
addResource
Beschreibung aus Schnittstelle kopiert:RegistryStores an arbitrary resource in the registry.- Angegeben von:
addResourcein SchnittstelleRegistry- Parameter:
resource- The resource to maintain indefinitely (until it is manually removed).
-
addResource
Beschreibung aus Schnittstelle kopiert:RegistryStores an arbitrary resource in the registry.Call this method repeatedly to refresh and prevent expiration of the resource.
- Angegeben von:
addResourcein SchnittstelleRegistry- Parameter:
resource- The resource to maintain.maxAgeSeconds- The time after which the registry will automatically remove the resource.
-
removeResource
Beschreibung aus Schnittstelle kopiert:RegistryRemoves a resource from the registry.- Angegeben von:
removeResourcein SchnittstelleRegistry- Parameter:
resource- The resource to remove.- Gibt zurück:
trueif the resource was registered and has been removed.
-
addLocalSubscription
Beschreibung aus Schnittstelle kopiert:RegistryCalled internally by the UPnP stack, during GENA protocol execution.- Angegeben von:
addLocalSubscriptionin SchnittstelleRegistry
-
getLocalSubscription
Beschreibung aus Schnittstelle kopiert:RegistryCalled internally by the UPnP stack, during GENA protocol execution.- Angegeben von:
getLocalSubscriptionin SchnittstelleRegistry
-
updateLocalSubscription
Beschreibung aus Schnittstelle kopiert:RegistryCalled internally by the UPnP stack, during GENA protocol execution.- Angegeben von:
updateLocalSubscriptionin SchnittstelleRegistry
-
removeLocalSubscription
Beschreibung aus Schnittstelle kopiert:RegistryCalled internally by the UPnP stack, during GENA protocol execution.- Angegeben von:
removeLocalSubscriptionin SchnittstelleRegistry
-
addRemoteSubscription
Beschreibung aus Schnittstelle kopiert:RegistryCalled internally by the UPnP stack, during GENA protocol execution.- Angegeben von:
addRemoteSubscriptionin SchnittstelleRegistry
-
getRemoteSubscription
Beschreibung aus Schnittstelle kopiert:RegistryCalled internally by the UPnP stack, during GENA protocol execution.- Angegeben von:
getRemoteSubscriptionin SchnittstelleRegistry
-
updateRemoteSubscription
Beschreibung aus Schnittstelle kopiert:RegistryCalled internally by the UPnP stack, during GENA protocol execution.- Angegeben von:
updateRemoteSubscriptionin SchnittstelleRegistry
-
removeRemoteSubscription
Beschreibung aus Schnittstelle kopiert:RegistryCalled internally by the UPnP stack, during GENA protocol execution.- Angegeben von:
removeRemoteSubscriptionin SchnittstelleRegistry
-
advertiseLocalDevices
public void advertiseLocalDevices()Beschreibung aus Schnittstelle kopiert:RegistryManually trigger advertisement messages for all local devices.No messages will be send for devices with disabled advertisements, see
DiscoveryOptions!- Angegeben von:
advertiseLocalDevicesin SchnittstelleRegistry
-
shutdown
public void shutdown()Beschreibung aus Schnittstelle kopiert:RegistryTypically called internally when the UPnP stack is stopping.Unsubscribes all local devices and GENA subscriptions.
-
pause
public void pause()Beschreibung aus Schnittstelle kopiert:RegistryStops background maintenance (thread) of registered items.When paused, the registry will no longer remove expired remote devices if their discovery announcements stop for some reason (device was turned off). Your local control point will now see potentially unavailable remote devices. Outbound GENA subscriptions from your local control point to remote services will not be renewed automatically anymore, a remote service might drop your subscriptions if you don't resume maintenance within the subscription's expiration timeout.
Local devices and services will not be announced periodically anymore to remote control points, only when they are manually added are removed from the registry. The registry will also no longer remove expired inbound GENA subscriptions to local service from remote control points, if that control point for some reason stops sending subscription renewal messages.
-
resume
public void resume()Beschreibung aus Schnittstelle kopiert:RegistryResumes background maintenance (thread) of registered items.A local control point has to handle the following situations when resuming registry maintenance:
A remote device registration might have expired. This is the case when the remote device stopped sending announcements while the registry was paused (maybe because the device was switched off) and the registry was paused longer than the device advertisement's maximum age. The registry will not know if the device is still available when it resumes maintenance. However, it will simply assume that the remote device is still available and restart its expiration check cycle. That means a device will finally be removed from the registry, if no further announcements from the device are received, when the maximum age of the device has elapsed after the registry resumed operation.
Secondly, a remote device registration might not have expired but some of your outbound GENA subscriptions to its services have not been renewed within the expected renewal period. Therefore your outbound subscriptions might be invalid, because the remote service can drop subscriptions when you don't renew them. On resume, the registry will attempt to send renewals for all outbound GENA subscriptions that require renewal, on devices that still haven't expired. If renewal fails, your subscription will end with
CancelReason.RENEWAL_FAILED. Although you then might conclude that the remote device is no longer available, a GENA renewal can also fail for other reasons. The remote device will be kept and maintained in the registry until it announces itself or it expires, even after a failed GENA renewal.If you are providing local devices and services, resuming registry maintenance has the following effects:
Local devices and their services are announced again immediately if the registry has been paused for longer than half of the device's maximum age. Remote control points will either see this as a new device advertisement (if they have dropped your device while you paused maintenance) or as a regular update if you didn't pause longer than the device's maximum age/expiration timeout.
Inbound GENA subscriptions to your local services are active, even in paused state - remote control points should continue renewing the subscription. If a remote control point stopped renewing a subscription without unsubscribing (hard power off), an outdated inbound subscription will be detected when you resume maintenance. This subscription will be cleaned up immediately on resume.
-
isPaused
public boolean isPaused() -
printDebugLog
public void printDebugLog() -
registerPendingRemoteSubscription
Beschreibung aus Schnittstelle kopiert:RegistryCalled internally by the UPnP stack, during GENA protocol execution.When subscribing with a remote host, the remote host might send the initial event message faster than the response for the subscription request. This method register that the subscription procedure is executing.
- Angegeben von:
registerPendingRemoteSubscriptionin SchnittstelleRegistry
-
unregisterPendingRemoteSubscription
Beschreibung aus Schnittstelle kopiert:RegistryCalled internally by the UPnP stack, during GENA protocol execution.Notify that the subscription procedure has terminated.
- Angegeben von:
unregisterPendingRemoteSubscriptionin SchnittstelleRegistry
-
getWaitRemoteSubscription
Beschreibung aus Schnittstelle kopiert:RegistryCalled internally by the UPnP stack, during GENA protocol execution.Get a remote subscription from its subscriptionId. If the subscription can't be found, wait for one of pending remote subscription procedures to terminate, until the subscription has been found or until there are no more pending subscription procedures.
- Angegeben von:
getWaitRemoteSubscriptionin SchnittstelleRegistry
-