org.apache.ojb.broker.core
Interface PersistenceBrokerFactoryIF

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

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 365232 2005-12-21 22:36:07Z tomdz $
Author:
Thomas Mahler

Method Summary
 int activePersistenceBroker()
          Returns the total number of active PersistenceBroker instances.
 PersistenceBrokerInternal createPersistenceBroker(PBKey key)
          Return PersistenceBroker instance for the given PBKey.
 PersistenceBrokerInternal createPersistenceBroker(java.lang.String jcdAlias, java.lang.String user, java.lang.String password)
          Return a ready for action PersistenceBroker instance.
 PersistenceBrokerInternal 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().
 void shutdown()
          Shutdown method for OJB, kills all running processes within OJB - after shutdown OJB can no longer be used.
 
Methods inherited from interface org.apache.ojb.broker.util.configuration.Configurable
configure
 

Method Detail

setDefaultKey

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

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

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

createPersistenceBroker

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

Parameters:
key -
Throws:
PBFactoryException

createPersistenceBroker

PersistenceBrokerInternal 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

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

Throws:
PBFactoryException

releaseAllInstances

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


activePersistenceBroker

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


shutdown

void shutdown()
Shutdown method for OJB, kills all running processes within OJB - after shutdown OJB can no longer be used.
This method is introduced to solve hot/redeployment problems (memory leaks) caused by the usage of ThreadLocal instances in OJB source and the reuse of threads by the container (e.g. servlet- or ejb-container).



(C) 2002 - 2006 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.4, 2005-12-30