org.apache.torque.manager
Class AbstractBaseManager

java.lang.Object
  extended byorg.apache.torque.manager.AbstractBaseManager
All Implemented Interfaces:
java.io.Serializable

public abstract class AbstractBaseManager
extends java.lang.Object
implements java.io.Serializable

This class contains common functionality of a Manager for instantiating OM's.

Version:
$Id: AbstractBaseManager.java,v 1.11.2.1 2003/06/20 08:12:50 dlr Exp $
Author:
John McNally
See Also:
Serialized Form

Field Summary
protected  org.apache.jcs.access.GroupCacheAccess cache
          used to cache the om objects.
protected static org.apache.log4j.Category category
          the log
private  java.lang.String className
           
private  boolean isNew
           
protected  java.util.Map listenersMap
           
protected  MethodResultCache mrCache
          method results cache
private  java.lang.Class omClass
          the class that the service will instantiate
private  java.lang.String region
           
protected  java.util.Map validFields
           
 
Constructor Summary
AbstractBaseManager()
           
 
Method Summary
 void addCacheListenerImpl(CacheListener listener)
           
protected  Persistent cacheGet(java.io.Serializable key)
           
protected  void clearImpl()
           
private  java.util.List createSubsetList(java.lang.String key)
           
 java.lang.String getClassName()
          Get the classname to instantiate for getInstance()
 MethodResultCache getMethodResultCache()
           
protected  java.lang.Class getOMClass()
          Get the Class instance
protected  Persistent getOMInstance()
          Get a fresh instance of an om
protected  Persistent getOMInstance(ObjectKey id)
          Return an instance of an om based on the id
protected  Persistent getOMInstance(ObjectKey key, boolean fromCache)
          Return an instance of an om based on the id
protected  java.util.List getOMs(java.util.List ids)
          Gets a list of om's based on id's.
protected  java.util.List getOMs(java.util.List ids, boolean fromCache)
          Gets a list of om's based on id's.
protected  java.util.List getOMs(ObjectKey[] ids)
          Gets a list of om's based on id's.
 java.lang.String getRegion()
          Get the value of region.
protected  void notifyListeners(java.util.List listeners, Persistent oldOm, Persistent om)
           
protected  Persistent putInstanceImpl(Persistent om)
           
protected  Persistent putInstanceImpl(java.io.Serializable key, Persistent om)
           
private  void readObject(java.io.ObjectInputStream in)
          Helper methods for the Serializable interface.
protected  void registerAsListener()
          NoOp version.
protected  Persistent removeInstanceImpl(java.io.Serializable key)
           
protected abstract  Persistent retrieveStoredOM(ObjectKey id)
           
protected abstract  java.util.List retrieveStoredOMs(java.util.List ids)
           
 void setClassName(java.lang.String v)
          Set the classname to instantiate for getInstance()
protected  void setOMClass(java.lang.Class omClass)
          Set the Class that will be instantiated by this manager
 void setRegion(java.lang.String v)
          Set the value of region.
private  void writeObject(java.io.ObjectOutputStream out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

category

protected static final org.apache.log4j.Category category
the log


cache

protected transient org.apache.jcs.access.GroupCacheAccess cache
used to cache the om objects. cache is set by the region property


mrCache

protected MethodResultCache mrCache
method results cache


omClass

private java.lang.Class omClass
the class that the service will instantiate


className

private java.lang.String className

region

private java.lang.String region

isNew

private boolean isNew

validFields

protected java.util.Map validFields

listenersMap

protected java.util.Map listenersMap
Constructor Detail

AbstractBaseManager

public AbstractBaseManager()
Method Detail

getOMClass

protected java.lang.Class getOMClass()
Get the Class instance

Returns:
the om class

setOMClass

protected void setOMClass(java.lang.Class omClass)
Set the Class that will be instantiated by this manager

Parameters:
omClass - the om class

getOMInstance

protected Persistent getOMInstance()
                            throws java.lang.InstantiationException,
                                   java.lang.IllegalAccessException
Get a fresh instance of an om

Returns:
an instance of the om class
Throws:
java.lang.InstantiationException
java.lang.IllegalAccessException

getClassName

public java.lang.String getClassName()
Get the classname to instantiate for getInstance()

Returns:
value of className.

setClassName

public void setClassName(java.lang.String v)
                  throws TorqueException
Set the classname to instantiate for getInstance()

Parameters:
v - Value to assign to className.
Throws:
TorqueException

getOMInstance

protected Persistent getOMInstance(ObjectKey id)
                            throws TorqueException
Return an instance of an om based on the id

Parameters:
id -
Throws:
TorqueException

getOMInstance

protected Persistent getOMInstance(ObjectKey key,
                                   boolean fromCache)
                            throws TorqueException
Return an instance of an om based on the id

Throws:
TorqueException

cacheGet

protected Persistent cacheGet(java.io.Serializable key)

clearImpl

protected void clearImpl()
                  throws TorqueException
Throws:
TorqueException

removeInstanceImpl

protected Persistent removeInstanceImpl(java.io.Serializable key)
                                 throws TorqueException
Throws:
TorqueException

putInstanceImpl

protected Persistent putInstanceImpl(Persistent om)
                              throws TorqueException
Throws:
TorqueException

putInstanceImpl

protected Persistent putInstanceImpl(java.io.Serializable key,
                                     Persistent om)
                              throws TorqueException
Throws:
TorqueException

retrieveStoredOM

protected abstract Persistent retrieveStoredOM(ObjectKey id)
                                        throws TorqueException
Throws:
TorqueException

getOMs

protected java.util.List getOMs(ObjectKey[] ids)
                         throws TorqueException
Gets a list of om's based on id's.

Parameters:
ids - a ObjectKey[] value
Returns:
a List value
Throws:
TorqueException - if an error occurs

getOMs

protected java.util.List getOMs(java.util.List ids)
                         throws TorqueException
Gets a list of om's based on id's.

Parameters:
ids - a List of ObjectKey's
Returns:
a List value
Throws:
TorqueException - if an error occurs

getOMs

protected java.util.List getOMs(java.util.List ids,
                                boolean fromCache)
                         throws TorqueException
Gets a list of om's based on id's.

Parameters:
ids - a List of ObjectKey's
Returns:
a List value
Throws:
TorqueException - if an error occurs

retrieveStoredOMs

protected abstract java.util.List retrieveStoredOMs(java.util.List ids)
                                             throws TorqueException
Throws:
TorqueException

getRegion

public java.lang.String getRegion()
Get the value of region.

Returns:
value of region.

setRegion

public void setRegion(java.lang.String v)
               throws TorqueException
Set the value of region.

Parameters:
v - Value to assign to region.
Throws:
TorqueException

getMethodResultCache

public MethodResultCache getMethodResultCache()
Returns:
The cache instance.

registerAsListener

protected void registerAsListener()
NoOp version. Managers should override this method to notify other managers that they are interested in CacheEvents.


addCacheListenerImpl

public void addCacheListenerImpl(CacheListener listener)
Parameters:
listener - A new listener for cache events.

createSubsetList

private java.util.List createSubsetList(java.lang.String key)
Parameters:
key -
Returns:
A subset of the list identified by key.

notifyListeners

protected void notifyListeners(java.util.List listeners,
                               Persistent oldOm,
                               Persistent om)

writeObject

private void writeObject(java.io.ObjectOutputStream out)
                  throws java.io.IOException
Throws:
java.io.IOException

readObject

private void readObject(java.io.ObjectInputStream in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Helper methods for the Serializable interface.

Parameters:
in - The stream to read a Serializable from.
Throws:
java.io.IOException
java.lang.ClassNotFoundException


Copyright © 1999-2003 Apache Software Foundation. All Rights Reserved.