arlut.csd.ganymede
Class StringDBField

java.lang.Object
  |
  +--arlut.csd.ganymede.DBField
        |
        +--arlut.csd.ganymede.StringDBField
All Implemented Interfaces:
db_field, java.rmi.Remote, string_field

public class StringDBField
extends DBField
implements string_field

StringDBField is a subclass of DBField for the storage and handling of string fields in the DBStore on the Ganymede server.

The Ganymede client talks to StringDBFields through the string_field RMI interface.


Field Summary
 
Fields inherited from class arlut.csd.ganymede.DBField
fieldcode, owner, value
 
Constructor Summary
(package private) StringDBField(arlut.csd.ganymede.DBObject owner, java.io.DataInput in, arlut.csd.ganymede.DBObjectBaseField definition)
          Receive constructor.
(package private) StringDBField(arlut.csd.ganymede.DBObject owner, arlut.csd.ganymede.DBObjectBaseField definition)
          No-value constructor.
  StringDBField(arlut.csd.ganymede.DBObject owner, arlut.csd.ganymede.StringDBField field)
          Copy constructor.
  StringDBField(arlut.csd.ganymede.DBObject owner, java.lang.String value, arlut.csd.ganymede.DBObjectBaseField definition)
          Scalar value constructor.
  StringDBField(arlut.csd.ganymede.DBObject owner, java.util.Vector values, arlut.csd.ganymede.DBObjectBaseField definition)
          Vector value constructor.
 
Method Summary
 boolean allowed(char c)
          Convenience method to identify if a particular character is acceptable in this field.
 java.lang.String allowedChars()
          Returns a string containing the list of acceptable characters.
 boolean canChoose()
          Returns true if this field has a list of recommended options for choices from the choices() method.
 arlut.csd.ganymede.QueryResult choices()
          Returns a list of recommended and/or mandatory choices for this field.
 java.lang.Object choicesKey()
          This method returns a key that can be used by the client to cache the value returned by choices().
 java.lang.Object clone()
           
 java.lang.String disallowedChars()
          Returns a string containing the list of forbidden characters for this field.
(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.
 void emitStringXML(arlut.csd.ganymede.XMLDumpContext xmlOut, java.lang.String value)
           
(package private)  void emitXML(arlut.csd.ganymede.XMLDumpContext xmlOut)
          This method is used when the database is being dumped, to write out this field to disk.
 boolean excludeSelected(arlut.csd.ganymede.db_field x)
          This method returns true if this invid field should not show any choices that are currently selected in field x, where x is another field in this db_object.
 arlut.csd.ganymede.DBField getCopy(arlut.csd.ganymede.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(arlut.csd.ganymede.DBField orig)
          Returns a String representing the change in value between this field and orig.
 java.lang.String getEncodingString()
          For strings, we don't care about having a reversible encoding, because we can sort and select normally based on the getValueString() result.
 java.lang.String getValueString()
          This method returns a text encoded value for this StringDBField without checking permissions.
 boolean isDefined()
          Returns true if this field has a value associated with it, or false if it is an unfilled 'placeholder'.
 int maxSize()
          Returns the maximum acceptable string length for this field.
 int minSize()
          Returns the minimum acceptable string length for this field.
 boolean mustChoose()
          Returns true if the only valid values for this string field are in the vector returned by choices().
(package private)  void receive(java.io.DataInput in, arlut.csd.ganymede.DBObjectBaseField definition)
          This method is responsible for reading in the contents of this field from an binary input stream.
 boolean showEcho()
          Returns true if the client should echo characters entered into the string field.
 java.lang.String value()
           
 java.lang.String value(int index)
           
 arlut.csd.ganymede.ReturnVal verifyNewValue(java.lang.Object o)
          Overridable method to verify that an object submitted to this field has an appropriate value.
 boolean verifyTypeMatch(java.lang.Object o)
          Overridable method to determine whether an Object submitted to this field is of an appropriate type.
 
Methods inherited from class arlut.csd.ganymede.DBField
addElement, addElement, addElement, addElementLocal, addElements, addElements, addElements, addElements, addElementsLocal, checkpoint, cleanup, containsElement, containsElement, containsElementLocal, copyFieldTo, deleteAllElements, deleteElement, deleteElement, deleteElement, deleteElement, deleteElement, deleteElement, deleteElementLocal, deleteElementLocal, deleteElements, deleteElements, deleteElements, deleteElementsLocal, equals, getComment, getElement, getFieldDef, getFieldDef, getFieldDef, getFieldInfo, getFieldTemplate, getID, getMaxArraySize, getName, getNameSpace, getObjTypeID, getOwner, getType, getTypeDesc, getValue, getValue, getValueLocal, getValues, getValuesLocal, getVectorDiff, getVectVal, getXMLName, indexOfValue, isBuiltIn, isEditable, isEditable, isEditInPlace, isVector, isVisible, key, key, mark, mark, rescanThisField, rollback, setElement, setElement, setElement, setElementLocal, setOwner, setUndefined, setValue, setValue, setValue, setValueLocal, size, toString, unmark, unmark, verifyReadPermission, verifyWritePermission
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface arlut.csd.ganymede.db_field
addElement, addElements, containsElement, deleteAllElements, deleteElement, deleteElement, deleteElements, getComment, getElement, getFieldInfo, getFieldTemplate, getID, getName, getType, getTypeDesc, getValue, getValues, isBuiltIn, isEditable, isEditInPlace, isVector, isVisible, setElement, setValue, size
 

Constructor Detail

StringDBField

StringDBField(arlut.csd.ganymede.DBObject owner,
              java.io.DataInput in,
              arlut.csd.ganymede.DBObjectBaseField definition)
        throws java.io.IOException

Receive constructor. Used to create a StringDBField from a DBStore/DBJournal DataInput stream.


StringDBField

StringDBField(arlut.csd.ganymede.DBObject owner,
              arlut.csd.ganymede.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.


StringDBField

public StringDBField(arlut.csd.ganymede.DBObject owner,
                     arlut.csd.ganymede.StringDBField field)
Copy constructor.


StringDBField

public StringDBField(arlut.csd.ganymede.DBObject owner,
                     java.lang.String value,
                     arlut.csd.ganymede.DBObjectBaseField definition)
Scalar value constructor.


StringDBField

public StringDBField(arlut.csd.ganymede.DBObject owner,
                     java.util.Vector values,
                     arlut.csd.ganymede.DBObjectBaseField definition)
Vector value constructor.

Method Detail

getCopy

public arlut.csd.ganymede.DBField getCopy(arlut.csd.ganymede.DBObject newOwner)

This method is used to return a copy of this field, with the field's owner set to newOwner.

Specified by:
getCopy in class DBField

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

emit

void emit(java.io.DataOutput out)
    throws java.io.IOException
Description copied from class: DBField

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

Specified by:
emit in class DBField
java.io.IOException

receive

void receive(java.io.DataInput in,
             arlut.csd.ganymede.DBObjectBaseField definition)
       throws java.io.IOException
Description copied from class: DBField

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

Specified by:
receive in class DBField
java.io.IOException

emitXML

void emitXML(arlut.csd.ganymede.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().

Specified by:
emitXML in class DBField
java.io.IOException

emitStringXML

public void emitStringXML(arlut.csd.ganymede.XMLDumpContext xmlOut,
                          java.lang.String value)
                   throws java.io.IOException
java.io.IOException

value

public java.lang.String value()

value

public java.lang.String value(int index)

getValueString

public java.lang.String getValueString()

This method returns a text encoded value for this StringDBField without checking permissions.

This method avoids checking permissions because it is used on the server side only and because it is involved in the getLabel() logic for DBObject, which is invoked from GanymedeSession's getPerm() method.

If this method checked permissions and the getPerm() method failed for some reason and tried to report the failure using object.getLabel(), as it does at present, the server could get into an infinite loop.

Specified by:
getValueString in interface db_field
Specified by:
getValueString in class DBField

getEncodingString

public java.lang.String getEncodingString()

For strings, we don't care about having a reversible encoding, because we can sort and select normally based on the getValueString() result.

Specified by:
getEncodingString in interface db_field
Specified by:
getEncodingString in class DBField
See Also:
db_field

getDiffString

public java.lang.String getDiffString(arlut.csd.ganymede.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.

Specified by:
getDiffString in class DBField

isDefined

public boolean isDefined()

Returns true if this field has a value associated with it, or false if it is an unfilled 'placeholder'.

Specified by:
isDefined in interface db_field
Overrides:
isDefined in class DBField
See Also:
db_field

maxSize

public int maxSize()
Returns the maximum acceptable string length for this field.

Specified by:
maxSize in interface string_field
See Also:
string_field

minSize

public int minSize()
Returns the minimum acceptable string length for this field.

Specified by:
minSize in interface string_field
See Also:
string_field

showEcho

public boolean showEcho()
Returns true if the client should echo characters entered into the string field.

Specified by:
showEcho in interface string_field
See Also:
string_field

canChoose

public boolean canChoose()
Returns true if this field has a list of recommended options for choices from the choices() method.

Specified by:
canChoose in interface string_field
See Also:
string_field

mustChoose

public boolean mustChoose()
Returns true if the only valid values for this string field are in the vector returned by choices().

Specified by:
mustChoose in interface string_field
See Also:
string_field

excludeSelected

public boolean excludeSelected(arlut.csd.ganymede.db_field x)
This method returns true if this invid field should not show any choices that are currently selected in field x, where x is another field in this db_object.

Specified by:
excludeSelected in interface string_field

choices

public arlut.csd.ganymede.QueryResult choices()

Returns a list of recommended and/or mandatory choices for this field. This list is dynamically generated by subclasses of DBEditObject; this method should not need to be overridden.

Specified by:
choices in interface string_field
See Also:
string_field

choicesKey

public java.lang.Object choicesKey()

This method returns a key that can be used by the client to cache the value returned by choices(). If the client already has the key cached on the client side, it can provide the choice list from its cache rather than calling choices() on this object again.

If there is no caching key, this method will return null.

Specified by:
choicesKey in interface string_field

allowedChars

public java.lang.String allowedChars()

Returns a string containing the list of acceptable characters. If the string is null, it should be interpreted as meaning all characters not listed in disallowedChars() are allowable by default.

Specified by:
allowedChars in interface string_field
See Also:
string_field

disallowedChars

public java.lang.String disallowedChars()

Returns a string containing the list of forbidden characters for this field. If the string is null, it should be interpreted as meaning that no characters are specifically disallowed.

Specified by:
disallowedChars in interface string_field
See Also:
string_field

allowed

public boolean allowed(char c)

Convenience method to identify if a particular character is acceptable in this field.

Specified by:
allowed in interface string_field
See Also:
string_field

verifyTypeMatch

public boolean verifyTypeMatch(java.lang.Object o)
Description copied from class: DBField
Overridable method to determine whether an Object submitted to this field is of an appropriate type.

Specified by:
verifyTypeMatch in class DBField

verifyNewValue

public arlut.csd.ganymede.ReturnVal verifyNewValue(java.lang.Object o)
Description copied from class: DBField
Overridable method to verify that an object submitted to this field has an appropriate value.

Specified by:
verifyNewValue in class DBField