Class DispatchingObjectStore
- java.lang.Object
-
- com.gargoylesoftware.base.objectstore.ObjectStore
-
- com.gargoylesoftware.base.objectstore.DispatchingObjectStore
-
public class DispatchingObjectStore extends ObjectStore
An object store that just dispatches commands to other object stores- Version:
- $Revision: 1.5 $
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map
dispatchMap_
private java.util.Map
resourceFactoryMap_
-
Constructor Summary
Constructors Modifier Constructor Description protected
DispatchingObjectStore(java.util.Map nameToResourceFactoryMap)
Create an instance.DispatchingObjectStore(java.util.Map commandToStoreMap, java.util.Map nameToResourceFactoryMap)
Create an instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.Object
executeImpl(ObjectStoreCommand command)
Perform the dispatching.protected ObjectStore
findStore(ObjectStoreCommand command)
Find the ObjectStore for the specified command-
Methods inherited from class com.gargoylesoftware.base.objectstore.ObjectStore
assertNotNull, execute, getResource, getResourceManager, handleError, handleException, releaseResource, setResourceFactoryMap, setResourceManager
-
-
-
-
Constructor Detail
-
DispatchingObjectStore
protected DispatchingObjectStore(java.util.Map nameToResourceFactoryMap)
Create an instance. If you use this constructor then you must override findStoreClass() since the dispatchMap has not been populated- Parameters:
nameToResourceFactoryMap
- keys are names, values are the resource factory objects that are represented by the name. This map will be passed into any newly created ObjectStore's via the method setResourceFactoryMap()
-
DispatchingObjectStore
public DispatchingObjectStore(java.util.Map commandToStoreMap, java.util.Map nameToResourceFactoryMap)
Create an instance- Parameters:
commandToStoreMap
- A map containing command to store mappings. Keys and values must be class objects.nameToResourceFactoryMap
- keys are names, values are the resource factory objects that are represented by the name. This map will be passed into any newly created ObjectStore's via the method setResourceFactoryMap()
-
-
Method Detail
-
executeImpl
protected java.lang.Object executeImpl(ObjectStoreCommand command)
Perform the dispatching.- Specified by:
executeImpl
in classObjectStore
- Parameters:
command
- The command to dispatch- Returns:
- The result of the command after the other store has processed it
- See Also:
ObjectStore.execute(ObjectStoreCommand)
-
findStore
protected ObjectStore findStore(ObjectStoreCommand command) throws ObjectStoreCommandNotSupportedException, ObjectStoreException
Find the ObjectStore for the specified command- Parameters:
command
- The command for which we are finding the store- Returns:
- The object store
- Throws:
ObjectStoreCommandNotSupportedException
- If we cannot find a store for the specified commandObjectStoreException
- if an error occurs when finding or creating an object store
-
-