Top Description Fields Constructors Methods
org.osgi.service.remoteserviceadmin

public final Class EndpointPermission

Additional top-level class in compilation unit: EndpointPermissionCollection.

extends Permission
Class Inheritance
Static Imports
org.osgi.service.remoteserviceadmin.RemoteConstants.*

A bundle's authority to export, import or read an Endpoint. Permission to read an Endpoint is required in order to detect events regarding an Endpoint. Untrusted bundles should not be able to detect the presence of certain Endpoints unless they have the appropriate EndpointPermission to read the specific service.
Author
$Id: bce27511ebaee16bccf0e7dbb5a12986958e9e88 $

Field Summary

Modifier and TypeField and Description
private static final int
private static final int
private static final int
pack-priv transient int
action_mask

The actions mask.

pack-priv static final int
private static final int
private volatile String
actions

The actions in canonical form.

pack-priv final transient EndpointDescription
endpoint

The endpoint used by this EndpointPermission.

public static final String
EXPORT

The action string export.

pack-priv transient 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.

public static final String
IMPORT

The action string import.

private final transient Dictionary<String, Object>
properties

This dictionary holds the properties of the permission, used to match a filter in implies.

public static final String
READ

The action string read.

pack-priv static final long

Constructor Summary

AccessConstructor and Description
public
EndpointPermission(String
The filter string or "*" to match all endpoints.
filterString
,
String
The actions read, import, or export.
actions
)

Create a new EndpointPermission with the specified filter.

public
EndpointPermission(EndpointDescription
The requested endpoint.
endpoint
,
String
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.
localFrameworkUUID
,
String
The actions read, import, or export.
actions
)

Creates a new requested EndpointPermission object to be used by code that must perform checkPermission.

pack-priv
EndpointPermission(String
class name
name
,
int
action mask
mask
)

Package private constructor used by EndpointPermissionCollection.

Method Summary

Modifier and TypeMethod and Description
private static String

Returns:

permission name.
createName
(EndpointDescription
EndpointDescription to use to create permission name.
endpoint
)

Create a permission name from a EndpointDescription.

public boolean

Returns:

true If obj is a EndpointPermission, and has the same name, actions and endpoint as this EndpointPermission object; false otherwise.
equals
(Object
The object to test for equality.
obj
)

Implements abstract java.security.Permission.equals.

Determines the equality of two EndpointPermission objects.

public String

Returns:

The canonical string representation of the actions.
getActions
()

Implements abstract java.security.Permission.getActions.

Returns the canonical string representation of the actions.

private Dictionary<String, Object>

Returns:

a dictionary of properties for this permission.
getProperties
()

Called by EndpointPermission#implies(Permission).

public int

Returns:

Hash code value for this object.
hashCode
()

Implements abstract java.security.Permission.hashCode.

Returns the hash code value for this object.

public boolean

Returns:

true if the specified permission is implied by this object; false otherwise.
implies
(Permission
The target permission to check.
p
)

Implements abstract java.security.Permission.implies.

Determines if a EndpointPermission object "implies" the specified permission.

pack-priv boolean

Returns:

true if the specified permission is implied by this object; false otherwise.
implies0
(EndpointPermission
The requested EndpointPermission which has already be validated as a proper argument. The requested EndpointPermission must not have a filter expression.
requested
,
int
The effective actions with which to start.
effective
)

Internal implies method.

public PermissionCollection

Returns:

A new PermissionCollection object suitable for storing EndpointPermission objects.
newPermissionCollection
()

Overrides java.security.Permission.newPermissionCollection.

Returns a new PermissionCollection object for storing EndpointPermission objects.

private static int

Returns:

action mask.
parseActions
(String
Action string.
actions
)

Parse action string into action mask.

private static Filter

Returns:

a Filter for this bundle.
parseFilter
(String
The filter string to parse.
filterString
)

Parse filter string into a Filter object.

private synchronized void
readObject(ObjectInputStream s)

readObject is called to restore the state of this permission from a stream.

private void
setTransients(Filter f, int
action mask
mask
)

Called by constructors and when deserialized.

private synchronized void
writeObject(ObjectOutputStream s)

WriteObject is called to save the state of this permission to a stream.

Inherited from java.security.Permission:
checkGuardgetNametoString

Field Detail

ACTION_ALLback to summary
private static final int ACTION_ALL
ACTION_EXPORTback to summary
private static final int ACTION_EXPORT
ACTION_IMPORTback to summary
private static final int ACTION_IMPORT
action_maskback to summary
pack-priv transient int action_mask

The actions mask.

ACTION_NONEback to summary
pack-priv static final int ACTION_NONE
ACTION_READback to summary
private static final int ACTION_READ
actionsback to summary
private volatile String actions

The actions in canonical form.

endpointback to summary
pack-priv final transient EndpointDescription endpoint

The endpoint used by this EndpointPermission. Must be null if not constructed with a endpoint.

EXPORTback to summary
public static final String EXPORT

The action string export. The export action implies the read action.

filterback to summary
pack-priv transient 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.

IMPORTback to summary
public static final String IMPORT

The action string import. The import action implies the read action.

propertiesback to summary
private final transient Dictionary<String, Object> properties

This dictionary holds the properties of the permission, used to match a filter in implies.

READback to summary
public static final String READ

The action string read.

serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides java.security.Permission.serialVersionUID.

Constructor Detail

EndpointPermissionback to summary
public EndpointPermission(String filterString, String actions)

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 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.

Parameters
filterString:String

The filter string or "*" to match all endpoints.

actions:String

The actions read, import, or export.

Exceptions
IllegalArgumentException:
If the filter has an invalid syntax or the actions are not valid.
EndpointPermissionback to summary
public EndpointPermission(EndpointDescription endpoint, String localFrameworkUUID, String actions)

Creates a new requested 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.

Parameters
endpoint:EndpointDescription

The requested endpoint.

localFrameworkUUID:String

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:String

The actions read, import, or export.

Exceptions
IllegalArgumentException:
If the endpoint is null or the actions are not valid.
EndpointPermissionback to summary
pack-priv EndpointPermission(String name, int mask)

Package private constructor used by EndpointPermissionCollection.

Parameters
name:String

class name

mask:int

action mask

Method Detail

createNameback to summary
private static String createName(EndpointDescription endpoint)

Create a permission name from a EndpointDescription.

Parameters
endpoint:EndpointDescription

EndpointDescription to use to create permission name.

Returns:String

permission name.

equalsback to summary
public boolean equals(Object obj)

Implements abstract java.security.Permission.equals.

Determines the equality of two EndpointPermission objects. Checks that specified object has the same name, actions and endpoint as this EndpointPermission.

Parameters
obj:Object

The object to test for equality.

Returns:boolean

true If obj is a EndpointPermission, and has the same name, actions and endpoint as this EndpointPermission object; false otherwise.

Annotations
@Override
getActionsback to summary
public String getActions()

Implements abstract java.security.Permission.getActions.

Returns the canonical string representation of the actions. Always returns present actions in the following canonical order: read, import, export.

Returns:String

The canonical string representation of the actions.

Annotations
@Override
getPropertiesback to summary
private Dictionary<String, Object> getProperties()

Called by EndpointPermission#implies(Permission).

Returns:Dictionary<String, Object>

a dictionary of properties for this permission.

hashCodeback to summary
public int hashCode()

Implements abstract java.security.Permission.hashCode.

Returns the hash code value for this object.

Returns:int

Hash code value for this object.

Annotations
@Override
impliesback to summary
public boolean implies(Permission p)

Implements abstract java.security.Permission.implies.

Determines if a EndpointPermission object "implies" the specified permission.

Parameters
p:Permission

The target permission to check.

Returns:boolean

true if the specified permission is implied by this object; false otherwise.

Annotations
@Override
implies0back to summary
pack-priv boolean implies0(EndpointPermission requested, int effective)

Internal implies method. Used by the implies and the permission collection implies methods.

Parameters
requested:EndpointPermission

The requested EndpointPermission which has already be validated as a proper argument. The requested EndpointPermission must not have a filter expression.

effective:int

The effective actions with which to start.

Returns:boolean

true if the specified permission is implied by this object; false otherwise.

newPermissionCollectionback to summary
public PermissionCollection newPermissionCollection()

Overrides java.security.Permission.newPermissionCollection.

Returns a new PermissionCollection object for storing EndpointPermission objects.

Returns:PermissionCollection

A new PermissionCollection object suitable for storing EndpointPermission objects.

Annotations
@Override
parseActionsback to summary
private static int parseActions(String actions)

Parse action string into action mask.

Parameters
actions:String

Action string.

Returns:int

action mask.

parseFilterback to summary
private static Filter parseFilter(String filterString)

Parse filter string into a Filter object.

Parameters
filterString:String

The filter string to parse.

Returns:Filter

a Filter for this bundle.

Exceptions
IllegalArgumentException:
If the filter syntax is invalid.
readObjectback to summary
private synchronized void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException

readObject is called to restore the state of this permission from a stream.

setTransientsback to summary
private void setTransients(Filter f, int mask)

Called by constructors and when deserialized.

Parameters
mask:int

action mask

writeObjectback to summary
private synchronized void writeObject(ObjectOutputStream s) throws IOException

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.