arlut.csd.ganymede
Class DBObjectBase

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--arlut.csd.ganymede.DBObjectBase
All Implemented Interfaces:
Base, CategoryNode, java.rmi.Remote, java.io.Serializable

public class DBObjectBase
extends java.rmi.server.UnicastRemoteObject
implements Base, CategoryNode

The data dictionary and object store for a particular kind of object in the DBStore on the Ganymede server.

Each DBObjectBase object includes a set of DBObjectBaseField objects, which define the types and constraints on fields that may be present in objects of this type. These field definitions are held in an DBBaseFieldTable.

The actual DBObject's themselves are contained in an optimized DBObjectTable contained within this DBObjectBase.

In addition to holding name, type id, and category information for a given object type, the DBObjectBase class may also contain a string classname for a Java class to be dynamically loaded to manage the server's interactions with objects of this type. Such a class name must refer to a subclass of the DBEditObject class. If such a custom class is defined for this object type, DBObjectBase will contain an objectHook DBEditObject instance whose methods will be consulted to customize a lot of the server's functioning.

DBObjectBase also keeps track of DBReadLocks, DBWriteLocks, and DBDumpLocks, to manage changes to be made to objects contained in this DBObjectBase.

DBObjectBase implements the Base RMI remote interface, which is used by the client to determine type information for objects of this type, as well as by the schema editor when the schema is being edited.

See Also:
Serialized Form

Field Summary
(package private)  arlut.csd.ganymede.Category category
          what category is this object in?
(package private)  java.lang.Class classdef
          Class definition for a DBEditObject subclass dynamically loaded to manage operations on this DBObjectBase.
(package private)  java.lang.String classname
          Fully qualified package and class name for a custom DBEditObject subclass to be dynamically loaded to manage operations on this DBObjectBase.
private static arlut.csd.Util.Compare comparator
           
(package private)  arlut.csd.ganymede.DBLock currentLock
          If this DBObjectBase is locked with an exclusive lock (a DBWriteLock), this field will point to it.
(package private)  java.util.Vector customFields
          Custom field dictionary sorted in display order.
(package private) static boolean debug
           
(package private) static boolean debug2
          More debugging.
private  java.util.Vector dumperList
          Set of DBDumpLocks pending on this DBObjectBase.
private  java.util.Vector dumpLockList
          Collection of DBDumpLocks that are locked on this DBObjectBase.
(package private)  arlut.csd.ganymede.DBSchemaEdit editor
          Used to keep track of schema editing
private  boolean embedded
          If true, this type of object is used as a target for an edit-in-place InvidDBField.
(package private)  arlut.csd.ganymede.DBBaseFieldTable fieldTable
          field dictionary
private  java.util.Vector iterationSet
          This Vector holds the current collection of DBObject objects in this DBObjectBase, for enumeration access.
(package private)  short label_id
          which field represents our label?
(package private)  java.util.Date lastChange
          Timestamp for the last time this DBObjectBase was changed, used by GanymedeBuilderTasks to determine whether a particular build sequence is necessary.
(package private)  int maxid
          highest invid to date
(package private)  java.lang.String object_name
          Name of this object type
(package private)  arlut.csd.ganymede.DBEditObject objectHook
          Each DBObjectBase can have an instantiation of a custom DBEditObject subclass to respond to a number of 'pseudostatic' method calls which customize the Ganymede server's behavior when dealing with objects of this DBObjectBase's type.
(package private)  arlut.csd.ganymede.DBObjectTable objectTable
          objects in our objectBase
private  java.util.Vector readerList
          Collection of DBReadLocks that are locked on this DBObjectBase.
(package private)  arlut.csd.ganymede.DBStore store
          The central Ganymede database object that this object base is contained within.
(package private)  java.util.Vector templateVector
          Cached template vector
(package private)  int tmp_displayOrder
          used only during loading of pre-2.0 format ganymede.db files
(package private)  short type_code
          short type id code for this object type.
(package private)  boolean writeInProgress
          Boolean flag monitoring whether or not this DBObjectBase is currently locked for writing.
private  java.util.Vector writerList
          Set of DBWriteLocks pending on this DBObjectBase.
(package private) static boolean xmldebug
           
 
Fields inherited from class java.rmi.server.UnicastRemoteObject
 
Fields inherited from class java.rmi.server.RemoteServer
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
DBObjectBase(java.io.DataInput in, arlut.csd.ganymede.DBStore store)
          receive constructor.
DBObjectBase(arlut.csd.ganymede.DBObjectBase original, arlut.csd.ganymede.DBSchemaEdit editor)
          copy constructor.
DBObjectBase(arlut.csd.ganymede.DBStore store, boolean embedded)
          Generic constructor.
DBObjectBase(arlut.csd.ganymede.DBStore store, boolean embedded, boolean createFields)
          This constructor actually does all the work of initializing a new DBObjectBase.
DBObjectBase(arlut.csd.ganymede.DBStore store, short id, boolean embedded, arlut.csd.ganymede.DBSchemaEdit editor)
          Creation constructor.
 
Method Summary
(package private)  boolean addDumper(arlut.csd.ganymede.DBDumpLock dumper)
          Add a DBDumpLock to this base's dumper waiting set.
(package private)  boolean addDumpLock(arlut.csd.ganymede.DBDumpLock dumper)
          Add a DBDumpLock to this base's dumper lock list.
(package private)  void addFieldToEnd(arlut.csd.ganymede.DBObjectBaseField field)
          This method is used to put a new user field into both the hashed field table and the customFields vector.
(package private)  void addFieldToStart(arlut.csd.ganymede.DBObjectBaseField field)
          This method is used to put a new user field into both the hashed field table and the customFields vector.
(package private)  boolean addReader(arlut.csd.ganymede.DBReadLock reader)
          Add a DBReadLock to this base's reader list.
(package private)  void addSystemField(arlut.csd.ganymede.DBObjectBaseField field)
          This method is used to store a system field.
(package private)  arlut.csd.ganymede.DBObjectBaseField addSystemField(java.lang.String name, short id, short type)
          This method is used to instantiate a mandatory system field in this object.
(package private)  boolean addWriter(arlut.csd.ganymede.DBWriteLock writer)
          Add a DBWriteLock to this base's writer wait set.
 boolean canCreate(arlut.csd.ganymede.Session session)
          Returns true if the current session is permitted to create an object of this type.
 boolean canInactivate()
          Returns true if this object type can be inactivated
(package private)  void clearEditor()
          Clear the editing flag.
private  void createBuiltIns(boolean embedded)
          This method is used to instantiate the system default fields in a newly created or loaded DBObjectBase.
(package private)  arlut.csd.ganymede.DBEditObject createHook()
          This method is used to create a DBEditObject subclass handle (objectHook), to allow various classes to make calls to overridden static methods for DBEditObject subclasses.
 arlut.csd.ganymede.BaseField createNewField()
          Creates a new base field, inserts it into the DBObjectBase field definitions hash, and returns a reference to it.
(package private)  arlut.csd.ganymede.DBEditObject createNewObject(arlut.csd.ganymede.DBEditSet editset)
          Factory method to create a new DBEditObject of this type.
(package private)  arlut.csd.ganymede.DBEditObject createNewObject(arlut.csd.ganymede.DBEditSet editset, arlut.csd.ganymede.Invid chosenSlot)
          Factory method to create a new DBEditObject of this type.
 arlut.csd.ganymede.ReturnVal deleteField(java.lang.String fieldName)
          This method is used to remove a field definition from the current schema.
(package private)  void emit(java.io.DataOutput out, boolean dumpObjects)
           
(package private)  void emitXML(arlut.csd.ganymede.XMLDumpContext xmlOut)
          This method dumps schema information to an XML stream.
 boolean fieldInUse(arlut.csd.ganymede.DBObjectBaseField bF)
          This method is used by the SchemaEditor to detect whether any objects are using a field definition.
 boolean fieldInUse(java.lang.String fieldName)
          This method is used by the SchemaEditor to detect whether any objects are using a field definition.
 arlut.csd.ganymede.Category getCategory()
          Get the parent Category for this object type.
 java.lang.Class getClassDef()
          Returns the class definition for this object type
 java.lang.String getClassName()
          Returns the name of the class managing this object type
(package private)  int getDumperSize()
          Returns the size of the dumper wait set
(package private)  int getDumpLockListSize()
          Returns the size of the dumper lock list
 arlut.csd.ganymede.BaseField getField(short id)
          Returns the field definition for the field matching id, or null if no match found.
 arlut.csd.ganymede.BaseField getField(java.lang.String name)
          Returns the field definition for the field matching name, or null if no match found.
 java.util.Vector getFields()
          Returns all DBObjectBaseField base field definitions for objects of this type, in random order.
 java.util.Vector getFields(boolean includeBuiltIns)
          Returns DBObjectBaseField base field definitions for objects of this type.
 java.util.Vector getFieldTemplateVector()
          Returns a vector of field definition templates, in display order.
(package private)  java.util.Vector getIterationSet()
          This method returns a vector containing references to all objects in this DBObjectBase at the time the vector reference is accessed.
 java.lang.Short getKey()
          Returns the invid type id for this object definition as a Short, suitable for use in a hash.
 short getLabelField()
          Returns the short type id for the field designated as this object's primary label field, if any.
 java.lang.String getLabelFieldName()
          Returns the field name for the field designated as this object's primary label field.
 java.lang.String getName()
          Returns the name of this object type.
(package private)  short getNextFieldID()
          Get the next available field id for a new custom field.
(package private)  int getNextID()
          allocate a new object id
 arlut.csd.ganymede.DBObject getObject(int objectID)
          This server-side routine provides a convenient accessor to retrieve a specific object stored in this DBObjectBase.
 arlut.csd.ganymede.DBObject getObject(arlut.csd.ganymede.Invid invid)
          This server-side routine provides a convenient accessor to retrieve a specific object stored in this DBObjectBase.
 arlut.csd.ganymede.DBEditObject getObjectHook()
          Helper method for DBEditObject subclasses
 java.lang.String getPath()
          Returns the name and category path of this object type.
(package private)  int getReaderSize()
          Returns the size of the reader list
 arlut.csd.ganymede.DBStore getStore()
          Returns the DBStore containing this DBObjectBase.
 java.util.Date getTimeStamp()
          Returns a Date object containing the time that any changes were committed to this DBObjectBase.
 short getTypeID()
          Returns the invid type id for this object definition
(package private)  int getWriterSize()
          Returns the size of the writer wait set
(package private)  boolean isDumperEmpty()
          Returns true if this base's dumper wait set is empty.
(package private)  boolean isDumpLockListEmpty()
          Returns true if this base's dumper lock list is empty.
 boolean isEmbedded()
          This method returns true if this object base is for an embedded object.
(package private)  boolean isLocked()
          Returns true if this DBObjectBase is currently locked for reading, writing, or dumping.
(package private)  boolean isReaderEmpty()
          Returns true if this base's reader list is empty.
 boolean isRemovable()
          This method indicates whether this base may be removed in the Schema Editor.
(package private)  boolean isWriterEmpty()
          Returns true if this base's writer wait set is empty.
 arlut.csd.ganymede.ReturnVal moveFieldAfter(java.lang.String fieldName, java.lang.String previousFieldName)
          This method is used to adjust the ordering of a custom field in this Base.
 arlut.csd.ganymede.ReturnVal moveFieldBefore(java.lang.String fieldName, java.lang.String nextFieldName)
          This method is used to adjust the ordering of a custom field in this Base.
 void print(java.io.PrintWriter out, java.lang.String indent)
          Print a debugging summary of the custom type information encoded in this objectbase to a PrintWriter.
 void printHTML(java.io.PrintWriter out)
          Print a debugging summary of the custom type information encoded in this objectbase to a PrintWriter.
(package private)  void receive(java.io.DataInput in)
           
(package private)  void releaseId(int id)
          releases an id if an object initially created by createDBObject is rejected due to its transaction being aborted
 void reloadCustomClass()
          This method is used to force a reload of the custom object code for this object type.
(package private)  boolean removeDumper(arlut.csd.ganymede.DBDumpLock dumper)
          Remove a DBDumpLock from this base's dumper waiting set.
(package private)  boolean removeDumpLock(arlut.csd.ganymede.DBDumpLock dumper)
          Remove a DBDumpLock from this base's dumper lock list.
private  void removeField(arlut.csd.ganymede.DBObjectBaseField field)
          This method is used to remove a field from this base's field database.
(package private)  boolean removeReader(arlut.csd.ganymede.DBReadLock reader)
          Remove a DBReadLock from this base's reader list.
(package private)  boolean removeWriter(arlut.csd.ganymede.DBWriteLock writer)
          Remove a DBWriteLock from this base's writer wait set.
 void setCategory(arlut.csd.ganymede.Category category)
          Set the objectbase category.
 arlut.csd.ganymede.ReturnVal setClassName(java.lang.String newName)
          Sets the fully qualified classname of the class managing this object type
static void setDebug(boolean val)
           
 arlut.csd.ganymede.ReturnVal setLabelField(short fieldID)
          Choose what field will serve as this objectBase's label.
 arlut.csd.ganymede.ReturnVal setLabelField(java.lang.String fieldName)
          Choose what field will serve as this objectBase's label.
 arlut.csd.ganymede.ReturnVal setName(java.lang.String newName)
          Sets the name for this object type
 arlut.csd.ganymede.ReturnVal setTypeID(short objectId)
          Sets the object ID code for this object type
(package private)  arlut.csd.ganymede.ReturnVal setXML(arlut.csd.Util.XMLItem root, boolean resolveInvidLinks, java.io.PrintWriter err)
          This method is used to read the definition for this DBObjectBase from an XMLItem <objectdef> tree.
 java.lang.String toString()
          Let's get our name here.
private  void updateBaseRefs()
          This method is used to update base references in objects after this base has replaced an old version via the SchemaEditor.
(package private)  void updateIterationSet()
          This method is used by the DBEditSet commit logic to replace this DBObjectBase's iterationSet with a new Vector with the current objectTable's values.
(package private)  void updateTimeStamp()
          This method is used to allow objects in this base to notify us when their state changes.
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

debug

static boolean debug

debug2

static final boolean debug2

More debugging.

See Also:
Constant Field Values

xmldebug

static final boolean xmldebug
See Also:
Constant Field Values

comparator

private static arlut.csd.Util.Compare comparator

store

arlut.csd.ganymede.DBStore store

The central Ganymede database object that this object base is contained within.


object_name

java.lang.String object_name

Name of this object type


type_code

short type_code

short type id code for this object type. This number is used as the type code in Invids pointing to objects of this type.


classname

java.lang.String classname

Fully qualified package and class name for a custom DBEditObject subclass to be dynamically loaded to manage operations on this DBObjectBase.


classdef

java.lang.Class classdef

Class definition for a DBEditObject subclass dynamically loaded to manage operations on this DBObjectBase.


label_id

short label_id
which field represents our label?


category

arlut.csd.ganymede.Category category
what category is this object in?


embedded

private boolean embedded

If true, this type of object is used as a target for an edit-in-place InvidDBField.


customFields

java.util.Vector customFields
Custom field dictionary sorted in display order. This Vector does *not* include any built-in fields. Elements of this Vector are DBObjectBaseFields.


templateVector

java.util.Vector templateVector

Cached template vector


fieldTable

arlut.csd.ganymede.DBBaseFieldTable fieldTable
field dictionary


objectTable

arlut.csd.ganymede.DBObjectTable objectTable
objects in our objectBase


maxid

int maxid
highest invid to date


tmp_displayOrder

int tmp_displayOrder
used only during loading of pre-2.0 format ganymede.db files


lastChange

java.util.Date lastChange

Timestamp for the last time this DBObjectBase was changed, used by GanymedeBuilderTasks to determine whether a particular build sequence is necessary.


currentLock

arlut.csd.ganymede.DBLock currentLock

If this DBObjectBase is locked with an exclusive lock (a DBWriteLock), this field will point to it.

This field is not currently used for anything in particular in the lock logic, it is here strictly for informational/debugging purposes.


writerList

private java.util.Vector writerList

Set of DBWriteLocks pending on this DBObjectBase. DBWriteLocks will add themselves to the writerList upon entering establish(). If writerList is not empty, no new DBReadLocks will be allowed to add to add themselve to the readerList in this DBObjectBase. DBDumpLocks don't check the writerList, and will add themselves to the dumperList as needed, which will block any further writers from queuing up in the list.

When a DBWriteLock is locked onto this base, it is taken out of writerList, writeInProgress is set to true, and currentLock is set to point to the DBWriteLock that has exclusive access.

Note that there is no guarantee that DBWriteLocks will be granted access to any given DBObjectBase in the order that their threads entered the establish() method, as different DBWriteLocks may be attempting to establish() on differing sets of DBObjectBases. There is not in fact any attempt in the DBWriteLock establish() method to ensure that writers are given the lock on a DBObjectBase in their writerList ordering. The establish() methods may establish() any writer in any order, depending on the server's threading behavior.


readerList

private java.util.Vector readerList

Collection of DBReadLocks that are locked on this DBObjectBase.


dumperList

private java.util.Vector dumperList

Set of DBDumpLocks pending on this DBObjectBase. DBDumpLocks will add themselves to the dumperList upon entering establish(). If dumperList is not empty, no new DBWriteLocks will be allowed to add themselves to the writerList in this DBObjectBase.

Note that there is no guarantee that DBDumpLocks will be granted access to any given DBObjectBase in the order that their threads entered the establish() method, as different DBDumpLocks may be attempting to establish() on differing sets of DBObjectBases. There is not in fact any attempt in the DBDumpLock establish() method to ensure that writers are given the lock on a DBObjectBase in their dumperList ordering. The establish() methods may establish() any dumper in any order, depending on the server's threading behavior.


dumpLockList

private java.util.Vector dumpLockList

Collection of DBDumpLocks that are locked on this DBObjectBase.


writeInProgress

boolean writeInProgress

Boolean flag monitoring whether or not this DBObjectBase is currently locked for writing.


editor

arlut.csd.ganymede.DBSchemaEdit editor
Used to keep track of schema editing


iterationSet

private java.util.Vector iterationSet

This Vector holds the current collection of DBObject objects in this DBObjectBase, for enumeration access. The GanymedeSession query logic iterates over this Vector so that querying on single bases can proceed while commits are under way.

This is practicable because assignment to this variable is an inherently atomic event in the Java spec, so we just wait to assign a new Vector here until we have a new one composed. We just have to depend on all code that accesses this vector to grab its own reference to this vector and then not modify it, and to drop reference to it when the iteration is complete.


objectHook

arlut.csd.ganymede.DBEditObject objectHook

Each DBObjectBase can have an instantiation of a custom DBEditObject subclass to respond to a number of 'pseudostatic' method calls which customize the Ganymede server's behavior when dealing with objects of this DBObjectBase's type. The DBObjectBase createHook() method is responsible for loading the custom DBEditObject subclass (classdef) from the classname specified in the ganymede.db schema section.

objectHook should never be null while the server is in operation. If the Ganymede schema definition data in the ganymede.db file does not specify a special class for this object type's objectHook, DBObjectBase should have an instance of the base DBEditObject class here.

See the Ganymede DBEditObject subclassing/customization guide for a lot more details on the use of DBEditObjects as objectHooks.

Constructor Detail

DBObjectBase

public DBObjectBase(arlut.csd.ganymede.DBStore store,
                    boolean embedded)
             throws java.rmi.RemoteException

Generic constructor.

Parameters:
store - The DBStore database this DBObjectBase is being created for.
embedded - If true, objects of this DBObjectBase type will not be top-level objects, but rather will be embedded using edit-in-place InvidDBFields.

DBObjectBase

public DBObjectBase(arlut.csd.ganymede.DBStore store,
                    boolean embedded,
                    boolean createFields)
             throws java.rmi.RemoteException

This constructor actually does all the work of initializing a new DBObjectBase. All other constructors for DBObjectBase will eventually call this constructor.

Parameters:
store - The DBStore database this DBObjectBase is being created for.
embedded - If true, objects of this DBObjectBase type will not be top-level objects, but rather will be embedded using edit-in-place InvidDBFields.
createFields - If true, the standard fields required by the server for its own operations will be created as part of DBObjectBase creation. This should be false if this DBObjectBase is being created in the process of loading data from a pre-existing database which will presumably already have all essential fields defined.

DBObjectBase

public DBObjectBase(arlut.csd.ganymede.DBStore store,
                    short id,
                    boolean embedded,
                    arlut.csd.ganymede.DBSchemaEdit editor)
             throws java.rmi.RemoteException

Creation constructor. Used when the schema editor interface is used to create a new DBObjectBase.


DBObjectBase

public DBObjectBase(java.io.DataInput in,
                    arlut.csd.ganymede.DBStore store)
             throws java.io.IOException,
                    java.rmi.RemoteException

receive constructor. Used to initialize this DBObjectBase from disk and load the objects of this type in from the standing store.

Parameters:
in - Input stream to read this object base from.
store - The Ganymede database object we are loading into.

DBObjectBase

public DBObjectBase(arlut.csd.ganymede.DBObjectBase original,
                    arlut.csd.ganymede.DBSchemaEdit editor)
             throws java.rmi.RemoteException

copy constructor. Used to create a copy that we can play with for schema editing.

Method Detail

setDebug

public static void setDebug(boolean val)

emit

void emit(java.io.DataOutput out,
          boolean dumpObjects)
    throws java.io.IOException
java.io.IOException

receive

void receive(java.io.DataInput in)
       throws java.io.IOException
java.io.IOException

createBuiltIns

private void createBuiltIns(boolean embedded)

This method is used to instantiate the system default fields in a newly created or loaded DBObjectBase.


emitXML

void emitXML(arlut.csd.ganymede.XMLDumpContext xmlOut)
       throws java.io.IOException

This method dumps schema information to an XML stream.

java.io.IOException

setXML

arlut.csd.ganymede.ReturnVal setXML(arlut.csd.Util.XMLItem root,
                                    boolean resolveInvidLinks,
                                    java.io.PrintWriter err)

This method is used to read the definition for this DBObjectBase from an XMLItem <objectdef> tree.


isEmbedded

public boolean isEmbedded()

This method returns true if this object base is for an embedded object. Embedded objects do not have their own expiration and removal dates, do not have history trails, and can be only owned by a single object, not by a list of administrators.

Specified by:
isEmbedded in interface Base

isRemovable

public boolean isRemovable()

This method indicates whether this base may be removed in the Schema Editor.

We don't allow removal of built-in Bases that the server depends on for its operation, such as permissions, notification, and logging object types.

Specified by:
isRemovable in interface Base
See Also:
Base

reloadCustomClass

public void reloadCustomClass()

This method is used to force a reload of the custom object code for this object type.


createHook

arlut.csd.ganymede.DBEditObject createHook()
                                     throws java.rmi.RemoteException

This method is used to create a DBEditObject subclass handle (objectHook), to allow various classes to make calls to overridden static methods for DBEditObject subclasses.

java.rmi.RemoteException

createNewObject

arlut.csd.ganymede.DBEditObject createNewObject(arlut.csd.ganymede.DBEditSet editset)

Factory method to create a new DBEditObject of this type. The created DBEditObject will be connected to the editset, and will not be integrated into the DBStore until the editset is committed.

IMPORTANT NOTE: This method *must not* be public! All DBEditObject customization classes should go through DBSession.createDBObject() to create new objects.

Parameters:
editset - The transaction this object is to be created in

createNewObject

arlut.csd.ganymede.DBEditObject createNewObject(arlut.csd.ganymede.DBEditSet editset,
                                                arlut.csd.ganymede.Invid chosenSlot)

Factory method to create a new DBEditObject of this type. The created DBEditObject will be connected to the editset, and will not be integrated into the DBStore until the editset is committed.

IMPORTANT NOTE: This method *must not* be public! All DBEditObject customization classes should go through DBSession.createDBObject() to create new objects.

Parameters:
editset - The transaction this object is to be created in
chosenSlot - If this is non-null, the object will be assigned the given invid, if available

getNextID

int getNextID()
allocate a new object id


releaseId

void releaseId(int id)

releases an id if an object initially created by createDBObject is rejected due to its transaction being aborted

note that we aren't being real fancy here.. if this doesn't work, it doesn't work.. we have 2 billion slots in this object base after all..


printHTML

public void printHTML(java.io.PrintWriter out)

Print a debugging summary of the custom type information encoded in this objectbase to a PrintWriter.

Parameters:
out - PrintWriter to print to.

print

public void print(java.io.PrintWriter out,
                  java.lang.String indent)

Print a debugging summary of the custom type information encoded in this objectbase to a PrintWriter.

Parameters:
out - PrintWriter to print to.

getStore

public arlut.csd.ganymede.DBStore getStore()

Returns the DBStore containing this DBObjectBase.


getName

public java.lang.String getName()

Returns the name of this object type. Guaranteed to be unique in the Ganymede server.

Specified by:
getName in interface Base
See Also:
Base

getPath

public java.lang.String getPath()
Returns the name and category path of this object type. Guaranteed to be unique in the Ganymede server.

Specified by:
getPath in interface Base

setName

public arlut.csd.ganymede.ReturnVal setName(java.lang.String newName)

Sets the name for this object type

This method is only valid when the Base reference is obtained from a SchemaEdit reference by the Ganymede schema editor.

Specified by:
setName in interface Base
See Also:
Base

getClassName

public java.lang.String getClassName()

Returns the name of the class managing this object type

Specified by:
getClassName in interface Base
See Also:
Base

setClassName

public arlut.csd.ganymede.ReturnVal setClassName(java.lang.String newName)

Sets the fully qualified classname of the class managing this object type

This method is only valid when the Base reference is obtained from a SchemaEdit reference by the Ganymede schema editor.

Specified by:
setClassName in interface Base
See Also:
Base

getClassDef

public java.lang.Class getClassDef()

Returns the class definition for this object type


moveFieldAfter

public arlut.csd.ganymede.ReturnVal moveFieldAfter(java.lang.String fieldName,
                                                   java.lang.String previousFieldName)

This method is used to adjust the ordering of a custom field in this Base.

Specified by:
moveFieldAfter in interface Base
Parameters:
fieldName - The name of the field to move
previousFieldName - The name of the field that fieldName is going to be put after, or null if fieldName is to be the first field displayed in this object type.

moveFieldBefore

public arlut.csd.ganymede.ReturnVal moveFieldBefore(java.lang.String fieldName,
                                                    java.lang.String nextFieldName)

This method is used to adjust the ordering of a custom field in this Base.

Specified by:
moveFieldBefore in interface Base
Parameters:
fieldName - The name of the field to move
nextFieldName - The name of the field that fieldName is going to be put before, or null if fieldName is to be the last field displayed in this object type.

canCreate

public boolean canCreate(arlut.csd.ganymede.Session session)

Returns true if the current session is permitted to create an object of this type.

Specified by:
canCreate in interface Base
See Also:
Base

canInactivate

public boolean canInactivate()

Returns true if this object type can be inactivated

Specified by:
canInactivate in interface Base
See Also:
Base

getTypeID

public short getTypeID()

Returns the invid type id for this object definition

Specified by:
getTypeID in interface Base
See Also:
Base

setTypeID

public arlut.csd.ganymede.ReturnVal setTypeID(short objectId)

Sets the object ID code for this object type


getLabelField

public short getLabelField()

Returns the short type id for the field designated as this object's primary label field, if any. Objects do not need to have a primary label field designated if labels for this object type are dynamically generated.

Specified by:
getLabelField in interface Base
See Also:
Base

getLabelFieldName

public java.lang.String getLabelFieldName()

Returns the field name for the field designated as this object's primary label field. null is returned if no label has been designated.

Specified by:
getLabelFieldName in interface Base
See Also:
Base

getKey

public java.lang.Short getKey()

Returns the invid type id for this object definition as a Short, suitable for use in a hash.


getFields

public java.util.Vector getFields()

Returns all DBObjectBaseField base field definitions for objects of this type, in random order.

Specified by:
getFields in interface Base
See Also:
Base

getFields

public java.util.Vector getFields(boolean includeBuiltIns)

Returns DBObjectBaseField base field definitions for objects of this type.

If includeBuiltIns is false, the fields returned will be the custom fields defined for this object type, and they will be returned in display order. If includeBuiltIns is true, the built-in fields will be appended to the Vector after the custom types, in random order.

Specified by:
getFields in interface Base
See Also:
Base

getField

public arlut.csd.ganymede.BaseField getField(short id)

Returns the field definition for the field matching id, or null if no match found.

Specified by:
getField in interface Base
See Also:
BaseField, Base

getField

public arlut.csd.ganymede.BaseField getField(java.lang.String name)

Returns the field definition for the field matching name, or null if no match found.

Specified by:
getField in interface Base
See Also:
BaseField, Base

setLabelField

public arlut.csd.ganymede.ReturnVal setLabelField(java.lang.String fieldName)

Choose what field will serve as this objectBase's label. A fieldName parameter of null will cause the object's label field to be undefined, in which case the object will have to generate its own label using the getLabelHook() method.

This method is only valid when the Base reference is obtained from a SchemaEdit reference by the Ganymede schema editor.

Specified by:
setLabelField in interface Base
See Also:
Base

setLabelField

public arlut.csd.ganymede.ReturnVal setLabelField(short fieldID)

Choose what field will serve as this objectBase's label. A fieldID parameter of -1 will cause the object's label field to be undefined, in which case the object will have to generate its own label using the getLabelHook() method.

This method is only valid when the Base reference is obtained from a SchemaEdit reference by the Ganymede schema editor.

Specified by:
setLabelField in interface Base
See Also:
Base

getCategory

public arlut.csd.ganymede.Category getCategory()

Get the parent Category for this object type. This is used by the Ganymede client and schema editor to present object types in a hierarchical tree.

Specified by:
getCategory in interface Base
See Also:
Base, CategoryNode

setCategory

public void setCategory(arlut.csd.ganymede.Category category)

Set the objectbase category. This operation only registers the category in this base, it doesn't register the base in the category. The proper way to add this base to a Category is to call addNode(Base, nodeBefore) on the appropriate Category object. That addNode() operation will call setCategory() here.

This method is only valid when the Base reference is obtained from a SchemaEdit reference by the Ganymede schema editor.

Specified by:
setCategory in interface CategoryNode
See Also:
CategoryNode

createNewField

public arlut.csd.ganymede.BaseField createNewField()

Creates a new base field, inserts it into the DBObjectBase field definitions hash, and returns a reference to it.

This method is only valid when the Base reference is obtained from a SchemaEdit reference by the Ganymede schema editor.

Specified by:
createNewField in interface Base
See Also:
Base

deleteField

public arlut.csd.ganymede.ReturnVal deleteField(java.lang.String fieldName)

This method is used to remove a field definition from the current schema.

Of course, this removal will only take effect if the schema editor commits.

Specified by:
deleteField in interface Base
See Also:
Base

fieldInUse

public boolean fieldInUse(arlut.csd.ganymede.DBObjectBaseField bF)

This method is used by the SchemaEditor to detect whether any objects are using a field definition.

Server-side only.


fieldInUse

public boolean fieldInUse(java.lang.String fieldName)

This method is used by the SchemaEditor to detect whether any objects are using a field definition.

Specified by:
fieldInUse in interface Base
See Also:
Base

getObjectHook

public arlut.csd.ganymede.DBEditObject getObjectHook()

Helper method for DBEditObject subclasses


getNextFieldID

short getNextFieldID()

Get the next available field id for a new custom field.


getObject

public final arlut.csd.ganymede.DBObject getObject(arlut.csd.ganymede.Invid invid)

This server-side routine provides a convenient accessor to retrieve a specific object stored in this DBObjectBase.


getObject

public final arlut.csd.ganymede.DBObject getObject(int objectID)

This server-side routine provides a convenient accessor to retrieve a specific object stored in this DBObjectBase.


clearEditor

void clearEditor()

Clear the editing flag. This disables the DBObjectBase set methods on this ObjectBase and all dependent field definitions. This method also updates the FieldTemplate for each field in this object base.


updateIterationSet

void updateIterationSet()

This method is used by the DBEditSet commit logic to replace this DBObjectBase's iterationSet with a new Vector with the current objectTable's values. This method should only be called within the context of a DBWriteLock being established on this DBObjectBase, in the DBEditSet.commitTransaction() logic.


getIterationSet

java.util.Vector getIterationSet()

This method returns a vector containing references to all objects in this DBObjectBase at the time the vector reference is accessed. The vector returned *must not* be modified by the caller, or else other threads iterating on that copy of the vector will be disrupted.


updateBaseRefs

private void updateBaseRefs()

This method is used to update base references in objects after this base has replaced an old version via the SchemaEditor.


updateTimeStamp

void updateTimeStamp()

This method is used to allow objects in this base to notify us when their state changes. It is called from the DBEditSet commit() method.

We use this method to be able to determine the last time anything in this DBObjectBase changed when making decisions as to what needs to be done in BuilderTasks.


getTimeStamp

public java.util.Date getTimeStamp()

Returns a Date object containing the time that any changes were committed to this DBObjectBase.


isLocked

boolean isLocked()

Returns true if this DBObjectBase is currently locked for reading, writing, or dumping.


addWriter

boolean addWriter(arlut.csd.ganymede.DBWriteLock writer)

Add a DBWriteLock to this base's writer wait set.


removeWriter

boolean removeWriter(arlut.csd.ganymede.DBWriteLock writer)

Remove a DBWriteLock from this base's writer wait set.


isWriterEmpty

boolean isWriterEmpty()

Returns true if this base's writer wait set is empty.


getWriterSize

int getWriterSize()

Returns the size of the writer wait set


addReader

boolean addReader(arlut.csd.ganymede.DBReadLock reader)

Add a DBReadLock to this base's reader list.


removeReader

boolean removeReader(arlut.csd.ganymede.DBReadLock reader)

Remove a DBReadLock from this base's reader list.


isReaderEmpty

boolean isReaderEmpty()

Returns true if this base's reader list is empty.


getReaderSize

int getReaderSize()

Returns the size of the reader list


addDumper

boolean addDumper(arlut.csd.ganymede.DBDumpLock dumper)

Add a DBDumpLock to this base's dumper waiting set.


removeDumper

boolean removeDumper(arlut.csd.ganymede.DBDumpLock dumper)

Remove a DBDumpLock from this base's dumper waiting set.


isDumperEmpty

boolean isDumperEmpty()

Returns true if this base's dumper wait set is empty.


getDumperSize

int getDumperSize()

Returns the size of the dumper wait set


addDumpLock

boolean addDumpLock(arlut.csd.ganymede.DBDumpLock dumper)

Add a DBDumpLock to this base's dumper lock list.


removeDumpLock

boolean removeDumpLock(arlut.csd.ganymede.DBDumpLock dumper)

Remove a DBDumpLock from this base's dumper lock list.


isDumpLockListEmpty

boolean isDumpLockListEmpty()

Returns true if this base's dumper lock list is empty.


getDumpLockListSize

int getDumpLockListSize()

Returns the size of the dumper lock list


toString

public java.lang.String toString()

Let's get our name here.

Overrides:
toString in class java.rmi.server.RemoteObject

getFieldTemplateVector

public java.util.Vector getFieldTemplateVector()

Returns a vector of field definition templates, in display order.

See Also:
FieldTemplate, Session

addFieldToStart

void addFieldToStart(arlut.csd.ganymede.DBObjectBaseField field)

This method is used to put a new user field into both the hashed field table and the customFields vector.


addFieldToEnd

void addFieldToEnd(arlut.csd.ganymede.DBObjectBaseField field)

This method is used to put a new user field into both the hashed field table and the customFields vector.


addSystemField

arlut.csd.ganymede.DBObjectBaseField addSystemField(java.lang.String name,
                                                    short id,
                                                    short type)

This method is used to instantiate a mandatory system field in this object.


addSystemField

void addSystemField(arlut.csd.ganymede.DBObjectBaseField field)

This method is used to store a system field.


removeField

private void removeField(arlut.csd.ganymede.DBObjectBaseField field)

This method is used to remove a field from this base's field database.

This method is not intended for access from outside this class.. use deleteField() for that.