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

public Class DmtPrincipalPermission

Additional top-level class in compilation unit: DmtPrincipalPermissionCollection.

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

Indicates the callers authority to create DMT sessions on behalf of a remote management server. Only protocol adapters communicating with management servers should be granted this permission.

DmtPrincipalPermission has a target string which controls the name of the principal on whose behalf the protocol adapter can act. A wildcard is allowed at the end of the target string, to allow using any principal name with the given prefix. The "*" target means the adapter can create a session in the name of any principal.

Author
$Id: bdbba264f6584e09532fd27d6280ceae1d4b830d $

Field Summary

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

Constructor Summary

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

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

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

Creates a new DmtPrincipalPermission 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 DmtPrincipalPermission instance
obj
)

Implements abstract java.security.Permission.equals.

Checks whether the given object is equal to this DmtPrincipalPermission 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 DmtPrincipalPermission instance implies the specified permission
implies
(Permission
the permission to check for implication
p
)

Implements abstract java.security.Permission.implies.

Checks if this DmtPrincipalPermission 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 DmtPrincipalPermission objects.

Inherited from java.security.Permission:
checkGuardgetNametoString

Field Detail

isPrefixback to summary
private final boolean isPrefix
principalback to summary
private final String principal
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.security.Permission.serialVersionUID.

Constructor Detail

DmtPrincipalPermissionback to summary
public DmtPrincipalPermission(String target)

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

Parameters
target:String

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

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

Creates a new DmtPrincipalPermission 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 principal, can end with * to match any principal 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 DmtPrincipalPermission instance. Two DmtPrincipalPermission instances are equal if they have the same target string.

Parameters
obj:Object

the object to compare to this DmtPrincipalPermission 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 DmtPrincipalPermission objects are equal according to the equals(Object) method, then calling this method on each of the two DmtPrincipalPermission 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 DmtPrincipalPermission object implies the specified permission. Another DmtPrincipalPermission 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 DmtPrincipalPermission instance implies the specified permission

Annotations
@Override
impliesPrincipalback to summary
pack-priv boolean impliesPrincipal(DmtPrincipalPermission p)
newPermissionCollectionback to summary
public PermissionCollection newPermissionCollection()

Overrides java.security.Permission.newPermissionCollection.

Returns a new PermissionCollection object for storing DmtPrincipalPermission objects.

Returns:PermissionCollection

the new PermissionCollection

Annotations
@Override