net.sf.farrago.plugin
Class FarragoPluginCache
java.lang.Object
org.eigenbase.util.CompoundClosableAllocation
net.sf.farrago.util.FarragoCompoundAllocation
net.sf.farrago.plugin.FarragoPluginCache
- All Implemented Interfaces:
- FarragoAllocation, FarragoAllocationOwner, ClosableAllocation, ClosableAllocationOwner
- Direct Known Subclasses:
- FarragoDataWrapperCache
public abstract class FarragoPluginCache
- extends FarragoCompoundAllocation
FarragoPluginCache is an abstract private cache for loading instances of
FarragoPlugin
(and their component sub-objects). It requires an
underlying shared FarragoObjectCache
.
This class is only a partial implementation. For an example of how to
build a full implementation, see FarragoDataWrapperCache
.
- Version:
- $Id: //open/dev/farrago/src/net/sf/farrago/plugin/FarragoPluginCache.java#21 $
- Author:
- John V. Sichi
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
mapMofIdToPlugin
private final Map<String,Object> mapMofIdToPlugin
sharedCache
private final FarragoObjectCache sharedCache
repos
private final FarragoRepos repos
classLoader
private final FarragoPluginClassLoader classLoader
FarragoPluginCache
public FarragoPluginCache(FarragoAllocationOwner owner,
FarragoObjectCache sharedCache,
FarragoPluginClassLoader classLoader,
FarragoRepos repos)
- Creates an empty cache.
- Parameters:
owner
- FarragoAllocationOwner for this cache, to make sure
everything gets discarded eventuallysharedCache
- underlying shared cacherepos
- FarragoRepos for wrapper initialization
getRepos
public FarragoRepos getRepos()
- Returns:
- the underlying repos
getSharedCache
public FarragoObjectCache getSharedCache()
- Returns:
- the underlying shared cache
getMapMofIdToPlugin
public Map<String,Object> getMapMofIdToPlugin()
- Returns:
- mapMofIdToPlugin
searchPrivateCache
protected Object searchPrivateCache(String mofId)
- Searches this cache for a plugin object identified by its catalog MofId.
- Parameters:
mofId
- MofId of plugin object being loaded
- Returns:
- cached instance or null if not yet cached
addToPrivateCache
protected Object addToPrivateCache(FarragoObjectCache.Entry entry)
- Adds a plugin object to this cache.
- Parameters:
entry
- pinned entry from underlying shared cache; key must be
plugin object's catalog MofId
- Returns:
- cached plugin object
initializePlugin
protected FarragoPlugin initializePlugin(String libraryName,
String jarAttributeName,
Properties options)
- Initializes a plugin instance.
- Parameters:
libraryName
- filename of jar containing plugin implementationjarAttributeName
- name of jar attribute to use to determine class
nameoptions
- options with which to initialize plugin
- Returns:
- initialized plugin