|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.gargoylesoftware.base.objectstore.ObjectStore
public abstract class ObjectStore
This is a wrapper for the data layer in an application. Any code that accesses a database or some other form of data should be in a subclass of ObjectStore
| Field Summary | |
|---|---|
private ResourceManager |
resourceManager_
|
| Constructor Summary | |
|---|---|
protected |
ObjectStore()
Create an instance |
| Method Summary | |
|---|---|
protected void |
assertNotNull(java.lang.String fieldName,
java.lang.Object object)
Throw an exception if the specified object is null |
java.lang.Object |
execute(ObjectStoreCommand command)
Perform the actions specified by the key and return a value. |
protected abstract java.lang.Object |
executeImpl(ObjectStoreCommand command)
Override this to provide the actual processing of the object store. |
protected java.lang.Object |
getResource(java.lang.String name)
Return a resource from the specified factory |
ResourceManager |
getResourceManager()
Gets the resource manager |
private ResourceManager |
getResourceManagerOrDie()
Return the resource manager. |
protected java.lang.Object |
handleError(java.lang.Error error)
Handle an exception that occured during the processing of executeImpl(). |
protected java.lang.Object |
handleException(java.lang.Exception exception)
Handle an exception that occured during the processing of executeImpl(). |
protected void |
releaseResource(ManagedResource object)
Release the specified resource |
void |
setResourceFactoryMap(java.util.Map inputMap)
Set the resource map. |
void |
setResourceManager(ResourceManager resourceManager)
Set the resource manager |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private ResourceManager resourceManager_
| Constructor Detail |
|---|
protected ObjectStore()
| Method Detail |
|---|
public final void setResourceFactoryMap(java.util.Map inputMap)
Set the resource map. This defines what class is used when a specific resource factory is requested.
It is recommended to use setResourceManager(ResourceManager) instead
inputMap - A map containing string/class pairs.public final void setResourceManager(ResourceManager resourceManager)
resourceManager - The new resource managerpublic final ResourceManager getResourceManager()
public final java.lang.Object execute(ObjectStoreCommand command)
throws ObjectStoreCommandNotSupportedException,
ObjectStoreException
command - The object that tells the object store what to do
ObjectStoreCommandNotSupportedException - If the command
is not supported by this store
ObjectStoreException - If an error occurs during processing
of this command.executeImpl(ObjectStoreCommand)
protected java.lang.Object handleException(java.lang.Exception exception)
throws ObjectStoreException,
ObjectStoreCommandNotSupportedException
The default behaviour is to rethrow any ObjectStoreExceptions or ObjectStoreCommandNotSupportedExceptions. All other exceptions are wrapped in a new ObjectStoreException and then that wrapper is thown
exception - the exception that had been thrown
ObjectStoreException - The exception to be thrown back out of
execute()
ObjectStoreCommandNotSupportedException - the exception to be
thrown back out of execute()protected java.lang.Object handleError(java.lang.Error error)
The default behaviour is to rethrow the error
error - The error that had been thrown
protected final java.lang.Object getResource(java.lang.String name)
name - The name of the factory
setResourceFactoryMap(Map)
protected abstract java.lang.Object executeImpl(ObjectStoreCommand command)
throws java.lang.Throwable,
ObjectStoreCommandNotSupportedException
command - The object that tells the object store what to do
ObjectStoreCommandNotSupportedException - If the specified
command is not understood by the object store
java.lang.Throwable - If an error occursexecute(ObjectStoreCommand)protected final void releaseResource(ManagedResource object)
object - The resource to releaseprivate ResourceManager getResourceManagerOrDie()
protected final void assertNotNull(java.lang.String fieldName,
java.lang.Object object)
fieldName - The name of the paremeter we are checkingobject - The value of the parameter we are checking
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||