|
Framework Professional Edition Package |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
public interface ControlUnitFactory
This interface may be registered as an OSGi service in order to make more then
one resources of the same type manageable through the Control Unit abstraction.
The ControlUnitFactory services should not be used directly by the applications.
Instead application access ControlUnitAdmin service, which
delegates the requests to the appropriate ControlUnitFactory or
ManagedControlUnit service.
ControlUnitFactories are suitable for representing variable number of resources with
similar characteristics. An advantage is that it is not necessary to permanently hold
Control Unit instance for every resource, because the corresponding wrapper may be
created on demand.
ControlUnitAdmin service is responsible for tracking all
ControlUnitFactory services registered in the service registry of the
framework.
One ControlUnitFactory may be responsible for providing ControlUnit instances
of exacly one type. It is not allowed to have more then one factory for the same type
and it is not allowed to have both ControlUnitFactory and
ManagedControlUnit services for the same
ControlUnit type.
To be properly handled by the Control Unit Admin the ControlUnitFactory
service must be registered with property ControlConstants.TYPE
with value of type String specifying the type of the Control Unit instances
exported by this factory. Optionally the registration properties may contain property
ControlConstants.PARENT_TYPE with value of type String
or String[] specifying the type(s) of parent control units in the control unit
hierarchy.
Factories wich support versioning of their control units' type should
additionaly register with the property
ControlConstants.VERSION with value of
type String.
| Method Summary | |
|---|---|
java.lang.String |
createControlUnit(java.lang.String constructorID,
java.lang.Object arguments)
Explicitly creates control unit and returns the id of the newly created control unit. |
void |
destroyControlUnit(java.lang.String controlUnitID)
Explicitly removes control unit instance with a given id. |
java.lang.String[] |
findControlUnits(java.lang.String finderID,
java.lang.Object arguments)
Returns ids of the control units satisfying the finder method and the supplied argument(s). |
ControlUnit |
getControlUnit(java.lang.String controlUnitID)
Returns the ControlUnit object, identified by the given id. |
java.lang.String[] |
getControlUnits(java.lang.String parentControlUnitType,
java.lang.String parentControlUnitID)
Returns ids of the control unit instances which are children of a control unit with a given type and id. |
java.lang.String[] |
getParents(java.lang.String childControlUnitID,
java.lang.String parentControlUnitType)
Returns the ids of the parents of a given control unit specified by its id. |
java.lang.Object |
invokeAction(java.lang.String controlUnitID,
java.lang.String actionID,
java.lang.Object arguments)
Executes the specified action over a control unit with specified id. |
java.lang.String[] |
listControlUnits()
Returns the ids of all control units currently exported by this factory. |
java.lang.Object |
queryStateVariable(java.lang.String controlUnitID,
java.lang.String stateVariableID)
Queries a control unit with a specified id for the value of the specified state variable. |
void |
setControlUnitCallback(CUAdminCallback adminCallback)
Supplies the Control Unit admin callback interface to the implementation of the ControlUnitFactory service. |
| Method Detail |
|---|
void setControlUnitCallback(CUAdminCallback adminCallback)
ControlUnitFactory service.
null argument
after registration of the ControlUnitFactory service or after startup of
the Control Unit Admin for already registered factories.
null argument during unregistration
of the ControlUnitFactory service or when the Control Unit Admin is stopped.
adminCallback - reference to the control unit callback interface or null
if previously set reference is not longer valid.ControlUnit getControlUnit(java.lang.String controlUnitID)
ControlUnit object, identified by the given id.
If there is no such control unit maintained by this factory,
null is returned.
controlUnitID - the id of the requested control unit
ControlUnit object with the given id.
java.lang.String[] getControlUnits(java.lang.String parentControlUnitType,
java.lang.String parentControlUnitID)
parentControlUnitType - type of the parent control unitparentControlUnitID - id of the parent control unit
java.lang.String[] listControlUnits()
java.lang.String[] findControlUnits(java.lang.String finderID,
java.lang.Object arguments)
throws java.lang.Exception
ControlUnitFactory may optionally define in its metadata
one or more methods for filtering of control units. This methods are called finders
are specified in the metadata definition for particular type of Control Units.
A finder is defined as a special class of action with identifier starting with
"$find.". Every finder method may have different number and/or
type of arguments, specified in the metadata and implemented by the corresponding
ControlUnitFactory.
null.
finderID - the id of the finder method. Must start with "$find.".arguments - the finder argument(s). If the argument is only
one this is the argument itself. If the arguments are more then one, the
value must be a Object[] and arguments are retrieved from
that array.
- Returns:
- the sub-control units of the specified control unit.
- Throws:
java.lang.Exception - if an error occures while searching control units.
java.lang.IllegalArgumentException - if this factory does not have finder
with the supplied Id or the arguments number and/or types do not match the
finder arguments.
java.lang.String[] getParents(java.lang.String childControlUnitID,
java.lang.String parentControlUnitType)
childControlUnitID - id of the child unitparentControlUnitType - type of the returned parent units
java.lang.Object queryStateVariable(java.lang.String controlUnitID,
java.lang.String stateVariableID)
controlUnitID - the id of the control unit provided by this factorystateVariableID - the id of the variable
java.lang.Object invokeAction(java.lang.String controlUnitID,
java.lang.String actionID,
java.lang.Object arguments)
throws java.lang.Exception
controlUnitID - the id of the control unitactionID - the id of the actionarguments - the input argument(s). If the argument is only one this is
the argument itself. If the arguments are more then one, the
value must be a Object[] and arguments are retrieved
from that array.
null if the action does not
return value.
java.lang.Exception - if an error occures while executing action.
java.lang.IllegalArgumentException - if this factory does not have action
with the supplied Id or the arguments number and/or types do not match the
action arguments.
java.lang.String createControlUnit(java.lang.String constructorID,
java.lang.Object arguments)
throws java.lang.Exception
ControlUnitFactory may optionally define in its
metadata one or more methods for creating of new control units. These methods are
called constructors and are specified in the the metadata definition for the particular
type of Control Units. A constructor is defined as a special class of
action with identifier starting with "$create.". Every constructor method
may have different number and/or types of arguments, specified in the metadata and
implemented by the corresponding ControlUnitFactory.
constructorID - the id of the constructors. Must start with "$create.".arguments - - the 'constructors' argument(s). If the argument is only
one this is the argument itself. If the arguments are more then one, the
value must be a Object[] and arguments are retrieved from that array.
- Returns:
- the id of the newly created control unit.
- Throws:
java.lang.Exception - if an error occures while creating Control Unit.
java.lang.IllegalArgumentException - if this factory does not have contructor
with the supplied Id or the arguments number and/or types do not match the
contructor arguments.
void destroyControlUnit(java.lang.String controlUnitID)
throws java.lang.Exception
IllegalArgumentException. Support for explicit destoying of
Control Units is specified in the control unit metadata by presense of an
action with id "$destroy".
controlUnitID - control unit id.
java.lang.Exception - if an error occures while destroying of the Control Unit.
java.lang.IllegalArgumentException - if this factory does not support
explicit destroy of the control units.
|
Framework Professional Edition Package |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||