mcconnell 2002/06/12 22:27:51
Modified: merlin README.txt build.xml default.properties
merlin/src/java/org/apache/excalibur/configuration
CascadingConfiguration.java
merlin/src/java/org/apache/excalibur/merlin UnitInfo.java
Added: merlin/src/demo build.xml demo.bat local.properties.example
profile.xml project.properties
merlin/src/demo/lib readme.txt
merlin/src/demo/src/etc demo.mf
merlin/src/demo/src/java/org/apache/excalibur/playground
BasicComponent.java BasicComponent.xinfo
BasicService.java ComplexComponent.java
ComplexComponent.xinfo SimpleComponent.java
SimpleComponent.xinfo SimpleService.java
TerminalComponent.java TerminalComponent.xinfo
merlin/src/etc build.xml demo.bat demo.mf
local.properties.example overview.html
project.properties
Log:
addition of demonstration package and misc. javadoc updates
Revision Changes Path
1.2 +32 -2 jakarta-avalon-excalibur/merlin/README.txt
Index: README.txt
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/merlin/README.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- README.txt 10 May 2002 17:53:48 -0000 1.1
+++ README.txt 13 Jun 2002 05:27:50 -0000 1.2
@@ -1,7 +1,37 @@
- Avalons Excalibur Merlin
- -------------------------
+To build the Merlin package you must have JDK 1.2 or later
+and Ant 1.4 and have already checked out the merlin package for
+the Avalon Excalibur CVS tree.
+ $ cd <your-merlin-cvs-directory>
+ $ ant dist
+The dist target will generate a directory named 'distributions' containing
+the merlin package in a release zip file. After expanding the zip file you
+can validate that merlin is working by running the demo.
+ $ cd <your-merlin-distribution-dir>
+ $ cd demo
+ $ ant demo
+The demonstratation builds and executes a target component. You should
+see the follwing log trace from the demonstration.
+
+ demo:
+ [INFO ] (merlin): starting
+ [DEBUG ] (complex): service
+ [DEBUG ] (complex): initialize
+ [INFO ] (complex): hello from ComplexComponent
+ [INFO ] (complex.simple): hello from SimpleComponent
+ [INFO ] (complex.basic): hello from TerminalComponent
+ [DEBUG ] (complex): dispose
+
+The demonstration project is supplied for you to experiment with Avalon
+component lifecycle concepts and the corresponding support that Merlin
+provides in the automation of component congiguration, contextualization,
+assembly, initialzation and execution.
+
+For additional information concerning the Merlin product please refer to
+the release javadoc. For information concerning advanced Merlin topics
+and the development activities relating to Merlin support for Avalon
+metainfo and metadata please email the Avalon developer list.
1.6 +34 -18 jakarta-avalon-excalibur/merlin/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/merlin/build.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- build.xml 11 Jun 2002 03:26:55 -0000 1.5
+++ build.xml 13 Jun 2002 05:27:50 -0000 1.6
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
-<project name="Excalibur template" default="main" basedir=".">
+<project name="Merlin" default="main" basedir=".">
<property file="${user.home}/build.properties"/>
<property file="${basedir}/../ant.properties"/>
@@ -37,8 +37,6 @@
<target name="dependencies" description="Check dependencies"
unless="skip.dependencies">
<ant antfile="${depchecker.prefix}/depchecker.xml"
target="checkCommon"/>
- <ant antfile="${depchecker.prefix}/depchecker.xml"
target="checkConfiguration"/>
- <ant antfile="${depchecker.prefix}/depchecker.xml"
target="checkContext"/>
<ant antfile="${depchecker.prefix}/depchecker.xml"
target="checkLogkit"/>
<ant antfile="${depchecker.prefix}/depchecker.xml"
target="checkFramework"/>
</target>
@@ -113,7 +111,9 @@
<mkdir dir="${build.conf}"/>
<copy todir="${build.conf}" flatten="true">
<fileset dir="../" includes="LICENSE.txt"/>
- <fileset dir="${conf.dir}" includes="MANIFEST.MF"/>
+ <fileset dir="${conf.dir}">
+ <include name="MANIFEST.MF"/>
+ </fileset>
<filterset>
<filtersfile file="default.properties"/>
</filterset>
@@ -140,6 +140,11 @@
<include name="merlin.properties"/>
</zipfileset>
</jar>
+ </target>
+
+ <!-- Creates all the .jar file -->
+ <target name="configuration.jar" depends="compile, prepare-conf"
description="Generates the independent configuration jar files">
+ <mkdir dir="${build.lib}"/>
<jar jarfile="${build.lib}/excalibur-configuration-1.0.jar"
basedir="${build.classes}"
compress="${build.compress}">
@@ -148,14 +153,6 @@
<include name="LICENSE.txt"/>
</zipfileset>
</jar>
- <jar jarfile="${build.lib}/demo.jar"
- basedir="${build.classes}"
- compress="${build.compress}">
- <include name="**/demo/**"/>
- <zipfileset dir="${build.conf}" prefix="META-INF/">
- <include name="LICENSE.txt"/>
- </zipfileset>
- </jar>
</target>
<!-- Creates all the Javadocs -->
@@ -164,7 +161,9 @@
<mkdir dir="${dist.javadocs}"/>
<javadoc packagenames="org.apache.*"
sourcepath="${java.dir}"
- destdir="${dist.javadocs}">
+ destdir="${dist.javadocs}"
+ excludepackagenames="org.apache.excalibur.assembly.demo.*"
+ overview="${src.dir}/etc/${overview.page}">
<classpath refid="project.class.path" />
<doclet name="com.sun.tools.doclets.standard.Standard">
<param name="-author"/>
@@ -281,14 +280,31 @@
<!-- Creates the distribution -->
<target name="dist"
- depends="dist-jar, test-reports, checkstyle-report, javadocs"
- description="Generates a distribution (jar + javadocs + unit tests +
checkstyle reports)">
+ depends="dist-jar, javadocs"
+ description="Generates a distribution (jar + javadocs)">
+ <!-- license and readme -->
<copy file="${build.conf}/LICENSE.txt" todir="${dist.dir}"/>
<copy file="../KEYS" todir="${dist.dir}"/>
<copy file="README.txt" todir="${dist.dir}"/>
+ <!-- package the jars with merlin so we can run using java -jar -->
+
+ <mkdir dir="${dist.dir}/lib"/>
+ <copy file="${avalon-framework.jar}" todir="${dist.dir}/lib"/>
+ <copy file="${logkit.jar}" todir="${dist.dir}/lib"/>
+
+ <!-- create the demo package -->
+
+ <copy todir="${dist.dir}">
+ <fileset dir="${src.dir}">
+ <include name="demo/**"/>
+ </fileset>
+ </copy>
+
+ <!-- zip it all up -->
+
<mkdir dir="${dist.base}"/>
<zip zipfile="${dist.base}/${dist.name}-bin.zip" compress="true">
@@ -322,8 +338,8 @@
<!-- Creates a mini jar-only distribution -->
<target name="dist-jar" depends="jar">
- <mkdir dir="${dist.dir}"/>
- <copy todir="${dist.dir}">
+ <mkdir dir="${dist.dir}/lib"/>
+ <copy todir="${dist.dir}/lib">
<fileset dir="${build.lib}">
<include name="*.jar"/>
</fileset>
@@ -332,7 +348,7 @@
<!-- Creates a minimal distribution -->
<target name="dist.lite"
- depends="dist-jar, test, javadocs"
+ depends="dist-jar, javadocs"
description="Generates a minimal distribution (jar + javadocs)">
<copy file="../LICENSE.txt" todir="${dist.dir}"/>
1.4 +5 -13 jakarta-avalon-excalibur/merlin/default.properties
Index: default.properties
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/merlin/default.properties,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- default.properties 11 Jun 2002 02:24:08 -0000 1.3
+++ default.properties 13 Jun 2002 05:27:50 -0000 1.4
@@ -5,13 +5,15 @@
# Overridden by ../default.properties and all ant.properties
# Not user-editable; use ant.properties files instead
-name=excalibur-merlin
-Name=Excalibur Merlin Service Management
+name=merlin
+Name=Merlin
dir-name=merlin
version=1.0
package-version=0.2
year=2002
+overview.page=overview.html
+
# --------------------------------------------------
# REQUIRED LIBRARIES
# --------------------------------------------------
@@ -21,16 +23,6 @@
avalon-framework.lib=${avalon-framework.home}/build/lib
avalon-framework.jar=${avalon-framework.lib}/avalon-framework.jar
-# ----- Excalibur Configuration -----
-excalibur-configuration.home=${basedir}/../configuration
-excalibur-configuration.lib=${excalibur-configuration.home}/build/lib
-excalibur-configuration.jar=${excalibur-configuration.lib}/excalibur-configuration-1.0.jar
-
-# ----- Excalibur Context -----
-excalibur-context.home=${basedir}/../context
-excalibur-context.lib=${excalibur-context.home}/build/lib
-excalibur-context.jar=${excalibur-context.lib}/excalibur-context-1.0.jar
-
# ----- Logkit -----
logkit.home=${basedir}/../../jakarta-avalon-logkit
logkit.lib=${logkit.home}/build/lib
@@ -79,7 +71,7 @@
dist.name = ${name}-${version}
# name of jar file
-jar.name = ${name}-${version}.jar
+jar.name = ${name}.jar
# property indicating directory where all distribution archives are placed
dist.base = distributions
1.1 jakarta-avalon-excalibur/merlin/src/demo/build.xml
Index: build.xml
===================================================================
<project name="demo" default="help" basedir=".">
<property file="local.properties"/>
<property file="project.properties"/>
<target name="help" >
<echo>
Description
-----------
${project.title}
General Targets:
----------------
all - clean, build and dist
build - invokes the general build target
javadoc - javadoc API generation
dist - executes build and javadoc
clean - destroy the build directory
test - run the component
</echo>
</target>
<property name="lib.dir" value="lib" />
<property name="src.dir" value="src" />
<property name="build.dir" value="build" />
<property name="dist.dir" value="dist" />
<property name="javadoc.root.path" value="${dist.dir}" />
<property name="javadoc.dir.name" value="api" />
<property name="project.jar" value="${ant.project.name}.jar" />
<property name="project.mf" value="${ant.project.name}.mf" />
<!-- classpath -->
<path id="project.classpath">
<fileset dir="${merlin.home}/lib">
<include name="*.jar" />
</fileset>
<fileset dir="${lib.dir}">
<include name="*.jar" />
</fileset>
</path>
<!-- MAIN TARGETS -->
<target name="all" depends="clean,dist,javadoc"/>
<target name="dist" depends="build"/>
<target name="clean">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<!-- PREPARE -->
<target name="prepare" >
<mkdir dir="${build.dir}" />
<mkdir dir="${dist.dir}" />
</target>
<!-- BLOCK -->
<target name="context" depends="prepare">
<uptodate property="uptodate" targetfile="${dist.dir}/${project.jar}">
<srcfiles dir="${src.dir}/java">
<include name="**/*.*"/>
</srcfiles>
<srcfiles dir="${src.dir}/etc">
<include name="${project.mf}"/>
</srcfiles>
</uptodate>
</target>
<target name="build" depends="context" unless="uptodate" >
<echo message="Building ${project.title}"/>
<javac debug="${project.debug}" destdir="${build.dir}"
deprecation="${project.deprication}">
<classpath>
<path refid="project.classpath" />
</classpath>
<src path="${src.dir}/java" />
</javac>
<copy todir="${build.dir}">
<fileset dir="${src.dir}/java">
<include name="**/*.xinfo"/>
<include name="**/*.xml"/>
<include name="**/*.properties"/>
</fileset>
</copy>
<jar jarfile="${dist.dir}/${project.jar}" basedir="${build.dir}"
manifest="${src.dir}/etc/${project.mf}"/>
</target>
<!-- UTILITY TARGETS -->
<target name="javadoc" depends="prepare" >
<mkdir dir="${javadoc.root.path}/${javadoc.dir.name}" />
<javadoc destdir="${javadoc.root.path}/${javadoc.dir.name}"
doctitle="<h1>${project.title}</h1>"
noindex="false" author="false"
use="true"
windowtitle="${project.title}"
additionalparam="-breakiterator"
packagenames="*"
>
<sourcepath path="${src.dir}/java"/>
<classpath>
<path refid="project.classpath" />
<pathelement path="${dist.dir}/${project.jar}" />
</classpath>
</javadoc>
</target>
<!-- Merlin based execution of the demo project primary component. -->
<path id="merlin.classpath">
<fileset dir="${merlin.home}/lib">
<include name="logkit.jar" />
<include name="avalon-framework.jar" />
<include name="merlin.jar" />
</fileset>
</path>
<target name="merlin.context">
<available property="merlin.available"
classname="org.apache.excalibur.merlin.ant.Load" >
<classpath>
<path refid="merlin.classpath"/>
</classpath>
</available>
</target>
<target name="merlin.defintion" depends="merlin.context"
if="merlin.available">
<taskdef resource="merlin.properties">
<classpath>
<path refid="merlin.classpath"/>
</classpath>
</taskdef>
</target>
<target name="merlin.validation" depends="merlin.defintion"
unless="merlin.available">
<echo message="Could not locate Merlin in the merlin.classpath
definition. Please check you merlin.home property."/>
</target>
<target name="demo" depends="merlin.validation,dist" if="merlin.available">
<!--
After loading jar files declared under a fileset, apply lifecycle
pipeline processing to the class referenced in the target attribute.
-->
<load target="${merlin.target}"
priority="${merlin.priority}" disposal="${merlin.disposal}"
verbose="${merlin.verbose}"
configuration="${merlin.profile}">
<classpath>
<path refid="merlin.classpath" />
</classpath>
<!--
For all of the jar files in the fileset, load the jar file
into the classloader.
-->
<fileset dir="${dist.dir}">
<include name="*.jar"/>
</fileset>
</load>
</target>
</project>
1.1 jakarta-avalon-excalibur/merlin/src/demo/demo.bat
Index: demo.bat
===================================================================
@echo off
rem
rem set the target component class to execute
rem
set MERLIN_TARGET=org.apache.excalibur.playground.ComplexComponent
rem
rem set the logging priority level
rem
set MERLIN_PRIORIITY=DEBUG
rem
rem set the verbose mode - if true, internal Merlin composition activies
rem will be display in the logger output
rem
set MERLIN_VERBOSE=FALSE
rem
rem declare the jar file containing the dependent components and classes to
be loaded
rem into the Merlin classloader (spec seperate file list - no wildcards)
rem
set MERLIN_FILES=./dist/demo.jar
rem
rem execute Merlin as a jar file
rem (avalon-framework.jar and logkit.jar must be in the same disrectory)
rem
java -jar ./lib/merlin.jar -target %MERLIN_TARGET% -priority
%MERLIN_PRIORITY% -verbose %MERLIN_VERBOSE% %MERLIN_FILES%
1.1
jakarta-avalon-excalibur/merlin/src/demo/local.properties.example
Index: local.properties.example
===================================================================
#-------------------------------------------------------------------
# Local customization of properties.
# Merlin composer default execution settings.
#-------------------------------------------------------------------
#
# If ${merlin.disposal} property if true, Merlin will attempt to
# execute the target commonent before immediate disposal. If false,
# and the compoennt is startable, Merlin will attempt to start the
# component. Merlin will gracefully intercept inturupts and handle
# the stopping of disposal of alll implied components. The default
# disposal policy is TRUE.
#
merlin.disposal=true
#
# The ${merlin.verbose} flag instructs merlin to include attitional
# logging events detailing the component assembly and composition phase.
# The default verbose policy is FASLE.
merlin.verbose=false
#
# The ${merlin.priority} flag set the logging level. The value may be
# one of INFO, WARN, ERROR, or DEBUG. The default priority policy is
# INFO.
#
merlin.priority=debug
#
# The ${merlin.target} is the class anme of the component implemetation
# to execute.
#
merlin.target=org.apache.excalibur.playground.ComplexComponent
#
# The optional ${merlin.config} property declares the assembly profile
# to be used (please note the assembly profile format is still in evolution
# and as such is subject to revision).
#
merlin.profile=profile.xml
1.1 jakarta-avalon-excalibur/merlin/src/demo/profile.xml
Index: profile.xml
===================================================================
<profile>
<!-- this is an empty Merlin profile -->
<!--
profile structure is currently under review in the context of the
metainfo and metadata activities - for more information concerning
profile usage, please refer to the ServiceLoader javadoc and references
to the ant load task configuration argument.
-->
</profile>
1.1
jakarta-avalon-excalibur/merlin/src/demo/project.properties
Index: project.properties
===================================================================
#-------------------------------------------------------------------
# Default build setting used in the project.
# This file should not be modified. To override setting declared here,
# please copy the local.properties.example the name local.properties
# and modify values in that file.
#-------------------------------------------------------------------
merlin.home=..
project.title=Merlin Sample Project
project.deprication=false
project.debug=off
javadoc.dir.name=api
#-------------------------------------------------------------------
# Merlin default execution settings settings
#-------------------------------------------------------------------
#
# If ${merlin.disposal} property if true, Merlin will attempt to
# execute the target commonent before immediate disposal. If false,
# and the compoennt is startable, Merlin will attempt to start the
# component. Merlin will gracefully intercept inturupts and handle
# the stopping of disposal of alll implied components. The default
# disposal policy is TRUE.
#
merlin.disposal=true
#
# The ${merlin.verbose} flag instructs merlin to include attitional
# logging events detailing the component assembly and composition phase.
# The default verbose policy is FASLE.
merlin.verbose=false
#
# The ${merlin.priority} flag set the logging level. The value may be
# one of INFO, WARN, ERROR, or DEBUG. The default priority policy is
# INFO.
#
merlin.priority=debug
#
# The ${merlin.target} is the class anme of the component implemetation
# to execute.
#
merlin.target=org.apache.excalibur.playground.ComplexComponent
#
# The ${merlin.config} property declares the assembly profile to be used.
# (please not the assembly profile format is still in evolution and as
# such is subject to change).
#
merlin.profile=profile.xml
1.1 jakarta-avalon-excalibur/merlin/src/demo/lib/readme.txt
Index: readme.txt
===================================================================
This is an empty directory that is referneced by the build procedure
when creating the project classpath. Any jar files placed in this directory
will be included.
1.1 jakarta-avalon-excalibur/merlin/src/demo/src/etc/demo.mf
Index: demo.mf
===================================================================
Manifest-Version: 1.0
Created-By: OSM SARL
Name: org/apache/excalibur/playground/SimpleComponent.class
Avalon-Block: true
Name: org/apache/excalibur/playground/TerminalComponent.class
Avalon-Block: true
Name: org/apache/excalibur/playground/BasicComponent.class
Avalon-Block: true
Name: org/apache/excalibur/playground/ComplexComponent.class
Avalon-Block: true
1.1
jakarta-avalon-excalibur/merlin/src/demo/src/java/org/apache/excalibur/playground/BasicComponent.java
Index: BasicComponent.java
===================================================================
package org.apache.excalibur.playground;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
/**
* This is a minimal demonstration component that implements the
* <code>BasicService</code> interface and has no dependencies.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
*/
public class BasicComponent extends AbstractLogEnabled
implements BasicService
{
//=======================================================================
// BasicService
//=======================================================================
public void doPrimeObjective()
{
getLogger().info("hello from BasicComponent");
}
}
1.1
jakarta-avalon-excalibur/merlin/src/demo/src/java/org/apache/excalibur/playground/BasicComponent.xinfo
Index: BasicComponent.xinfo
===================================================================
<?xml version="1.0"?>
<blockinfo>
<block>
<!-- the component name -->
<name>basic-component</name>
</block>
<services>
<!-- services that this component provides -->
<service name="org.apache.excalibur.playground.BasicService"/>
</services>
</blockinfo>
1.1
jakarta-avalon-excalibur/merlin/src/demo/src/java/org/apache/excalibur/playground/BasicService.java
Index: BasicService.java
===================================================================
/*
*/
package org.apache.excalibur.playground;
import org.apache.avalon.framework.activity.Executable;
/**
* The <code>BasicService</code> executes a prime objective.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
*/
public interface BasicService
{
static final String KEY = "org.apache.excalibur.playground.BasicService";
/**
* Execute the prime objective of this services.
*/
void doPrimeObjective();
}
1.1
jakarta-avalon-excalibur/merlin/src/demo/src/java/org/apache/excalibur/playground/ComplexComponent.java
Index: ComplexComponent.java
===================================================================
/*
* ComplexComponent.java
*/
package org.apache.excalibur.playground;
import org.apache.avalon.framework.activity.Executable;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.service.Serviceable;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.ServiceException;
/**
* This is a minimal demonstration component that declares no interface but
* has dependecies on two services. These include SimpleService and
* BasicService.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
*/
public class ComplexComponent extends AbstractLogEnabled
implements Serviceable, Initializable, Executable, Disposable
{
private ServiceManager m_manager;
private SimpleService m_simple;
private BasicService m_basic;
//=================================================================
// Serviceable
//=================================================================
/**
* Pass the <code>ServiceManager</code> to the <code>Serviceable</code>.
* The <code>Serviceable</code> implementation uses the specified
* <code>ServiceManager</code> to acquire the services it needs for
* execution.
*
* @param manager The <code>ServiceManager</code> which this
* <code>Serviceable</code> uses.
*/
public void service( ServiceManager manager )
throws ServiceException
{
if( getLogger().isDebugEnabled() )
getLogger().debug("service");
m_manager = manager;
}
//=======================================================================
// Initializable
//=======================================================================
public void initialize()
throws Exception
{
if( getLogger().isDebugEnabled() )
getLogger().debug("initialize");
//
// verify current state
//
if( getLogger() == null ) throw new IllegalStateException(
"Logging channel has not been assigned.");
if( m_manager == null ) throw new IllegalStateException(
"Manager has not been declared.");
//
// lookup the primary service
//
m_simple = (SimpleService) m_manager.lookup( "simple" );
m_basic = (BasicService) m_manager.lookup( "basic" );
}
//=======================================================================
// Executable
//=======================================================================
public void execute()
{
getLogger().info("hello from ComplexComponent");
m_simple.doObjective();
m_basic.doPrimeObjective();
}
//=======================================================================
// Disposable
//=======================================================================
public void dispose()
{
if( getLogger().isDebugEnabled() )
getLogger().debug("dispose");
m_simple = null;
m_manager = null;
}
}
1.1
jakarta-avalon-excalibur/merlin/src/demo/src/java/org/apache/excalibur/playground/ComplexComponent.xinfo
Index: ComplexComponent.xinfo
===================================================================
<?xml version="1.0"?>
<blockinfo>
<block>
<name>complex</name>
</block>
<dependencies>
<dependency>
<role>simple</role>
<service name="org.apache.excalibur.playground.SimpleService"/>
</dependency>
<dependency>
<role>basic</role>
<service name="org.apache.excalibur.playground.BasicService"/>
</dependency>
</dependencies>
</blockinfo>
1.1
jakarta-avalon-excalibur/merlin/src/demo/src/java/org/apache/excalibur/playground/SimpleComponent.java
Index: SimpleComponent.java
===================================================================
package org.apache.excalibur.playground;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
/**
* This is a minimal demonstration component that a dependency on
* BasicService and provides SimpleService.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
*/
public class SimpleComponent extends AbstractLogEnabled
implements SimpleService
{
//=======================================================================
// PrimaryService
//=======================================================================
public void doObjective()
{
getLogger().info("hello from SimpleComponent");
}
}
1.1
jakarta-avalon-excalibur/merlin/src/demo/src/java/org/apache/excalibur/playground/SimpleComponent.xinfo
Index: SimpleComponent.xinfo
===================================================================
<?xml version="1.0"?>
<blockinfo>
<block>
<name>simple-component</name>
</block>
<services>
<service name="org.apache.excalibur.playground.SimpleService"/>
</services>
<dependencies>
<dependency>
<role>basic</role>
<service name="org.apache.excalibur.playground.BasicService"/>
</dependency>
</dependencies>
</blockinfo>
1.1
jakarta-avalon-excalibur/merlin/src/demo/src/java/org/apache/excalibur/playground/SimpleService.java
Index: SimpleService.java
===================================================================
/*
*/
package org.apache.excalibur.playground;
import org.apache.avalon.framework.activity.Executable;
/**
* The <code>SimpleService</code> executes an objective.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
*/
public interface SimpleService
{
static final String KEY = "org.apache.excalibur.playground.SimpleService";
/**
* Execute the prime objective of this services.
*/
void doObjective();
}
1.1
jakarta-avalon-excalibur/merlin/src/demo/src/java/org/apache/excalibur/playground/TerminalComponent.java
Index: TerminalComponent.java
===================================================================
package org.apache.excalibur.playground;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
/**
* This is a minimal demonstration component that provides BasicService
* and has no dependencies
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
*/
public class TerminalComponent extends AbstractLogEnabled
implements BasicService
{
//=======================================================================
// BasicService
//=======================================================================
public void doPrimeObjective()
{
getLogger().info("hello from TerminalComponent");
}
}
1.1
jakarta-avalon-excalibur/merlin/src/demo/src/java/org/apache/excalibur/playground/TerminalComponent.xinfo
Index: TerminalComponent.xinfo
===================================================================
<?xml version="1.0"?>
<blockinfo>
<block>
<name>terminal-component</name>
</block>
<services>
<service name="org.apache.excalibur.playground.BasicService"/>
</services>
</blockinfo>
1.1 jakarta-avalon-excalibur/merlin/src/etc/build.xml
Index: build.xml
===================================================================
<project name="demo" default="help" basedir=".">
<property file="local.properties"/>
<property file="project.properties"/>
<target name="help" >
<echo>
Description
-----------
${project.title}
General Targets:
----------------
all - clean, build and dist
build - invokes the general build target
javadoc - javadoc API generation
dist - executes build and javadoc
clean - destroy the build directory
test - run the component
</echo>
</target>
<property name="lib.path" value="lib" />
<property name="src.path" value="src" />
<property name="build.path" value="build" />
<property name="dist.path" value="dist" />
<property name="javadoc.root.path" value="${dist}/doc" />
<property name="javadoc.dir.name" value="api" />
<property name="project.jar" value="${ant.project.name}.jar" />
<property name="project.mf" value="${ant.project.name}.mf" />
<!-- classpath -->
<path id="project.classpath">
<fileset dir="${lib}">
<include name="*.jar" />
</fileset>
</path>
<!-- MAIN TARGETS -->
<target name="all" depends="clean,dist,javadoc"/>
<target name="dist" depends="build"/>
<target name="clean">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<!-- PREPARE -->
<target name="prepare" >
<mkdir dir="${build.dir}" />
<mkdir dir="${dist.dir}" />
</target>
<!-- BLOCK -->
<target name="context" depends="prepare">
<uptodate property="uptodate" targetfile="${dist.dir}/${prject.jar}">
<srcfiles dir="${src.dir}/java">
<include name="**/*.*"/>
</srcfiles>
<srcfiles dir="${src.dir}/etc">
<include name="${project.mf}"/>
</srcfiles>
</uptodate>
</target>
<target name="build" depends="context" unless="uptodate" >
<echo message="Building ${project.title}"/>
<javac debug="${project.debug}" destdir="${build.dir}"
deprecation="${project.deprication}">
<classpath>
<path refid="project.classpath" />
</classpath>
<src path="${src.dir}/java" />
</javac>
<copy todir="${build.dir}">
<fileset dir="${src.dir}/java">
<include name="**/*.xinfo"/>
<include name="**/*.xml"/>
<include name="**/*.properties"/>
</fileset>
</copy>
<jar jarfile="${dist,dir}/${project.jar}" basedir="${build.dir}"
manifest="${etc}/${project.mf}"/>
</target>
<!-- UTILITY TARGETS -->
<target name="javadoc" depends="prepare" >
<mkdir dir="${javadoc.root.path}/${javadoc.dir.name}" />
<javadoc destdir="${javadoc.root.path}/${javadoc.dir.name}"
doctitle="<h1>${project.title}</h1>"
noindex="false" author="false"
use="true"
windowtitle="${project.title}"
additionalparam="-breakiterator"
packagenames="*"
>
<sourcepath path="${src.path}/java"/>
<classpath>
<path refid="project.classpath" />
<pathelement path="${dist.path}/${project.jar}" />
</classpath>
</javadoc>
</target>
<!-- Merlin based execution of the demo project primary component. -->
<path id="merlin.classpath">
<fileset dir="${lib.path}">
<include name="logkit.jar" />
<include name="avalon-framework.jar" />
<include name="merlin.jar" />
</fileset>
</path>
<target name="merlin.context">
<available property="merlin.available"
classname="org.apache.excalibur.merlin.ant.Load" >
<classpath>
<path refid="merlin.classpath"/>
</classpath>
</available>
</target>
<target name="merlin.defintion" depends="merlin.context"
if="merlin.available">
<taskdef resource="merlin.properties">
<classpath>
<path refid="merlin.classpath"/>
</classpath>
</taskdef>
</target>
<target name="merlin.validation" depends="merlin.defintion"
unless="merlin.available">
<echo message="Ignoring load task. Could not locate Merlin in the
classpath."/>
</target>
<target name="demo" depends="merlin.validation,dist" if="merlin.available">
<!--
After loading jar files declared under a fileset, apply lifecycle
pipeline processing to the class referenced in the target attribute.
-->
<load target="${merlin.target}"
priority="${merlin.priority}" disposal="${merlin.disposal}"
verbose="${merlin.verbose}"
configuration="${merlin.profile}">
<classpath>
<path refid="merlin.classpath" />
</classpath>
<!--
For all of the jar files in the fileset, load the jar file
into the classloader.
-->
<fileset dir="${dist.path}">
<include name="*.jar"/>
</fileset>
</load>
</target>
</project>
1.1 jakarta-avalon-excalibur/merlin/src/etc/demo.bat
Index: demo.bat
===================================================================
@echo off
rem
rem set the target component class to execute
rem
set MERLIN_TARGET=org.apache.excalibur.playground.ComplexComponent
rem
rem set the logging priority level
rem
set MERLIN_PRIORIITY=DEBUG
rem
rem set the verbose mode - if true, internal Merlin composition activies
rem will be display in the logger output
rem
set MERLIN_VERBOSE=FALSE
rem
rem declare the jar file containing the dependent components and classes to
be loaded
rem into the Merlin classloader (spec seperate file list - no wildcards)
rem
set MERLIN_FILES=./dist/demo.jar
rem
rem execute Merlin as a jar file
rem (avalon-framework.jar and logkit.jar must be in the same disrectory)
rem
java -jar ./lib/merlin.jar -target %MERLIN_TARGET% -priority
%MERLIN_PRIORITY% -verbose %MERLIN_VERBOSE% %MERLIN_FILES%
1.1 jakarta-avalon-excalibur/merlin/src/etc/demo.mf
Index: demo.mf
===================================================================
Manifest-Version: 1.0
Created-By: OSM SARL
Name: org/apache/excalibur/assembly/demo/SimpleComponent.class
Avalon-Block: true
Name: org/apache/excalibur/assembly/demo/TerminalComponent.class
Avalon-Block: true
Name: org/apache/excalibur/assembly/demo/BasicComponent.class
Avalon-Block: true
Name: org/apache/excalibur/assembly/demo/ComplexComponent.class
Avalon-Block: true
1.1
jakarta-avalon-excalibur/merlin/src/etc/local.properties.example
Index: local.properties.example
===================================================================
#-------------------------------------------------------------------
# Local customization of properties.
# Merlin composer default execution settings.
#-------------------------------------------------------------------
#
# If ${merlin.disposal} property if true, Merlin will attempt to
# execute the target commonent before immediate disposal. If false,
# and the compoennt is startable, Merlin will attempt to start the
# component. Merlin will gracefully intercept inturupts and handle
# the stopping of disposal of alll implied components. The default
# disposal policy is TRUE.
#
merlin.disposal=true
#
# The ${merlin.verbose} flag instructs merlin to include attitional
# logging events detailing the component assembly and composition phase.
# The default verbose policy is FASLE.
merlin.verbose=false
#
# The ${merlin.priority} flag set the logging level. The value may be
# one of INFO, WARN, ERROR, or DEBUG. The default priority policy is
# INFO.
#
merlin.priority=debug
#
# The ${merlin.target} is the class anme of the component implemetation
# to execute.
#
merlin.target=org.apache.excalibur.playground.ComplexComponent
#
# The ${merlin.config} property declares the assembly profile to be used.
# (please not the assembly profile format is still in evolution and as
# such is subject to change).
#
merlin.profile=profile.xml
1.1 jakarta-avalon-excalibur/merlin/src/etc/overview.html
Index: overview.html
===================================================================
<body>
<p>
Merlin service composition and assembly engine. The primary package
resource is the ServiceLoader class which handles dynamic service loading,
configuration, contextualization, automated service composition, dependent
service management, and service decommissioning.
</p>
<p><table border="1" cellpadding="3" cellspacing="0" width="100%">
<tr bgcolor="#ccccff">
<td colspan="2"><font size="+2"><b>Components</b></font></td>
<tr><td width="20%" valign="top"><strong>[EMAIL PROTECTED]
org.apache.excalibur.merlin.ServiceLoader}</strong></td>
<td>The <code>ServiceLoader</code> component support for the loading, log
enablement, runtime context management,
supply of static configuration information profils, composition of dependent
services, and service decommissioning.
The <coe>ServiceLoader</code> is executable via the command line (as a jar
file or class invocation), as a classic
component managed by a container, or executed as an Ant task.</td></tr>
</table>
<h3>Overview</h3>
<table border="1" cellpadding="3" cellspacing="0" width="100%">
<tr bgcolor="#ccccff">
<td colspan="2"><b><font size="+2">Features Summary</b></font></td>
<tr><td width="20%"><b>Feature</b></td>
<td><b>Description</b></td></tr>
<tr><td valign="top">Service Composition</td>
<td>Handles automated composition of services based on declared component
dependencies.</td></tr>
<tr><td valign="top">Default Configurations</td>
<td>Provides support for configuration using component default configurations
together
with supplied configuration information using the CascadingConfiguration
model.</td></tr>
<tr><td valign="top">Mixed execution modes</td>
<td>Supports execution from the command line (main method), as a jar file, as
an Ant task,
and as an embedded component.
<p><strong>java -jar form</strong></p>
<p>Execution using java -jar pattern requires the presence
of the following files under the same directory:</p>
<ul>
<li><code>merlin.jar</code>
<li><code>avalon-framework.jar</code>
<li><code>logkit.jar</code>
</ul>
<p>An example command line is shown below:</p>
<pre>
$ java -jar <strong>merlin.jar</strong> <supporting-jar-files>
-target <class-name>
</pre>
<p><strong>java -classpath form</strong></p>
<p>Execution using java -classpath pattern requires the inclusions
of the pipeline, framework and logkit jar files in the classpath
statement.</p>
<p>An example command line is shown below:</p>
<pre>
$ java -classpath
<strong>merlin.jar;avalon-framework.jar;logkit.jar</strong>
org.apache.excalibur.merlin.ServiceLoader
<supporting-jar-files> -target <class-name>
</pre>
<p><i>Where the <supporting-jar-files< values is a space
delimited
list of file names.</i></p>
<p><strong>Ant task</strong></p>
<p>Execution of Merlin as an Ant task requires either:
<ul>
<li>the presence of the following files under the ${ant.home}/lib
directory:</p>
<ul>
<li><code>merlin.jar</code>
<li><code>avalon-framework.jar</code>
<li><code>logkit.jar</code>
</ul>
<li>declaration of a classpath within the merlin load task (see below)
</ul>
<p>An example load task is included below:</p>
<pre>
<task name="my-task">
<font color="blue"><i><!--
Declare the ant task.
--></i></font>
<taskdef resource="merlin.properties"/>
<font color="blue"><i><!--
Invoke the loading of a target and supporting services.
--></i></font>
<load target="org.apache.demo.ReferralBlock" priority="DEBUG"
disposal="true" verbose="false">
<font color="blue"><i><!--
Classpath declaration only required if dependent files are
not included in the ant lib directory.
--></i></font>
<classpath>
<fileset dir="${merlin.home}">
<include name="merlin.jar"/>
<include name="avalon-framework.jar"/>
<include name="logkit.jar">
</fileset>
%lt;/classpath>
<font color="blue"><i><!--
For all of the jar files in the fileset, load the jar file
into the service classloader.
--></i></font>
<fileset dir="${dist}">
<include name="examples.jar"/>
</fileset>
</load>
</task">
</pre>
</td></tr>
</table>
<h3>Component Creation</h3>
The pipeline class manages the creation and deployment of a target component
and dynamic
resolution of dependencies based on meta-information contained in a jar
manifest file. Entries
in the manifest file reference class names that are used to load the
component implementation
and configuration the component based on meta-information contained in .xinfo
and .conf files
of the same name as the implementation class.
<h4>The Manifest File</h4>
<p>Reusable components are published through a manifest declaration show
below. When
a jar file is supplied to the Pipeline the manifest is checked for any block
declarations.
Blocks declared within the manifest are registered by the pipeline as
potentially available
services that can be used in service dependency resolution. Each
Avalon-block declaration
in the manifest refers to a component implementation class and its associated
.xinfo file.</p>
<pre>
Manifest-Version: 1.0
Name: org/apache/excalibur/playground/ComponentComponent.class
Avalon-Block: true
Name: org/apache/excalibur/playground/SimpleComponent.class
Avalon-Block: true
</pre>
<h4>The <classname>.xinfo File</h4>
<p>For each component declared in a manifest, the implementation establishes
the available services
and dependencies based on information contained in an <code>.xinfo</code>
file. Given a component
implementation class
<strong><code>org/apache/ReferralBlock.class</code></strong> the
<code>ServiceLoader</code> will attempt to locate a
<strong><code>org/apache/ReferralBlock.xinfo</code></strong>
resource in the jar file.</P>
<pre>
<?xml version="1.0"?>
<blockinfo>
<font color="blue"><i><!--
Block name and implementation version.
--></i></font>
<block name="referral">
<version>1.0</version>
</block>
<font color="blue"><i><!--
Services that are offered by the component are declared under the
services element. A services element may contain multiple service
declarations.
--></i></font>
<services>
<font color="blue"><i><!--
A service declaration includes a class name (typically an interface)
and a service version identifier. Service versions may have up to
three fields (e.g. 1.1.3).
--></i></font>
<service name="org.apache.ReferralService" version="1.0" />
</services>
<font color="blue"><i><!--
A component declares the dependencies it has with other components
under
the dependencies element. A dependencies element may contain multiple
dependency statements.
--></i></font>
<dependencies>
<font color="blue"><i><!--
A dependency element contains the declaration of a role and a
service
that the component is dependent on. The pipeline processor will
attempt
to resolve dependencies based on registered services and
dynamically
establish and provide the dependencies via the component
Serviceable
implementation. The role name corresponds to the identifying string
that the component implementation will use to lookup a service from
a service manager during the serviceable or composable lifecycle
phase.
--></i></font>
<dependency>
<role>directory</role>
<service name="org.apache.DirectoryService"
version="1.0"/>
<font color="blue"><i><!--
An optional configuration element may be declared as part of a
dependency. The configuration will be applied as the primary
configuration backed by the supporting services default
configuration.
--></i></font>
<configuration>
<!-- any assembly criteria to be added to the components
configuration -->
</configuration>
</dependency>
</dependencies>
<font color="blue"><i><!--
Optional component implementation policy may be one of the following:
(a) <strong>SINGLETON</strong>, service is available for the lifetime
of the manager
(b) <strong>TRANSIENT</strong>, manager is a factory of transient
service instances
--></i></font>
<implementation policy="SINGLETON" />
<font color="blue"><i><!--
The default configuration for a component is declared under the
<strong>configuration</strong>
element. This configuration value may be modified and/or supplimented
by a
configuration supplied by a managing container. If the
<strong>configuration</strong>
elements includes the <string>extends</string> attribute, the
configuration will be created
as a <code>CascadingConfiguration</code> where the default
configuration is a resource derived
from the extends path value and the primary configuration will be the
content of the
configuration element.
--></i></font>
<configuration extends=org/apache/"credits.xml">
<about>Example default configuration for this
component.</about>
</configuration>
</blockinfo>
</pre>
</body>
1.1
jakarta-avalon-excalibur/merlin/src/etc/project.properties
Index: project.properties
===================================================================
#-------------------------------------------------------------------
# Default build setting used in the project.
# This file should not be modified. To override setting declared here,
# please copy the local.properties.example the name local.properties
# and modify values in that file.
#-------------------------------------------------------------------
project.title=Merlin Sample Project
project.deprication=false
project.debug=off
javadoc.root.path=${dist}/doc
javadoc.dir.name=api
#-------------------------------------------------------------------
# Merlin default execution settings settings
#-------------------------------------------------------------------
#
# If ${merlin.disposal} property if true, Merlin will attempt to
# execute the target commonent before immediate disposal. If false,
# and the compoennt is startable, Merlin will attempt to start the
# component. Merlin will gracefully intercept inturupts and handle
# the stopping of disposal of alll implied components. The default
# disposal policy is TRUE.
#
merlin.disposal=true
#
# The ${merlin.verbose} flag instructs merlin to include attitional
# logging events detailing the component assembly and composition phase.
# The default verbose policy is FASLE.
merlin.verbose=false
#
# The ${merlin.priority} flag set the logging level. The value may be
# one of INFO, WARN, ERROR, or DEBUG. The default priority policy is
# INFO.
#
merlin.priority=debug
#
# The ${merlin.target} is the class anme of the component implemetation
# to execute.
#
merlin.target=org.apache.excalibur.playground.ComplexComponent
#
# The ${merlin.config} property declares the assembly profile to be used.
# (please not the assembly profile format is still in evolution and as
# such is subject to change).
#
merlin.profile=profile.xml
1.2 +2 -2
jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/configuration/CascadingConfiguration.java
Index: CascadingConfiguration.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/configuration/CascadingConfiguration.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CascadingConfiguration.java 11 Jun 2002 03:26:55 -0000 1.1
+++ CascadingConfiguration.java 13 Jun 2002 05:27:51 -0000 1.2
@@ -303,7 +303,7 @@
/**
* Return the <code>boolean</code> value of the specified parameter
contained
- * in this node.<br>
+ * in this node.
*
* @param paramName The name of the parameter you ask the value of.
* @return boolean value of attribute
@@ -395,7 +395,7 @@
}
/**
- * Return the <code>long</code> value of the node.<br>
+ * Return the <code>long</code> value of the node.
*
* @return the value of the node.
* @exception ConfigurationException If conversion to <code>long</code>
fails.
1.6 +2 -2
jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/UnitInfo.java
Index: UnitInfo.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/merlin/src/java/org/apache/excalibur/merlin/UnitInfo.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- UnitInfo.java 11 Jun 2002 03:26:55 -0000 1.5
+++ UnitInfo.java 13 Jun 2002 05:27:51 -0000 1.6
@@ -20,7 +20,7 @@
import org.apache.avalon.framework.context.Context;
import org.apache.excalibur.configuration.CascadingConfiguration;
import org.apache.excalibur.configuration.ConfigurationUtil;
-import org.apache.excalibur.context.ContextUtility;
+import org.apache.excalibur.configuration.ContextFactory;
/**
* Meta information about a <code>Serviceable</code> component.
@@ -234,7 +234,7 @@
if( contextConfig != null )
{
- m_context = ContextUtility.createContextFromConfiguration(
+ m_context = ContextFactory.createContextFromConfiguration(
context, contextConfig );
}
else
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>