Package org.osgi.service.subsystem
Class SubsystemPermission
- java.lang.Object
-
- java.security.Permission
-
- java.security.BasicPermission
-
- org.osgi.service.subsystem.SubsystemPermission
-
- All Implemented Interfaces:
java.io.Serializable,java.security.Guard
public final class SubsystemPermission extends java.security.BasicPermissionA bundle's authority to perform specific privileged administrative operations on or to get sensitive information about a subsystem. The actions for this permission are:Action Methods context Subsystem.getBundleContext execute Subsystem.start Subsystem.stop lifecycle Subsystem.install Subsystem.uninstall metadata Subsystem.getSubsystemHeaders Subsystem.getLocationThe name of this permission is a filter expression. The filter gives access to the following attributes:
- location - The location of a subsystem.
- id - The subsystem ID of the designated subsystem.
- name - The symbolic name of a subsystem.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description SubsystemPermission(java.lang.String filter, java.lang.String actions)Create a new SubsystemPermission.SubsystemPermission(Subsystem subsystem, java.lang.String actions)Creates a new requestedSubsystemPermissionobject to be used by the code that must performcheckPermission.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Determines the equality of twoSubsystemPermissionobjects.java.lang.StringgetActions()Returns the canonical string representation of theSubsystemPermissionactions.inthashCode()Returns the hash code value for this object.booleanimplies(java.security.Permission p)Determines if the specified permission is implied by this object.java.security.PermissionCollectionnewPermissionCollection()Returns a newPermissionCollectionobject suitable for storingSubsystemPermissions.
-
-
-
Field Detail
-
EXECUTE
public static final java.lang.String EXECUTE
The action stringexecute.- See Also:
- Constant Field Values
-
LIFECYCLE
public static final java.lang.String LIFECYCLE
The action stringlifecycle.- See Also:
- Constant Field Values
-
METADATA
public static final java.lang.String METADATA
The action stringmetadata.- See Also:
- Constant Field Values
-
CONTEXT
public static final java.lang.String CONTEXT
The action stringcontext.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SubsystemPermission
public SubsystemPermission(java.lang.String filter, java.lang.String actions)Create a new SubsystemPermission. This constructor must only be used to create a permission that is going to be checked.Examples:
(name=com.acme.*)(location=http://www.acme.com/subsystems/*)) (id>=1)
- Parameters:
filter- A filter expression that can use, location, id, and name keys. Filter attribute names are processed in a case sensitive manner. A special value of"*"can be used to match all subsystems.actions-execute,lifecycle,metadata, orcontext.- Throws:
java.lang.IllegalArgumentException- If the filter has an invalid syntax.
-
SubsystemPermission
public SubsystemPermission(Subsystem subsystem, java.lang.String actions)
Creates a new requestedSubsystemPermissionobject to be used by the code that must performcheckPermission.SubsystemPermissionobjects created with this constructor cannot be added to anSubsystemPermissionpermission collection.- Parameters:
subsystem- A subsystem.actions-execute,lifecycle,metadata, orcontext.
-
-
Method Detail
-
implies
public boolean implies(java.security.Permission p)
Determines if the specified permission is implied by this object. This method throws an exception if the specified permission was not constructed with a subsystem.This method returns
trueif the specified permission is a SubsystemPermission AND- this object's filter matches the specified permission's subsystem ID, subsystem symbolic name, and subsystem location OR
- this object's filter is "*"
Special case: if the specified permission was constructed with "*" filter, then this method returns
trueif this object's filter is "*" and this object's actions include all of the specified permission's actions- Overrides:
impliesin classjava.security.BasicPermission- Parameters:
p- The requested permission.- Returns:
trueif the specified permission is implied by this object;falseotherwise.
-
getActions
public java.lang.String getActions()
Returns the canonical string representation of theSubsystemPermissionactions.Always returns present
SubsystemPermissionactions in the following order:execute,lifecycle,metadata,context.- Overrides:
getActionsin classjava.security.BasicPermission- Returns:
- Canonical string representation of the
SubsystemPermissionactions.
-
newPermissionCollection
public java.security.PermissionCollection newPermissionCollection()
Returns a newPermissionCollectionobject suitable for storingSubsystemPermissions.- Overrides:
newPermissionCollectionin classjava.security.BasicPermission- Returns:
- A new
PermissionCollectionobject.
-
equals
public boolean equals(java.lang.Object obj)
Determines the equality of twoSubsystemPermissionobjects.- Overrides:
equalsin classjava.security.BasicPermission- Parameters:
obj- The object being compared for equality with this object.- Returns:
trueifobjis equivalent to thisSubsystemPermission;falseotherwise.
-
hashCode
public int hashCode()
Returns the hash code value for this object.- Overrides:
hashCodein classjava.security.BasicPermission- Returns:
- Hash code value for this object.
-
-