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

java.lang.Object
  extended byorg.apache.ojb.broker.util.factory.ConfigurableFactory
All Implemented Interfaces:
Configurable
Direct Known Subclasses:
ConnectionFactoryFactory, ConnectionManagerFactory, DCollectionFactory.BaseFactory, JdbcAccessFactory, ObjectCacheFactory, SqlGeneratorFactory, StatementManagerFactory, StatementsForClassFactory

public abstract class ConfigurableFactory
extends java.lang.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  java.lang.String buildArgumentString(java.lang.Class[] types, java.lang.Object[] args)
           
 void configure(Configuration pConfig)
          configure an object using the Configuration pConfig
 java.lang.Object createNewInstance()
          factory method for creating new instances the Class to be instantiated is defined by getClassToServe().
 java.lang.Object createNewInstance(java.lang.Class[] types, java.lang.Object[] args)
          factory method for creating new instances the Class to be instantiated is defined by getClassToServe().
 java.lang.Object createNewInstance(java.lang.Class type, java.lang.Object arg)
          factory method for creating new instances the Class to be instantiated is defined by getClassToServe().
 java.lang.Class getClassToServe()
          Returns the classToServe.
protected abstract  java.lang.String getConfigurationKey()
          must be implemented in the concrete factory classes.
protected  Logger getLogger()
          the logger for the ConfigurableFactory
 void setClassToServe(java.lang.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 java.lang.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 java.lang.Object createNewInstance(java.lang.Class[] types,
                                          java.lang.Object[] args)
factory method for creating new instances the Class to be instantiated is defined by getClassToServe().

Returns:
Object the created instance

buildArgumentString

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

createNewInstance

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

Returns:
Object the created instance

createNewInstance

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

Returns:
Object the created instance

getClassToServe

public java.lang.Class getClassToServe()
Returns the classToServe.

Returns:
Class

setClassToServe

public void setClassToServe(java.lang.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



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