org.apache.portals.graffito.store.impl.ojb
Interface OjbFactory

All Known Implementing Classes:
DefaultOjbFactory, SpringOjbFactory

public interface OjbFactory

Interface featuring methods for OJB PersistenceBroker handling, allowing for reuse of PersistenceBroker instances within transactions. Note : inspired from the Spring framework.

Version:
$Id: OjbFactory.java,v 1.1 2004/12/22 20:37:01 christophe Exp $
Author:
Lombart Christophe

Method Summary
 org.apache.ojb.broker.PersistenceBroker getPersistenceBroker(org.apache.ojb.broker.PBKey pbKey, boolean allowCreate)
          Get an OJB PersistenceBroker for the given PBKey.
 org.apache.ojb.broker.PersistenceBroker getPersistenceBroker(org.apache.ojb.broker.PBKey pbKey, boolean allowCreate, boolean allowSynchronization)
          Get an OJB PersistenceBroker for the given PBKey.
 

Method Detail

getPersistenceBroker

org.apache.ojb.broker.PersistenceBroker getPersistenceBroker(org.apache.ojb.broker.PBKey pbKey,
                                                             boolean allowCreate)
Get an OJB PersistenceBroker for the given PBKey. Is aware of a corresponding PersistenceBroker bound to the current thread, for example when using PersistenceBrokerTransactionManager. Will create a new PersistenceBroker else, if allowCreate is true.

Parameters:
pbKey - PBKey to create the PersistenceBroker for
allowCreate - if a new PersistenceBroker should be created if no thread-bound found
Returns:
the PersistenceBroker
Throws:
java.lang.IllegalStateException - if no thread-bound PersistenceBroker found and allowCreate false

getPersistenceBroker

org.apache.ojb.broker.PersistenceBroker getPersistenceBroker(org.apache.ojb.broker.PBKey pbKey,
                                                             boolean allowCreate,
                                                             boolean allowSynchronization)
Get an OJB PersistenceBroker for the given PBKey. Is aware of a corresponding PersistenceBroker bound to the current thread, for example when using PersistenceBrokerTransactionManager. Will create a new PersistenceBroker else.

Parameters:
pbKey - PBKey to create the PersistenceBroker for
allowCreate - if a new PersistenceBroker should be created if no thread-bound found
allowSynchronization - if a new OJB PersistenceBroker is supposed to be registered with transaction synchronization (if synchronization is active). This will always be true for typical data access code.
Returns:
the PersistenceBroker
Throws:
java.lang.IllegalStateException - if no thread-bound PersistenceBroker found and allowCreate false


Copyright © 2004-2006 The Apache Software Foundation. All Rights Reserved.