public abstract class BitFlagsResource extends AbstractResource implements BitFlagsConstants
Rights objects for this resource are made of one bitfield with 8 bits. The first four bits
correspond to the create, delete, read and write respectively. There are 3 reserved bits.
The last bit is for explicit denial of access. When printed, they are shown as
CDRW...N.
Resource names will be namespaced using the subclass' resource type name. The naming approach
is /resource_type_name/instance_name. Each different instance of a particular
resource type will share the same type name but must have a unique, non-empty instance name.
| Modifier and Type | Field and Description |
|---|---|
private java.lang.String[] |
extBits
Extended bits, if any
|
private static CentralLogger |
LOG
Logger.
|
objectPointer, resourceIndex, smBIT_CREATE_ACCESS, BIT_DELETE_ACCESS, BIT_DENIED_ACCESS, BIT_READ_ACCESS, BIT_WRITE_ACCESS, BITSET_SIZE| Constructor and Description |
|---|
BitFlagsResource()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
accessWorker(java.lang.String name,
int bit)
Implements generalized access rights check worker.
|
boolean |
canCreate(java.lang.String name)
Reports if CREATE is allowed for the given resource name.
|
boolean |
canDelete(java.lang.String name)
Reports if DELETE is allowed for the given resource name.
|
boolean |
canRead(java.lang.String name)
Reports if READ is allowed for the given resource name.
|
boolean |
canWrite(java.lang.String name)
Reports if WRITE is allowed for the given resource name.
|
Description[] |
describeRights()
Returns an array of descriptions, one object per the plugin's access rights item.
|
java.lang.String[] |
getExtendedBits()
Override the method to provide extended bit names to augment the default set of bits.
|
Rights |
getRightsInstance(java.lang.Object[] rights)
Converts from the persistent form of the plugin's rights to the specific in-memory
type.
|
abstract java.lang.String |
getTypeName()
Returns the plugin's resource type name as a string.
|
boolean |
isRightsSetValid(java.lang.Object[] rights)
Checks whether a given array of objects representing a set of access
rights fields is acceptable.
|
associate, attach, disassociate, getACLMatcher, getEnclosingScope, getLibrary, getLink, getPermissions, init, refresh, registeredAs, toStringgetLibraries, getLibraryClasses, getLibsByClass, getVariableList, getVariablesclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitisInstanceNameValidprivate java.lang.String[] extBits
private static final CentralLogger LOG
public abstract java.lang.String getTypeName()
getTypeName in interface Resourcepublic java.lang.String[] getExtendedBits()
null for no extended bits or an array of length 1, 2, 3.
An array of length 1 will carry name of bit 4, length 2 bits 4 and 5, and length 3 bits 4, 5 and 6.public final Description[] describeRights()
This plugin uses one field of type BitField with three bits: read, write end execute.
describeRights in interface Resourcepublic Rights getRightsInstance(java.lang.Object[] rights)
getRightsInstance in interface Resourcerights - An array of objects of proper types representing items in a set
of access rights.public boolean isRightsSetValid(java.lang.Object[] rights)
This method returns true only if:
isRightsSetValid in interface Resourcerights - An array of objects of proper types representing items in a set of access rights.true if the array is acceptable for an instance of access rights.public boolean canCreate(java.lang.String name)
name - Resource instance name.true if access is allowed.public boolean canDelete(java.lang.String name)
name - Resource instance name.true if access is allowed.public boolean canRead(java.lang.String name)
name - Resource instance name.true if access is allowed.public boolean canWrite(java.lang.String name)
name - Resource instance name.true if access is allowed.public boolean accessWorker(java.lang.String name,
int bit)
name - Resource instance name.bit - The bit to check.true if access is allowed.