public final class AdminPermission
extends java.security.BasicPermission
Action Methods class Bundle.loadClass execute Bundle.start Bundle.stop StartLevel.setBundleStartLevel extensionLifecycle BundleContext.installBundle for extension bundles Bundle.update for extension bundles Bundle.uninstall for extension bundles lifecycle BundleContext.installBundle Bundle.update Bundle.uninstall listener BundleContext.addBundleListener for SynchronousBundleListener BundleContext.removeBundleListener for SynchronousBundleListener metadata Bundle.getHeaders Bundle.getLocation resolve PackageAdmin.refreshPackages PackageAdmin.resolveBundles resource Bundle.getResource Bundle.getResources Bundle.getEntry Bundle.getEntryPaths Bundle.findEntries Bundle resource/entry URL creation startlevel StartLevel.setStartLevel StartLevel.setInitialBundleStartLevel context Bundle.getBundleContext
The special action "*" will represent all actions. The
resolve
action is implied by the class
,
execute
and resource
actions.
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_CLASS |
private static int |
ACTION_CONTEXT |
private static int |
ACTION_EXECUTE |
private static int |
ACTION_EXTENSIONLIFECYCLE |
private static int |
ACTION_LIFECYCLE |
private static int |
ACTION_LISTENER |
(package private) int |
action_mask
The actions mask.
|
private static int |
ACTION_METADATA |
(package private) static int |
ACTION_NONE |
private static int |
ACTION_RESOLVE |
private static int |
ACTION_RESOURCE |
private static int |
ACTION_STARTLEVEL |
private java.lang.String |
actions
The actions in canonical form.
|
(package private) Bundle |
bundle
The bundle governed by this AdminPermission - only used if filter == null
|
static java.lang.String |
CLASS
The action string
class . |
static java.lang.String |
CONTEXT
The action string
context . |
static java.lang.String |
EXECUTE
The action string
execute . |
static java.lang.String |
EXTENSIONLIFECYCLE
The action string
extensionLifecycle . |
(package private) Filter |
filter
If this AdminPermission 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 |
LISTENER
The action string
listener . |
static java.lang.String |
METADATA
The action string
metadata . |
private java.util.Dictionary |
properties
This dictionary holds the properties of the permission, used to match a
filter in implies.
|
private static java.lang.ThreadLocal |
recurse
ThreadLocal used to determine if we have recursively called
getProperties.
|
static java.lang.String |
RESOLVE
The action string
resolve . |
static java.lang.String |
RESOURCE
The action string
resource . |
(package private) static long |
serialVersionUID |
static java.lang.String |
STARTLEVEL
The action string
startlevel . |
Constructor and Description |
---|
AdminPermission()
Creates a new
AdminPermission object that matches all
bundles and has all actions. |
AdminPermission(Bundle bundle,
java.lang.String actions)
Creates a new requested
AdminPermission object to be used by
the code that must perform checkPermission . |
AdminPermission(Filter filter,
int mask)
Package private constructor used by AdminPermissionCollection.
|
AdminPermission(java.lang.String filter,
java.lang.String actions)
Create a new AdminPermission.
|
Modifier and Type | Method and Description |
---|---|
private static java.lang.String |
createName(Bundle bundle)
Create a permission name from a Bundle
|
boolean |
equals(java.lang.Object obj)
Determines the equality of two
AdminPermission objects. |
java.lang.String |
getActions()
Returns the canonical string representation of the
AdminPermission actions. |
private java.util.Dictionary |
getProperties()
Called by
implies0 on an AdminPermission which was
constructed with a Bundle. |
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(AdminPermission requested,
int effective)
Internal implies method.
|
java.security.PermissionCollection |
newPermissionCollection()
Returns a new
PermissionCollection object suitable for
storing AdminPermission s. |
private static int |
parseActions(java.lang.String actions)
Parse action string into action mask.
|
private static 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(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 CLASS
class
. The class
action
implies the resolve
action.public static final java.lang.String EXECUTE
execute
. The execute
action
implies the resolve
action.public static final java.lang.String EXTENSIONLIFECYCLE
extensionLifecycle
.public static final java.lang.String LIFECYCLE
lifecycle
.public static final java.lang.String LISTENER
listener
.public static final java.lang.String METADATA
metadata
.public static final java.lang.String RESOLVE
resolve
. The resolve
action
is implied by the class
, execute
and
resource
actions.public static final java.lang.String RESOURCE
resource
. The resource
action
implies the resolve
action.public static final java.lang.String STARTLEVEL
startlevel
.public static final java.lang.String CONTEXT
context
.private static final int ACTION_CLASS
private static final int ACTION_EXECUTE
private static final int ACTION_LIFECYCLE
private static final int ACTION_LISTENER
private static final int ACTION_METADATA
private static final int ACTION_RESOLVE
private static final int ACTION_RESOURCE
private static final int ACTION_STARTLEVEL
private static final int ACTION_EXTENSIONLIFECYCLE
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 Filter filter
final transient Bundle bundle
private transient volatile java.util.Dictionary properties
private static final java.lang.ThreadLocal recurse
public AdminPermission()
AdminPermission
object that matches all
bundles and has all actions. Equivalent to AdminPermission("*","*");public AdminPermission(java.lang.String filter, java.lang.String actions)
Examples:
(signer=\*,o=ACME,c=US) (&(signer=\*,o=ACME,c=US)(name=com.acme.*)(location=http://www.acme.com/bundles/*)) (id>=1)
When a signer key is used within the filter expression the signer value must escape the special filter chars ('*', '(', ')').
Null arguments are equivalent to "*".
filter
- A filter expression that can use signer, location, id, and
name keys. A value of "*" or null
matches
all bundle. Filter attribute names are processed in a case
sensitive manner.actions
- class
, execute
,
extensionLifecycle
, lifecycle
,
listener
, metadata
, resolve
, resource
, startlevel
or
context
. A value of "*" or null
indicates all actions.java.lang.IllegalArgumentException
- If the filter has an invalid syntax.public AdminPermission(Bundle bundle, java.lang.String actions)
AdminPermission
object to be used by
the code that must perform checkPermission
.
AdminPermission
objects created with this constructor cannot
be added to an AdminPermission
permission collection.bundle
- A bundle.actions
- class
, execute
,
extensionLifecycle
, lifecycle
,
listener
, metadata
, resolve
, resource
, startlevel
,
context
. A value of "*" or null
indicates all actions.AdminPermission(Filter filter, int mask)
filter
- name filter or null
for wildcard.mask
- action maskprivate static java.lang.String createName(Bundle bundle)
bundle
- Bundle to use to create permission name.private void setTransients(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 Filter parseFilter(java.lang.String filterString)
filterString
- The filter string to parse.null
or equals "*", then 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 an
AdminPermission 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(AdminPermission requested, int effective)
requested
- The requested AdminPermision which has already be
validated as a proper argument. The requested AdminPermission 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()
AdminPermission
actions.
Always returns present AdminPermission
actions in the
following order: class
, execute
,
extensionLifecycle
, lifecycle
,
listener
, metadata
, resolve
,
resource
, startlevel
, context
.
getActions
in class java.security.BasicPermission
AdminPermission
actions.public java.security.PermissionCollection newPermissionCollection()
PermissionCollection
object suitable for
storing AdminPermission
s.newPermissionCollection
in class java.security.BasicPermission
PermissionCollection
object.public boolean equals(java.lang.Object obj)
AdminPermission
objects.equals
in class java.security.BasicPermission
obj
- The object being compared for equality with this object.true
if obj
is equivalent to this
AdminPermission
; 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.Dictionary getProperties()
implies0
on an AdminPermission which was
constructed with a Bundle. This method loads a dictionary with the
filter-matchable properties of this bundle. The dictionary is cached so
this lookup only happens once.
This method should only be called on an AdminPermission which was
constructed with a bundle