arlut.csd.ganymede.client
Class Loader

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--arlut.csd.ganymede.client.Loader
All Implemented Interfaces:
java.lang.Runnable

public class Loader
extends java.lang.Thread

Client-side thread class for loading object and field type definitions from the server in the background during the client's start-up.


Field Summary
private  java.util.Hashtable baseHash
           
private  boolean baseHashLoaded
           
private  java.util.Vector baseList
           
private  boolean baseListLoaded
           
private  java.util.Hashtable baseMap
           
private  boolean baseMapLoaded
           
private  java.util.Hashtable baseNames
           
private  boolean baseNamesLoaded
           
private  java.util.Hashtable baseToShort
           
private  boolean debug
           
private  boolean keepGoing
           
private  java.util.Hashtable nameShorts
           
private  arlut.csd.ganymede.Session session
           
private  java.util.Hashtable templateHash
          Hash mapping Short object type id's to Vectors of FieldTemplate's, used by the client to quickly look up information about fields in order to populate containerPanel's.
private  boolean templateLoading
           
private  java.util.Hashtable templateNameHash
          Hash mapping Short object type id's to a Hash that maps field name to FieldTemplate object
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Loader(arlut.csd.ganymede.Session session, boolean debug)
           
 
Method Summary
 void cleanUp()
          Clear out all information in the loader
 void clear()
          Clear out all the information in the loader, and spawn a new loader thread to download new information from the server.
private  void constructTemplateNameHash(java.lang.Short objectId, java.util.Vector fieldTemplates)
           
 java.util.Vector getBaseList()
          Returns a Vector of BaseDump objects, providing a local cache of Base references that the client consults during operations.
 java.util.Hashtable getBaseMap()
          Returns a hash mapping Short Base id's to BaseDump objects.
 java.util.Hashtable getBaseNames()
          Returns a hash mapping BaseDump references to their title.
 java.util.Hashtable getBaseToShort()
          Returns a hashtable mapping BaseDump references to their object type id in Short form.
 arlut.csd.ganymede.FieldTemplate getFieldTemplate(short objectid, java.lang.String fieldname)
          Returns a FieldTemplate for a field specified by object type id and field name.
 arlut.csd.ganymede.FieldTemplate getFieldTemplate(java.lang.Short objectid, java.lang.String fieldname)
          Returns a FieldTemplate for a field specified by object type id and field name.
 java.util.Hashtable getNameToShort()
          Returns a hashtable mapping base names to their object type id in Short form.
 java.lang.String getObjectType(arlut.csd.ganymede.Invid objId)
          Returns the type name for a given object.
 java.util.Vector getTemplateVector(short id)
          Returns a vector of FieldTemplate's.
 java.util.Vector getTemplateVector(java.lang.Short id)
          Returns a vector of FieldTemplate's listing fields and field informaton for the object type identified by id.
private  void loadBaseHash()
          loadBaseHash is used to prepare a hash table mapping Bases to Vector's of BaseField..
private  void loadBaseList()
          loadBaseList gets the list of types from the server.
private  void loadBaseMap()
          loadBaseMap() generates baseMap, a mapping of Short's to the corresponding remote base reference.
private  void loadBaseNames()
          loadBaseNames constructs a hashtable mapping Base references to base names.
 void run()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

debug

private boolean debug

baseMap

private java.util.Hashtable baseMap

baseNames

private java.util.Hashtable baseNames

baseHash

private java.util.Hashtable baseHash

baseToShort

private java.util.Hashtable baseToShort

nameShorts

private java.util.Hashtable nameShorts

baseList

private java.util.Vector baseList

keepGoing

private boolean keepGoing

baseNamesLoaded

private boolean baseNamesLoaded

baseListLoaded

private boolean baseListLoaded

baseMapLoaded

private boolean baseMapLoaded

templateLoading

private boolean templateLoading

baseHashLoaded

private boolean baseHashLoaded

session

private arlut.csd.ganymede.Session session

templateHash

private java.util.Hashtable templateHash

Hash mapping Short object type id's to Vectors of FieldTemplate's, used by the client to quickly look up information about fields in order to populate containerPanel's.

This hash is used by getTemplateVector.


templateNameHash

private java.util.Hashtable templateNameHash

Hash mapping Short object type id's to a Hash that maps field name to FieldTemplate object

Constructor Detail

Loader

public Loader(arlut.csd.ganymede.Session session,
              boolean debug)
Method Detail

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

clear

public void clear()
Clear out all the information in the loader, and spawn a new loader thread to download new information from the server.


cleanUp

public void cleanUp()

Clear out all information in the loader


getObjectType

public java.lang.String getObjectType(arlut.csd.ganymede.Invid objId)

Returns the type name for a given object.

If the loader thread hasn't yet downloaded that information, this method will block until the information is available.


getBaseList

public java.util.Vector getBaseList()

Returns a Vector of BaseDump objects, providing a local cache of Base references that the client consults during operations.

If this thread hasn't yet downloaded that information, this method will block until the information is available.


getBaseNames

public java.util.Hashtable getBaseNames()

Returns a hash mapping BaseDump references to their title.

If this thread hasn't yet downloaded that information, this method will block until the information is available.


getBaseMap

public java.util.Hashtable getBaseMap()

Returns a hash mapping Short Base id's to BaseDump objects.

If this thread hasn't yet downloaded that information, this method will block until the information is available.


getBaseToShort

public java.util.Hashtable getBaseToShort()

Returns a hashtable mapping BaseDump references to their object type id in Short form. This is a holdover from a time when the client didn't create local copies of the server's Base references.

If this thread hasn't yet downloaded that information, this method will block until the information is available.


getNameToShort

public java.util.Hashtable getNameToShort()

Returns a hashtable mapping base names to their object type id in Short form. This is used by the XML client to quickly map object type names to the numeric type id.

If this thread hasn't yet downloaded that information, this method will block until the information is available.


getFieldTemplate

public arlut.csd.ganymede.FieldTemplate getFieldTemplate(short objectid,
                                                         java.lang.String fieldname)

Returns a FieldTemplate for a field specified by object type id and field name.


getFieldTemplate

public arlut.csd.ganymede.FieldTemplate getFieldTemplate(java.lang.Short objectid,
                                                         java.lang.String fieldname)

Returns a FieldTemplate for a field specified by object type id and field name.


getTemplateVector

public java.util.Vector getTemplateVector(short id)

Returns a vector of FieldTemplate's.

Parameters:
id - Object type id to retrieve field information for.

getTemplateVector

public java.util.Vector getTemplateVector(java.lang.Short id)

Returns a vector of FieldTemplate's listing fields and field informaton for the object type identified by id.

Parameters:
id - The id number of the object type to be returned the base id.

constructTemplateNameHash

private void constructTemplateNameHash(java.lang.Short objectId,
                                       java.util.Vector fieldTemplates)

loadBaseList

private void loadBaseList()
                   throws java.rmi.RemoteException
loadBaseList gets the list of types from the server. This is used in loadBaseHash to get the rest of the BaseHash, but is also used in a few places in the client where the whole list of fields in the baseHash isn't needed.

java.rmi.RemoteException

loadBaseNames

private void loadBaseNames()
                    throws java.rmi.RemoteException
loadBaseNames constructs a hashtable mapping Base references to base names. This is intended to serve as a local cache to avoid having to do round-trip calls to the server just to get a Base reference's name.

java.rmi.RemoteException

loadBaseHash

private void loadBaseHash()
                   throws java.rmi.RemoteException
loadBaseHash is used to prepare a hash table mapping Bases to Vector's of BaseField.. this is used to allow different pieces of client-side code to get access to the Base/BaseField information, which changes infrequently (not at all?) while the client is connected.. the perm_editor panel created by the windowPanel class benefits from this, as does buildTree() below.

java.rmi.RemoteException

loadBaseMap

private void loadBaseMap()
                  throws java.rmi.RemoteException
loadBaseMap() generates baseMap, a mapping of Short's to the corresponding remote base reference.

java.rmi.RemoteException