|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object
|
+--arlut.csd.ganymede.DBField
|
+--arlut.csd.ganymede.PermissionMatrixDBField
PermissionMatrixDBField is a subclass of DBField for the storage and handling of
permission matrix fields (used only in the Role
DBObjects) in the
DBStore on the Ganymede
server.
The Ganymede client talks to PermissionMatrixDBFields through the
perm_field RMI interface.
This class differs a bit from most subclasses of DBField in that the normal setValue()/getValue()
methods are non-functional. Instead, there are special methods used to set or
access permission information from the specially coded Hashtable held by
a PermissionMatrixDBField. This Hashtable maps strings encoded by the
matrixEntry() methods to PermEntry
objects, which hold create, edit, view, and delete bits.
PermissionMatrixDBField's methods encode part of the server's permissions
logic, including the restrictions on what bits can be set in a Role's
permission matrix based on the rights granted in the client's
GanymedeSession. We determine
what GanymedeSession we are operating in for that case
by asking our DBEditObject owner.
| Field Summary | |
(package private) static boolean |
debug
|
(package private) boolean |
defined
|
(package private) java.util.Hashtable |
matrix
|
| Fields inherited from class arlut.csd.ganymede.DBField |
fieldcode, owner, value |
| Constructor Summary | |
(package private) |
PermissionMatrixDBField(DBObject owner,
java.io.DataInput in,
DBObjectBaseField definition)
Receive constructor. |
(package private) |
PermissionMatrixDBField(DBObject owner,
DBObjectBaseField definition)
No-value constructor. |
|
PermissionMatrixDBField(DBObject owner,
PermissionMatrixDBField field)
Copy constructor. |
| Method Summary | |
boolean |
allowablePermEntry(short baseID,
short fieldID,
PermEntry entry)
This method is used to check that the given operation can be set by the current administrator. |
java.lang.Object |
checkpoint()
This method is used to basically dump state out of this field so that the DBEditSet
checkpoint()
code can restore it later
if need be. |
private void |
clean()
This internal method is used to cull out any entries in this permissions field that are non-operative, either by referring to an object/field type that does not exist, or by being redundant. |
java.lang.Object |
clone()
|
ReturnVal |
copyFieldTo(DBField target,
boolean local)
This method copies the current value of this DBField to target. |
(package private) static java.lang.String |
debugdecode(java.util.Hashtable matrix)
This method generates a string version of the debugdump output. |
void |
debugdump()
This method does a dump to System.err of the permission contents held in this field. |
private static void |
debugdump(java.util.Hashtable matrix)
This method does a dump to System.err of the permission contents held in matrix. |
void |
debugdump(PermissionMatrixDBField me)
This method does a dump to System.err of the permission contents held in PermissionMatrixDBField me. |
static void |
debugdump(PermMatrix matrix)
|
static java.lang.String |
decodeBaseName(java.lang.String entry)
This utility method extracts the DBObjectBase name from a coded
permission entry held in a
PermMatrix/PermissionMatrixDBField
Matrix. |
static java.lang.String |
decodeFieldName(java.lang.String entry)
This utility method extracts the DBObjectBaseField name from a coded
permission entry held in a
PermMatrix/PermissionMatrixDBField
Matrix. |
(package private) void |
emit(java.io.DataOutput out)
This method is responsible for writing out the contents of this field to an binary output stream. |
(package private) void |
emitXML(XMLDumpContext xmlOut)
This method is used when the database is being dumped, to write out this field to disk. |
boolean |
equals(java.lang.Object obj)
fancy equals method really does check for value equality |
DBField |
getCopy(DBObject newOwner)
This method is used to return a copy of this field, with the field's owner set to newOwner. |
java.lang.String |
getDiffString(DBField orig)
Returns a String representing the change in value between this field and orig. |
java.lang.String |
getEncodingString()
We don't try and give a comprehensive encoding string for permission matrices, let's just give enough so they know what we are. |
PermMatrix |
getMatrix()
Return a serializable, read-only copy of this field's permission matrix |
PermEntry |
getPerm(Base base)
Returns a PermEntry object representing this PermMatrix's permissions on the base <base> |
PermEntry |
getPerm(Base base,
BaseField field)
Returns a PermEntry object representing this PermMatrix's permissions on the field <field> in base <base> |
PermEntry |
getPerm(short baseID)
Returns a PermEntry object representing this PermMatrix's permissions on the base <baseID> |
PermEntry |
getPerm(short baseID,
short fieldID)
Returns a PermEntry object representing this PermMatrix's
permissions on the field <fieldID> in base <baseID> |
PermMatrix |
getTemplateMatrix()
Return a serializable, read-only copy of the maximum permissions that can be set for this field's permission matrix. |
java.lang.Object |
getValue()
We always return null here.. |
java.lang.Object |
getValueLocal()
Returns an Object carrying the value held in this field. This is intended to be used within the Ganymede server, it bypasses the permissions checking that getValues() does. |
java.lang.String |
getValueString()
Returns a String representing the value of this field. |
private boolean |
isBasePerm(java.lang.String matrixEntry)
Returns true if the given String encodes the identity of a DBObjectBase and
not a field within a DBObjectBase. |
boolean |
isDefined()
Returns true if this field has a value associated with it, or false if it is an unfilled 'placeholder'. |
static boolean |
isValidCode(java.lang.String entry)
This method returns true if the given PermMatrix/
PermissionMatrixDBField key refers to a currently valid
DBObjectBase/
DBObjectBaseField
in the loaded schema. |
java.lang.Object |
key()
we don't really want to hash according to our permission contents, so just hash according to our containing object's i.d. |
private java.lang.String |
matrixEntry(short baseID)
Private method to generate a key for use in our internal Hashtable, used to encode the permission for a given DBObjectBase. |
private java.lang.String |
matrixEntry(short baseID,
short fieldID)
Private method to generate a key for use in our internal Hashtable, used to encode the permission for a given DBObjectBase and DBObjectBaseField. |
(package private) void |
receive(java.io.DataInput in,
DBObjectBaseField definition)
This method is responsible for reading in the contents of this field from an binary input stream. |
ReturnVal |
resetPerms()
Resets the permissions in this PermissionMatrixDBField to the empty set. |
void |
rollback(java.lang.Object oldval)
This method is used to basically force state into this field. |
ReturnVal |
setFieldPerms(short baseID,
PermEntry entry,
boolean includeBuiltins)
Sets the permission entry for all fields in base <baseID> to PermEntry <entry> |
ReturnVal |
setPerm(Base base,
BaseField field,
PermEntry entry)
Sets the permission entry for base <base>, field <field> to PermEntry <entry> |
ReturnVal |
setPerm(Base base,
PermEntry entry)
Sets the permission entry for base <baseID> to PermEntry <entry>. |
ReturnVal |
setPerm(short baseID,
PermEntry entry)
Sets the permission entry for this matrix for base <baseID> to PermEntry <entry> |
ReturnVal |
setPerm(short baseID,
short fieldID,
PermEntry entry)
Sets the permission entry for base <baseID>, field <fieldID> to PermEntry <entry>. |
ReturnVal |
setUndefined(boolean local)
This method is used to mark a field as undefined when it is checked out for editing. |
ReturnVal |
setValue(java.lang.Object value,
boolean local,
boolean noWizards)
we don't allow setValue.. |
ReturnVal |
verifyNewValue(java.lang.Object v)
Overridable method to verify that an object submitted to this field has an appropriate value. |
boolean |
verifyTypeMatch(java.lang.Object v)
Overridable method to determine whether an Object submitted to this field is of an appropriate type. |
| Methods inherited from class java.lang.Object |
|
| Methods inherited from interface arlut.csd.ganymede.db_field |
addElement, addElements, containsElement, deleteAllElements, deleteElement, deleteElement, deleteElements, getComment, getElement, getFieldInfo, getFieldTemplate, getID, getName, getType, getTypeDesc, getValues, isBuiltIn, isEditable, isEditInPlace, isVector, isVisible, setElement, setValue, size |
| Field Detail |
static final boolean debug
boolean defined
java.util.Hashtable matrix
| Constructor Detail |
PermissionMatrixDBField(DBObject owner,
java.io.DataInput in,
DBObjectBaseField definition)
throws java.io.IOException
Receive constructor. Used to create a PermissionMatrixDBField from a
DBStore/DBJournal
DataInput stream.
PermissionMatrixDBField(DBObject owner,
DBObjectBaseField definition)
No-value constructor. Allows the construction of a
'non-initialized' field, for use where the
DBObjectBase
definition indicates that a given field may be present,
but for which no value has been stored in the
DBStore.
Used to provide the client a template for 'creating' this field if so desired.
public PermissionMatrixDBField(DBObject owner,
PermissionMatrixDBField field)
| Method Detail |
public boolean isDefined()
isDefined in interface db_fieldisDefined in class DBFielddb_fieldpublic ReturnVal setUndefined(boolean local)
This method is used to mark a field as undefined when it is
checked out for editing. Different subclasses of
DBField may
implement this in different ways, if simply setting the field's
value member to null is not appropriate. Any namespace values claimed
by the field will be released, and when the transaction is
committed, this field will be released.
setUndefined in class DBFieldpublic static java.lang.String decodeBaseName(java.lang.String entry)
This utility method extracts the
DBObjectBase name from a coded
permission entry held in a
PermMatrix/PermissionMatrixDBField
Matrix.
public static java.lang.String decodeFieldName(java.lang.String entry)
This utility method extracts the
DBObjectBaseField name from a coded
permission entry held in a
PermMatrix/PermissionMatrixDBField
Matrix.
private boolean isBasePerm(java.lang.String matrixEntry)
Returns true if the given String encodes the identity of
a DBObjectBase and
not a field within a DBObjectBase.
public static boolean isValidCode(java.lang.String entry)
This method returns true if the given
PermMatrix/
PermissionMatrixDBField key refers to a currently valid
DBObjectBase/
DBObjectBaseField
in the loaded schema.
public void debugdump(PermissionMatrixDBField me)
public static void debugdump(PermMatrix matrix)
private static void debugdump(java.util.Hashtable matrix)
static java.lang.String debugdecode(java.util.Hashtable matrix)
public boolean verifyTypeMatch(java.lang.Object v)
DBFieldverifyTypeMatch in class DBFieldpublic ReturnVal verifyNewValue(java.lang.Object v)
DBFieldverifyNewValue in class DBFieldpublic boolean equals(java.lang.Object obj)
equals in class DBField
public ReturnVal copyFieldTo(DBField target,
boolean local)
This method copies the current value of this DBField to target. The target DBField must be contained within a checked-out DBEditObject in order to be updated. Any actions that would normally occur from a user manually setting a value into the field will occur.
copyFieldTo in class DBFieldtarget - The DBField to copy this field's contents to.local - If true, permissions checking is skipped.public java.lang.Object key()
key in class DBFieldpublic java.lang.Object getValue()
getValue in interface db_fieldgetValue in class DBFieldarlut.csd.ganymede.DBFielddb_fieldpublic java.lang.Object getValueLocal()
getValueLocal in class DBField
public ReturnVal setValue(java.lang.Object value,
boolean local,
boolean noWizards)
setValue in class DBFieldarlut.csd.ganymede.DBFieldvalue - Value to set this field tolocal - If true, permissions checking will be skippednoWizards - If true, wizards will be skippedpublic DBField getCopy(DBObject newOwner)
This method is used to return a copy of this field, with the field's owner set to newOwner.
getCopy in class DBFieldpublic java.lang.Object clone()
clone in class java.lang.Object
void emit(java.io.DataOutput out)
throws java.io.IOException
DBFieldThis method is responsible for writing out the contents of this field to an binary output stream. It is used in writing fields to the ganymede.db file and to the journal file.
This method only writes out the value contents of this field.
The DBObject
emit()
method is responsible for writing out the field identifier information
ahead of the field's contents.
emit in class DBField
void receive(java.io.DataInput in,
DBObjectBaseField definition)
throws java.io.IOException
DBFieldThis method is responsible for reading in the contents of this field from an binary input stream. It is used in reading fields from the ganymede.db file and from the journal file.
The code that calls receive() on this field is responsible for having read enough of the binary input stream's context to place the read cursor at the point in the file immediately after the field's id and type information has been read.
receive in class DBField
void emitXML(XMLDumpContext xmlOut)
throws java.io.IOException
This method is used when the database is being dumped, to write out this field to disk. It is mated with receiveXML().
emitXML in class DBFieldpublic java.lang.String getValueString()
db_fieldgetValueString in interface db_fieldgetValueString in class DBFieldpublic java.lang.String getEncodingString()
getEncodingString in interface db_fieldgetEncodingString in class DBFieldarlut.csd.ganymede.DBFielddb_fieldpublic java.lang.String getDiffString(DBField orig)
Returns a String representing the change in value between this field and orig. This String is intended for logging and email, not for any sort of programmatic activity. The format of the generated string is not defined, but is intended to be suitable for inclusion in a log entry and in an email message.
If there is no change in the field, null will be returned.
getDiffString in class DBFieldpublic PermMatrix getMatrix()
getMatrix in interface perm_fieldperm_fieldpublic PermMatrix getTemplateMatrix()
Return a serializable, read-only copy of the maximum permissions that can be set for this field's permission matrix. This matrix is drawn from the union of delegatable roles that the client's adminPersona is a member of.
This method will return null if this perm_field is not associated with an object that is being edited, or if the client is logged into the server as supergash.
getTemplateMatrix in interface perm_fieldperm_field
public PermEntry getPerm(short baseID,
short fieldID)
PermMatrix's
permissions on the field <fieldID> in base <baseID>getPerm in interface perm_fieldperm_field,
PermMatrixpublic PermEntry getPerm(short baseID)
getPerm in interface perm_fieldperm_field,
PermMatrix
public PermEntry getPerm(Base base,
BaseField field)
getPerm in interface perm_fieldperm_field,
PermMatrixpublic PermEntry getPerm(Base base)
getPerm in interface perm_fieldperm_field,
PermMatrixpublic ReturnVal resetPerms()
Resets the permissions in this PermissionMatrixDBField to the empty set. Used by non-interactive clients to reset the Permission Matrix to a known state before setting permissions.
Returns null on success, or a failure-coded ReturnVal on permissions failure.
resetPerms in interface perm_field
public ReturnVal setPerm(Base base,
BaseField field,
PermEntry entry)
Sets the permission entry for base <base>, field <field> to PermEntry <entry>
This operation will fail if this PermissionMatrixDBField is not editable.
setPerm in interface perm_fieldperm_field,
PermEntry
public ReturnVal setPerm(short baseID,
short fieldID,
PermEntry entry)
Sets the permission entry for base <baseID>, field <fieldID> to PermEntry <entry>.
This operation will fail if this PermissionMatrixDBField is not editable.
setPerm in interface perm_fieldbaseID - the object type to set permissions forfieldID - the field to set permissions for. If fieldID < 0,
the permission will be applied to the object as a whole rather
than any individual field within the objectperm_field,
PermEntry
public ReturnVal setPerm(Base base,
PermEntry entry)
Sets the permission entry for base <baseID> to PermEntry <entry>.
This operation will fail if this PermissionMatrixDBField is not editable.
setPerm in interface perm_fieldperm_field,
PermMatrix
public ReturnVal setPerm(short baseID,
PermEntry entry)
Sets the permission entry for this matrix for base <baseID> to PermEntry <entry>
This operation will fail if this PermissionMatrixDBField is not editable.
setPerm in interface perm_fieldperm_field,
PermEntry
public ReturnVal setFieldPerms(short baseID,
PermEntry entry,
boolean includeBuiltins)
Sets the permission entry for all fields in base <baseID> to PermEntry <entry>
This operation will fail if this PermissionMatrixDBField is not editable.
setFieldPerms in interface perm_fieldincludeBuiltins - if true, this will set the permissions for the
built-in fields to entry as well as the custom fields.private void clean()
This internal method is used to cull out any entries in this permissions field that are non-operative, either by referring to an object/field type that does not exist, or by being redundant.
private java.lang.String matrixEntry(short baseID,
short fieldID)
Private method to generate a key for use in
our internal Hashtable, used to encode the
permission for a given DBObjectBase and DBObjectBaseField.
private java.lang.String matrixEntry(short baseID)
Private method to generate a key for use in
our internal Hashtable, used to encode the
permission for a given DBObjectBase.
public java.lang.Object checkpoint()
This method is used to basically dump state out of this field
so that the DBEditSet
checkpoint()
code can restore it later
if need be.
checkpoint in class DBFieldpublic void rollback(java.lang.Object oldval)
This method is used to basically force state into this field.
It is used to place a value or set of values that were known to be good during the current transaction back into this field, without creating or changing this DBField's object identity.
rollback in class DBField
public boolean allowablePermEntry(short baseID,
short fieldID,
PermEntry entry)
This method is used to check that the given operation can be set by the current administrator.
If fieldID < 0, entry will be checked against the administrator's applicable base permissions.
public void debugdump()
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||