|
||||||||||
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
DelegatingPersistenceBroker
s, and you want to make
sure to obtain a "genuine" PersistenceBroker
implementaion instance.
public boolean isInTransaction() throws PersistenceBrokerException
PersistenceBroker
isInTransaction
in interface PersistenceBroker
PersistenceBrokerException
public boolean isClosed()
isClosed
in interface PersistenceBroker
public void setClosed(boolean closed)
setClosed
in interface PBState
public void beginTransaction() throws TransactionInProgressException, TransactionAbortedException
PersistenceBroker
beginTransaction
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 PersistenceBroker
TransactionInProgressException
TransactionAbortedException
public void commitTransaction() throws TransactionNotInProgressException, TransactionAbortedException
PersistenceBroker
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.
commitTransaction
in interface PersistenceBroker
TransactionNotInProgressException
TransactionAbortedException
public void abortTransaction() throws TransactionNotInProgressException
PersistenceBroker
abortTransaction
in interface PersistenceBroker
TransactionNotInProgressException
public boolean close()
PersistenceBroker
close
in interface PersistenceBroker
public org.apache.ojb.broker.accesslayer.sql.SqlGenerator serviceSqlGenerator()
PersistenceBroker
SqlGenerator
instance associated with this broker.
serviceSqlGenerator
in interface PersistenceBroker
public org.apache.ojb.broker.accesslayer.JdbcAccess serviceJdbcAccess()
PersistenceBroker
JdbcAccess
instance associated with this broker.
serviceJdbcAccess
in interface PersistenceBroker
public void delete(java.lang.Object obj) throws PersistenceBrokerException
PersistenceBroker
delete
in interface PersistenceBroker
PersistenceBrokerException
public void store(java.lang.Object obj) throws PersistenceBrokerException
PersistenceBroker
store
in interface PersistenceBroker
PersistenceBrokerException
public void store(java.lang.Object obj, org.apache.ojb.broker.util.ObjectModification modification) throws PersistenceBrokerException
PersistenceBroker
store
in interface PersistenceBroker
PersistenceBrokerException
public PBKey getPBKey()
PersistenceBroker
PBKey
for this broker.
getPBKey
in interface PersistenceBroker
public void removeFromCache(java.lang.Object obj) throws PersistenceBrokerException
PersistenceBroker
Identity
,
the associated object was removed from cache.
removeFromCache
in interface PersistenceBroker
PersistenceBrokerException
public void clearCache() throws PersistenceBrokerException
PersistenceBroker
clearCache
in interface PersistenceBroker
PersistenceBrokerException
public DescriptorRepository getDescriptorRepository()
PersistenceBroker
DescriptorRepository
associated with this broker.
getDescriptorRepository
in interface PersistenceBroker
public void removeAllListeners() throws PersistenceBrokerException
PersistenceBroker
removeAllListeners
in interface PersistenceBroker
PersistenceBrokerException
public void removeAllListeners(boolean permanent) throws PersistenceBrokerException
PersistenceBroker
permanet
was true
all permanent and temporary listeners
will be removed from this PersistenceBroker instance.
removeAllListeners
in interface PersistenceBroker
PersistenceBrokerException
PersistenceBroker.removeListener(PBListener listener)
public void retrieveReference(java.lang.Object pInstance, java.lang.String pAttributeName) throws PersistenceBrokerException
PersistenceBroker
retrieveReference
in interface PersistenceBroker
pInstance
- the persistent instancepAttributeName
- the name of the Attribute to load
PersistenceBrokerException
public void retrieveAllReferences(java.lang.Object pInstance) throws PersistenceBrokerException
PersistenceBroker
retrieveAllReferences
in interface PersistenceBroker
pInstance
- the persistent instance
PersistenceBrokerException
public org.apache.ojb.broker.accesslayer.ConnectionManagerIF serviceConnectionManager()
PersistenceBroker
ConnectionManagerIF
instance associated with this broker.
serviceConnectionManager
in interface PersistenceBroker
public org.apache.ojb.broker.accesslayer.StatementManagerIF serviceStatementManager()
PersistenceBroker
StatementManagerIF
instance associated with this broker.
serviceStatementManager
in interface PersistenceBroker
public SequenceManager serviceSequenceManager()
PersistenceBroker
SequenceManager
instance associated with this broker.
serviceSequenceManager
in interface PersistenceBroker
public org.apache.ojb.broker.util.BrokerHelper serviceBrokerHelper()
PersistenceBroker
BrokerHelper
instance associated with this broker.
Makes some helper methods available.
serviceBrokerHelper
in interface PersistenceBroker
public org.apache.ojb.broker.cache.ObjectCache serviceObjectCache()
PersistenceBroker
ObjectCache
instance associated
with this broker.
serviceObjectCache
in interface PersistenceBroker
public void fireBrokerEvent(PersistenceBrokerEvent event)
PersistenceBroker
PBListener
implementations.
fireBrokerEvent
in interface PersistenceBroker
public void fireBrokerEvent(PBLifeCycleEvent event)
PersistenceBroker
PBListener
implementations.
fireBrokerEvent
in interface PersistenceBroker
public void fireBrokerEvent(PBStateEvent event)
PersistenceBroker
PBListener
implementations.
fireBrokerEvent
in interface PersistenceBroker
public void addListener(PBListener listener) throws PersistenceBrokerException
PersistenceBroker
PBListener
to this PersistenceBroker instance - when PersistenceBroker.close() was
called the listener was removed.
addListener
in interface PersistenceBroker
listener
- The listener to add
PersistenceBrokerException
PersistenceBroker.addListener(org.apache.ojb.broker.PBListener listener, boolean permanent)
public void addListener(PBListener listener, boolean permanent) throws PersistenceBrokerException
PersistenceBroker
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.
addListener
in interface PersistenceBroker
PersistenceBrokerException
public void removeListener(PBListener listener) throws PersistenceBrokerException
PersistenceBroker
removeListener
in interface PersistenceBroker
listener
-
PersistenceBrokerException
public java.lang.Class getTopLevelClass(java.lang.Class clazz) throws PersistenceBrokerException
PersistenceBroker
getTopLevelClass
in interface PersistenceBroker
PersistenceBrokerException
- 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 PersistenceBroker
clazz
-
public ClassDescriptor getClassDescriptor(java.lang.Class clazz) throws PersistenceBrokerException
PersistenceBroker
getClassDescriptor
in interface PersistenceBroker
PersistenceBrokerException
public java.util.Enumeration getPKEnumerationByQuery(java.lang.Class primaryKeyClass, Query query) throws PersistenceBrokerException
PersistenceBroker
getPKEnumerationByQuery
in interface PersistenceBroker
primaryKeyClass
- the pk class for the searched objectsquery
- the query
PersistenceBrokerException
public java.lang.Object getObjectByQuery(Query query) throws PersistenceBrokerException
PersistenceBroker
getObjectByQuery
in interface PersistenceBroker
PersistenceBrokerException
public java.lang.Object getObjectByIdentity(Identity id) throws PersistenceBrokerException
PersistenceBroker
getObjectByIdentity
in interface PersistenceBroker
PersistenceBrokerException
public java.util.Iterator getReportQueryIteratorByQuery(Query query) throws PersistenceBrokerException
PersistenceBroker
getReportQueryIteratorByQuery
in interface PersistenceBroker
PersistenceBrokerException
public java.util.Iterator getIteratorByQuery(Query query) throws PersistenceBrokerException
PersistenceBroker
getIteratorByQuery
in interface PersistenceBroker
PersistenceBrokerException
public ManageableCollection getCollectionByQuery(java.lang.Class collectionClass, Query query) throws PersistenceBrokerException
PersistenceBroker
getCollectionByQuery
in interface PersistenceBroker
PersistenceBrokerException
public int getCount(Query query) throws PersistenceBrokerException
PersistenceBroker
getCount
in interface PersistenceBroker
PersistenceBrokerException
public java.util.Collection getCollectionByQuery(Query query) throws PersistenceBrokerException
PersistenceBroker
getCollectionByQuery
in interface PersistenceBroker
PersistenceBrokerException
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.Configurable
org.apache.ojb.broker.util.configuration.ConfigurationException
public Query query()
ObjectContainer
Query
object.
query
in interface ObjectContainer
public void deleteByQuery(Query query) throws PersistenceBrokerException
PersistenceBroker
deleteByQuery
in interface PersistenceBroker
PersistenceBrokerException
public void deleteMtoNImplementor(MtoNImplementor m2nImpl) throws PersistenceBrokerException
PersistenceBroker
deleteMtoNImplementor
in interface PersistenceBroker
m2nImpl
-
PersistenceBrokerException
- if an error occoursPersistenceBroker.deleteMtoNImplementor(org.apache.ojb.broker.MtoNImplementor)
public void addMtoNImplementor(MtoNImplementor m2nImpl) throws PersistenceBrokerException
addMtoNImplementor
in interface PersistenceBroker
PersistenceBrokerException
PersistenceBroker.addMtoNImplementor(org.apache.ojb.broker.MtoNImplementor)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |