org.openware.job.data
Class PersistentManager

org.openware.job.data.PersistentManager
All Implemented Interfaces:
java.io.Serializable

public class PersistentManager
implements java.io.Serializable

PersistentManager is basically a cache of TableRow objects.

Version:
$Revision: 1.54 $ $Date: 2001/07/26 01:57:22 $
Author:
Vincent Sheffer
See Also:
Serialized Form

Constructor Summary
PersistentManager(ClassInfo cinfo)
           
PersistentManager(java.util.Hashtable jndiEnv, java.lang.String sessionJNDIName, ClassInfo cinfo)
           
PersistentManager(java.lang.String sessionJNDIName, ClassInfo cinfo)
           
 
Method Summary
 Oid addData(java.lang.Class persistClass, DataShell shell, java.lang.String key)
          Add TableRow data to the PersistentManager
 void addOneToManyList(Oid owningOid, java.lang.String fkColName, java.lang.Class persistType)
           
 void addToOneToManyList(Oid owningOid, java.lang.String fkColName, Persist persist, Oid ownedOid)
          Add a Persistent object to the PersistentManager.
 void debug(java.lang.Exception e, java.lang.String msg)
           
 void debug(java.lang.String msg)
           
 CacheManager getCacheManager()
           
 ClassInfo getClassInfo()
           
 DataShell getData(Oid oid)
           
 DataShell getHollowDataShell(DataShell shell, java.lang.String pkey)
          The 1 side of a 1-to-many relationship is a reference.
 java.util.Iterator getList(Oid owningOid, java.lang.String fkColName, java.lang.String tableName, java.lang.String whereClause)
           
 java.lang.Object getLockObject()
           
 MetaData getMetaData()
           
 java.lang.String getName()
           
 Persist getPersist(java.lang.String oidstr)
           
 java.lang.Object getReference(Oid parentOid)
           
 java.util.LinkedList getSaveList()
           
 void invalidateForTable(java.lang.String tableName)
           
 void invalidateList(java.lang.String owningPrimaryKey, java.lang.String fkColName, java.lang.String ownedTableName)
           
 void purgeCaches()
          Clear out all of the caches so that everything will come from database.
 void purgeNewInvalidPersists()
          Purge any objects that were created by then set to be invalid.
 java.util.Collection query(java.lang.Class persistType, java.lang.String whereClause)
           
 java.util.Collection query(java.lang.Class persistType, java.lang.String whereClause, java.lang.String[] joinTables)
           
 boolean rawUpdate(TableRow shell)
          Do a raw update on the passed in shell.
 void revert()
          Revert back to the state of the PersistentManager at the time immediately after that last save operation (or after the creation of the PersistentManager).
 CacheInvalidationInfo save()
           
 UpdateResults save(java.util.LinkedList saveList)
           
 CacheInvalidationInfo save(java.lang.String filename)
          Save the PersistentManager object.
 void setCacheManager(CacheManager cacheManager)
           
 void setForRemove(Oid oid)
           
 void setName(java.lang.String value)
           
 void setQueryCache(QueryCache queryCache)
           
 void update(UpdateResults ur)
           
 void updateCache(CacheInvalidationInfo cacheInfo)
           
 void valueBound(javax.servlet.http.HttpSessionBindingEvent event)
           
 void valueUnbound(javax.servlet.http.HttpSessionBindingEvent event)
           
 

Constructor Detail

PersistentManager

public PersistentManager(ClassInfo cinfo)
                  throws PersistException

PersistentManager

public PersistentManager(java.lang.String sessionJNDIName,
                         ClassInfo cinfo)
                  throws PersistException

PersistentManager

public PersistentManager(java.util.Hashtable jndiEnv,
                         java.lang.String sessionJNDIName,
                         ClassInfo cinfo)
                  throws PersistException
Method Detail

getLockObject

public java.lang.Object getLockObject()

getName

public java.lang.String getName()

setName

public void setName(java.lang.String value)

getClassInfo

public ClassInfo getClassInfo()

setQueryCache

public void setQueryCache(QueryCache queryCache)

setCacheManager

public void setCacheManager(CacheManager cacheManager)

getCacheManager

public CacheManager getCacheManager()

getReference

public java.lang.Object getReference(Oid parentOid)
                              throws PersistException

getPersist

public Persist getPersist(java.lang.String oidstr)
                   throws PersistException

addData

public Oid addData(java.lang.Class persistClass,
                   DataShell shell,
                   java.lang.String key)
            throws PersistException
Add TableRow data to the PersistentManager
Parameters:
data - The TableRow data to add.
key - The key to cache the data by. If the key is null then get a new key by calling the nextKey method.
Returns:
The Oid of TableRow data object.

debug

public void debug(java.lang.String msg)

debug

public void debug(java.lang.Exception e,
                  java.lang.String msg)

setForRemove

public void setForRemove(Oid oid)
                  throws PersistException

invalidateForTable

public void invalidateForTable(java.lang.String tableName)

addOneToManyList

public void addOneToManyList(Oid owningOid,
                             java.lang.String fkColName,
                             java.lang.Class persistType)
                      throws PersistException

query

public java.util.Collection query(java.lang.Class persistType,
                                  java.lang.String whereClause)
                           throws PersistException

query

public java.util.Collection query(java.lang.Class persistType,
                                  java.lang.String whereClause,
                                  java.lang.String[] joinTables)
                           throws PersistException

invalidateList

public void invalidateList(java.lang.String owningPrimaryKey,
                           java.lang.String fkColName,
                           java.lang.String ownedTableName)

addToOneToManyList

public void addToOneToManyList(Oid owningOid,
                               java.lang.String fkColName,
                               Persist persist,
                               Oid ownedOid)
                        throws PersistException
Add a Persistent object to the PersistentManager.
Parameters:
owningOid - The Oid of the object to add the Persist to.
persist - The Persist object instance to add.

getList

public java.util.Iterator getList(Oid owningOid,
                                  java.lang.String fkColName,
                                  java.lang.String tableName,
                                  java.lang.String whereClause)
                           throws PersistException

getHollowDataShell

public DataShell getHollowDataShell(DataShell shell,
                                    java.lang.String pkey)
The 1 side of a 1-to-many relationship is a reference. If a TableRow object exists for the given data and pkey then return it. If not, create a new one, set it's state to be HOLLOW, set it's primary key value to be 'pkey', and return it.
Parameters:
shell - The DataShell that is contained by the referenced Persist object.
pkey - The primary key value of the TableRow object.
Returns:
Either the existing DataShell object or the newly created instance.

getData

public DataShell getData(Oid oid)
                  throws PersistException

save

public CacheInvalidationInfo save()
                           throws PersistException

save

public CacheInvalidationInfo save(java.lang.String filename)
                           throws PersistException
Save the PersistentManager object.
Parameters:
filename - If the PersistentManager can't access the EJB server then serialize the PersistentManager to a file with this file name.

getSaveList

public java.util.LinkedList getSaveList()
                                 throws PersistException

getMetaData

public MetaData getMetaData()
                     throws PersistException

save

public UpdateResults save(java.util.LinkedList saveList)
                   throws PersistException

rawUpdate

public boolean rawUpdate(TableRow shell)
                  throws PersistException
Do a raw update on the passed in shell. The persistent manager does nothing but call the raw update method in the EJB. If you want to change the state you will need to do this explicitly.
Parameters:
shell - The table row to do the update on.
Returns:
true if the shell was updated, false otherwise.

update

public void update(UpdateResults ur)
            throws PersistException

purgeCaches

public void purgeCaches()
Clear out all of the caches so that everything will come from database. Any new items will not be added to the database and any removed items will not be removed. If you want to make sure your changes get commited you should call the save method before calling this method.

updateCache

public void updateCache(CacheInvalidationInfo cacheInfo)

purgeNewInvalidPersists

public void purgeNewInvalidPersists()
Purge any objects that were created by then set to be invalid.

revert

public void revert()
Revert back to the state of the PersistentManager at the time immediately after that last save operation (or after the creation of the PersistentManager).

valueBound

public void valueBound(javax.servlet.http.HttpSessionBindingEvent event)

valueUnbound

public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent event)


Copyright © 2000,2001 Openware. All Rights Reserved.