|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.knowhowlab.osgi.monitoradmin.MonitorAdminImpl
public class MonitorAdminImpl
MonitorAdmin implementation
| Constructor Summary | |
|---|---|
MonitorAdminImpl(LogVisitor logVisitor,
MonitorAdminCommon common,
org.osgi.framework.Bundle consumer)
Initialize MonitorAdmin implementation instance |
|
| Method Summary | |
|---|---|
java.lang.String |
getDescription(java.lang.String path)
Returns a human readable description of the given StatusVariable. |
java.lang.String[] |
getMonitorableNames()
Returns the names of the Monitorable services that are
currently registered. |
MonitoringJob[] |
getRunningJobs()
Returns the list of currently running MonitoringJobs. |
StatusVariable |
getStatusVariable(java.lang.String path)
Returns a StatusVariable addressed by its full path. |
java.lang.String[] |
getStatusVariableNames(java.lang.String monitorableId)
Returns the list of StatusVariable names published by a
Monitorable instance. |
StatusVariable[] |
getStatusVariables(java.lang.String monitorableId)
Returns the StatusVariable objects published by a
Monitorable instance. |
boolean |
resetStatusVariable(java.lang.String path)
Issues a request to reset a given StatusVariable. |
MonitoringJob |
startJob(java.lang.String initiator,
java.lang.String[] statusVariables,
int count)
Starts a change based MonitoringJob with the parameters
provided. |
MonitoringJob |
startScheduledJob(java.lang.String initiator,
java.lang.String[] statusVariables,
int schedule,
int count)
Starts a time based MonitoringJob with the parameters
provided. |
void |
switchEvents(java.lang.String path,
boolean on)
Switches event sending on or off for the specified StatusVariables. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MonitorAdminImpl(LogVisitor logVisitor,
MonitorAdminCommon common,
org.osgi.framework.Bundle consumer)
logVisitor - loggers visitorcommon - commons actionsconsumer - bundle-consumer| Method Detail |
|---|
public StatusVariable getStatusVariable(java.lang.String path)
throws java.lang.IllegalArgumentException,
java.lang.SecurityException
StatusVariable addressed by its full path.
The entity which queries a StatusVariable needs to hold
MonitorPermission for the given target with the
read action present.
getStatusVariable in interface MonitorAdminpath - the full path of the StatusVariable in
[Monitorable_ID]/[StatusVariable_ID] format
StatusVariable object
java.lang.IllegalArgumentException - if path is
null or otherwise invalid, or points to a
non-existing StatusVariable
java.lang.SecurityException - if the caller does not hold a
MonitorPermission for the
StatusVariable specified by path
with the read action present
public java.lang.String getDescription(java.lang.String path)
throws java.lang.IllegalArgumentException,
java.lang.SecurityException
StatusVariable. The null value may be returned
if there is no description for the given StatusVariable.
The entity that queries a StatusVariable needs to hold
MonitorPermission for the given target with the
read action present.
getDescription in interface MonitorAdminpath - the full path of the StatusVariable in
[Monitorable_ID]/[StatusVariable_ID] format
StatusVariable or null if it is not
set
java.lang.IllegalArgumentException - if path is
null or otherwise invalid, or points to a
non-existing StatusVariable
java.lang.SecurityException - if the caller does not hold a
MonitorPermission for the
StatusVariable specified by path
with the read action presentpublic java.lang.String[] getMonitorableNames()
Monitorable services that are
currently registered. The Monitorable instances are not
accessible through the MonitorAdmin, so that requests to
individual status variables can be filtered with respect to the
publishing rights of the Monitorable and the reading
rights of the caller.
The returned array contains the names in alphabetical order. It cannot be
null, an empty array is returned if no
Monitorable services are registered.
getMonitorableNames in interface MonitorAdminMonitorable names
public StatusVariable[] getStatusVariables(java.lang.String monitorableId)
throws java.lang.IllegalArgumentException
StatusVariable objects published by a
Monitorable instance. The StatusVariables
will hold the values taken at the time of this method call. Only those
status variables are returned where the following two conditions are met:
Monitorable holds a
MonitorPermission for the status variable with the
publish action present
MonitorPermission for the status
variable with the read action present
null, an empty array is returned if no
(authorized and readable) Status Variables are provided by the given
Monitorable.
getStatusVariables in interface MonitorAdminmonitorableId - the identifier of a Monitorable
instance
StatusVariable objects published
by the specified Monitorable
java.lang.IllegalArgumentException - if monitorableId
is null or otherwise invalid, or points to a
non-existing Monitorable
public java.lang.String[] getStatusVariableNames(java.lang.String monitorableId)
throws java.lang.IllegalArgumentException
StatusVariable names published by a
Monitorable instance. Only those status variables are
listed where the following two conditions are met:
Monitorable holds a
MonitorPermission for the status variable with the
publish action present
MonitorPermission for
the status variable with the read action present
null, an empty array is
returned if no (authorized and readable) Status Variables are provided
by the given Monitorable.
getStatusVariableNames in interface MonitorAdminmonitorableId - the identifier of a Monitorable
instance
StatusVariable objects names
published by the specified Monitorable
java.lang.IllegalArgumentException - if monitorableId
is null or otherwise invalid, or points to a
non-existing Monitorable
public boolean resetStatusVariable(java.lang.String path)
throws java.lang.IllegalArgumentException,
java.lang.SecurityException
StatusVariable.
Depending on the semantics of the StatusVariable this call
may or may not succeed: it makes sense to reset a counter to its starting
value, but e.g. a StatusVariable of type String might not
have a meaningful default value. Note that for numeric
StatusVariables the starting value may not necessarily be
0. Resetting a StatusVariable triggers a monitor event if
the StatusVariable supports update notifications.
The entity that wants to reset the StatusVariable needs to
hold MonitorPermission with the reset
action present. The target field of the permission must match the
StatusVariable name to be reset.
resetStatusVariable in interface MonitorAdminpath - the identifier of the StatusVariable in
[Monitorable_id]/[StatusVariable_id] format
true if the Monitorable could
successfully reset the given StatusVariable,
false otherwise
java.lang.IllegalArgumentException - if path is
null or otherwise invalid, or points to a
non-existing StatusVariable
java.lang.SecurityException - if the caller does not hold
MonitorPermission with the reset
action or if the specified StatusVariable is not
allowed to be reset as per the target field of the permission
public void switchEvents(java.lang.String path,
boolean on)
throws java.lang.IllegalArgumentException,
java.lang.SecurityException
StatusVariables. When the MonitorAdmin is
notified about a StatusVariable being updated it sends an
event unless this feature is switched off. Note that events within a
monitoring job can not be switched off. The event sending state of the
StatusVariables must not be persistently stored. When a
StatusVariable is registered for the first time in a
framework session, its event sending state is set to ON by default.
Usage of the "*" wildcard is allowed in the path argument of this method
as a convenience feature. The wildcard can be used in either or both path
fragments, but only at the end of the fragments. The semantics of the
wildcard is that it stands for any matching StatusVariable
at the time of the method call, it does not affect the event sending
status of StatusVariables which are not yet registered. As
an example, when the switchEvents("MyMonitorable/*", false)
method is executed, event sending from all StatusVariables
of the MyMonitorable service are switched off. However, if the
MyMonitorable service starts to publish a new StatusVariable
later, it's event sending status is on by default.
switchEvents in interface MonitorAdminpath - the identifier of the StatusVariable(s) in
[Monitorable_id]/[StatusVariable_id] format, possibly with the
"*" wildcard at the end of either path fragmenton - false if event sending should be switched off,
true if it should be switched on for the given path
java.lang.SecurityException - if the caller does not hold
MonitorPermission with the
switchevents action or if there is any
StatusVariable in the path field for
which it is not allowed to switch event sending on or off as per
the target field of the permission
java.lang.IllegalArgumentException - if path is
null or otherwise invalid, or points to a
non-existing StatusVariable
public MonitoringJob startScheduledJob(java.lang.String initiator,
java.lang.String[] statusVariables,
int schedule,
int count)
throws java.lang.IllegalArgumentException,
java.lang.SecurityException
MonitoringJob with the parameters
provided. Monitoring events will be sent according to the specified
schedule. All specified StatusVariables must exist when the
job is started. The initiator string is used in the
mon.listener.id field of all events triggered by the job,
to allow filtering the events based on the initiator.
The schedule parameter specifies the time in seconds
between two measurements, it must be greater than 0. The first
measurement will be taken when the timer expires for the first time, not
when this method is called.
The count parameter defines the number of measurements to be
taken, and must either be a positive integer, or 0 if the measurement is
to run until explicitly stopped.
The entity which initiates a MonitoringJob needs to hold
MonitorPermission for all the specified target
StatusVariables with the startjob action
present. If the permission's action string specifies a minimal sampling
interval then the schedule parameter should be at least as
great as the value in the action string.
startScheduledJob in interface MonitorAdmininitiator - the identifier of the entity that initiated the jobstatusVariables - the list of StatusVariables to be
monitored, with each StatusVariable name given in
[Monitorable_PID]/[StatusVariable_ID] formatschedule - the time in seconds between two measurementscount - the number of measurements to be taken, or 0 for the
measurement to run until explicitly stopped
null
java.lang.IllegalArgumentException - if the list of
StatusVariable names contains an invalid or
non-existing StatusVariable; if
initiator is null or empty; or if the
schedule or count parameters are
invalid
java.lang.SecurityException - if the caller does not hold
MonitorPermission for all the specified
StatusVariables, with the startjob
action present, or if the permission does not allow starting the
job with the given frequency
public MonitoringJob startJob(java.lang.String initiator,
java.lang.String[] statusVariables,
int count)
throws java.lang.IllegalArgumentException,
java.lang.SecurityException
MonitoringJob with the parameters
provided. Monitoring events will be sent when the
StatusVariables of this job are updated. All specified
StatusVariables must exist when the job is started, and
all must support update notifications. The initiator string is used in
the mon.listener.id field of all events triggered by the
job, to allow filtering the events based on the initiator.
The count parameter specifies the number of changes that
must happen to a StatusVariable before a new notification is
sent, this must be a positive integer.
The entity which initiates a MonitoringJob needs to hold
MonitorPermission for all the specified target
StatusVariables with the startjob action
present.
startJob in interface MonitorAdmininitiator - the identifier of the entity that initiated the jobstatusVariables - the list of StatusVariables to be
monitored, with each StatusVariable name given in
[Monitorable_PID]/[StatusVariable_ID] formatcount - the number of changes that must happen to a
StatusVariable before a new notification is sent
null
java.lang.IllegalArgumentException - if the list of
StatusVariable names contains an invalid or
non-existing StatusVariable, or one that does not
support notifications; if the initiator is
null or empty; or if count is invalid
java.lang.SecurityException - if the caller does not hold
MonitorPermission for all the specified
StatusVariables, with the startjob
action presentpublic MonitoringJob[] getRunningJobs()
MonitoringJobs.
Jobs are only visible to callers that have the necessary permissions: to
receive a Monitoring Job in the returned list, the caller must hold all
permissions required for starting the job. This means that if the caller
does not have MonitorPermission with the proper
startjob action for all the Status Variables monitored by a
job, then that job will be silently omitted from the results.
The returned array cannot be null, an empty array is
returned if there are no running jobs visible to the caller at the time
of the call.
getRunningJobs in interface MonitorAdmin
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||