Class EndpointPermission
java.lang.Object
java.security.Permission
org.osgi.service.remoteserviceadmin.EndpointPermission
- All Implemented Interfaces:
Serializable
,Guard
A bundle's authority to export, import or read an Endpoint.
- The
export
action allows a bundle to export a service as an Endpoint. - The
import
action allows a bundle to import a service from an Endpoint. - The
read
action allows a bundle to read references to an Endpoint.
EndpointPermission
to read the specific service.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private static final int
private static final int
(package private) int
The actions mask.(package private) static final int
private static final int
private String
The actions in canonical form.(package private) final EndpointDescription
The endpoint used by this EndpointPermission.static final String
The action stringexport
.(package private) org.osgi.framework.Filter
If this EndpointPermission was not constructed with an EndpointDescription, this holds a Filter matching object used to evaluate the filter in implies ornull
for wildcard.static final String
The action stringimport
.private final Dictionary<String,
Object> This dictionary holds the properties of the permission, used to match a filter in implies.static final String
The action stringread
.(package private) static final long
-
Constructor Summary
ConstructorsConstructorDescriptionEndpointPermission
(String name, int mask) Package private constructor used by EndpointPermissionCollection.EndpointPermission
(String filterString, String actions) Create a new EndpointPermission with the specified filter.EndpointPermission
(EndpointDescription endpoint, String localFrameworkUUID, String actions) Creates a new requestedEndpointPermission
object to be used by code that must performcheckPermission
. -
Method Summary
Modifier and TypeMethodDescriptionprivate static String
createName
(EndpointDescription endpoint) Create a permission name from a EndpointDescription.boolean
Determines the equality of two EndpointPermission objects.Returns the canonical string representation of the actions.private Dictionary<String,
Object> Called byimplies(Permission)
.int
hashCode()
Returns the hash code value for this object.boolean
Determines if aEndpointPermission
object "implies" the specified permission.(package private) boolean
implies0
(EndpointPermission requested, int effective) Internal implies method.Returns a newPermissionCollection
object for storingEndpointPermission
objects.private static int
parseActions
(String actions) Parse action string into action mask.private static org.osgi.framework.Filter
parseFilter
(String filterString) Parse filter string into a Filter object.private void
readObject is called to restore the state of this permission from a stream.private void
setTransients
(org.osgi.framework.Filter f, int mask) Called by constructors and when deserialized.private void
WriteObject is called to save the state of this permission to a stream.Methods inherited from class java.security.Permission
checkGuard, getName, toString
-
Field Details
-
serialVersionUID
static final long serialVersionUID- See Also:
-
READ
The action stringread
.- See Also:
-
IMPORT
The action stringimport
. Theimport
action implies theread
action.- See Also:
-
EXPORT
The action stringexport
. Theexport
action implies theread
action.- See Also:
-
ACTION_READ
private static final int ACTION_READ- See Also:
-
ACTION_IMPORT
private static final int ACTION_IMPORT- See Also:
-
ACTION_EXPORT
private static final int ACTION_EXPORT- See Also:
-
ACTION_ALL
private static final int ACTION_ALL- See Also:
-
ACTION_NONE
static final int ACTION_NONE- See Also:
-
action_mask
transient int action_maskThe actions mask. -
actions
The actions in canonical form. -
endpoint
The endpoint used by this EndpointPermission. Must benull
if not constructed with a endpoint. -
properties
This dictionary holds the properties of the permission, used to match a filter in implies. -
filter
transient org.osgi.framework.Filter filterIf this EndpointPermission was not constructed with an EndpointDescription, this holds a Filter matching object used to evaluate the filter in implies ornull
for wildcard.
-
-
Constructor Details
-
EndpointPermission
Create a new EndpointPermission with the specified filter.The filter will be evaluated against the endpoint properties of a requested EndpointPermission.
There are three possible actions:
read
,import
andexport
. Theread
action allows the owner of this permission to see the presence of distributed services. Theimport
action allows the owner of this permission to import an endpoint. Theexport
action allows the owner of this permission to export a service.- Parameters:
filterString
- The filter string or "*" to match all endpoints.actions
- The actionsread
,import
, orexport
.- Throws:
IllegalArgumentException
- If the filter has an invalid syntax or the actions are not valid.
-
EndpointPermission
Creates a new requestedEndpointPermission
object to be used by code that must performcheckPermission
.EndpointPermission
objects created with this constructor cannot be added to anEndpointPermission
permission collection.- Parameters:
endpoint
- The requested endpoint.localFrameworkUUID
- The UUID of the local framework. This is used to support matching theendpoint.framework.uuid
endpoint property to the<<LOCAL>>
value in the filter expression.actions
- The actionsread
,import
, orexport
.- Throws:
IllegalArgumentException
- If the endpoint isnull
or the actions are not valid.
-
EndpointPermission
EndpointPermission(String name, int mask) Package private constructor used by EndpointPermissionCollection.- Parameters:
name
- class namemask
- action mask
-
-
Method Details
-
createName
Create a permission name from a EndpointDescription.- Parameters:
endpoint
- EndpointDescription to use to create permission name.- Returns:
- permission name.
-
setTransients
private void setTransients(org.osgi.framework.Filter f, int mask) Called by constructors and when deserialized.- Parameters:
mask
- action mask
-
parseActions
Parse action string into action mask.- Parameters:
actions
- Action string.- Returns:
- action mask.
-
parseFilter
Parse filter string into a Filter object.- Parameters:
filterString
- The filter string to parse.- Returns:
- a Filter for this bundle.
- Throws:
IllegalArgumentException
- If the filter syntax is invalid.
-
implies
Determines if aEndpointPermission
object "implies" the specified permission.- Specified by:
implies
in classPermission
- Parameters:
p
- The target permission to check.- Returns:
true
if the specified permission is implied by this object;false
otherwise.
-
implies0
Internal implies method. Used by the implies and the permission collection implies methods.- Parameters:
requested
- The requested EndpointPermission which has already be validated as a proper argument. The requested EndpointPermission must not have a filter expression.effective
- The effective actions with which to start.- Returns:
true
if the specified permission is implied by this object;false
otherwise.
-
getActions
Returns the canonical string representation of the actions. Always returns present actions in the following canonical order:read
,import
,export
.- Specified by:
getActions
in classPermission
- Returns:
- The canonical string representation of the actions.
-
newPermissionCollection
Returns a newPermissionCollection
object for storingEndpointPermission
objects.- Overrides:
newPermissionCollection
in classPermission
- Returns:
- A new
PermissionCollection
object suitable for storingEndpointPermission
objects.
-
equals
Determines the equality of two EndpointPermission objects. Checks that specified object has the same name, actions and endpoint as thisEndpointPermission
.- Specified by:
equals
in classPermission
- Parameters:
obj
- The object to test for equality.- Returns:
- true If obj is a
EndpointPermission
, and has the same name, actions and endpoint as thisEndpointPermission
object;false
otherwise.
-
hashCode
public int hashCode()Returns the hash code value for this object.- Specified by:
hashCode
in classPermission
- Returns:
- Hash code value for this object.
-
writeObject
WriteObject is called to save the state of this permission to a stream. The actions are serialized, and the superclass takes care of the name.- Throws:
IOException
-
readObject
readObject is called to restore the state of this permission from a stream.- Throws:
IOException
ClassNotFoundException
-
getProperties
Called byimplies(Permission)
.- Returns:
- a dictionary of properties for this permission.
-