|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object blackboard.persist.BbPersistenceManager
public class BbPersistenceManager
The BbPersistenceManager
class is the central provider of both
loader and persister implementation instances in the persistence framework.
The BbPersistenceManager
is created specific to a particular
Container
and thus returns only loader/persister implementations
specific to that container. If cross-container loading/persisting is required,
multiple instances of BbPersistenceManager
(one for each
container) should be created.
Method Summary | |
---|---|
void |
addConfigurationBindings(java.io.InputStream in)
Adds new persister/loader bindings to this pm's config. |
void |
addConfigurationBindings(java.lang.String filePath)
Adds new persister/loader bindings to this pm's config. |
Id |
generateId(DataType dataType,
int nKey1)
Generates an Id instance specific to the Container
associated with this persistence manager. |
Id |
generateId(DataType dataType,
int nKey1,
int nKey2)
Generates an Id instance specific to the Container
associated with this persistence manager. |
Id |
generateId(DataType dataType,
java.lang.String strKey)
Generates an Id instance specific to the Container
associated with this persistence manager. |
Cache |
getCache()
Returns the Cache associated with this persistence manager. |
Container |
getContainer()
Returns the Container associated with this persistence manager. |
PersistenceContext |
getContext()
Returns the PersistenceContext associated with this persistence
manager. |
static BbPersistenceManager |
getInstance(Container targetContainer)
Returns an instance of BbPersistenceManager associated with the
given target container. |
static BbPersistenceManager |
getInstance(Container targetContainer,
PersistenceContext context)
Returns an instance of BbPersistenceManager associated with the
given target container and persistence content. |
Loader |
getLoader(java.lang.String loaderType)
Returns a loader implementation as specified by the given type value and using the default AppVersion specifier. |
Loader |
getLoader(java.lang.String loaderType,
AppVersion appVersion)
Returns a loader implementation as specified by the given type value and using the provided AppVersion specifier. |
LogService |
getLogService()
Returns the LogService for this persistence manager. |
Persister |
getPersister(java.lang.String persisterType)
Returns a persister implementation as specified by the given type value and using the default AppVersion specifier. |
Persister |
getPersister(java.lang.String persisterType,
AppVersion appVersion)
Returns a persister implementation as specified by the given type value and using the provided AppVersion specifier. |
protected void |
initLoadersAndPersisters()
Initialize loaders/persisters |
boolean |
isValidId(Id id)
Convenience method to determines if the provided Id is a "valid"
Id for this BbPersistenceManager 's Container
. |
void |
refreshLoader(java.lang.String loaderType)
Method to signal the cache for the specified type to refresh from the database. |
protected void |
runCacheUpdate()
Performs an update for caching loaders that rely on signalling. |
void |
runDbQuery(BbQuery query)
Convenience method for executing a query on the persistence manager's associated database using a connection obtained through this persistence manager's database context. |
void |
runDbQuery(BbQuery query,
java.sql.Connection con)
Convenience method for executing a query on the persistence manager's associated database using the supplied connection. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
protected void initLoadersAndPersisters() throws InitializationException
InitializationException
public static BbPersistenceManager getInstance(Container targetContainer) throws InitializationException
BbPersistenceManager
associated with the
given target container.
targetContainer
- the Container
with which the returned
persistence manager should be associated
BbPersistenceManager
associated with
the given Container
InitializationException
public static BbPersistenceManager getInstance(Container targetContainer, PersistenceContext context) throws InitializationException
BbPersistenceManager
associated with the
given target container and persistence content.
targetContainer
- the Container
with which the returned
persistence manager should be associated.context
- the PersistenceContext
with which the returned
persistence manager should be associated.
BbPersistenceManager
associated with
the given Container
and PersistenceContext
InitializationException
public final Container getContainer()
Container
associated with this persistence manager.
Container
associated with this persistence manager
when it was initially created.public final Cache getCache()
Cache
associated with this persistence manager.
Cache
associated with this persistence manager
when it was initially created.public final PersistenceContext getContext()
PersistenceContext
associated with this persistence
manager.
PersistenceContext
associated with this persistence
manager when it was initially created.public final LogService getLogService()
LogService
for this persistence manager.
LogService
associated with this persistence managerpublic final Loader getLoader(java.lang.String loaderType) throws PersistenceException
AppVersion
specifier. The default version is
the one contained in the PersistenceContext
associated with this
BbPersistenceManager
. If the default AppVersion
is not appropriate use getLoader(String,AppVersion)
.
loaderType
- a String
specifying the loader that should be
returned
loaderType
and the default AppVersion
PersistenceException
- if an errors occurs while trying to retrieve
a loader instance for the given typepublic final Loader getLoader(java.lang.String loaderType, AppVersion appVersion) throws PersistenceException
AppVersion
specifier. This can be useful
because it gives a great deal of flexibility, allowing a caller to load
multiple versions of a given data object from a container all using the
same instance of a BbPersistenceManager
.
loaderType
- a String
specifying the loader that should be
returnedappVersion
- an AppVersion
specifying the version information
for the loader that should be returned
loaderType
and the given AppVersion
PersistenceException
- if an errors occurs while trying to retrieve
a loader instance for the given typepublic final Persister getPersister(java.lang.String persisterType) throws PersistenceException
AppVersion
specifier. The default version is
the one contained in the PersistenceContext
associated with this
BbPersistenceManager
. If the default AppVersion
is not appropriate use getPersister(String,AppVersion)
.
persisterType
- a String
specifying the persister that should
be returned
persisterType
and the default AppVersion
PersistenceException
- if an errors occurs while trying to retrieve
a persister instance for the given typepublic final Persister getPersister(java.lang.String persisterType, AppVersion appVersion) throws PersistenceException
AppVersion
specifier. This can be useful
because it gives a great deal of flexibility, allowing a caller to load
multiple versions of a given data object from a container all using the
same instance of a BbPersistenceManager
.
persisterType
- a String
specifying the persister that should
be returnedappVersion
- an AppVersion
specifying the version information
for the persister that should be returned
persisterType
and the given AppVersion
PersistenceException
- if an errors occurs while trying to retrieve
a persister instance for the given typepublic Id generateId(DataType dataType, java.lang.String strKey) throws PersistenceException
Id
instance specific to the Container
associated with this persistence manager. The format of the provided string
is determined by the container type and should be of the form produced by
the toExternalString()
method on the Id
s generated
through the container. The resulting Id
will be valid to use
in a load operation on this persistence manager.
dataType
- the DataType
of the object that the generated
Id
instance will refer tostrKey
- the String
value to use when generating the key value
of the Id
instance
Id
implementation instance, appropriate to the Container
associated with this persistence manager, whose key
value is generated from the given value
PersistenceException
- if the target container does not support
the creation of an Id
using the given key argumentDatabaseContainer.generateId(DataType,String)
,
XmlContainer#generateId(DataType,String)
,
Id.toExternalString()
public Id generateId(DataType dataType, int nKey1, int nKey2) throws PersistenceException
Id
instance specific to the Container
associated with this persistence manager. The key value created from the
provided integer key values is determined by the container type. The
resulting Id
will be valid to use in a load operation on this
persistence manager.
dataType
- the DataType
of the object that the generated
Id
instance will refer tonKey1
- an integer value to use when generating the key value of the
Id
instancenKey2
- another integer value to use when generating the key value of
the Id
instance
Id
implementation instance, appropriate to the Container
associated with this persistence manager, whose key
value is generated from the given integer values
PersistenceException
- if the target container does not support
the creation of an Id
using the given key argumentsDatabaseContainer.generateId(DataType,int,int)
,
XmlContainer#generateId(DataType,int,int)
public Id generateId(DataType dataType, int nKey1) throws PersistenceException
Id
instance specific to the Container
associated with this persistence manager. The key value created from the
provided integer key values is determined by the container type. The
resulting Id
will be valid to use in a load operation on this
persistence manager.
dataType
- the DataType
of the object that the generated
Id
instance will refer tonKey1
- an integer value to use when generating the key value of the
Id
instance
Id
implementation instance, appropriate to the Container
associated with this persistence manager, whose key
value is generated from the given integer values
PersistenceException
- if the target container does not support
the creation of an Id
using the given key argumentsDatabaseContainer.generateId(DataType,int,int)
,
XmlContainer#generateId(DataType,int,int)
public boolean isValidId(Id id)
Id
is a "valid"
Id
for this BbPersistenceManager
's Container
.
Id
is considered valid for a Container
if it
is "set" (see Id.isSet()
), if it originates from the container, and
if it is an instance of the appropriate Id subclass for the container.
id
- the Id
to examine for validity
public void runDbQuery(BbQuery query) throws PersistenceException
query
- the BbQuery
that should be executed
PersistenceExceptino
- thrown if an error occurs during query
execution
PersistenceException
public void runDbQuery(BbQuery query, java.sql.Connection con) throws PersistenceException
query
- the BbQuery
that should be executedcon
- the Connection
to execute the query on
PersistenceExceptino
- thrown if an error occurs during query
execution
PersistenceException
public void addConfigurationBindings(java.lang.String filePath) throws InitializationException
filePath
- Target file path for config xml.
InitializationException
public void addConfigurationBindings(java.io.InputStream in) throws InitializationException
in
- An input stream from which to read the xml.
InitializationException
protected void runCacheUpdate()
public void refreshLoader(java.lang.String loaderType) throws PersistenceException
loaderType
- Key for the loader to actually refresh; this in turn
is used to find the actual cache key.
PersistenceException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |