Klasse DefaultServiceManager<T>
- Alle implementierten Schnittstellen:
ServiceManager<T>
Creates instance of the defined service class when it is first needed (acts as a factory),
manages the instance in a field (it's shared), and synchronizes (locks) all
multi-threaded access. A locking attempt will timeout after 500 milliseconds with
a runtime exception if another operation is already in progress. Override
getLockTimeoutMillis() to customize this behavior, e.g. if your service
bean is slow and requires more time for typical action executions or state
variable reading.
- Autor:
- Christian Bauer, Jochen Hiller - Changed to use Compact2 compliant Java Beans
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifizierer und TypKlasseBeschreibungprotected class -
Feldübersicht
FelderModifizierer und TypFeldBeschreibungprotected final ReentrantLockprotected PropertyChangeSupportprotected final LocalService<T> protected TVon Schnittstelle geerbte Felder org.jupnp.model.ServiceManager
EVENTED_STATE_VARIABLES -
Konstruktorübersicht
KonstruktorenModifiziererKonstruktorBeschreibungprotectedDefaultServiceManager(LocalService<T> service) DefaultServiceManager(LocalService<T> service, Class<T> serviceClass) -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprotected PropertyChangeListenercreatePropertyChangeListener(T serviceImpl) protected PropertyChangeSupportcreatePropertyChangeSupport(T serviceImpl) protected TvoidDouble-dispatch of arbitrary commands, used by action executors and state variable accessors.Reading the state of a service manually.protected Collection<StateVariableValue> getCurrentState(String[] variableNames) protected intProvides the capability to monitor the service for state changes.protected voidinit()protected voidlock()protected Collection<StateVariableValue> toString()protected voidunlock()
-
Felddetails
-
service
-
serviceClass
-
lock
-
serviceImpl
-
propertyChangeSupport
-
-
Konstruktordetails
-
DefaultServiceManager
-
DefaultServiceManager
-
-
Methodendetails
-
lock
protected void lock() -
unlock
protected void unlock() -
getLockTimeoutMillis
protected int getLockTimeoutMillis() -
getService
- Angegeben von:
getServicein SchnittstelleServiceManager<T>- Gibt zurück:
- The metadata of the service to which this manager is assigned.
-
getImplementation
- Angegeben von:
getImplementationin SchnittstelleServiceManager<T>- Gibt zurück:
- An instance with the interface expected by the
bound
ActionExecutors andStateVariableAccessors.
-
getPropertyChangeSupport
Beschreibung aus Schnittstelle kopiert:ServiceManagerProvides the capability to monitor the service for state changes.The GENA subsystem expects that this adapter will notify its listeners whenever any evented UPnP state variable of the service has changed its state. The following change event is expected:
- The property name is the constant
ServiceManager.EVENTED_STATE_VARIABLES. - The "old value" can be
null, only the current state has to be included. - The "new value" is a
CollectionofStateVariableValue, representing the current state of the service after the change.
The collection has to include values for all state variables, no matter what state variable was updated. Any other event is ignored (e.g. individual property changes).
- Angegeben von:
getPropertyChangeSupportin SchnittstelleServiceManager<T>- Gibt zurück:
- An adapter that will notify its listeners whenever any evented state variable changes.
- The property name is the constant
-
execute
Beschreibung aus Schnittstelle kopiert:ServiceManagerDouble-dispatch of arbitrary commands, used by action executors and state variable accessors.The service manager will execute the given
Commandand it might decorate the execution, for example, by locking/unlocking access to a shared service implementation before and after the execution.- Angegeben von:
executein SchnittstelleServiceManager<T>- Parameter:
cmd- The command to execute.- Löst aus:
Exception- Any exception, without wrapping, as thrown byCommand.execute(ServiceManager)
-
getCurrentState
Beschreibung aus Schnittstelle kopiert:ServiceManagerReading the state of a service manually.- Angegeben von:
getCurrentStatein SchnittstelleServiceManager<T>- Gibt zurück:
- A
CollectionofStateVariableValue, representing the current state of the service, that is, all evented state variable values. - Löst aus:
Exception- Any error that occurred when the service's state was accessed.
-
getCurrentState
- Löst aus:
Exception
-
init
protected void init() -
createServiceInstance
-
createPropertyChangeSupport
- Löst aus:
Exception
-
createPropertyChangeListener
- Löst aus:
Exception
-
readInitialEventedStateVariableValues
- Löst aus:
Exception
-
toString
-