Interface Monitorable
-
public interface MonitorableAMonitorablecan provide information about itself in the form ofStatusVariables. Instances of this interface should register themselves at the OSGi Service Registry. TheMonitorAdminlistens to the registration ofMonitorableservices, and makes the information they provide available also through the Device Management Tree (DMT) for remote access.The monitorable service is identified by its PID string which must be a non-
null, non-empty string that conforms to the "symbolic-name" definition in the OSGi core specification. This means that only the characters [-_.a-zA-Z0-9] may be used. The length of the PID must not exceed 32 characters.A
Monitorablemay optionally support sending notifications when the status of itsStatusVariableschange. Support for change notifications can be defined perStatusVariable.Publishing
StatusVariablesrequires the presence of theMonitorPermissionwith thepublishaction string. This permission, however, is not checked during registration of theMonitorableservice. Instead, theMonitorAdminimplementation must make sure that when aStatusVariableis queried, it is shown only if theMonitorableis authorized to publish the givenStatusVariable.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.StringgetDescription(java.lang.String id)Returns a human readable description of aStatusVariable.StatusVariablegetStatusVariable(java.lang.String id)Returns theStatusVariableobject addressed by its identifier.java.lang.String[]getStatusVariableNames()Returns the list ofStatusVariableidentifiers published by thisMonitorable.booleannotifiesOnChange(java.lang.String id)Tells whether theStatusVariableprovider is able to send instant notifications when the givenStatusVariablechanges.booleanresetStatusVariable(java.lang.String id)Issues a request to reset a givenStatusVariable.
-
-
-
Method Detail
-
getStatusVariableNames
java.lang.String[] getStatusVariableNames()
Returns the list ofStatusVariableidentifiers published by thisMonitorable. AStatusVariablename is unique within the scope of aMonitorable. The array contains the elements in no particular order. The returned value must not benull.- Returns:
- the
StatusVariableidentifiers published by this object, or an empty array if none are published
-
getStatusVariable
StatusVariable getStatusVariable(java.lang.String id) throws java.lang.IllegalArgumentException
Returns theStatusVariableobject addressed by its identifier. TheStatusVariablewill hold the value taken at the time of this method call.The given identifier does not contain the Monitorable PID, i.e. it specifies the name and not the path of the Status Variable.
- Parameters:
id- the identifier of theStatusVariable, cannot benull- Returns:
- the
StatusVariableobject - Throws:
java.lang.IllegalArgumentException- ifidpoints to a non-existingStatusVariable
-
notifiesOnChange
boolean notifiesOnChange(java.lang.String id) throws java.lang.IllegalArgumentExceptionTells whether theStatusVariableprovider is able to send instant notifications when the givenStatusVariablechanges. If theMonitorablesupports sending change updates it must notify theMonitorListenerwhen the value of theStatusVariablechanges. TheMonitorablefinds theMonitorListenerservice through the Service Registry.The given identifier does not contain the Monitorable PID, i.e. it specifies the name and not the path of the Status Variable.
- Parameters:
id- the identifier of theStatusVariable, cannot benull- Returns:
trueif theMonitorablecan send notification when the givenStatusVariablechanges,falseotherwise- Throws:
java.lang.IllegalArgumentException- ifidpoints to a non-existingStatusVariable
-
resetStatusVariable
boolean resetStatusVariable(java.lang.String id) throws java.lang.IllegalArgumentExceptionIssues a request to reset a givenStatusVariable. Depending on the semantics of the actual Status Variable this call may or may not succeed: it makes sense to reset a counter to its starting value, but for example aStatusVariableof typeStringmight not have a meaningful default value. Note that for numericStatusVariablesthe starting value may not necessarily be 0. Resetting aStatusVariablemust trigger a monitor event.The given identifier does not contain the Monitorable PID, i.e. it specifies the name and not the path of the Status Variable.
- Parameters:
id- the identifier of theStatusVariable, cannot benull- Returns:
trueif theMonitorablecould successfully reset the givenStatusVariable,falseotherwise- Throws:
java.lang.IllegalArgumentException- ifidpoints to a non-existingStatusVariable
-
getDescription
java.lang.String getDescription(java.lang.String id) throws java.lang.IllegalArgumentExceptionReturns a human readable description of aStatusVariable. This can be used by management systems on their GUI. Thenullreturn value is allowed if there is no description for the specified Status Variable.The given identifier does not contain the Monitorable PID, i.e. it specifies the name and not the path of the Status Variable.
- Parameters:
id- the identifier of theStatusVariable, cannot benull- Returns:
- the human readable description of this
StatusVariableornullif it is not set - Throws:
java.lang.IllegalArgumentException- ifidpoints to a non-existingStatusVariable
-
-