Top Description Fields Constructors Methods
org.osgi.service.dmt.security

public Class AlertPermission

Additional top-level class in compilation unit: DmtAlertPermissionCollection.

extends Permission
Class Inheritance
Imports
java.security.Permission, .PermissionCollection, java.util.ArrayList, .Collections, .Enumeration, .Iterator

Indicates the callers authority to send alerts to management servers, identified by their principal names.

AlertPermission has a target string which controls the principal names where alerts can be sent. A wildcard is allowed at the end of the target string, to allow sending alerts to any principal with a name matching the given prefix. The "*" target means that alerts can be sent to any destination.

Author
$Id: cfbfdadc581fb700f0a67bff7fdc67772d18a313 $

Field Summary

Modifier and TypeField and Description
private final boolean
private static final long
private final String

Constructor Summary

AccessConstructor and Description
public
AlertPermission(String
the name of a principal, can end with * to match any principal identifier with the given prefix
target
)

Creates a new AlertPermission object with its name set to the target string.

public
AlertPermission(String
the name of the server, can end with * to match any server identifier with the given prefix
target
,
String
no actions defined, must be "*" for forward compatibility
actions
)

Creates a new AlertPermission object using the 'canonical' two argument constructor.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the parameter represents the same permissions as this instance
equals
(Object
the object to compare to this AlertPermission instance
obj
)

Implements abstract java.security.Permission.equals.

Checks whether the given object is equal to this AlertPermission instance.

public String

Returns:

the action string "*"
getActions
()

Implements abstract java.security.Permission.getActions.

Returns the action list (always * in the current version).

public int

Returns:

hash code for this permission object
hashCode
()

Implements abstract java.security.Permission.hashCode.

Returns the hash code for this permission object.

public boolean

Returns:

true if this AlertPermission instance implies the specified permission
implies
(Permission
the permission to check for implication
p
)

Implements abstract java.security.Permission.implies.

Checks if this AlertPermission object implies the specified permission.

pack-priv boolean
public PermissionCollection

Returns:

the new PermissionCollection
newPermissionCollection
()

Overrides java.security.Permission.newPermissionCollection.

Returns a new PermissionCollection object for storing AlertPermission objects.

Inherited from java.security.Permission:
checkGuardgetNametoString

Field Detail

isPrefixback to summary
private final boolean isPrefix
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.security.Permission.serialVersionUID.

serverIdback to summary
private final String serverId

Constructor Detail

AlertPermissionback to summary
public AlertPermission(String target)

Creates a new AlertPermission object with its name set to the target string. Name must be non-null and non-empty.

Parameters
target:String

the name of a principal, can end with * to match any principal identifier with the given prefix

Exceptions
NullPointerException:
if name is null
IllegalArgumentException:
if name is empty
AlertPermissionback to summary
public AlertPermission(String target, String actions)

Creates a new AlertPermission object using the 'canonical' two argument constructor. In this version this class does not define any actions, the second argument of this constructor must be "*" so that this class can later be extended in a backward compatible way.

Parameters
target:String

the name of the server, can end with * to match any server identifier with the given prefix

actions:String

no actions defined, must be "*" for forward compatibility

Exceptions
NullPointerException:
if name or actions is null
IllegalArgumentException:
if name is empty or actions is not "*"

Method Detail

equalsback to summary
public boolean equals(Object obj)

Implements abstract java.security.Permission.equals.

Checks whether the given object is equal to this AlertPermission instance. Two AlertPermission instances are equal if they have the same target string.

Parameters
obj:Object

the object to compare to this AlertPermission instance

Returns:boolean

true if the parameter represents the same permissions as this instance

Annotations
@Override
getActionsback to summary
public String getActions()

Implements abstract java.security.Permission.getActions.

Returns the action list (always * in the current version).

Returns:String

the action string "*"

Annotations
@Override
hashCodeback to summary
public int hashCode()

Implements abstract java.security.Permission.hashCode.

Returns the hash code for this permission object. If two AlertPermission objects are equal according to the equals(Object) method, then calling this method on each of the two AlertPermission objects must produce the same integer result.

Returns:int

hash code for this permission object

Annotations
@Override
impliesback to summary
public boolean implies(Permission p)

Implements abstract java.security.Permission.implies.

Checks if this AlertPermission object implies the specified permission. Another AlertPermission instance is implied by this permission either if the target strings are identical, or if this target can be made identical to the other target by replacing a trailing "*" with any string.

Parameters
p:Permission

the permission to check for implication

Returns:boolean

true if this AlertPermission instance implies the specified permission

Annotations
@Override
impliesServerback to summary
pack-priv boolean impliesServer(AlertPermission p)
newPermissionCollectionback to summary
public PermissionCollection newPermissionCollection()

Overrides java.security.Permission.newPermissionCollection.

Returns a new PermissionCollection object for storing AlertPermission objects.

Returns:PermissionCollection

the new PermissionCollection

Annotations
@Override