YAACC - UPNP Client and Server
|
Default implementation, creates and manages a single instance of a plain Java bean. More...
Classes | |
class | DefaultPropertyChangeListener |
Public Member Functions | |
DefaultServiceManager (LocalService< T > service, Class< T > serviceClass) | |
LocalService< T > | getService () |
T | getImplementation () |
PropertyChangeSupport | getPropertyChangeSupport () |
Provides the capability to monitor the service for state changes. | |
void | execute (Command< T > cmd) throws Exception |
Double-dispatch of arbitrary commands, used by action executors and state variable accessors. | |
Collection< StateVariableValue > | getCurrentState () throws Exception |
Reading the state of a service manually. | |
String | toString () |
Protected Attributes | |
final LocalService< T > | service |
final Class< T > | serviceClass |
final ReentrantLock | lock = new ReentrantLock(true) |
T | serviceImpl |
PropertyChangeSupport | propertyChangeSupport |
Additional Inherited Members | |
Static Public Attributes inherited from org.fourthline.cling.model.ServiceManager< T > | |
static final String | EVENTED_STATE_VARIABLES = "_EventedStateVariables" |
Use this property name when propagating change events that affect any evented UPnP state variable. | |
Default implementation, creates and manages a single instance of a plain Java bean.
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.
void org.fourthline.cling.model.DefaultServiceManager< T >.execute | ( | Command< T > | cmd | ) | throws Exception |
Double-dispatch of arbitrary commands, used by action executors and state variable accessors.
The service manager will execute the given org.fourthline.cling.model.Command
and it might decorate the execution, for example, by locking/unlocking access to a shared service implementation before and after the execution.
cmd | The command to execute. |
Exception | Any exception, without wrapping, as thrown by org.fourthline.cling.model.Command#execute(ServiceManager) |
Implements org.fourthline.cling.model.ServiceManager< T >.
Collection< StateVariableValue > org.fourthline.cling.model.DefaultServiceManager< T >.getCurrentState | ( | ) | throws Exception |
Reading the state of a service manually.
Collection
of org.fourthline.cling.model.state.StateVariableValue
, representing the current state of the service, that is, all evented state variable values. Exception | Any error that occurred when the service's state was accessed. |
Implements org.fourthline.cling.model.ServiceManager< T >.
T org.fourthline.cling.model.DefaultServiceManager< T >.getImplementation | ( | ) |
org.fourthline.cling.model.action.ActionExecutor
s and org.fourthline.cling.model.state.StateVariableAccessor
s. Implements org.fourthline.cling.model.ServiceManager< T >.
Referenced by org.fourthline.cling.model.DefaultServiceManager< T >.getCurrentState().
PropertyChangeSupport org.fourthline.cling.model.DefaultServiceManager< T >.getPropertyChangeSupport | ( | ) |
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:
EVENTED_STATE_VARIABLES
. null
, only the current state has to be included. Collection
of org.fourthline.cling.model.state.StateVariableValue
, 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).
Implements org.fourthline.cling.model.ServiceManager< T >.
LocalService< T > org.fourthline.cling.model.DefaultServiceManager< T >.getService | ( | ) |
Implements org.fourthline.cling.model.ServiceManager< T >.
Referenced by org.fourthline.cling.model.DefaultServiceManager< T >.getCurrentState().