arlut.csd.ganymede
Class DateDBField

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

public class DateDBField
extends DBField
implements date_field

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

The Ganymede client talks to DateDBFields through the date_field RMI interface.

Ganymede uses the standard Java Date class, which can encode dates from roughly 300 million years B.C. to 300 million years A.D., with millisecond resolution. No Y2k problems here. ;-)


Field Summary
(package private) static java.text.DateFormat formatter
           
 
Fields inherited from class arlut.csd.ganymede.DBField
fieldcode, owner, value
 
Constructor Summary
(package private) DateDBField(DBObject owner, java.io.DataInput in, DBObjectBaseField definition)
          Receive constructor.
  DateDBField(DBObject owner, DateDBField field)
          Copy constructor.
  DateDBField(DBObject owner, java.util.Date value, DBObjectBaseField definition)
          Scalar value constructor.
(package private) DateDBField(DBObject owner, DBObjectBaseField definition)
          No-value constructor.
  DateDBField(DBObject owner, java.util.Vector values, DBObjectBaseField definition)
          Vector value constructor.
 
Method Summary
 java.lang.Object clone()
           
(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 emitDateXML(XMLDumpContext xmlOut, java.util.Date value)
           
(package private)  void emitXML(XMLDumpContext xmlOut)
          This method is used when the database is being dumped, to write out this field to disk.
 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()
          Date fields need a special encoding that can be easily reversed to obtain a date object on the client for sorting and selection purposes.
 java.lang.String getValueString()
          Returns a String representing the value of this field.
 boolean limited()
          Returns true if this date field has a minimum and/or maximum date set.
 java.util.Date maxDate()
          Returns the latest date acceptable for this field
 java.util.Date minDate()
          Returns the earliest date acceptable for this field
(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.
 java.util.Date value()
           
 java.util.Date value(int index)
           
 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, isDefined, 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, registerNatives, 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, isDefined, isEditable, isEditInPlace, isVector, isVisible, setElement, setValue, size
 

Field Detail

formatter

static java.text.DateFormat formatter
Constructor Detail

DateDBField

DateDBField(DBObject owner,
            java.io.DataInput in,
            DBObjectBaseField definition)
      throws java.io.IOException

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


DateDBField

DateDBField(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.


DateDBField

public DateDBField(DBObject owner,
                   DateDBField field)
Copy constructor.

DateDBField

public DateDBField(DBObject owner,
                   java.util.Date value,
                   DBObjectBaseField definition)
Scalar value constructor.

DateDBField

public DateDBField(DBObject owner,
                   java.util.Vector values,
                   DBObjectBaseField definition)
Vector value constructor.
Method Detail

getCopy

public DBField getCopy(DBObject newOwner)

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

Overrides:
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.

Overrides:
emit in class DBField

receive

void receive(java.io.DataInput in,
             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.

Overrides:
receive in class DBField

emitXML

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().

Overrides:
emitXML in class DBField

emitDateXML

public void emitDateXML(XMLDumpContext xmlOut,
                        java.util.Date value)
                 throws java.io.IOException

value

public java.util.Date value()

value

public java.util.Date value(int index)

getValueString

public java.lang.String getValueString()
Description copied from interface: db_field
Returns a String representing the value of this field.
Specified by:
getValueString in interface db_field
Overrides:
getValueString in class DBField

getEncodingString

public java.lang.String getEncodingString()
Date fields need a special encoding that can be easily reversed to obtain a date object on the client for sorting and selection purposes.
Specified by:
getEncodingString in interface db_field
Overrides:
getEncodingString in class DBField
Following copied from class: arlut.csd.ganymede.DBField
See Also:
db_field

getDiffString

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

Overrides:
getDiffString in class DBField

limited

public boolean limited()

Returns true if this date field has a minimum and/or maximum date set.

We depend on our owner's isDateLimited() method to tell us whether this Date field should be limited or not in this editing context.

Specified by:
limited in interface date_field
See Also:
date_field

minDate

public java.util.Date minDate()

Returns the earliest date acceptable for this field

We depend on our owner's minDate() method to tell us what the earliest acceptable Date for this field is.

Specified by:
minDate in interface date_field
See Also:
date_field

maxDate

public java.util.Date maxDate()

Returns the latest date acceptable for this field

We depend on our owner's maxDate() method to tell us what the earliest acceptable Date for this field is.

Specified by:
maxDate in interface date_field
See Also:
date_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.
Overrides:
verifyTypeMatch in class DBField

verifyNewValue

public 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.
Overrides:
verifyNewValue in class DBField