Package org.osgi.service.cm
Class ConfigurationPermission
- java.lang.Object
-
- java.security.Permission
-
- java.security.BasicPermission
-
- org.osgi.service.cm.ConfigurationPermission
-
- All Implemented Interfaces:
java.io.Serializable,java.security.Guard
public final class ConfigurationPermission extends java.security.BasicPermissionIndicates a bundle's authority to configure bundles or be updated by Configuration Admin.- Since:
- 1.2
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static intACTION_ALLprivate static intACTION_ATTRIBUTEprivate static intACTION_CONFIGURE(package private) intaction_maskThe actions mask.(package private) static intACTION_NONEprivate static intACTION_TARGETprivate java.lang.StringactionsThe actions in canonical form.static java.lang.StringATTRIBUTEProvides permission to set or remove an attribute on the configuration.static java.lang.StringCONFIGUREProvides permission to create new configurations for other bundles as well as manipulate them.private static longserialVersionUIDprivate java.util.List<java.lang.String>substringsParsed name if it includes wildcards: "*"static java.lang.StringTARGETThe permission to be updated, that is, act as a Managed Service or Managed Service Factory.
-
Constructor Summary
Constructors Constructor Description ConfigurationPermission(java.lang.String name, int mask)Package private constructor used by ConfigurationPermissionCollection.ConfigurationPermission(java.lang.String name, java.lang.String actions)Create a new ConfigurationPermission.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Determines the equality of twoConfigurationPermissionobjects.java.lang.StringgetActions()Returns the canonical string representation of theConfigurationPermissionactions.inthashCode()Returns the hash code value for this object.booleanimplies(java.security.Permission p)Determines if aConfigurationPermissionobject "implies" the specified permission.(package private) booleanimplies0(ConfigurationPermission requested, int effective)Internal implies method.java.security.PermissionCollectionnewPermissionCollection()Returns a newPermissionCollectionobject suitable for storingConfigurationPermissions.private static intparseActions(java.lang.String actions)Parse action string into action mask.private static java.util.List<java.lang.String>parseSubstring(java.lang.String name)Parse the name for wildcard processing.private voidreadObject(java.io.ObjectInputStream s)readObject is called to restore the state of this permission from a stream.private voidsetTransients(int mask)Called by constructors and when deserialized.private voidwriteObject(java.io.ObjectOutputStream s)WriteObject is called to save the state of this permission object to a stream.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
CONFIGURE
public static final java.lang.String CONFIGURE
Provides permission to create new configurations for other bundles as well as manipulate them. The action string "configure".- See Also:
- Constant Field Values
-
TARGET
public static final java.lang.String TARGET
The permission to be updated, that is, act as a Managed Service or Managed Service Factory. The action string "target".- Since:
- 1.4
- See Also:
- Constant Field Values
-
ATTRIBUTE
public static final java.lang.String ATTRIBUTE
Provides permission to set or remove an attribute on the configuration. The action string "attribute".- Since:
- 1.6
- See Also:
- Constant Field Values
-
ACTION_CONFIGURE
private static final int ACTION_CONFIGURE
- See Also:
- Constant Field Values
-
ACTION_TARGET
private static final int ACTION_TARGET
- See Also:
- Constant Field Values
-
ACTION_ATTRIBUTE
private static final int ACTION_ATTRIBUTE
- See Also:
- Constant Field Values
-
ACTION_ALL
private static final int ACTION_ALL
- See Also:
- Constant Field Values
-
ACTION_NONE
static final int ACTION_NONE
- See Also:
- Constant Field Values
-
action_mask
transient int action_mask
The actions mask.
-
actions
private volatile java.lang.String actions
The actions in canonical form.
-
substrings
private transient java.util.List<java.lang.String> substrings
Parsed name if it includes wildcards: "*"
-
-
Constructor Detail
-
ConfigurationPermission
public ConfigurationPermission(java.lang.String name, java.lang.String actions)Create a new ConfigurationPermission.- Parameters:
name- Name of the permission. Wildcards ('*') are allowed in the name. Duringimplies(Permission), the name is matched to the requested permission using the substring matching rules used byFilters.actions- Comma separated list ofCONFIGURE,TARGET,ATTRIBUTE(case insensitive).
-
ConfigurationPermission
ConfigurationPermission(java.lang.String name, int mask)Package private constructor used by ConfigurationPermissionCollection.- Parameters:
name- location stringmask- action mask
-
-
Method Detail
-
setTransients
private void setTransients(int mask)
Called by constructors and when deserialized.- Parameters:
mask- action mask
-
parseActions
private static int parseActions(java.lang.String actions)
Parse action string into action mask.- Parameters:
actions- Action string.- Returns:
- action mask.
-
parseSubstring
private static java.util.List<java.lang.String> parseSubstring(java.lang.String name)
Parse the name for wildcard processing.- Parameters:
name- The name of the permission.- Returns:
nullis the name has no wildcards or aList<String>where element is a substring to match or null for'*'.
-
implies
public boolean implies(java.security.Permission p)
Determines if aConfigurationPermissionobject "implies" the specified permission.- Overrides:
impliesin classjava.security.BasicPermission- Parameters:
p- The target permission to check.- Returns:
trueif the specified permission is implied by this object;falseotherwise.
-
implies0
boolean implies0(ConfigurationPermission requested, int effective)
Internal implies method. Used by the implies and the permission collection implies methods.- Parameters:
requested- The requested ConfigurationPermission which has already be validated as a proper argument.effective- The effective actions with which to start.- Returns:
trueif the specified permission is implied by this object;falseotherwise.
-
equals
public boolean equals(java.lang.Object obj)
Determines the equality of twoConfigurationPermissionobjects.Two
ConfigurationPermissionobjects are equal.- Overrides:
equalsin classjava.security.BasicPermission- Parameters:
obj- The object being compared for equality with this object.- Returns:
trueifobjis equivalent to thisConfigurationPermission;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.
-
getActions
public java.lang.String getActions()
Returns the canonical string representation of theConfigurationPermissionactions.Always returns present
ConfigurationPermissionactions in the following order: "configure", "target", "attribute".- Overrides:
getActionsin classjava.security.BasicPermission- Returns:
- Canonical string representation of the
ConfigurationPermissionactions.
-
newPermissionCollection
public java.security.PermissionCollection newPermissionCollection()
Returns a newPermissionCollectionobject suitable for storingConfigurationPermissions.- Overrides:
newPermissionCollectionin classjava.security.BasicPermission- Returns:
- A new
PermissionCollectionobject.
-
writeObject
private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOExceptionWriteObject is called to save the state of this permission object to a stream. The actions are serialized, and the superclass takes care of the name.- Throws:
java.io.IOException
-
readObject
private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, java.lang.ClassNotFoundExceptionreadObject is called to restore the state of this permission from a stream.- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
-