org.apache.ojb.broker.util.factory
Class ConfigurableFactory

java.lang.Object
  extended by org.apache.ojb.broker.util.factory.ConfigurableFactory
All Implemented Interfaces:
Configurable
Direct Known Subclasses:
ConnectionFactoryFactory, ConnectionManagerFactory, JdbcAccessFactory, OJB, SqlGeneratorFactory, StatementManagerFactory, StatementsForClassFactory, TransactionManagerFactoryFactory.TMFactoryFactory, TxManagerFactory

public abstract class ConfigurableFactory
extends Object
implements Configurable

ConfigurableFactory is an abstract baseclass for OJB factory classes. It provides all infrastructure for configuration through OJB.properties. A derived class must implement the getConfigurationKey() method. The returned configuration key is used to lookup the class to be instantiated by the derived factory. The lookup is performed in the configure() method and uses the OJB.properties information.

Author:
Thomas Mahler

Constructor Summary
ConfigurableFactory()
          the public constructor calls configure() to perform configuration of the factory instance.
 
Method Summary
protected  String buildArgumentString(Class[] types, Object[] args)
           
 void configure(Configuration pConfig)
          configure an object using the Configuration pConfig
 Object createNewInstance()
          factory method for creating new instances the Class to be instantiated is defined by getClassToServe().
 Object createNewInstance(Class[] types, Object[] args)
          factory method for creating new instances the Class to be instantiated is defined by getClassToServe().
 Object createNewInstance(Class type, Object arg)
          factory method for creating new instances the Class to be instantiated is defined by getClassToServe().
 Class getClassToServe()
          Returns the classToServe.
protected abstract  String getConfigurationKey()
          must be implemented in the concrete factory classes.
protected  Logger getLogger()
          the logger for the ConfigurableFactory
 void setClassToServe(Class classToServe)
          Sets the classToServe.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfigurableFactory

public ConfigurableFactory()
the public constructor calls configure() to perform configuration of the factory instance.

Method Detail

getConfigurationKey

protected abstract String getConfigurationKey()
must be implemented in the concrete factory classes. the configuration key is used to lookup the Class to serve from the OjbConfiguration in configure().


configure

public void configure(Configuration pConfig)
               throws ConfigurationException
Description copied from interface: Configurable
configure an object using the Configuration pConfig

Specified by:
configure in interface Configurable
Parameters:
pConfig - the Configuration object used to configure current instance
Throws:
ConfigurationException
See Also:
looks up the the key getConfigurationKey() in the OjbConfiguration to determine the Class to be served.

createNewInstance

public Object createNewInstance(Class[] types,
                                Object[] args)
factory method for creating new instances the Class to be instantiated is defined by getClassToServe().

Returns:
Object the created instance

buildArgumentString

protected String buildArgumentString(Class[] types,
                                     Object[] args)

createNewInstance

public Object createNewInstance()
factory method for creating new instances the Class to be instantiated is defined by getClassToServe().

Returns:
Object the created instance

createNewInstance

public Object createNewInstance(Class type,
                                Object arg)
factory method for creating new instances the Class to be instantiated is defined by getClassToServe().

Returns:
Object the created instance

getClassToServe

public Class getClassToServe()
Returns the classToServe.

Returns:
Class

setClassToServe

public void setClassToServe(Class classToServe)
Sets the classToServe.
Normally this is done by the factory using getConfigurationKey().
Note: For internal use only!

Parameters:
classToServe - The classToServe to set

getLogger

protected Logger getLogger()
the logger for the ConfigurableFactory



Copyright © 2004-2012 The Kuali Foundation. All Rights Reserved.