org.apache.avalon.fortress.tools
Class FortressBean

java.lang.Object
  extended byorg.apache.avalon.fortress.tools.FortressBean
All Implemented Interfaces:
Disposable, Initializable, LogEnabled, Serviceable

public class FortressBean
extends java.lang.Object
implements Initializable, LogEnabled, Serviceable, Disposable

Bean for making it easier to run Fortress, for example as Ant task.

Version:
CVS $Revision: 1.7 $ $Date: 2004/05/06 11:00:44 $
Author:
The Avalon Team

Field Summary
static java.lang.String PROPERTY_CONTAINER_CLASS
           
static java.lang.String PROPERTY_CONTAINER_CONFIGURATION
           
static java.lang.String PROPERTY_CONTEXT_DIRECTORY
           
static java.lang.String PROPERTY_INSTRUMENT_MANAGER_CONFIGURATION
           
static java.lang.String PROPERTY_INVOKE_METHOD
           
static java.lang.String PROPERTY_LOGGER_MANAGER_CONFIGURATION
           
static java.lang.String PROPERTY_LOOKUP_COMPONENT_ROLE
           
static java.lang.String PROPERTY_ROLE_MANAGER_CONFIGURATION
           
static java.lang.String PROPERTY_SYSTEM_EXIT_ON_DISPOSE
           
static java.lang.String PROPERTY_WORK_DIRECTORY
           
 
Constructor Summary
FortressBean()
           
 
Method Summary
 void dispose()
          The dispose operation is called at the end of a components lifecycle.
 void enableLogging(Logger logger)
          Provide component with a logger.
 void execute()
          Implementation execute() method for Ant compatability.
protected  Logger getLogger()
           
protected  ServiceManager getServiceManager()
           
 void initialize()
          Initialize the component.
 void initialize(java.util.Properties p)
           
static void main(java.lang.String[] args)
           
 void run()
           
 void service(ServiceManager sm)
          Pass the ServiceManager to the Serviceable.
 void setContainerClass(java.lang.String containerClass)
          The container implementation has to be a subclass of org.apache.avalon.fortress.impl.DefaultContainer.
 void setContainerConfiguration(java.lang.String containerConfiguration)
           
 void setContextDirectory(java.lang.String contextDirectory)
           
 void setInstrumentManagerConfiguration(java.lang.String instrumentManagerConfiguration)
           
 void setInvokeMethod(java.lang.String invokeMethod)
           
 void setLoggerManagerConfiguration(java.lang.String loggerManagerConfiguration)
           
 void setLookupComponentRole(java.lang.String lookupComponentRole)
           
 void setProperties(java.util.Properties properties)
           
 void setRoleManagerConfiguration(java.lang.String roleManagerConfiguration)
           
 void setSystemExitOnDispose(boolean systemExitOnDispose)
          Should we call System.exit(0) after we are finished with processing.
 void setWorkDirectory(java.lang.String workDirectory)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_CONTAINER_CLASS

public static final java.lang.String PROPERTY_CONTAINER_CLASS
See Also:
Constant Field Values

PROPERTY_CONTAINER_CONFIGURATION

public static final java.lang.String PROPERTY_CONTAINER_CONFIGURATION
See Also:
Constant Field Values

PROPERTY_CONTEXT_DIRECTORY

public static final java.lang.String PROPERTY_CONTEXT_DIRECTORY
See Also:
Constant Field Values

PROPERTY_INSTRUMENT_MANAGER_CONFIGURATION

public static final java.lang.String PROPERTY_INSTRUMENT_MANAGER_CONFIGURATION
See Also:
Constant Field Values

PROPERTY_INVOKE_METHOD

public static final java.lang.String PROPERTY_INVOKE_METHOD
See Also:
Constant Field Values

PROPERTY_LOGGER_MANAGER_CONFIGURATION

public static final java.lang.String PROPERTY_LOGGER_MANAGER_CONFIGURATION
See Also:
Constant Field Values

PROPERTY_LOOKUP_COMPONENT_ROLE

public static final java.lang.String PROPERTY_LOOKUP_COMPONENT_ROLE
See Also:
Constant Field Values

PROPERTY_ROLE_MANAGER_CONFIGURATION

public static final java.lang.String PROPERTY_ROLE_MANAGER_CONFIGURATION
See Also:
Constant Field Values

PROPERTY_SYSTEM_EXIT_ON_DISPOSE

public static final java.lang.String PROPERTY_SYSTEM_EXIT_ON_DISPOSE
See Also:
Constant Field Values

PROPERTY_WORK_DIRECTORY

public static final java.lang.String PROPERTY_WORK_DIRECTORY
See Also:
Constant Field Values
Constructor Detail

FortressBean

public FortressBean()
Method Detail

enableLogging

public void enableLogging(Logger logger)
Description copied from interface: LogEnabled
Provide component with a logger.

Specified by:
enableLogging in interface LogEnabled
Parameters:
logger - the logger. Must not be null.
See Also:
LogEnabled.enableLogging(org.apache.avalon.framework.logger.Logger)

getLogger

protected final Logger getLogger()

initialize

public void initialize()
                throws java.lang.Exception
Description copied from interface: Initializable
Initialize the component. Initialization includes allocating any resources required throughout the component's lifecycle.

Specified by:
initialize in interface Initializable
Throws:
java.lang.Exception - if an error occurs
See Also:
Initializable.initialize()

initialize

public void initialize(java.util.Properties p)
                throws java.lang.Exception
Throws:
java.lang.Exception

run

public void run()
         throws java.lang.Exception
Throws:
java.lang.Exception

execute

public void execute()
Implementation execute() method for Ant compatability.


service

public void service(ServiceManager sm)
             throws ServiceException
Description copied from interface: Serviceable
Pass the ServiceManager to the Serviceable. The Serviceable implementation should use the specified ServiceManager to acquire the components it needs for execution.

Specified by:
service in interface Serviceable
Parameters:
sm - The ServiceManager which this Serviceable uses. Must not be null.
Throws:
ServiceException - if an error occurs
See Also:
Serviceable.service(org.apache.avalon.framework.service.ServiceManager)

dispose

public void dispose()
Description copied from interface: Disposable
The dispose operation is called at the end of a components lifecycle. This method will be called after Startable.stop() method (if implemented by component). Components use this method to release and destroy any resources that the Component owns.

Specified by:
dispose in interface Disposable
See Also:
Disposable.dispose()

getServiceManager

protected ServiceManager getServiceManager()

setContainerClass

public void setContainerClass(java.lang.String containerClass)
                       throws java.lang.Exception
The container implementation has to be a subclass of org.apache.avalon.fortress.impl.DefaultContainer.

Parameters:
containerClass - fully qualified class name of the container implementation class.
Throws:
java.lang.Exception

setContainerConfiguration

public void setContainerConfiguration(java.lang.String containerConfiguration)

setContextDirectory

public void setContextDirectory(java.lang.String contextDirectory)

setInstrumentManagerConfiguration

public void setInstrumentManagerConfiguration(java.lang.String instrumentManagerConfiguration)

setLoggerManagerConfiguration

public void setLoggerManagerConfiguration(java.lang.String loggerManagerConfiguration)

setRoleManagerConfiguration

public void setRoleManagerConfiguration(java.lang.String roleManagerConfiguration)

setWorkDirectory

public void setWorkDirectory(java.lang.String workDirectory)

setInvokeMethod

public void setInvokeMethod(java.lang.String invokeMethod)

setLookupComponentRole

public void setLookupComponentRole(java.lang.String lookupComponentRole)

setSystemExitOnDispose

public void setSystemExitOnDispose(boolean systemExitOnDispose)
Should we call System.exit(0) after we are finished with processing. Useful if the components have a GUI and there are some threads running that do not allow the JVM to exit.


main

public static void main(java.lang.String[] args)

setProperties

public void setProperties(java.util.Properties properties)


Copyright © 1997-2005 The Apache Software Foundation. All Rights Reserved.