Package org.osgi.service.application
Class ApplicationAdminPermission
- java.lang.Object
-
- java.security.Permission
-
- org.osgi.service.application.ApplicationAdminPermission
-
- All Implemented Interfaces:
java.io.Serializable,java.security.Guard
public class ApplicationAdminPermission extends java.security.PermissionThis class implements permissions for manipulating applications and their instances.ApplicationAdminPermission can be targeted to applications that matches the specified filter.
ApplicationAdminPermission may be granted for different actions:
lifecycle,scheduleandlock. The permissionscheduleimplies the permissionlifecycle.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classApplicationAdminPermission.SignerWrapper
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringactionsprivate static java.util.VectorACTIONSprivate java.util.VectoractionsVectorprivate ApplicationDescriptorapplicationDescriptorprivate java.lang.StringapplicationIDprivate org.osgi.framework.FilterappliedFilterprivate java.lang.Stringfilterstatic java.lang.StringLIFECYCLE_ACTIONAllows the lifecycle management of the target applications.static java.lang.StringLOCK_ACTIONAllows setting/unsetting the locking state of the target applications.static java.lang.StringSCHEDULE_ACTIONAllows scheduling of the target applications.private static longserialVersionUID
-
Constructor Summary
Constructors Constructor Description ApplicationAdminPermission(java.lang.String filter, java.lang.String actions)Constructs an ApplicationAdminPermission.ApplicationAdminPermission(ApplicationDescriptor application, java.lang.String actions)This constructor should be used when creatingApplicationAdminPermissioninstance forcheckPermissioncall.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.util.VectoractionsVector(java.lang.String actions)private static booleanequal(java.lang.Object a, java.lang.Object b)Compares parameters for equality.booleanequals(java.lang.Object with)java.lang.StringgetActions()Returns the actions of this permission.private org.osgi.framework.FiltergetFilter()inthashCode()booleanimplies(java.security.Permission otherPermission)Checks if the specifiedpermissionis implied by this permission.private voidinit()ApplicationAdminPermissionsetCurrentApplicationId(java.lang.String applicationId)This method can be used in theProtectionDomainimplementation in theimpliesmethod to insert the application ID of the current application into the permission being checked.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
LIFECYCLE_ACTION
public static final java.lang.String LIFECYCLE_ACTION
Allows the lifecycle management of the target applications.- See Also:
- Constant Field Values
-
SCHEDULE_ACTION
public static final java.lang.String SCHEDULE_ACTION
Allows scheduling of the target applications. The permission to schedule an application implies that the scheduler can also manage the lifecycle of that application i.e.scheduleimplieslifecycle- See Also:
- Constant Field Values
-
LOCK_ACTION
public static final java.lang.String LOCK_ACTION
Allows setting/unsetting the locking state of the target applications.- See Also:
- Constant Field Values
-
applicationDescriptor
private ApplicationDescriptor applicationDescriptor
-
applicationID
private java.lang.String applicationID
-
ACTIONS
private static final java.util.Vector ACTIONS
-
actionsVector
private java.util.Vector actionsVector
-
filter
private final java.lang.String filter
-
actions
private final java.lang.String actions
-
appliedFilter
private org.osgi.framework.Filter appliedFilter
-
-
Constructor Detail
-
ApplicationAdminPermission
public ApplicationAdminPermission(java.lang.String filter, java.lang.String actions) throws org.osgi.framework.InvalidSyntaxExceptionConstructs an ApplicationAdminPermission. Thefilterspecifies the target application. Thefilteris an LDAP-style filter, the recognized properties aresignerandpid. The pattern specified in thesigneris matched with the Distinguished Name chain used to sign the application. Wildcards in a DN are not matched according to the filter string rules, but according to the rules defined for a DN chain. The attributepidis matched with the PID of the application according to the filter string rules.If the
filterisnullthen it matches"*". Ifactionsis"*"then it identifies all the possible actions.- Parameters:
filter- filter to identify application. The valuenullis equivalent to"*"and it indicates "all application".actions- comma-separated list of the desired actions granted on the applications or "*" means all the actions. It must not benull. The order of the actions in the list is not significant.- Throws:
org.osgi.framework.InvalidSyntaxException- is thrown if the specifiedfilteris not syntactically correct.java.lang.NullPointerException- is thrown if the actions parameter isnull- See Also:
ApplicationDescriptor,AdminPermission
-
ApplicationAdminPermission
public ApplicationAdminPermission(ApplicationDescriptor application, java.lang.String actions)
This constructor should be used when creatingApplicationAdminPermissioninstance forcheckPermissioncall.- Parameters:
application- The target of the operation, it must not benull.actions- The required operation, it must not benull.- Throws:
java.lang.NullPointerException- If any of the arguments is null.
-
-
Method Detail
-
setCurrentApplicationId
public ApplicationAdminPermission setCurrentApplicationId(java.lang.String applicationId)
This method can be used in theProtectionDomainimplementation in theimpliesmethod to insert the application ID of the current application into the permission being checked. This enables the evaluation of the<<SELF>>pseudo targets.- Parameters:
applicationId- the ID of the current application.- Returns:
- the permission updated with the ID of the current application
-
implies
public boolean implies(java.security.Permission otherPermission)
Checks if the specifiedpermissionis implied by this permission. The method returns true under the following conditions:- This permission was created by specifying a filter (see
ApplicationAdminPermission(String, String)) - The implied
otherPermissionwas created for a particularApplicationDescriptor(seeApplicationAdminPermission(ApplicationDescriptor, String)) - The
filterof this permission matches theApplicationDescriptorspecified in theotherPermission. If the filter in this permission is the<<SELF>>pseudo target, then the currentApplicationId set in theotherPermissionis compared to the application Id of the targetApplicationDescriptor. - The list of permitted actions in this permission contains all actions
required in the
otherPermission
- Specified by:
impliesin classjava.security.Permission- Parameters:
otherPermission- the implied permission- Returns:
- true if this permission implies the
otherPermission, false otherwise.
- This permission was created by specifying a filter (see
-
equals
public boolean equals(java.lang.Object with)
- Specified by:
equalsin classjava.security.Permission
-
equal
private static boolean equal(java.lang.Object a, java.lang.Object b)Compares parameters for equality. If both object are null, they are considered equal.- Parameters:
a- object to compareb- other object to compare- Returns:
- true if both objects are equal or both are null
-
hashCode
public int hashCode()
- Specified by:
hashCodein classjava.security.Permission
-
getActions
public java.lang.String getActions()
Returns the actions of this permission.- Specified by:
getActionsin classjava.security.Permission- Returns:
- the actions specified when this permission was created
-
actionsVector
private static java.util.Vector actionsVector(java.lang.String actions)
-
init
private void init()
-
getFilter
private org.osgi.framework.Filter getFilter()
-
-