public final class SubsystemPermission
extends java.security.BasicPermission
Action Methods context Subsystem.getBundleContext execute Subsystem.start Subsystem.stop lifecycle Subsystem.install Subsystem.uninstall metadata Subsystem.getSubsystemHeaders Subsystem.getLocation
The name of this permission is a filter expression. The filter gives access to the following attributes:
Modifier and Type | Field and Description |
---|---|
private static int |
ACTION_ALL |
private static int |
ACTION_CONTEXT |
private static int |
ACTION_EXECUTE |
private static int |
ACTION_LIFECYCLE |
(package private) int |
action_mask
The actions mask.
|
private static int |
ACTION_METADATA |
(package private) static int |
ACTION_NONE |
private java.lang.String |
actions
The actions in canonical form.
|
static java.lang.String |
CONTEXT
The action string
context . |
static java.lang.String |
EXECUTE
The action string
execute . |
(package private) org.osgi.framework.Filter |
filter
If this SubsystemPermission was constructed with a filter, this holds a
Filter matching object used to evaluate the filter in implies.
|
static java.lang.String |
LIFECYCLE
The action string
lifecycle . |
static java.lang.String |
METADATA
The action string
metadata . |
private java.util.Map<java.lang.String,java.lang.Object> |
properties
This map holds the properties of the permission, used to match a filter
in implies.
|
private static java.lang.ThreadLocal<Subsystem> |
recurse
ThreadLocal used to determine if we have recursively called
getProperties.
|
(package private) static long |
serialVersionUID |
(package private) Subsystem |
subsystem
The subsystem governed by this SubsystemPermission - only used if filter
== null
|
Constructor and Description |
---|
SubsystemPermission(org.osgi.framework.Filter filter,
int mask)
Package private constructor used by SubsystemPermissionCollection.
|
SubsystemPermission(java.lang.String filter,
java.lang.String actions)
Create a new SubsystemPermission.
|
SubsystemPermission(Subsystem subsystem,
java.lang.String actions)
Creates a new requested
SubsystemPermission object to be used by
the code that must perform checkPermission . |
Modifier and Type | Method and Description |
---|---|
private static java.lang.String |
createName(Subsystem subsystem)
Create a permission name from a Subsystem
|
boolean |
equals(java.lang.Object obj)
Determines the equality of two
SubsystemPermission objects. |
java.lang.String |
getActions()
Returns the canonical string representation of the
SubsystemPermission actions. |
private java.util.Map<java.lang.String,java.lang.Object> |
getProperties()
Called by
implies0 on an SubsystemPermission which was
constructed with a Subsystem. |
int |
hashCode()
Returns the hash code value for this object.
|
boolean |
implies(java.security.Permission p)
Determines if the specified permission is implied by this object.
|
(package private) boolean |
implies0(SubsystemPermission requested,
int effective)
Internal implies method.
|
java.security.PermissionCollection |
newPermissionCollection()
Returns a new
PermissionCollection object suitable for storing
SubsystemPermission s. |
private static int |
parseActions(java.lang.String actions)
Parse action string into action mask.
|
private static org.osgi.framework.Filter |
parseFilter(java.lang.String filterString)
Parse filter string into a Filter object.
|
private void |
readObject(java.io.ObjectInputStream s)
readObject is called to restore the state of this permission from a
stream.
|
private void |
setTransients(org.osgi.framework.Filter filter,
int mask)
Called by constructors and when deserialized.
|
private void |
writeObject(java.io.ObjectOutputStream s)
WriteObject is called to save the state of this permission object to a
stream.
|
static final long serialVersionUID
public static final java.lang.String EXECUTE
execute
.public static final java.lang.String LIFECYCLE
lifecycle
.public static final java.lang.String METADATA
metadata
.public static final java.lang.String CONTEXT
context
.private static final int ACTION_EXECUTE
private static final int ACTION_LIFECYCLE
private static final int ACTION_METADATA
private static final int ACTION_CONTEXT
private static final int ACTION_ALL
static final int ACTION_NONE
private volatile java.lang.String actions
transient int action_mask
transient org.osgi.framework.Filter filter
final transient Subsystem subsystem
private transient volatile java.util.Map<java.lang.String,java.lang.Object> properties
private static final java.lang.ThreadLocal<Subsystem> recurse
public SubsystemPermission(java.lang.String filter, java.lang.String actions)
Examples:
(name=com.acme.*)(location=http://www.acme.com/subsystems/*)) (id>=1)
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
, or
context
.java.lang.IllegalArgumentException
- If the filter has an invalid syntax.public SubsystemPermission(Subsystem subsystem, java.lang.String actions)
SubsystemPermission
object to be used by
the code that must perform checkPermission
.
SubsystemPermission
objects created with this constructor cannot
be added to an SubsystemPermission
permission collection.subsystem
- A subsystem.actions
- execute
, lifecycle
, metadata
, or
context
.SubsystemPermission(org.osgi.framework.Filter filter, int mask)
filter
- name filter or null
for wildcard.mask
- action maskprivate static java.lang.String createName(Subsystem subsystem)
subsystem
- Subsystem to use to create permission name.private void setTransients(org.osgi.framework.Filter filter, int mask)
filter
- Permission's filter or null
for wildcard.mask
- action maskprivate static int parseActions(java.lang.String actions)
actions
- Action string.private static org.osgi.framework.Filter parseFilter(java.lang.String filterString)
filterString
- The filter string to parse.null
is returned to indicate a wildcard.java.lang.IllegalArgumentException
- If the filter syntax is invalid.public boolean implies(java.security.Permission p)
This method returns true
if the specified permission is a
SubsystemPermission AND
Special case: if the specified permission was constructed with "*"
filter, then this method returns true
if this object's filter is
"*" and this object's actions include all of the specified permission's
actions
implies
in class java.security.BasicPermission
p
- The requested permission.true
if the specified permission is implied by this
object; false
otherwise.boolean implies0(SubsystemPermission requested, int effective)
requested
- The requested SubsystemPermision which has already been
validated as a proper argument. The requested SubsystemPermission
must not have a filter expression.effective
- The effective actions with which to start.true
if the specified permission is implied by this
object; false
otherwise.public java.lang.String getActions()
SubsystemPermission
actions.
Always returns present SubsystemPermission
actions in the
following order: execute
, lifecycle
, metadata
,
context
.
getActions
in class java.security.BasicPermission
SubsystemPermission
actions.public java.security.PermissionCollection newPermissionCollection()
PermissionCollection
object suitable for storing
SubsystemPermission
s.newPermissionCollection
in class java.security.BasicPermission
PermissionCollection
object.public boolean equals(java.lang.Object obj)
SubsystemPermission
objects.equals
in class java.security.BasicPermission
obj
- The object being compared for equality with this object.true
if obj
is equivalent to this
SubsystemPermission
; false
otherwise.public int hashCode()
hashCode
in class java.security.BasicPermission
private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException
java.io.IOException
private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
private java.util.Map<java.lang.String,java.lang.Object> getProperties()
implies0
on an SubsystemPermission which was
constructed with a Subsystem. This method loads a map with the
filter-matchable properties of this subsystem. The map is cached so this
lookup only happens once.
This method should only be called on an SubsystemPermission which was
constructed with a subsystem