org.objectweb.jac.aspects.distrans.persistence
Class PersistenceAC
java.lang.Object
org.objectweb.jac.core.AspectComponent
org.objectweb.jac.aspects.distrans.persistence.PersistenceAC
- All Implemented Interfaces:
- BaseProgramListener, Serializable
- public class PersistenceAC
- extends AspectComponent
Transaction-enabled persistence storage.
An instance this AC is mandatory with DisTransAC.
This class delegates most of the work (apart from data sources
registering) to a technical implementation of the persistence API
PersistenceItf.
Current implementations of this API: SimpleDbPersistence.
Relies on jac.aspects.distrans.JOTMHelper
to retrieve the JOTM instance used by JAC.
- Version:
- 1.0
- Author:
- Lionel Seinturier
- See Also:
- Serialized Form
Fields inherited from class org.objectweb.jac.core.AspectComponent |
application, blockKeywords, cr, currentConfigMethod, currentImports, firstCall, NOT_SHARED, SHARED, startWeavingCCount, startWeavingCount, startWeavingMethod, startWeavingType, systemListener, wrappers |
Methods inherited from class org.objectweb.jac.core.AspectComponent |
addWrapper, afterApplicationStarted, afterRunningWrapper, afterWrap, afterWrappeeInit, attr, attrdef, beforeConfiguration, beforeReload, beforeRunningWrapper, beforeWrappeeInit, configure, defines, defineTimer, doRegister, doUnregister, error, getAC, getApplication, getBlockKeywords, getConfigurationMethods, getConfigurationMethodsName, getConfigurationMethodsName, getDefaultConfigs, getName, getNameCounters, getWrappers, init, isConfigurationMethod, isSystemListener, onExit, pointcut, pointcut, pointcut, pointcut, pointcut, pointcut, pointcut, pointcut, setApplication, setAttribute, setAttribute, setAttribute, setSystemListener, simulateUsingNewInstance, unweave, unwrapAll, updateNameCounters, warning, weave, whenClone, whenCloseDisplay, whenConfigured, whenDeleted, whenDeserialized, whenFree, whenGetObjects, whenNameObject, whenObjectMiss, whenReload, whenRemoteInstantiation, whenSerialized, whenTopologyChanged, whenUsingNewClass, whenUsingNewInstance |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PersistenceAC
public PersistenceAC()
defineDataSource
public void defineDataSource(String sourceName,
String driver,
String url,
String user,
String password)
- Define a data source name that will be later on used by the remaining
configuration methods of this AC.
- Parameters:
sourceName
- the data source namedriver
- the JDBC driver name (eg org.postgresql.Driver)url
- the JDBC URL (eg jdbc:postgresql://localhost/test)user
- the login to usepassword
- the password to use
setStorageType
public void setStorageType(String classname)
initStorageIfNeeded
public void initStorageIfNeeded(String className,
String sourceName)
- Initialize the persistence storage.
If the storage already exists, do not reinitialize it.
- Parameters:
className
- the class name for which we want to create a storagesourceName
- the data source name
initStorage
public void initStorage(String className,
String sourceName)
- Initialize the persistence storage.
If the storage already exists, reinitialize it.
- Parameters:
className
- the class name for which we want to create a storagesourceName
- the data source name
registerPersistentRessource
public void registerPersistentRessource(String objectNameExpression,
String sourceName)
- All objects matching the objectNameExpression
are made persistent to a SQL database represented by the data source.
These objects are ressources that will potentially be used
later on in transactions.
Even if the objectNameExpression can be any regular expression,
it is assumed to designate instances storable in existing
storages (eventually call initStorageIfNeeded before).
- Parameters:
objectNameExpression
- the object name expressionsourceName
- the source name