public abstract class DOFPermission extends java.lang.Object implements org.opendof.core.internal.protocol.Marshallable, java.io.Serializable, DOFImmutable
DOFPermission.Factory
implementation.
A default hashCode() and equals() implementation is provided, but should be overridden for each custom
permission.Modifier and Type | Class and Description |
---|---|
static class |
DOFPermission.ActAs
The "act as" permission declares the source identifier that a node can use to represent another node.
|
static class |
DOFPermission.ActAsAny
The "act as any" permission declares that a node can use any source identifiers to represent other nodes.
|
static class |
DOFPermission.Binding
The Binding class defines the permission required to binding Objects and Interfaces.
|
static class |
DOFPermission.Define
The Define class defines the permission required to act as a define for a specific interface or for all if
the
DOFInterfaceID.WILDCARD interface is specified. |
static interface |
DOFPermission.Factory
A permission factory can be implemented and registered to instruct the OAL how to
create custom permissions from serial form.
|
static class |
DOFPermission.IAm
The "I am" permission declares the source identifier that a node can use to represent itself.
|
static class |
DOFPermission.Provider
The Provider class defines the permission required to act as a provider in a general sense.
|
static class |
DOFPermission.Requestor
The Requestor class defines the permission required to act as a requestor in a general sense.
|
static class |
DOFPermission.TunnelDomain
The tunnel domain permission declares the remote domain identifier that a node can use when sending an operation.
|
static class |
DOFPermission.Unknown
The Unknown class represents the condition of unknown permission.
|
Modifier and Type | Field and Description |
---|---|
static short |
ACT_AS
The "I am" permission is implemented in
DOFPermission.ActAs . |
static short |
BINDING
The binding permission is implemented in
DOFPermission.Binding . |
static short |
DEFINE
The define permission is implemented in
DOFPermission.Define . |
static short |
I_AM
The "I am" permission is implemented in
DOFPermission.IAm . |
static short |
PROVIDER
The provider permission is implemented in
DOFPermission.Provider . |
static short |
REQUESTOR
The requestor permission is implemented in
DOFPermission.Requestor . |
static short |
TUNNEL_DOMAIN
The tunnel domain permission is implemented in
DOFPermission.TunnelDomain . |
Constructor and Description |
---|
DOFPermission() |
Modifier and Type | Method and Description |
---|---|
static void |
addFactory(DOFPermission.Factory factory)
Add a new DOFPermissionFactory that can be used to create permissions
from serialized form.
|
static DOFPermission |
create(byte[] data)
Creates and returns a Permission object of the correct type from a byte array of data.
|
static DOFPermission |
create(DOFMarshalContext context,
DOFPacket p)
Creates and returns a Permission object of the correct type by
removing it from the front of a BufferedPacket.
|
boolean |
equals(java.lang.Object obj) |
abstract byte[] |
getBytes()
Get the serialized bytes of the permission.
|
abstract DOFPermissionSet |
getComplement()
Return the complement permission for this permission.
|
abstract short |
getPermissionType()
Returns the type of the permission.
|
int |
hashCode() |
abstract boolean |
isAllowedBy(DOFPermission permission)
Returns whether or not this Permission is a subset of the permissions
allowed by the specified Permission.
|
abstract boolean |
isAllowedBy(DOFPermissionSet permissionSet)
Returns whether or not this permission is a subset of the permissions
allowed by the specified permission set.
|
boolean |
isExplicit()
Returns whether or not this permission is considered explicit.
|
abstract boolean |
isIntersection(DOFPermission permission)
Returns whether or not this permission has an intersection with the specified permission.
|
abstract boolean |
isTerminal()
Returns whether or not this permission is a terminal permission.
|
void |
marshal(DOFMarshalContext context,
java.lang.Object state,
DOFPacket packet)
Write an object to a serialized form to the specified buffer, according
to the context specified and with the given state.
|
abstract DOFPermissionSet |
normalize()
Normalize this permission.
|
public static final short BINDING
DOFPermission.Binding
.public static final short I_AM
DOFPermission.IAm
.public static final short ACT_AS
DOFPermission.ActAs
.public static final short REQUESTOR
DOFPermission.Requestor
.public static final short PROVIDER
DOFPermission.Provider
.public static final short DEFINE
DOFPermission.Define
.public static final short TUNNEL_DOMAIN
DOFPermission.TunnelDomain
.public abstract boolean isAllowedBy(DOFPermission permission)
permission
- The Permission to compare permissions against.public abstract boolean isIntersection(DOFPermission permission)
normalize()
)
where either is allowed by the other.permission
- The permission to determine an intersection.public abstract boolean isAllowedBy(DOFPermissionSet permissionSet)
permissionSet
- The permission set to compare permissions against.public abstract boolean isTerminal()
public abstract DOFPermissionSet normalize()
public boolean isExplicit()
isAllowedBy(DOFPermission)
unless ALL permissions are known.public abstract DOFPermissionSet getComplement()
REQUESTOR
is
the complement of PROVIDER
.public abstract short getPermissionType()
public void marshal(DOFMarshalContext context, java.lang.Object state, DOFPacket packet) throws DOFMarshalException
marshal
in interface org.opendof.core.internal.protocol.Marshallable
context
- The context of the marshaling to be performed.state
- The state in which the marshalling is done. This may affect the result.packet
- The buffer which will receive the marshaled data. Must not be null.DOFMarshalException
- If there are errors in the data or the buffer.public abstract byte[] getBytes()
public final boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public final int hashCode()
hashCode
in class java.lang.Object
public static void addFactory(DOFPermission.Factory factory)
factory
- The new DOFPermissionFactorypublic static DOFPermission create(byte[] data) throws DOFSecurityException
data
- A byte array holding a serialized Permission.DOFSecurityException
- If the permission could not be deserialized.public static DOFPermission create(DOFMarshalContext context, DOFPacket p) throws DOFSecurityException
context
- The marshalling context.p
- A packet holding a serialized Permission at the front.DOFSecurityException
- If the permission could not be deserialized. In
this case the packet will remain unaffected.