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

public final Class WirePermission

Additional top-level class in compilation unit: WirePermissionCollection.

extends BasicPermission
Class Inheritance
Imports
java.io.IOException, java.security.BasicPermission, .Permission, .PermissionCollection, java.util.ArrayList, .Collections, .Enumeration, .Hashtable, .List

Permission for the scope of a Wire object. When a Envelope object is used for communication with the poll or update method, and the scope is set, then the Wire object must verify that the Consumer service has WirePermission[name,CONSUME] and the Producer service has WirePermission[name,PRODUCE] for all names in the scope.

The names are compared with the normal rules for permission names. This means that they may end with a "*" to indicate wildcards. E.g. Door.* indicates all scope names starting with the string "Door". The last period is required due to the implementations of the BasicPermission class.

Author
$Id: c2ef56aee74b62f072ac0fa044d26e9869be50a8 $

Field Summary

Modifier and TypeField and Description
private static final int
private static final int
private transient int
action_mask

The actions mask.

private static final int
private static final int
private volatile String
actions

The actions in canonical form.

public static final String
CONSUME

The action string for the consume action.

public static final String
PRODUCE

The action string for the produce action.

pack-priv static final long

Constructor Summary

AccessConstructor and Description
public
WirePermission(String
Wire name.
name
,
String
produce, consume (canonical order).
actions
)

Create a new WirePermission with the given name (may be wildcard) and actions.

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

Package private constructor used by WirePermissionCollection.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

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

Overrides java.security.BasicPermission.equals.

Determines the equality of two WirePermission objects.

public String

Returns:

The canonical string representation of the actions.
getActions
()

Overrides java.security.BasicPermission.getActions.

Returns the canonical string representation of the actions.

pack-priv synchronized int

Returns:

The actions mask.
getActionsMask
()

Returns the current action mask.

public int

Returns:

Hash code value for this object.
hashCode
()

Overrides java.security.BasicPermission.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 permission to check against.
p
)

Overrides java.security.BasicPermission.implies.

Checks if this WirePermission object implies the specified permission.

public PermissionCollection

Returns:

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

Overrides java.security.BasicPermission.newPermissionCollection.

Returns a new PermissionCollection object for storing WirePermission objects.

private static int

Returns:

action mask.
parseActions
(String
Action string.
actions
)

Parse action string into action mask.

private synchronized void
readObject(ObjectInputStream
the ObjectInputStream from which data is read
s
)

Hides java.security.BasicPermission.readObject.

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

private synchronized void
setTransients(int
action mask
mask
)

Called by constructors and when deserialized.

public String

Returns:

information about this Permission object.
toString
()

Overrides java.security.Permission.toString.

Returns a string describing this WirePermission.

private synchronized void
writeObject(ObjectOutputStream s)

WriteObject is called to save the state of the ServicePermission to a stream.

Field Detail

ACTION_ALLback to summary
private static final int ACTION_ALL
ACTION_CONSUMEback to summary
private static final int ACTION_CONSUME
action_maskback to summary
private transient int action_mask

The actions mask.

ACTION_NONEback to summary
private static final int ACTION_NONE
ACTION_PRODUCEback to summary
private static final int ACTION_PRODUCE
actionsback to summary
private volatile String actions

The actions in canonical form.

CONSUMEback to summary
public static final String CONSUME

The action string for the consume action.

PRODUCEback to summary
public static final String PRODUCE

The action string for the produce action.

serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides java.security.BasicPermission.serialVersionUID.

Constructor Detail

WirePermissionback to summary
public WirePermission(String name, String actions)

Create a new WirePermission with the given name (may be wildcard) and actions.

Parameters
name:String

Wire name.

actions:String

produce, consume (canonical order).

WirePermissionback to summary
pack-priv WirePermission(String name, int mask)

Package private constructor used by WirePermissionCollection.

Parameters
name:String

class name

mask:int

action mask

Method Detail

equalsback to summary
public boolean equals(Object obj)

Overrides java.security.BasicPermission.equals.

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

Parameters
obj:Object

The object to test for equality.

Returns:boolean

true if obj is a WirePermission, and has the same name and actions as this WirePermission object; false otherwise.

Annotations
@Override
getActionsback to summary
public String getActions()

Overrides java.security.BasicPermission.getActions.

Returns the canonical string representation of the actions. Always returns present actions in the following order: produce, consume.

Returns:String

The canonical string representation of the actions.

Annotations
@Override
getActionsMaskback to summary
pack-priv synchronized int getActionsMask()

Returns the current action mask. Used by the WirePermissionCollection object.

Returns:int

The actions mask.

hashCodeback to summary
public int hashCode()

Overrides java.security.BasicPermission.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)

Overrides java.security.BasicPermission.implies.

Checks if this WirePermission object implies the specified permission.

More specifically, this method returns true if:

  • p is an instanceof the WirePermission class,
  • p's actions are a proper subset of this object's actions, and
  • p's name is implied by this object's name. For example, java.* implies java.home.
Parameters
p:Permission

The permission to check against.

Returns:boolean

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

Annotations
@Override
newPermissionCollectionback to summary
public PermissionCollection newPermissionCollection()

Overrides java.security.BasicPermission.newPermissionCollection.

Returns a new PermissionCollection object for storing WirePermission objects.

Returns:PermissionCollection

A new PermissionCollection object suitable for storing WirePermission 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.

readObjectback to summary
private synchronized void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException

Hides java.security.BasicPermission.readObject.

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

Parameters
s:ObjectInputStream

Doc from java.security.BasicPermission.readObject.

the ObjectInputStream from which data is read

Exceptions
IOException:

Doc from java.security.BasicPermission.readObject.

if an I/O error occurs

ClassNotFoundException:

Doc from java.security.BasicPermission.readObject.

if a serialized class cannot be loaded

setTransientsback to summary
private synchronized void setTransients(int mask)

Called by constructors and when deserialized.

Parameters
mask:int

action mask

toStringback to summary
public String toString()

Overrides java.security.Permission.toString.

Returns a string describing this WirePermission. The convention is to specify the class name, the permission name, and the actions in the following format: '(org.osgi.service.wireadmin.WirePermission "name" "actions")'.

Returns:String

information about this Permission object.

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

WriteObject is called to save the state of the ServicePermission to a stream. The actions are serialized, and the superclass takes care of the name.