|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.ojb.broker.core.DelegatingPersistenceBroker
Delegating implementation of a PersistenceBroker
| Constructor Summary | |
DelegatingPersistenceBroker(PersistenceBroker broker)
|
|
| 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 |
configure(org.apache.ojb.broker.util.configuration.Configuration pConfig)
|
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. |
PersistenceBroker |
getDelegate()
Returns only the wrapped PersistenceBroker instance |
DescriptorRepository |
getDescriptorRepository()
Returns the DescriptorRepository
associated with this broker. |
PersistenceBroker |
getInnermostDelegate()
If my underlying PersistenceBroker
is not a DelegatingPersistenceBroker, returns it,
otherwise recursively invokes this method on my delegate. |
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 |
Query |
query()
factory method to create a new Query object. |
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. |
org.apache.ojb.broker.util.BrokerHelper |
serviceBrokerHelper()
Returns the BrokerHelper instance associated with this broker. |
org.apache.ojb.broker.accesslayer.ConnectionManagerIF |
serviceConnectionManager()
Returns the ConnectionManagerIF instance associated with this broker. |
org.apache.ojb.broker.accesslayer.JdbcAccess |
serviceJdbcAccess()
Returns the JdbcAccess instance associated with this broker. |
org.apache.ojb.broker.cache.ObjectCache |
serviceObjectCache()
Returns the ObjectCache instance associated
with this broker. |
SequenceManager |
serviceSequenceManager()
Returns the SequenceManager instance associated with this broker. |
org.apache.ojb.broker.accesslayer.sql.SqlGenerator |
serviceSqlGenerator()
Returns the SqlGenerator instance associated with this broker. |
org.apache.ojb.broker.accesslayer.StatementManagerIF |
serviceStatementManager()
Returns the StatementManagerIF instance associated with this broker. |
void |
setClosed(boolean closed)
|
void |
setDelegate(PersistenceBroker broker)
|
void |
store(java.lang.Object obj)
make object obj persistent in the underlying persistence system. |
void |
store(java.lang.Object obj,
org.apache.ojb.broker.util.ObjectModification modification)
makes object obj persistent in the underlying persistence system. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public DelegatingPersistenceBroker(PersistenceBroker broker)
| Method Detail |
public PersistenceBroker getDelegate()
PersistenceBroker instance
public void setDelegate(PersistenceBroker broker)
public PersistenceBroker getInnermostDelegate()
PersistenceBroker
is not a DelegatingPersistenceBroker, returns it,
otherwise recursively invokes this method on my delegate.
Hence this method will return the first
delegate that is not a DelegatingPersistenceBroker,
or null when no non-DelegatingPersistenceBroker
delegate can be found by transversing this chain.
This method is useful when you may have nested
DelegatingPersistenceBrokers, and you want to make
sure to obtain a "genuine" PersistenceBroker
implementaion instance.
public boolean isInTransaction()
throws PersistenceBrokerException
PersistenceBroker
isInTransaction in interface PersistenceBrokerPersistenceBrokerExceptionpublic boolean isClosed()
isClosed in interface PersistenceBrokerpublic void setClosed(boolean closed)
setClosed in interface PBState
public void beginTransaction()
throws TransactionInProgressException,
TransactionAbortedException
PersistenceBrokerbeginTransaction multiple times,
without an intervening call to commitTransaction or abortTransaction,
causes the exception TransactionInProgressException to be thrown
on the second and subsequent calls.
beginTransaction in interface PersistenceBrokerTransactionInProgressException
TransactionAbortedException
public void commitTransaction()
throws TransactionNotInProgressException,
TransactionAbortedException
PersistenceBrokercommit 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.
commitTransaction in interface PersistenceBrokerTransactionNotInProgressException
TransactionAbortedException
public void abortTransaction()
throws TransactionNotInProgressException
PersistenceBroker
abortTransaction in interface PersistenceBrokerTransactionNotInProgressExceptionpublic boolean close()
PersistenceBroker
close in interface PersistenceBrokerpublic org.apache.ojb.broker.accesslayer.sql.SqlGenerator serviceSqlGenerator()
PersistenceBrokerSqlGenerator instance associated with this broker.
serviceSqlGenerator in interface PersistenceBrokerpublic org.apache.ojb.broker.accesslayer.JdbcAccess serviceJdbcAccess()
PersistenceBrokerJdbcAccess instance associated with this broker.
serviceJdbcAccess in interface PersistenceBroker
public void delete(java.lang.Object obj)
throws PersistenceBrokerException
PersistenceBroker
delete in interface PersistenceBrokerPersistenceBrokerException
public void store(java.lang.Object obj)
throws PersistenceBrokerException
PersistenceBroker
store in interface PersistenceBrokerPersistenceBrokerException
public void store(java.lang.Object obj,
org.apache.ojb.broker.util.ObjectModification modification)
throws PersistenceBrokerException
PersistenceBroker
store in interface PersistenceBrokerPersistenceBrokerExceptionpublic PBKey getPBKey()
PersistenceBrokerPBKey for this broker.
getPBKey in interface PersistenceBroker
public void removeFromCache(java.lang.Object obj)
throws PersistenceBrokerException
PersistenceBrokerIdentity,
the associated object was removed from cache.
removeFromCache in interface PersistenceBrokerPersistenceBrokerException
public void clearCache()
throws PersistenceBrokerException
PersistenceBroker
clearCache in interface PersistenceBrokerPersistenceBrokerExceptionpublic DescriptorRepository getDescriptorRepository()
PersistenceBrokerDescriptorRepository
associated with this broker.
getDescriptorRepository in interface PersistenceBroker
public void removeAllListeners()
throws PersistenceBrokerException
PersistenceBroker
removeAllListeners in interface PersistenceBrokerPersistenceBrokerException
public void removeAllListeners(boolean permanent)
throws PersistenceBrokerException
PersistenceBrokerpermanet was true all permanent and temporary listeners
will be removed from this PersistenceBroker instance.
removeAllListeners in interface PersistenceBrokerPersistenceBrokerExceptionPersistenceBroker.removeListener(PBListener listener)
public void retrieveReference(java.lang.Object pInstance,
java.lang.String pAttributeName)
throws PersistenceBrokerException
PersistenceBroker
retrieveReference in interface PersistenceBrokerpInstance - the persistent instancepAttributeName - the name of the Attribute to load
PersistenceBrokerException
public void retrieveAllReferences(java.lang.Object pInstance)
throws PersistenceBrokerException
PersistenceBroker
retrieveAllReferences in interface PersistenceBrokerpInstance - the persistent instance
PersistenceBrokerExceptionpublic org.apache.ojb.broker.accesslayer.ConnectionManagerIF serviceConnectionManager()
PersistenceBrokerConnectionManagerIF instance associated with this broker.
serviceConnectionManager in interface PersistenceBrokerpublic org.apache.ojb.broker.accesslayer.StatementManagerIF serviceStatementManager()
PersistenceBrokerStatementManagerIF instance associated with this broker.
serviceStatementManager in interface PersistenceBrokerpublic SequenceManager serviceSequenceManager()
PersistenceBrokerSequenceManager instance associated with this broker.
serviceSequenceManager in interface PersistenceBrokerpublic org.apache.ojb.broker.util.BrokerHelper serviceBrokerHelper()
PersistenceBrokerBrokerHelper instance associated with this broker.
Makes some helper methods available.
serviceBrokerHelper in interface PersistenceBrokerpublic org.apache.ojb.broker.cache.ObjectCache serviceObjectCache()
PersistenceBrokerObjectCache instance associated
with this broker.
serviceObjectCache in interface PersistenceBrokerpublic void fireBrokerEvent(PersistenceBrokerEvent event)
PersistenceBrokerPBListener implementations.
fireBrokerEvent in interface PersistenceBrokerpublic void fireBrokerEvent(PBLifeCycleEvent event)
PersistenceBrokerPBListener implementations.
fireBrokerEvent in interface PersistenceBrokerpublic void fireBrokerEvent(PBStateEvent event)
PersistenceBrokerPBListener implementations.
fireBrokerEvent in interface PersistenceBroker
public void addListener(PBListener listener)
throws PersistenceBrokerException
PersistenceBrokerPBListener
to this PersistenceBroker instance - when PersistenceBroker.close() was
called the listener was removed.
addListener in interface PersistenceBrokerlistener - The listener to add
PersistenceBrokerExceptionPersistenceBroker.addListener(org.apache.ojb.broker.PBListener listener, boolean permanent)
public void addListener(PBListener listener,
boolean permanent)
throws PersistenceBrokerException
PersistenceBrokerPBListener
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.
addListener in interface PersistenceBrokerPersistenceBrokerException
public void removeListener(PBListener listener)
throws PersistenceBrokerException
PersistenceBroker
removeListener in interface PersistenceBrokerlistener -
PersistenceBrokerException
public java.lang.Class getTopLevelClass(java.lang.Class clazz)
throws PersistenceBrokerException
PersistenceBroker
getTopLevelClass in interface PersistenceBrokerPersistenceBrokerException - if clazz is not persistence capable,
i.e. if clazz is not defined in the DescriptorRepository.public boolean hasClassDescriptor(java.lang.Class clazz)
PersistenceBroker
hasClassDescriptor in interface PersistenceBrokerclazz -
public ClassDescriptor getClassDescriptor(java.lang.Class clazz)
throws PersistenceBrokerException
PersistenceBroker
getClassDescriptor in interface PersistenceBrokerPersistenceBrokerException
public java.util.Enumeration getPKEnumerationByQuery(java.lang.Class primaryKeyClass,
Query query)
throws PersistenceBrokerException
PersistenceBroker
getPKEnumerationByQuery in interface PersistenceBrokerprimaryKeyClass - the pk class for the searched objectsquery - the query
PersistenceBrokerException
public java.lang.Object getObjectByQuery(Query query)
throws PersistenceBrokerException
PersistenceBroker
getObjectByQuery in interface PersistenceBrokerPersistenceBrokerException
public java.lang.Object getObjectByIdentity(Identity id)
throws PersistenceBrokerException
PersistenceBroker
getObjectByIdentity in interface PersistenceBrokerPersistenceBrokerException
public java.util.Iterator getReportQueryIteratorByQuery(Query query)
throws PersistenceBrokerException
PersistenceBroker
getReportQueryIteratorByQuery in interface PersistenceBrokerPersistenceBrokerException
public java.util.Iterator getIteratorByQuery(Query query)
throws PersistenceBrokerException
PersistenceBroker
getIteratorByQuery in interface PersistenceBrokerPersistenceBrokerException
public ManageableCollection getCollectionByQuery(java.lang.Class collectionClass,
Query query)
throws PersistenceBrokerException
PersistenceBroker
getCollectionByQuery in interface PersistenceBrokerPersistenceBrokerException
public int getCount(Query query)
throws PersistenceBrokerException
PersistenceBroker
getCount in interface PersistenceBrokerPersistenceBrokerException
public java.util.Collection getCollectionByQuery(Query query)
throws PersistenceBrokerException
PersistenceBroker
getCollectionByQuery in interface PersistenceBrokerPersistenceBrokerException
public void configure(org.apache.ojb.broker.util.configuration.Configuration pConfig)
throws org.apache.ojb.broker.util.configuration.ConfigurationException
configure in interface org.apache.ojb.broker.util.configuration.Configurableorg.apache.ojb.broker.util.configuration.ConfigurationExceptionpublic Query query()
ObjectContainerQuery object.
query in interface ObjectContainer
public void deleteByQuery(Query query)
throws PersistenceBrokerException
PersistenceBroker
deleteByQuery in interface PersistenceBrokerPersistenceBrokerException
public void deleteMtoNImplementor(MtoNImplementor m2nImpl)
throws PersistenceBrokerException
PersistenceBroker
deleteMtoNImplementor in interface PersistenceBrokerm2nImpl -
PersistenceBrokerException - if an error occoursPersistenceBroker.deleteMtoNImplementor(org.apache.ojb.broker.MtoNImplementor)
public void addMtoNImplementor(MtoNImplementor m2nImpl)
throws PersistenceBrokerException
addMtoNImplementor in interface PersistenceBrokerPersistenceBrokerExceptionPersistenceBroker.addMtoNImplementor(org.apache.ojb.broker.MtoNImplementor)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||