org.kuali.rice.core.ojb
Class BaseOjbConfigurer

java.lang.Object
  extended by org.kuali.rice.core.lifecycle.BaseLifecycle
      extended by org.kuali.rice.core.ojb.BaseOjbConfigurer
All Implemented Interfaces:
Lifecycle, org.springframework.beans.factory.InitializingBean

public class BaseOjbConfigurer
extends BaseLifecycle
implements org.springframework.beans.factory.InitializingBean

Base Ojb Configurer implementation which configures OJB for a particular rice module.

Author:
Kuali Rice Team (rice.collab@kuali.org)

Field Summary
static String DEFAULT_OJB_PROPERTIES
           
protected  String[] jcdAliases
          The OJB JCD aliases
protected  String metadataLocation
          The location of the OJB repository/metadata descriptor
static String OJB_PROPERTIES_PROP
           
static String RICE_OJB_PROPERTIES_PARAM
           
 
Constructor Summary
BaseOjbConfigurer()
          No-arg constructor
BaseOjbConfigurer(String moduleName)
          Constructor that derives jcd aliases and repository metadata location from the module name jcdAliases = [ moduleName.toLowerCase() + "DataSource" ] metadataLocation = "classpath:OJB-repository-" + moduleName.toLowerCase() + ".xml";
BaseOjbConfigurer(String[] jcdAliases, String metadataLocation)
          Constructor which takes the jcdAliases and metadata location
 
Method Summary
 void afterPropertiesSet()
           
protected  void establishConnectionMetaData(org.apache.ojb.broker.metadata.MetadataManager mm)
           
protected  void establishRepositoryMetaData(org.apache.ojb.broker.metadata.MetadataManager mm)
           
protected  String[] getJcdAliases()
          Return the jcd alias of the connection loaded by the connection metadata.
protected  String getMetadataLocation()
          Should return a String representing the location of a file to load OJB connection and repository metadata from.
protected  String getOjbPropertiesLocation()
           
protected  boolean isConnectionAlreadyConfigured(org.apache.ojb.broker.metadata.MetadataManager mm)
           
protected  InputStream preprocessConnectionMetadata(InputStream inputStream)
           
protected  InputStream preprocessRepositoryMetadata(InputStream inputStream)
           
 void setJcdAliases(String[] jcdAliases)
           
 void setMetadataLocation(String metadataLocation)
           
 void start()
           
 void stop()
           
 
Methods inherited from class org.kuali.rice.core.lifecycle.BaseLifecycle
isStarted, setStarted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RICE_OJB_PROPERTIES_PARAM

public static final String RICE_OJB_PROPERTIES_PARAM
See Also:
Constant Field Values

OJB_PROPERTIES_PROP

public static final String OJB_PROPERTIES_PROP
See Also:
Constant Field Values

DEFAULT_OJB_PROPERTIES

public static final String DEFAULT_OJB_PROPERTIES
See Also:
Constant Field Values

jcdAliases

protected String[] jcdAliases
The OJB JCD aliases


metadataLocation

protected String metadataLocation
The location of the OJB repository/metadata descriptor

Constructor Detail

BaseOjbConfigurer

public BaseOjbConfigurer()
No-arg constructor


BaseOjbConfigurer

public BaseOjbConfigurer(String moduleName)
Constructor that derives jcd aliases and repository metadata location from the module name jcdAliases = [ moduleName.toLowerCase() + "DataSource" ] metadataLocation = "classpath:OJB-repository-" + moduleName.toLowerCase() + ".xml";

Parameters:
moduleName - the module name

BaseOjbConfigurer

public BaseOjbConfigurer(String[] jcdAliases,
                         String metadataLocation)
Constructor which takes the jcdAliases and metadata location

Parameters:
jcdAliases - the jcd aliases
metadataLocation - the metadata location
Method Detail

start

public void start()
           throws Exception
Specified by:
start in interface Lifecycle
Overrides:
start in class BaseLifecycle
Throws:
Exception

stop

public void stop()
          throws Exception
Specified by:
stop in interface Lifecycle
Overrides:
stop in class BaseLifecycle
Throws:
Exception

getOjbPropertiesLocation

protected String getOjbPropertiesLocation()

establishConnectionMetaData

protected void establishConnectionMetaData(org.apache.ojb.broker.metadata.MetadataManager mm)
                                    throws Exception
Throws:
Exception

preprocessConnectionMetadata

protected InputStream preprocessConnectionMetadata(InputStream inputStream)
                                            throws Exception
Throws:
Exception

isConnectionAlreadyConfigured

protected boolean isConnectionAlreadyConfigured(org.apache.ojb.broker.metadata.MetadataManager mm)

preprocessRepositoryMetadata

protected InputStream preprocessRepositoryMetadata(InputStream inputStream)
                                            throws Exception
Throws:
Exception

establishRepositoryMetaData

protected void establishRepositoryMetaData(org.apache.ojb.broker.metadata.MetadataManager mm)
                                    throws Exception
Throws:
Exception

getJcdAliases

protected String[] getJcdAliases()
Return the jcd alias of the connection loaded by the connection metadata. The default implementation returns the jcd alias with which the instance was created (if any)

Returns:
the jcd alias of the connection loaded by the connection metadata.

getMetadataLocation

protected String getMetadataLocation()
Should return a String representing the location of a file to load OJB connection and repository metadata from. If null or empty than no metadata will be loaded. The default implementation returns the metadata location with which the instance was created (if any)


afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
Exception
See Also:
InitializingBean.afterPropertiesSet()

setJcdAliases

public void setJcdAliases(String[] jcdAliases)
Parameters:
jcdAliases - the jcdAliases to set

setMetadataLocation

public void setMetadataLocation(String metadataLocation)
Parameters:
metadataLocation - the metadataLocation to set


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