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 ReentrantLock
protected PropertyChangeSupport
protected final LocalService
<T> protected T
Von Schnittstelle geerbte Felder org.jupnp.model.ServiceManager
EVENTED_STATE_VARIABLES
-
Konstruktorübersicht
KonstruktorenModifiziererKonstruktorBeschreibungprotected
DefaultServiceManager
(LocalService<T> service) DefaultServiceManager
(LocalService<T> service, Class<T> serviceClass) -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungprotected PropertyChangeListener
createPropertyChangeListener
(T serviceImpl) protected PropertyChangeSupport
createPropertyChangeSupport
(T serviceImpl) protected T
void
Double-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 int
Provides the capability to monitor the service for state changes.protected void
init()
protected void
lock()
protected Collection
<StateVariableValue> toString()
protected void
unlock()
-
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:
getService
in SchnittstelleServiceManager<T>
- Gibt zurück:
- The metadata of the service to which this manager is assigned.
-
getImplementation
- Angegeben von:
getImplementation
in SchnittstelleServiceManager<T>
- Gibt zurück:
- An instance with the interface expected by the
bound
ActionExecutor
s andStateVariableAccessor
s.
-
getPropertyChangeSupport
Beschreibung aus Schnittstelle kopiert:ServiceManager
Provides 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
Collection
ofStateVariableValue
, 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:
getPropertyChangeSupport
in 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:ServiceManager
Double-dispatch of arbitrary commands, used by action executors and state variable accessors.The service manager will execute the given
Command
and it might decorate the execution, for example, by locking/unlocking access to a shared service implementation before and after the execution.- Angegeben von:
execute
in 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:ServiceManager
Reading the state of a service manually.- Angegeben von:
getCurrentState
in SchnittstelleServiceManager<T>
- Gibt zurück:
- A
Collection
ofStateVariableValue
, 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
-