public final class EndpointPermission
extends java.security.Permission
export
action allows a bundle to export a service as an
Endpoint.import
action allows a bundle to import a service from an
Endpoint.read
action allows a bundle to read references to an
Endpoint.EndpointPermission
to read the specific service.Modifier and Type | Field and Description |
---|---|
private static int |
ACTION_ALL |
private static int |
ACTION_EXPORT |
private static int |
ACTION_IMPORT |
(package private) int |
action_mask
The actions mask.
|
(package private) static int |
ACTION_NONE |
private static int |
ACTION_READ |
private java.lang.String |
actions
The actions in canonical form.
|
(package private) EndpointDescription |
endpoint
The endpoint used by this EndpointPermission.
|
static java.lang.String |
EXPORT
The action string
export . |
(package private) org.osgi.framework.Filter |
filter
If this EndpointPermission was not constructed with an
EndpointDescription, this holds a Filter matching object used to evaluate
the filter in implies or
null for wildcard. |
static java.lang.String |
IMPORT
The action string
import . |
private java.util.Dictionary<java.lang.String,java.lang.Object> |
properties
This dictionary holds the properties of the permission, used to match a
filter in implies.
|
static java.lang.String |
READ
The action string
read . |
(package private) static long |
serialVersionUID |
Constructor and Description |
---|
EndpointPermission(EndpointDescription endpoint,
java.lang.String localFrameworkUUID,
java.lang.String actions)
Creates a new requested
EndpointPermission object to be used by
code that must perform checkPermission . |
EndpointPermission(java.lang.String name,
int mask)
Package private constructor used by EndpointPermissionCollection.
|
EndpointPermission(java.lang.String filterString,
java.lang.String actions)
Create a new EndpointPermission with the specified filter.
|
Modifier and Type | Method and Description |
---|---|
private static java.lang.String |
createName(EndpointDescription endpoint)
Create a permission name from a EndpointDescription.
|
boolean |
equals(java.lang.Object obj)
Determines the equality of two EndpointPermission objects.
|
java.lang.String |
getActions()
Returns the canonical string representation of the actions.
|
private java.util.Dictionary<java.lang.String,java.lang.Object> |
getProperties()
Called by
implies(Permission) . |
int |
hashCode()
Returns the hash code value for this object.
|
boolean |
implies(java.security.Permission p)
Determines if a
EndpointPermission object "implies" the specified
permission. |
(package private) boolean |
implies0(EndpointPermission requested,
int effective)
Internal implies method.
|
java.security.PermissionCollection |
newPermissionCollection()
Returns a new
PermissionCollection object for storing
EndpointPermission objects. |
private static int |
parseActions(java.lang.String actions)
Parse action string into action mask.
|
private static org.osgi.framework.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(org.osgi.framework.Filter f,
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 to a stream.
|
static final long serialVersionUID
public static final java.lang.String READ
read
.public static final java.lang.String IMPORT
import
. The import
action implies the
read
action.public static final java.lang.String EXPORT
export
. The export
action implies the
read
action.private static final int ACTION_READ
private static final int ACTION_IMPORT
private static final int ACTION_EXPORT
private static final int ACTION_ALL
static final int ACTION_NONE
transient int action_mask
private volatile java.lang.String actions
final transient EndpointDescription endpoint
null
if not
constructed with a endpoint.private final transient java.util.Dictionary<java.lang.String,java.lang.Object> properties
transient org.osgi.framework.Filter filter
null
for wildcard.public EndpointPermission(java.lang.String filterString, java.lang.String actions)
The filter will be evaluated against the endpoint properties of a requested EndpointPermission.
There are three possible actions: read
, import
and
export
. The read
action allows the owner of this
permission to see the presence of distributed services. The
import
action allows the owner of this permission to import an
endpoint. The export
action allows the owner of this permission
to export a service.
filterString
- The filter string or "*" to match all
endpoints.actions
- The actions read
, import
, or
export
.java.lang.IllegalArgumentException
- If the filter has an invalid syntax or
the actions are not valid.public EndpointPermission(EndpointDescription endpoint, java.lang.String localFrameworkUUID, java.lang.String actions)
EndpointPermission
object to be used by
code that must perform checkPermission
.
EndpointPermission
objects created with this constructor cannot
be added to an EndpointPermission
permission collection.endpoint
- The requested endpoint.localFrameworkUUID
- The UUID of the local framework. This is used
to support matching the
endpoint.framework.uuid
endpoint property to the
<<LOCAL>>
value in the filter expression.actions
- The actions read
, import
, or
export
.java.lang.IllegalArgumentException
- If the endpoint is null
or the
actions are not valid.EndpointPermission(java.lang.String name, int mask)
name
- class namemask
- action maskprivate static java.lang.String createName(EndpointDescription endpoint)
endpoint
- EndpointDescription to use to create permission name.private void setTransients(org.osgi.framework.Filter f, int mask)
mask
- action maskprivate static int parseActions(java.lang.String actions)
actions
- Action string.private static org.osgi.framework.Filter parseFilter(java.lang.String filterString)
filterString
- The filter string to parse.java.lang.IllegalArgumentException
- If the filter syntax is invalid.public boolean implies(java.security.Permission p)
EndpointPermission
object "implies" the specified
permission.implies
in class java.security.Permission
p
- The target permission to check.true
if the specified permission is implied by this
object; false
otherwise.boolean implies0(EndpointPermission requested, int effective)
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.true
if the specified permission is implied by this
object; false
otherwise.public java.lang.String getActions()
read
,
import
, export
.getActions
in class java.security.Permission
public java.security.PermissionCollection newPermissionCollection()
PermissionCollection
object for storing
EndpointPermission
objects.newPermissionCollection
in class java.security.Permission
PermissionCollection
object suitable for storing
EndpointPermission
objects.public boolean equals(java.lang.Object obj)
EndpointPermission
.equals
in class java.security.Permission
obj
- The object to test for equality.EndpointPermission
, and has the same
name, actions and endpoint as this EndpointPermission
object; false
otherwise.public int hashCode()
hashCode
in class java.security.Permission
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<java.lang.String,java.lang.Object> getProperties()
implies(Permission)
.