org.apache.avalon.excalibur.component
Class ExcaliburComponentManagerCreator

java.lang.Object
  extended by org.apache.avalon.excalibur.component.ExcaliburComponentManagerCreator
All Implemented Interfaces:
org.apache.avalon.framework.activity.Disposable

Deprecated. ECM is no longer supported

public class ExcaliburComponentManagerCreator
extends java.lang.Object
implements org.apache.avalon.framework.activity.Disposable

Utility class which can be used to manage the life cycle of a ComponentManager and its RoleManager, LoggerManager, and optional InstrumentManager.

The code necessary to manage all of the above can be reduced to the following:

     m_componentManagerCreator = new ExcaliburComponentManagerCreator(
                                          null,  // Optional Context
                                          new File( "../conf/logkit.xml" ),
                                          new File( "../conf/roles.xml" ),
                                          new File( "../conf/components.xml"),
                                          new File( "../conf/instrument.xml" ) );
 
Then simply remember to dispose of the creator when the application shuts down.
     m_componentManagerCreator.dispose();
     m_componentManagerCreator = null;
 
The ServiceManager (ComponentManager) or any of the other managers can be accessed using their getter methods. getServiceManager() for example. Note that while the ComponentManager is still available, it has been deprecated in favor of the ServiceManager interface.

Since:
4.2
Version:
CVS $Revision: 1.4 $ $Date: 2004/02/28 11:47:14 $
Author:
Avalon Development Team

Field Summary
private  org.apache.avalon.framework.component.ComponentManager m_componentManager
          Deprecated. Internal component manager.
private  org.apache.avalon.framework.context.Context m_context
          Deprecated. Context to create the ComponentManager with.
private  org.apache.excalibur.instrument.InstrumentManager m_instrumentManager
          Deprecated. Internal instrument manager.
private  org.apache.avalon.framework.logger.Logger m_logger
          Deprecated. Internal logger set once the LoggerManager has been initialized.
private  org.apache.avalon.excalibur.logger.LoggerManager m_loggerManager
          Deprecated. Internal logger manager.
private  org.apache.avalon.framework.logger.Logger m_primordialLogger
          Deprecated. Simple logger which can be used until the LoggerManager has been setup.
private  RoleManager m_roleManager
          Deprecated. Internal role manager.
private  org.apache.avalon.framework.service.ServiceManager m_serviceManager
          Deprecated. Internal service manager.
 
Constructor Summary
ExcaliburComponentManagerCreator(org.apache.avalon.framework.context.Context context, org.apache.avalon.framework.configuration.Configuration loggerManagerConfig, org.apache.avalon.framework.configuration.Configuration roleManagerConfig, org.apache.avalon.framework.configuration.Configuration componentManagerConfig, org.apache.avalon.framework.configuration.Configuration instrumentManagerConfig)
          Deprecated. Create a new ExcaliburComponentManagerCreator using Configuration objects.
ExcaliburComponentManagerCreator(org.apache.avalon.framework.context.Context context, java.io.File loggerManagerConfigFile, java.io.File roleManagerConfigFile, java.io.File componentManagerConfigFile, java.io.File instrumentManagerConfigFile)
          Deprecated. Create a new ExcaliburComponentManagerCreator using Files.
ExcaliburComponentManagerCreator(org.apache.avalon.framework.context.Context context, java.io.InputStream loggerManagerConfigStream, java.io.InputStream roleManagerConfigStream, java.io.InputStream componentManagerConfigStream, java.io.InputStream instrumentManagerConfigStream)
          Deprecated. Create a new ExcaliburComponentManagerCreator using Input Streams.
 
Method Summary
private static org.apache.avalon.framework.context.Context createDefaultContext()
          Deprecated. Creates and initializes a default context.
 void dispose()
          Deprecated. Disposes the component manager creator along with the CompoentManager and other managers which it was responsible for creating.
 org.apache.avalon.framework.component.ComponentManager getComponentManager()
          Deprecated. The ComponentManager interface has been deprecated. Please use the getServiceManager method.
 org.apache.excalibur.instrument.InstrumentManager getInstrumentManager()
          Deprecated. Returns the configured InstrumentManager.
private  org.apache.avalon.framework.logger.Logger getLogger()
          Deprecated. Returns the logger for internal use.
 org.apache.avalon.excalibur.logger.LoggerManager getLoggerManager()
          Deprecated. Returns the configured LoggerManager.
 org.apache.avalon.framework.service.ServiceManager getServiceManager()
          Deprecated. Returns the configured ServiceManager.
private  void initializeComponentManager(org.apache.avalon.framework.configuration.Configuration componentManagerConfig)
          Deprecated.  
private  void initializeInstrumentManager(org.apache.avalon.framework.configuration.Configuration instrumentManagerConfig)
          Deprecated.  
private  void initializeLoggerManager(org.apache.avalon.framework.configuration.Configuration loggerManagerConfig)
          Deprecated.  
private  void initializeRoleManager(org.apache.avalon.framework.configuration.Configuration roleManagerConfig)
          Deprecated.  
private static org.apache.avalon.framework.configuration.Configuration readConfigurationFromFile(java.io.File file)
          Deprecated. Creates a Configuration object from data read from an InputStream.
private static org.apache.avalon.framework.configuration.Configuration readConfigurationFromStream(java.io.InputStream is)
          Deprecated. Creates a Configuration object from data read from an InputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_logger

private org.apache.avalon.framework.logger.Logger m_logger
Deprecated. 
Internal logger set once the LoggerManager has been initialized. Always call getLogger() to get the best available logger.


m_primordialLogger

private final org.apache.avalon.framework.logger.Logger m_primordialLogger
Deprecated. 
Simple logger which can be used until the LoggerManager has been setup. Always call getLogger() to get the best available logger.


m_context

private org.apache.avalon.framework.context.Context m_context
Deprecated. 
Context to create the ComponentManager with.


m_loggerManager

private org.apache.avalon.excalibur.logger.LoggerManager m_loggerManager
Deprecated. 
Internal logger manager.


m_roleManager

private RoleManager m_roleManager
Deprecated. 
Internal role manager.


m_componentManager

private org.apache.avalon.framework.component.ComponentManager m_componentManager
Deprecated. 
Internal component manager.


m_serviceManager

private org.apache.avalon.framework.service.ServiceManager m_serviceManager
Deprecated. 
Internal service manager.


m_instrumentManager

private org.apache.excalibur.instrument.InstrumentManager m_instrumentManager
Deprecated. 
Internal instrument manager.

Constructor Detail

ExcaliburComponentManagerCreator

public ExcaliburComponentManagerCreator(org.apache.avalon.framework.context.Context context,
                                        org.apache.avalon.framework.configuration.Configuration loggerManagerConfig,
                                        org.apache.avalon.framework.configuration.Configuration roleManagerConfig,
                                        org.apache.avalon.framework.configuration.Configuration componentManagerConfig,
                                        org.apache.avalon.framework.configuration.Configuration instrumentManagerConfig)
                                 throws java.lang.Exception
Deprecated. 
Create a new ExcaliburComponentManagerCreator using Configuration objects.

Parameters:
context - Context to use when creating the ComponentManager. May be null.
loggerManagerConfig - Configuration object to use to create a LoggerManager.
roleManagerConfig - Configuration object to use to create a RoleManager.
componentManagerConfig - Configuration object to use to create a ComponentManager.
instrumentManagerConfig - Configuration object to use to create an InstrumentManager. May be null.
Throws:
java.lang.Exception - If there were any problems initializing the ComponentManager.

ExcaliburComponentManagerCreator

public ExcaliburComponentManagerCreator(org.apache.avalon.framework.context.Context context,
                                        java.io.InputStream loggerManagerConfigStream,
                                        java.io.InputStream roleManagerConfigStream,
                                        java.io.InputStream componentManagerConfigStream,
                                        java.io.InputStream instrumentManagerConfigStream)
                                 throws java.lang.Exception
Deprecated. 
Create a new ExcaliburComponentManagerCreator using Input Streams.

Parameters:
context - Context to use when creating the ComponentManager. May be null.
loggerManagerConfigStream - InputStream from which to read the Configuration object to use to create a LoggerManager.
roleManagerConfigStream - InputStream from which to read the Configuration object to use to create a RoleManager.
componentManagerConfigStream - InputStream from which to read the Configuration object to use to create a ComponentManager.
instrumentManagerConfigStream - InputStream from which to read the Configuration object to use to create a InstrumentManager. May be null.
Throws:
java.lang.Exception - If there were any problems initializing the ComponentManager.

ExcaliburComponentManagerCreator

public ExcaliburComponentManagerCreator(org.apache.avalon.framework.context.Context context,
                                        java.io.File loggerManagerConfigFile,
                                        java.io.File roleManagerConfigFile,
                                        java.io.File componentManagerConfigFile,
                                        java.io.File instrumentManagerConfigFile)
                                 throws java.lang.Exception
Deprecated. 
Create a new ExcaliburComponentManagerCreator using Files.

Parameters:
context - Context to use when creating the ComponentManager. May be null.
loggerManagerConfigFile - File from which to read the Configuration object to use to create a LoggerManager.
roleManagerConfigFile - File from which to read the Configuration object to use to create a RoleManager.
componentManagerConfigFile - File from which to read the Configuration object to use to create a ComponentManager.
instrumentManagerConfigFile - File from which to read the Configuration object to use to create a InstrumentManager. May be null.
Throws:
java.lang.Exception - If there were any problems initializing the ComponentManager.
Method Detail

createDefaultContext

private static org.apache.avalon.framework.context.Context createDefaultContext()
Deprecated. 
Creates and initializes a default context.


readConfigurationFromStream

private static org.apache.avalon.framework.configuration.Configuration readConfigurationFromStream(java.io.InputStream is)
                                                                                            throws java.lang.Exception
Deprecated. 
Creates a Configuration object from data read from an InputStream.

Parameters:
is - InputStream from which the Configuration is created.
Returns:
Configuration created from the InputStream
Throws:
java.lang.Exception - If the configuration could not be processed.

readConfigurationFromFile

private static org.apache.avalon.framework.configuration.Configuration readConfigurationFromFile(java.io.File file)
                                                                                          throws java.lang.Exception
Deprecated. 
Creates a Configuration object from data read from an InputStream.

Parameters:
file - InputStream from which the Configuration is created.
Returns:
Configuration created from the InputStream
Throws:
java.lang.Exception - If the configuration could not be read or processed.

dispose

public void dispose()
Deprecated. 
Disposes the component manager creator along with the CompoentManager and other managers which it was responsible for creating.

Specified by:
dispose in interface org.apache.avalon.framework.activity.Disposable

getLoggerManager

public org.apache.avalon.excalibur.logger.LoggerManager getLoggerManager()
Deprecated. 
Returns the configured LoggerManager.

Returns:
The configured LoggerManager.

getInstrumentManager

public org.apache.excalibur.instrument.InstrumentManager getInstrumentManager()
Deprecated. 
Returns the configured InstrumentManager. May be null if an instrument configuration was not specified in the constructor.

Returns:
The configured InstrumentManager.

getComponentManager

public org.apache.avalon.framework.component.ComponentManager getComponentManager()
Deprecated. The ComponentManager interface has been deprecated. Please use the getServiceManager method.

Returns the configured ComponentManager.

Returns:
The configured ComponentManager.

getServiceManager

public org.apache.avalon.framework.service.ServiceManager getServiceManager()
Deprecated. 
Returns the configured ServiceManager.

Returns:
The configured ServiceManager.

getLogger

private org.apache.avalon.framework.logger.Logger getLogger()
Deprecated. 
Returns the logger for internal use.


initializeLoggerManager

private void initializeLoggerManager(org.apache.avalon.framework.configuration.Configuration loggerManagerConfig)
                              throws java.lang.Exception
Deprecated. 
Throws:
java.lang.Exception

initializeRoleManager

private void initializeRoleManager(org.apache.avalon.framework.configuration.Configuration roleManagerConfig)
                            throws java.lang.Exception
Deprecated. 
Throws:
java.lang.Exception

initializeInstrumentManager

private void initializeInstrumentManager(org.apache.avalon.framework.configuration.Configuration instrumentManagerConfig)
                                  throws java.lang.Exception
Deprecated. 
Throws:
java.lang.Exception

initializeComponentManager

private void initializeComponentManager(org.apache.avalon.framework.configuration.Configuration componentManagerConfig)
                                 throws java.lang.Exception
Deprecated. 
Throws:
java.lang.Exception