org.teleal.cling.model
Interface ServiceManager<T>

Type Parameters:
T - The interface expected by the bound ActionExecutors and StateVariableAccessors.
All Known Implementing Classes:
DefaultServiceManager

public interface ServiceManager<T>

Binds the metadata of a service to a service implementation, unified interface for accessing local services.

The UPnP core will always access a local service implementation through this manager, available with LocalService.getManager():

A service manager can implement these concerns in any way imaginable. It has to be thread-safe.

Author:
Christian Bauer

Field Summary
static String EVENTED_STATE_VARIABLES
          Use this property name when propagating change events that affect any evented UPnP state variable.
 
Method Summary
 void execute(Command<T> cmd)
          Double-dispatch of arbitrary commands, used by action executors and state variable accessors.
 T getImplementation()
           
 PropertyChangeSupport getPropertyChangeSupport()
          Provides the capability to monitor the service for state changes.
 LocalService<T> getService()
           
 Collection<StateVariableValue> readEventedStateVariableValues()
          Reading the state of a service manually.
 

Field Detail

EVENTED_STATE_VARIABLES

static final String EVENTED_STATE_VARIABLES
Use this property name when propagating change events that affect any evented UPnP state variable. This name is detected by the GENA subsystem.

See Also:
Constant Field Values
Method Detail

getService

LocalService<T> getService()
Returns:
The metadata of the service to which this manager is assigned.

getImplementation

T getImplementation()
Returns:
An instance with the interface expected by the bound ActionExecutors and StateVariableAccessors.

execute

void 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 Command and it might decorate the execution, for example, by locking/unlocking access to a shared service implementation before and after the execution.

Parameters:
cmd - The command to execute.
Throws:
Exception - Any exception, without wrapping, as thrown by Command.execute(ServiceManager)

getPropertyChangeSupport

PropertyChangeSupport 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:

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).

Returns:
An adapter that will notify its listeners whenever any evented state variable changes.

readEventedStateVariableValues

Collection<StateVariableValue> readEventedStateVariableValues()
                                                              throws Exception
Reading the state of a service manually.

Returns:
A Collection of StateVariableValue, representing the current state of the service.
Throws:
Exception - Any error that occured when the service's state was accessed.


Copyright © 2010 Teleal GmbH, Switzerland. All Rights Reserved.