org.apache.ojb.broker
Class PersistenceBrokerFactory

java.lang.Object
  extended by org.apache.ojb.broker.PersistenceBrokerFactory

public class PersistenceBrokerFactory
extends java.lang.Object

Convenience factory class that produces PersistenceBroker instances.

Version:
$Id: PersistenceBrokerFactory.java 365243 2005-12-22 21:24:51Z tomdz $
Author:
Thomas Mahler
See Also:
PersistenceBrokerFactoryFactory, PersistenceBrokerFactoryIF

Constructor Summary
PersistenceBrokerFactory()
           
 
Method Summary
static PersistenceBroker createPersistenceBroker(PBKey key)
          Creates a new broker instance for the given key.
static PersistenceBroker createPersistenceBroker(java.lang.String jcdAlias, java.lang.String user, java.lang.String password)
          Creates a new broker instance.
static PersistenceBroker defaultPersistenceBroker()
          Creates a default broker instance for the default broker key.
static org.apache.ojb.broker.util.configuration.Configurator getConfigurator()
          Returns the Configurator object.
static PBKey getDefaultKey()
          Returns the key that specifies the default persistence manager.
static void releaseAllInstances()
          Releases all broker instances pooled by this factory (if any).
static void setDefaultKey(PBKey key)
          Sets the key that specifies the default persistence manager.
static void shutdown()
          Shuts OJB down, i.e. releases all resources.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistenceBrokerFactory

public PersistenceBrokerFactory()
Method Detail

getConfigurator

public static org.apache.ojb.broker.util.configuration.Configurator getConfigurator()
Returns the Configurator object.

Returns:
The configurator

setDefaultKey

public static void setDefaultKey(PBKey key)
Sets the key that specifies the default persistence manager.

Parameters:
key - The default broker key
See Also:
PersistenceBrokerFactoryIF.setDefaultKey(org.apache.ojb.broker.PBKey)

getDefaultKey

public static PBKey getDefaultKey()
Returns the key that specifies the default persistence manager.

Returns:
The default broker key
See Also:
PersistenceBrokerFactoryIF.getDefaultKey()

defaultPersistenceBroker

public static PersistenceBroker defaultPersistenceBroker()
                                                  throws PBFactoryException
Creates a default broker instance for the default broker key.

Returns:
The persistence broker
Throws:
PBFactoryException
See Also:
PersistenceBrokerFactoryIF.defaultPersistenceBroker()

createPersistenceBroker

public static PersistenceBroker createPersistenceBroker(java.lang.String jcdAlias,
                                                        java.lang.String user,
                                                        java.lang.String password)
                                                 throws PBFactoryException
Creates a new broker instance.

Parameters:
jcdAlias - The jdbc connection descriptor name as defined in the repository
user - The user name to be used for connecting to the database
password - The password to be used for connecting to the database
Returns:
The persistence broker
Throws:
PBFactoryException
See Also:
PersistenceBrokerFactoryIF.createPersistenceBroker(java.lang.String, java.lang.String, java.lang.String)

createPersistenceBroker

public static PersistenceBroker createPersistenceBroker(PBKey key)
                                                 throws PBFactoryException
Creates a new broker instance for the given key.

Parameters:
key - The broker key
Returns:
The persistence broker
Throws:
PBFactoryException
See Also:
PersistenceBrokerFactoryIF.createPersistenceBroker(org.apache.ojb.broker.PBKey)

releaseAllInstances

public static void releaseAllInstances()
Releases all broker instances pooled by this factory (if any). Note that the broker are closed prior to releasing them.

See Also:
PersistenceBrokerFactoryIF.releaseAllInstances()

shutdown

public static void shutdown()
Shuts OJB down, i.e. releases all resources. You should not use any OJB functionality after calling this method.

See Also:
PersistenceBrokerFactoryIF.shutdown()


(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