You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 39 Next »

Elf Documentation

Overview

Elf is a robust container designed to support scriptable applicatations.

Elf Core Goals

  1. Robust
    • Must not fail unexpectedly
    • Must not fail silently
    • Must be able to determine cause of failure
  2. Monitorable
    • Must report status information to listeners
    • Should report debug information to listeners
    • Should report progress information to listeners
    • Should standardize logging across scripting implementations
  3. Extensible
    • Should allow for user extensions to core functionality without recompilation
  4. Steerable
    • Must be cancellable

Elf Core Functionality

Authentication Management

Individual sub-component may need to authenticate to services. The AuthenticationManager should provide an extensible mechanism for managing authentication tokens.

Event Management

Events (currently Progress, Status, and Debug Events) should have a centralized handling mechanism. Sub-components should have a means of adding listeners for specific types of events and should have a standardized way to create and send events.

Identity Management

Components should be able to create an identity for their sub-components. The mechanism for determining the identity will be extensible.

Elf Container

Elf should support multiple types of containers.

Elf Core Components

ElfRuntime

This class is instantiated and started by the Eclipse platform. It is responsible for instantiation, management of lifetime (configure, initialize, run), and management of status (calling Bootstrap.alive(), Bootstrap.failed(), Bootstrap.success()) of the Bootstrap object.

This object should not throw any exceptions, and should handle failures cleanly by returning the appropriate exit code.

Bootstrap

The Bootstrap class is responsible for parsing the command line arguments, the set up of the runtime environment, the configuration of ElfPlatform, and the instantiation and management of the Container. The configuration of this class should work with little mandatory configuration and should fail cleanly if the Container is missing or invalid.

ElfPlatform

ElfPlatform is the globally accessible point of access to Elf-wide objects. The various managers (Authentication, Event, and Identity) are instantiated and configured by this class from a file determined by a command line argument "-bootstrap.properties <value>". The platform should provide default managers if nothing specific is requested.

Elf Runtime Environment

Elf should provide a standard environment for running scriptable applications. The platform should provide a means of accessing these variables.

This environment consists of the following:

  • bootstrap.home – The directory in which the Bootstrap code will run.
    • The default location is defined by the system property "user.dir"
    • This can be overridden by a property named "bootstrapHome" in the bootstrap properties file.
  • container.path – The location of the Container script.
    • The default location is a file named "elf-container.xml" in the current working directory.
    • This can be overridden by a property named "containerPath" in the bootstrap properties file.

Elf Platform Initialization

The ElfPlatform handles the instantiation and initialization of the components that are available Elf-wide.

Bootstrap Properties File

The bootstrap properties file is a standard properties file.

bootstrap.properties example
# ENVIRONMENT CONFIGURATION
containerPath=/home/shawn/elfStuff/container.xml
bootstrapHome=/tmp/run

# EVENT MANAGEMENT
eventListener.tag=loggingListener
eventListener.loggingListener.log4jPropertiesFile=/home/shawn/elfStuff/log4j.properties

# AUTHENTICATION MANAGER
authenticationManager.tag=usernamePasswordAuthenication
authenticationManager.usernamePasswordAuthentication.username=shawn
authenticationManager.usernamePasswordAuthentication.password=foobar

# IDENTITY MANAGER
identityManager.tag=defaultIdentification
identityManager.defaultIdentification.baseId=http://tb1.ncsa.uiuc.edu:8080/ensemble/services/EnsembleBroker?eid=FooBar/12&wfname=IdealWrfNcar&nname=IdealWrf

Logging

log4j.properties
# Set root category priority to ERROR and its only appender to A1.
log4j.rootCategory=DEBUG, FA

# MAIN_CONSOLE
log4j.appender.MAIN_CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.MAIN_CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.MAIN_CONSOLE.layout.ConversionPattern=%-r - [%c{1}]:  %m%n

# MAIN_FILE
log4j.appender.MAIN_FILE=org.apache.log4j.FileAppender
log4j.appender.MAIN_FILE.File=${bootstrap.home}/main.log
log4j.appender.MAIN_FILE.Append=false
log4j.appender.MAIN_FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.MAIN_FILE.layout.ConversionPattern=%-r - [%c{1}]:  %m%n

 # FA is set to be a FileAppender.
log4j.appender.FA=org.apache.log4j.FileAppender
log4j.appender.FA.File=${bootstrap.home}/elf.log
log4j.appender.FA.Append=false
log4j.appender.FA.layout=org.apache.log4j.PatternLayout
log4j.appender.FA.layout.ConversionPattern=%-4r [%t] %-5p %C %x - %m%n

# CLASSES
log4j.logger.ncsa.tools.ogrescript.tasks.system.Echo=DEBUG, MAIN_CONSOLE, MAIN_FILE
log4j.logger.debug=DEBUG, MAIN_CONSOLE, MAIN_FILE

Get properties file here.

Running Elf

Elf requires both JAVA_HOME and ELF_HOME to be set. Elf looks for a container in the current directory, this can be overridden by a command-line argument -containerPath <path> or a properties in bootstrapProperties: containerPath. Elf also looks for bootstrapProperties in the current directory, this can be overridden by a command-line argument -bootstrapProperties <path>.

ELF_HOME/elf
ELF_HOME/elf -containerPath /tmp/foo.xml
ELF_HOME/elf -bootstrapProperties /tmp/bootstrap.properties

  • No labels