org.apache.ojb.broker.core
Interface PersistenceBrokerFactoryIF

All Superinterfaces:
org.apache.ojb.broker.util.configuration.Configurable
All Known Implementing Classes:
PersistenceBrokerFactoryBaseImpl

public interface PersistenceBrokerFactoryIF
extends org.apache.ojb.broker.util.configuration.Configurable

Factory for PersistenceBroker instances. Each implementation have to provide a default constructor.

Version:
$Id: PersistenceBrokerFactoryIF.java,v 1.2 2003/10/28 21:18:47 arminw Exp $
Author:
Thomas Mahler

Method Summary
 int activePersistenceBroker()
          Returns the total number of active PersistenceBroker instances.
 PersistenceBroker createPersistenceBroker(PBKey key)
          Return PersistenceBroker instance for the given PBKey.
 PersistenceBroker createPersistenceBroker(java.lang.String jcdAlias, java.lang.String user, java.lang.String password)
          Return a ready for action PersistenceBroker instance.
 PersistenceBroker defaultPersistenceBroker()
          Return a default broker instance, specified in configuration or set using setDefaultKey(org.apache.ojb.broker.PBKey).
 PBKey getDefaultKey()
          Get the default PBKey.
 void releaseAllInstances()
          release all broker instances pooled by the factory.
 void setDefaultKey(PBKey key)
          Set the PBKey used for convinience PersistenceBroker lookup method defaultPersistenceBroker().
 
Methods inherited from interface org.apache.ojb.broker.util.configuration.Configurable
configure
 

Method Detail

setDefaultKey

public void setDefaultKey(PBKey key)
Set the PBKey used for convinience PersistenceBroker lookup method defaultPersistenceBroker().
Note: It's only allowed to set the default PBKey once. All further calls will cause an exception. If a default JdbcConnectionDescriptor was declared in configuration file, OJB will set the declared PBKey as default.
This method is convenience for MetadataManager.setDefaultPBKey(org.apache.ojb.broker.PBKey).


getDefaultKey

public PBKey getDefaultKey()
Get the default PBKey. This method is convenience for MetadataManager.getDefaultPBKey().

See Also:
setDefaultKey(org.apache.ojb.broker.PBKey)

createPersistenceBroker

public PersistenceBroker createPersistenceBroker(PBKey key)
                                          throws PBFactoryException
Return PersistenceBroker instance for the given PBKey.

Parameters:
key -
Throws:
PBFactoryException

createPersistenceBroker

public PersistenceBroker createPersistenceBroker(java.lang.String jcdAlias,
                                                 java.lang.String user,
                                                 java.lang.String password)
                                          throws PBFactoryException
Return a ready for action PersistenceBroker instance.

Parameters:
jcdAlias - An jcdAlias name specified in a jdbc-connection-descriptor
user - user name specified in a jdbc-connection-descriptor
password - valid password specified in a jdbc-connection-descriptor
Throws:
PBFactoryException

defaultPersistenceBroker

public PersistenceBroker defaultPersistenceBroker()
                                           throws PBFactoryException
Return a default broker instance, specified in configuration or set using setDefaultKey(org.apache.ojb.broker.PBKey).

Throws:
PBFactoryException

releaseAllInstances

public void releaseAllInstances()
release all broker instances pooled by the factory. each broker instance is closed before release.


activePersistenceBroker

public int activePersistenceBroker()
Returns the total number of active PersistenceBroker instances.



Authors: Thomas Mahler and others. (C) 2000 - 2003 Apache Software Foundation
All rights reserved. Published under the Apache License.
http://db.apache.org/ojb
Version: 1.0.rc5, 2003-12-14