public class MonitorPermission
extends java.security.Permission
StatusVariable
s, to switch event sending on or off or to start
monitoring jobs. The target of the permission is the identifier of the
StatusVariable
, the action can be read
,
publish
, reset
, startjob
,
switchevents
, or the combination of these separated by commas.
Action names are interpreted case-insensitively, but the canonical action
string returned by getActions()
uses the forms defined by the action
constants.
If the wildcard *
appears in the actions field, all legal
monitoring commands are allowed on the designated target(s) by the owner of
the permission.
Modifier and Type | Field and Description |
---|---|
private static int |
ALL_FLAGS |
private int |
mask |
private int |
minJobInterval |
private java.lang.String |
monId |
private boolean |
prefixMonId |
private boolean |
prefixVarId |
static java.lang.String |
PUBLISH
Holders of
MonitorPermission with the publish
action present are Monitorable services that are allowed
to publish the StatusVariable s specified in the
permission's target field. |
private static int |
PUBLISH_FLAG |
static java.lang.String |
READ
Holders of
MonitorPermission with the read
action present are allowed to read the value of the
StatusVariable s specified in the permission's target field. |
private static int |
READ_FLAG |
static java.lang.String |
RESET
Holders of
MonitorPermission with the reset
action present are allowed to reset the value of the
StatusVariable s specified in the permission's target field. |
private static int |
RESET_FLAG |
private static long |
serialVersionUID |
static java.lang.String |
STARTJOB
Holders of
MonitorPermission with the startjob
action present are allowed to initiate monitoring jobs involving the
StatusVariable s specified in the permission's target field. |
private static int |
STARTJOB_FLAG |
static java.lang.String |
SWITCHEVENTS
Holders of
MonitorPermission with the
switchevents action present are allowed to switch event
sending on or off for the value of the StatusVariable s
specified in the permission's target field. |
private static int |
SWITCHEVENTS_FLAG |
private java.lang.String |
varId |
Constructor and Description |
---|
MonitorPermission(java.lang.String statusVariable,
java.lang.String actions)
Create a
MonitorPermission object, specifying the target
and actions. |
Modifier and Type | Method and Description |
---|---|
private void |
addToMask(int action,
java.lang.String actionString) |
private void |
appendAction(java.lang.StringBuffer sb,
int flag,
java.lang.String actionName) |
private void |
checkId(java.lang.String id,
java.lang.String idName) |
boolean |
equals(java.lang.Object o)
Determines the equality of two
MonitorPermission objects. |
java.lang.String |
getActions()
Get the action string associated with this permission.
|
int |
hashCode()
Create an integer hash of the object.
|
boolean |
implies(java.security.Permission p)
Determines if the specified permission is implied by this permission.
|
private boolean |
implies(java.lang.String id,
boolean prefix,
java.lang.String oid,
boolean oprefix) |
private static final long serialVersionUID
public static final java.lang.String READ
MonitorPermission
with the read
action present are allowed to read the value of the
StatusVariable
s specified in the permission's target field.public static final java.lang.String RESET
MonitorPermission
with the reset
action present are allowed to reset the value of the
StatusVariable
s specified in the permission's target field.public static final java.lang.String PUBLISH
MonitorPermission
with the publish
action present are Monitorable
services that are allowed
to publish the StatusVariable
s specified in the
permission's target field. Note, that this permission cannot be enforced
when a Monitorable
registers to the framework, because the
Service Registry does not know about this permission. Instead, any
StatusVariable
s published by a Monitorable
without the corresponding publish
permission are silently
ignored by MonitorAdmin
, and are therefore invisible to the
users of the monitoring service.public static final java.lang.String STARTJOB
MonitorPermission
with the startjob
action present are allowed to initiate monitoring jobs involving the
StatusVariable
s specified in the permission's target field.
A minimal sampling interval can be optionally defined in the following
form: startjob:n
. This allows the holder of the permission
to initiate time based jobs with a measurement interval of at least
n
seconds. If n
is not specified or 0 then the
holder of this permission is allowed to start monitoring jobs specifying
any frequency.
public static final java.lang.String SWITCHEVENTS
MonitorPermission
with the
switchevents
action present are allowed to switch event
sending on or off for the value of the StatusVariable
s
specified in the permission's target field.private static final int READ_FLAG
private static final int RESET_FLAG
private static final int PUBLISH_FLAG
private static final int STARTJOB_FLAG
private static final int SWITCHEVENTS_FLAG
private static final int ALL_FLAGS
private java.lang.String monId
private java.lang.String varId
private boolean prefixMonId
private boolean prefixVarId
private int mask
private int minJobInterval
public MonitorPermission(java.lang.String statusVariable, java.lang.String actions) throws java.lang.IllegalArgumentException
MonitorPermission
object, specifying the target
and actions.
The statusVariable
parameter is the target of the
permission, defining one or more status variable names to which the
specified actions apply. Multiple status variable names can be selected
by using the wildcard *
in the target string. The wildcard
is allowed in both fragments, but only at the end of the fragments.
For example, the following targets are valid:
com.mycomp.myapp/queue_length
,
com.mycomp.myapp/*
, com.mycomp.*/*
,
*/*
, */queue_length
,
*/queue*
.
The following targets are invalid:
*.myapp/queue_length
, com.*.myapp/*
,
*
.
The actions
parameter specifies the allowed action(s):
read
, publish
, startjob
,
reset
, switchevents
, or the combination of
these separated by commas. String constants are defined in this class for
each valid action. Passing "*"
as the action
string is equivalent to listing all actions.
statusVariable
- the identifier of the StatusVariable
in [Monitorable_id]/[StatusVariable_id] formatactions
- the list of allowed actions separated by commas, or
*
for all actionsjava.lang.IllegalArgumentException
- if either parameter is
null
, or invalid with regard to the constraints
defined above and in the documentation of the used actionsprivate void addToMask(int action, java.lang.String actionString)
private void checkId(java.lang.String id, java.lang.String idName) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public int hashCode()
MonitorPermission
s p1
and p2
are
the same if p1.equals(p2)
.hashCode
in class java.security.Permission
public boolean equals(java.lang.Object o)
MonitorPermission
objects.
Two MonitorPermission
objects are equal if their target
strings are equal and the same set of actions are listed in their action
strings.equals
in class java.security.Permission
o
- the object being compared for equality with this objecttrue
if the two permissions are equalpublic java.lang.String getActions()
read
, reset
,
publish
, startjob
, switchevents
.getActions
in class java.security.Permission
null
private void appendAction(java.lang.StringBuffer sb, int flag, java.lang.String actionName)
public boolean implies(java.security.Permission p)
This method returns false
if and only if at least one of the
following conditions are fulfilled for the specified permission:
MonitorPermission
Monitorable
s is not the same nor a
subset of the target set of Monitorable
s of this permission
StatusVariable
s is not the same
nor a subset of the target set of StatusVariable
s of this
permission
implies
in class java.security.Permission
p
- the permission to be checkedtrue
if the given permission is implied by this
permissionprivate boolean implies(java.lang.String id, boolean prefix, java.lang.String oid, boolean oprefix)