|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
PersistenceBroker declares a protocol for persisting arbitrary objects. A typical implementation might wrap an RDBMS access layer.
PersistenceBrokerImpl
,
PersistenceBrokerBean
Method Summary | |
void |
abortTransaction()
Abort and close the transaction. |
void |
addListener(PBListener listener)
Adds a temporary PBListener
to this PersistenceBroker instance - when PersistenceBroker.close() was
called the listener was removed. |
void |
addListener(PBListener listener,
boolean permanent)
Adds a permanent PBListener
to this PersistenceBroker instance if parameter permanent
was true . |
void |
addMtoNImplementor(MtoNImplementor m2nImpl)
|
void |
beginTransaction()
Begin a transaction against the underlying RDBMS. |
void |
clearCache()
clears the brokers internal cache. |
boolean |
close()
Close this PersistenceBroker so that no further requests may be made on it. |
void |
commitTransaction()
Commit and close the transaction. |
void |
delete(java.lang.Object obj)
deletes the objects obj concrete representation in the underlying persistence system. |
void |
deleteByQuery(Query query)
Deletes all objects matching the query from the underlying persistence system. |
void |
deleteMtoNImplementor(MtoNImplementor m2nImpl)
Deletes and MtoN implementor (a row on a indirection table) As it is today, ojb doesn't handle collection inherence, so collections descriptors are written per class. |
void |
fireBrokerEvent(PBLifeCycleEvent event)
Performs a broker event to inform all managed PBListener implementations. |
void |
fireBrokerEvent(PBStateEvent event)
Performs a broker event to inform all managed PBListener implementations. |
void |
fireBrokerEvent(PersistenceBrokerEvent event)
Performs a broker event to inform all managed PBListener implementations. |
ClassDescriptor |
getClassDescriptor(java.lang.Class clazz)
returns a ClassDescriptor for the persistence capable class clazz. |
ManageableCollection |
getCollectionByQuery(java.lang.Class collectionClass,
Query query)
Retrieve a userdefined Collection that implements the interface Manageable collection that contains all Objects matching the Query query. |
java.util.Collection |
getCollectionByQuery(Query query)
Retrieve a collection of itemClass Objects matching the Query query. |
int |
getCount(Query query)
Returns the count of elements a given query will return. |
DescriptorRepository |
getDescriptorRepository()
Returns the DescriptorRepository
associated with this broker. |
java.util.Iterator |
getIteratorByQuery(Query query)
returns an Iterator that iterates Objects of class c if calling the .next() method. |
java.lang.Object |
getObjectByIdentity(Identity id)
Retrieve an Object by its Identity. |
java.lang.Object |
getObjectByQuery(Query query)
Retrieve an Object by query. |
PBKey |
getPBKey()
Get the PBKey for this broker. |
java.util.Enumeration |
getPKEnumerationByQuery(java.lang.Class PrimaryKeyClass,
Query query)
Returns an Enumeration of PrimaryKey Objects for objects of class DataClass. |
java.util.Iterator |
getReportQueryIteratorByQuery(Query query)
Returns an Iterator that iterates Object[] calling the .next() method. |
java.lang.Class |
getTopLevelClass(java.lang.Class clazz)
Returns the top level (extent) class to which the given class belongs. |
boolean |
hasClassDescriptor(java.lang.Class clazz)
same as getClassDescriptor, but does not throw. |
boolean |
isClosed()
|
boolean |
isInTransaction()
Returns true if the broker performs a transaction, false in the other case |
void |
removeAllListeners()
Removes all temporary listeners from this PersistenceBroker instance - Handle with care! |
void |
removeAllListeners(boolean permanent)
If parameter permanet was true all permanent and temporary listeners
will be removed from this PersistenceBroker instance. |
void |
removeFromCache(java.lang.Object obj)
Removes the object from the brokers internal cache. |
void |
removeListener(PBListener listener)
Removes a listener from this PersistenceBroker instance |
void |
retrieveAllReferences(java.lang.Object pInstance)
Retrieve all Reference- and Collection-attributes of a given instance |
void |
retrieveReference(java.lang.Object pInstance,
java.lang.String pAttributeName)
retrieve a single reference- or collection attribute of a persistent instance. |
BrokerHelper |
serviceBrokerHelper()
Returns the BrokerHelper instance associated with this broker. |
ConnectionManagerIF |
serviceConnectionManager()
Returns the ConnectionManagerIF instance associated with this broker. |
JdbcAccess |
serviceJdbcAccess()
Returns the JdbcAccess instance associated with this broker. |
ObjectCache |
serviceObjectCache()
Returns the ObjectCache instance associated
with this broker. |
SequenceManager |
serviceSequenceManager()
Returns the SequenceManager instance associated with this broker. |
SqlGenerator |
serviceSqlGenerator()
Returns the SqlGenerator instance associated with this broker. |
StatementManagerIF |
serviceStatementManager()
Returns the StatementManagerIF instance associated with this broker. |
void |
store(java.lang.Object obj)
make object obj persistent in the underlying persistence system. |
void |
store(java.lang.Object obj,
ObjectModification modification)
makes object obj persistent in the underlying persistence system. |
Methods inherited from interface org.apache.ojb.broker.util.configuration.Configurable |
configure |
Methods inherited from interface org.odbms.ObjectContainer |
query |
Method Detail |
public StatementManagerIF serviceStatementManager()
StatementManagerIF
instance associated with this broker.
public ConnectionManagerIF serviceConnectionManager()
ConnectionManagerIF
instance associated with this broker.
public SqlGenerator serviceSqlGenerator()
SqlGenerator
instance associated with this broker.
public JdbcAccess serviceJdbcAccess()
JdbcAccess
instance associated with this broker.
public SequenceManager serviceSequenceManager()
SequenceManager
instance associated with this broker.
public BrokerHelper serviceBrokerHelper()
BrokerHelper
instance associated with this broker.
Makes some helper methods available.
public ObjectCache serviceObjectCache()
ObjectCache
instance associated
with this broker.
public void fireBrokerEvent(PersistenceBrokerEvent event)
PBListener
implementations.
public void fireBrokerEvent(PBLifeCycleEvent event)
PBListener
implementations.
public void fireBrokerEvent(PBStateEvent event)
PBListener
implementations.
public void removeAllListeners() throws PersistenceBrokerException
PersistenceBrokerException
public void removeAllListeners(boolean permanent) throws PersistenceBrokerException
permanet
was true
all permanent and temporary listeners
will be removed from this PersistenceBroker instance.
PersistenceBrokerException
removeListener(PBListener listener)
public void addListener(PBListener listener) throws PersistenceBrokerException
PBListener
to this PersistenceBroker instance - when PersistenceBroker.close() was
called the listener was removed.
listener
- The listener to add
PersistenceBrokerException
addListener(org.apache.ojb.broker.PBListener listener, boolean permanent)
public void addListener(PBListener listener, boolean permanent) throws PersistenceBrokerException
PBListener
to this PersistenceBroker instance if parameter permanent
was true
. This means the listener will be
hold the whole life time of the broker.
PersistenceBrokerFactoryIF
or extend the default
implementation PersistenceBrokerFactoryDefaultImpl
and add the listener at creation of the PersistenceBroker
instances.
PersistenceBrokerException
public void removeListener(PBListener listener) throws PersistenceBrokerException
listener
-
PersistenceBrokerException
public void abortTransaction() throws TransactionNotInProgressException
TransactionNotInProgressException
public void beginTransaction() throws TransactionInProgressException, TransactionAbortedException
beginTransaction
multiple times,
without an intervening call to commitTransaction
or abortTransaction
,
causes the exception TransactionInProgressException
to be thrown
on the second and subsequent calls.
TransactionInProgressException
TransactionAbortedException
public void commitTransaction() throws TransactionNotInProgressException, TransactionAbortedException
commit
commits to the database all
UPDATE, INSERT and DELETE statements called within the transaction and
releases any locks held by the transaction.
If beginTransaction() has not been called before a
TransactionNotInProgressException exception is thrown.
If the transaction cannot be commited a TransactionAbortedException exception is thrown.
TransactionNotInProgressException
TransactionAbortedException
public boolean isInTransaction() throws PersistenceBrokerException
PersistenceBrokerException
public boolean close()
public boolean isClosed()
public DescriptorRepository getDescriptorRepository()
DescriptorRepository
associated with this broker.
public PBKey getPBKey()
PBKey
for this broker.
public ClassDescriptor getClassDescriptor(java.lang.Class clazz) throws PersistenceBrokerException
PersistenceBrokerException
public boolean hasClassDescriptor(java.lang.Class clazz)
clazz
-
public java.lang.Class getTopLevelClass(java.lang.Class clazz) throws PersistenceBrokerException
PersistenceBrokerException
- if clazz is not persistence capable,
i.e. if clazz is not defined in the DescriptorRepository.public void clearCache() throws PersistenceBrokerException
PersistenceBrokerException
public void removeFromCache(java.lang.Object obj) throws PersistenceBrokerException
Identity
,
the associated object was removed from cache.
PersistenceBrokerException
public void store(java.lang.Object obj, ObjectModification modification) throws PersistenceBrokerException
PersistenceBrokerException
public void store(java.lang.Object obj) throws PersistenceBrokerException
PersistenceBrokerException
public void delete(java.lang.Object obj) throws PersistenceBrokerException
PersistenceBrokerException
public void deleteMtoNImplementor(MtoNImplementor m2nImpl) throws PersistenceBrokerException
m2nImpl
-
PersistenceBrokerException
- if an error occourspublic void addMtoNImplementor(MtoNImplementor m2nImpl) throws PersistenceBrokerException
PersistenceBrokerException
public void deleteByQuery(Query query) throws PersistenceBrokerException
PersistenceBrokerException
public void retrieveAllReferences(java.lang.Object pInstance) throws PersistenceBrokerException
pInstance
- the persistent instance
PersistenceBrokerException
public void retrieveReference(java.lang.Object pInstance, java.lang.String pAttributeName) throws PersistenceBrokerException
pInstance
- the persistent instancepAttributeName
- the name of the Attribute to load
PersistenceBrokerException
public int getCount(Query query) throws PersistenceBrokerException
PersistenceBrokerException
public java.util.Collection getCollectionByQuery(Query query) throws PersistenceBrokerException
PersistenceBrokerException
public ManageableCollection getCollectionByQuery(java.lang.Class collectionClass, Query query) throws PersistenceBrokerException
PersistenceBrokerException
public java.util.Iterator getIteratorByQuery(Query query) throws PersistenceBrokerException
PersistenceBrokerException
public java.util.Iterator getReportQueryIteratorByQuery(Query query) throws PersistenceBrokerException
PersistenceBrokerException
public java.lang.Object getObjectByIdentity(Identity id) throws PersistenceBrokerException
PersistenceBrokerException
public java.lang.Object getObjectByQuery(Query query) throws PersistenceBrokerException
PersistenceBrokerException
public java.util.Enumeration getPKEnumerationByQuery(java.lang.Class PrimaryKeyClass, Query query) throws PersistenceBrokerException
PrimaryKeyClass
- the pk class for the searched objectsquery
- the query
PersistenceBrokerException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |