Package org.osgi.service.application
Class ApplicationAdminPermission
java.lang.Object
java.security.Permission
org.osgi.service.application.ApplicationAdminPermission
- All Implemented Interfaces:
Serializable
,Guard
This 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
, schedule
and lock
. The permission
schedule
implies the permission lifecycle
.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final String
private static final Vector
private Vector
private ApplicationDescriptor
private String
private org.osgi.framework.Filter
private final String
static final String
Allows the lifecycle management of the target applications.static final String
Allows setting/unsetting the locking state of the target applications.static final String
Allows scheduling of the target applications.private static final long
-
Constructor Summary
ConstructorsConstructorDescriptionApplicationAdminPermission
(String filter, String actions) Constructs an ApplicationAdminPermission.ApplicationAdminPermission
(ApplicationDescriptor application, String actions) This constructor should be used when creatingApplicationAdminPermission
instance forcheckPermission
call. -
Method Summary
Modifier and TypeMethodDescriptionprivate static Vector
actionsVector
(String actions) private static boolean
Compares parameters for equality.boolean
Returns the actions of this permission.private org.osgi.framework.Filter
int
hashCode()
boolean
implies
(Permission otherPermission) Checks if the specifiedpermission
is implied by this permission.private void
init()
setCurrentApplicationId
(String applicationId) This method can be used in theProtectionDomain
implementation in theimplies
method to insert the application ID of the current application into the permission being checked.Methods inherited from class java.security.Permission
checkGuard, getName, newPermissionCollection, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
LIFECYCLE_ACTION
Allows the lifecycle management of the target applications.- See Also:
-
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.schedule
implieslifecycle
- See Also:
-
LOCK_ACTION
Allows setting/unsetting the locking state of the target applications.- See Also:
-
applicationDescriptor
-
applicationID
-
ACTIONS
-
actionsVector
-
filter
-
actions
-
appliedFilter
private org.osgi.framework.Filter appliedFilter
-
-
Constructor Details
-
ApplicationAdminPermission
public ApplicationAdminPermission(String filter, String actions) throws org.osgi.framework.InvalidSyntaxException Constructs an ApplicationAdminPermission. Thefilter
specifies the target application. Thefilter
is an LDAP-style filter, the recognized properties aresigner
andpid
. The pattern specified in thesigner
is 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 attributepid
is matched with the PID of the application according to the filter string rules.If the
filter
isnull
then it matches"*"
. Ifactions
is"*"
then it identifies all the possible actions.- Parameters:
filter
- filter to identify application. The valuenull
is 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 specifiedfilter
is not syntactically correct.NullPointerException
- is thrown if the actions parameter isnull
- See Also:
-
ApplicationAdminPermission
This constructor should be used when creatingApplicationAdminPermission
instance forcheckPermission
call.- Parameters:
application
- The target of the operation, it must not benull
.actions
- The required operation, it must not benull
.- Throws:
NullPointerException
- If any of the arguments is null.
-
-
Method Details
-
setCurrentApplicationId
This method can be used in theProtectionDomain
implementation in theimplies
method 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
Checks if the specifiedpermission
is 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
otherPermission
was created for a particularApplicationDescriptor
(seeApplicationAdminPermission(ApplicationDescriptor, String)
) - The
filter
of this permission matches theApplicationDescriptor
specified in theotherPermission
. If the filter in this permission is the<<SELF>>
pseudo target, then the currentApplicationId set in theotherPermission
is 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:
implies
in classPermission
- 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
- Specified by:
equals
in classPermission
-
equal
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:
hashCode
in classPermission
-
getActions
Returns the actions of this permission.- Specified by:
getActions
in classPermission
- Returns:
- the actions specified when this permission was created
-
actionsVector
-
init
private void init() -
getFilter
private org.osgi.framework.Filter getFilter()
-