You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2002/11/24 13:50:47 UTC

cvs commit: avalon-sandbox/assembly/src/test/org/apache/avalon/playground BasicComponent.java BasicComponent.xconfig BasicComponent.xinfo BasicComponent.xprofile BasicContext.java BasicContextInterface.java BasicService.java BasicService.xservice ComplexComponent.java ComplexComponent.xinfo DemoManager.java DemoManager.xinfo Demonstratable.java Exploitable.java ExploitationManager.java ExploitationManager.xinfo InvalidComponent.java InvalidComponent.xinfo NullService.java SimpleComponent.java SimpleComponent.xconfig SimpleComponent.xinfo SimpleService.java TerminalComponent.java TerminalComponent.xinfo package.html

mcconnell    2002/11/24 04:50:47

  Added:       assembly .cvsignore build.xml default.properties
               assembly/src/etc checkstyle.properties demo.mf project.mf
               assembly/src/java/org/apache/avalon/assembly/appliance
                        Appliance.java ApplianceException.java
                        ApplianceManager.java
                        ApplianceRuntimeException.java
                        ApplianceSelector.java DefaultAppliance.java
                        DefaultApplianceManager.java
                        DuplicateApplianceException.java package.html
               assembly/src/java/org/apache/avalon/assembly/logger
                        DefaultLoggerManager.java FileTargetProvider.java
                        LoggerException.java LoggingDescriptor.java
                        TargetDescriptor.java TargetProvider.java
                        package.html
               assembly/src/java/org/apache/avalon/assembly/profile
                        DefaultProfileManager.java
                        DuplicateProfileException.java
                        ProfileException.java ProfileManager.java
                        ProfileSelector.java UnknownProfileException.java
                        package.html
               assembly/src/java/org/apache/avalon/assembly/service
                        DefaultServiceManager.java
                        DuplicateServiceException.java
                        ServiceException.java ServiceManager.java
                        ServiceRuntimeException.java
                        UnknownServiceException.java package.html
               assembly/src/java/org/apache/avalon/assembly/type
                        DefaultTypeManager.java DuplicateTypeException.java
                        TypeException.java TypeManager.java
                        TypeRuntimeException.java UnknownTypeException.java
                        package.html
               assembly/src/test/org/apache/avalon/assembly
                        TestCaseBase.java
               assembly/src/test/org/apache/avalon/assembly/profile
                        ProfileManagerTestCase.java
               assembly/src/test/org/apache/avalon/assembly/service
                        DefaultServiceManagerTestCase.java
               assembly/src/test/org/apache/avalon/assembly/type
                        TypeManagerTestCase.java
               assembly/src/test/org/apache/avalon/playground
                        BasicComponent.java BasicComponent.xconfig
                        BasicComponent.xinfo BasicComponent.xprofile
                        BasicContext.java BasicContextInterface.java
                        BasicService.java BasicService.xservice
                        ComplexComponent.java ComplexComponent.xinfo
                        DemoManager.java DemoManager.xinfo
                        Demonstratable.java Exploitable.java
                        ExploitationManager.java ExploitationManager.xinfo
                        InvalidComponent.java InvalidComponent.xinfo
                        NullService.java SimpleComponent.java
                        SimpleComponent.xconfig SimpleComponent.xinfo
                        SimpleService.java TerminalComponent.java
                        TerminalComponent.xinfo package.html
  Log:
  Initial commit of the assembly package derived from the Excalibur Assembly project content under the org.apache.excalibur.assembly.* package dealing with type, service, profile, appliance and logging management.
  
  Revision  Changes    Path
  1.1                  avalon-sandbox/assembly/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  ant.properties
  build
  dist
  checkstyle.cache
  kernel.log
  extensions
  distributions
  
  
  
  1.1                  avalon-sandbox/assembly/build.xml
  
  Index: build.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <!--  
  Copyright (C) The Apache Software Foundation. All rights reserved.
  This software is published under the terms of the Apache Software License
  version 1.1, a copy of which has been included with this distribution in
  the LICENSE.txt file.
  
  @author  Avalon Development Team
  @version 1.0 12/03/2001
  -->
  
  <project name="assembly" default="main" basedir=".">
  
    <property file="${basedir}/../ant.properties"/>
    <property file="${basedir}/ant.properties"/>
    <property file="${user.home}/.ant.properties"/>
    <property file="${basedir}/../default.properties"/>
    <property file="${basedir}/default.properties"/>
  
    <!-- Classpath for product -->
    <path id="project.class.path">
      <pathelement location="${logkit.jar}"/>
      <pathelement location="${avalon-framework.jar}"/>
      <pathelement location="${excalibur-i18n.jar}"/>
      <pathelement location="${avalon-meta.jar}"/>
      <pathelement location="${avalon-lifecycle.jar}"/>
      <pathelement location="${excalibur-logger.jar}"/>
      <pathelement location="${excalibur-configuration.jar}"/>
      <pathelement location="${build.classes}"/>
      <pathelement location="${checkstyle.jar}"/>
      <pathelement location="${xml-apis.jar}"/>
      <pathelement path="${java.class.path}"/>
    </path>
  
    <path id="test.class.path">
      <path refid="project.class.path"/>
      <pathelement location="${build.dir}/lib/${demo.jar}"/>
      <pathelement location="${build.testclasses}"/>
    </path>
  
    <target name="main" depends="jar,jar-playground" description="Build the project"/>
    <target name="rebuild" depends="clean,main" description="Rebuild the project"/>
    <target name="all" depends="rebuild,docs" description="Rebuild the project"/>
  
    <target name="meta-context">
      <uptodate property="meta-uptodate" targetfile="${avalon-meta.jar}">
        <srcfiles dir="${avalon-meta.home}/src">
          <include name="**/*.*"/>
        </srcfiles>
      </uptodate>
    </target>
  
    <target name="meta" depends="meta-context" description="Meta dependency" unless="meta-uptodate">
      <ant dir="../meta" inheritAll="false"/>
    </target>
  
    <target name="lifecycle-context">
      <uptodate property="lifecycle-uptodate" targetfile="${avalon-lifecycle.jar}">
        <srcfiles dir="${avalon-lifecycle.home}/src">
          <include name="**/*.*"/>
        </srcfiles>
      </uptodate>
    </target>
  
    <target name="lifecycle" depends="lifecycle-context" description="Lifecycle Extensions dependency" unless="lifecycle-uptodate">
      <ant dir="../lifecycle" inheritAll="false"/>
    </target>
  
    <target name="dependencies" depends="lifecycle,meta" description="Check dependencies" />
  
    <target name="context">
      <uptodate property="uptodate" targetfile="${build.lib}/${jar.name}">
        <srcfiles dir="${src.dir}">
          <include name="**/*.*"/>
        </srcfiles>
      </uptodate>
    </target>
  
    <!-- Compiles the source code -->
    <target name="compile" depends="context,dependencies" 
         description="Compiles the source code" unless="uptodate">
      
      <echo message="compiling ${ant.project.name}"/>
      <mkdir dir="${build.classes}"/>
  
      <!-- Compile all classes -->
  
      <javac srcdir="${java.dir}"
         destdir="${build.classes}"
         debug="${build.debug}"
         optimize="${build.optimize}"
         deprecation="${build.deprecation}"
         target="1.2">
        <src path="${java.dir}" />
        <classpath refid="project.class.path" />
        <exclude name="**/playground/**/*.java"/>
        <include name="**/*.java"/>
      </javac>
  
      <!-- copy resources to same location as .class files -->
      <copy todir="${build.classes}">
        <fileset dir="${java.dir}">
          <exclude name="**/*.java"/>
          <exclude name="**/package.html"/>
          <exclude name="**/playground/**/*.*"/>
        </fileset>
      </copy>
  
    </target>
  
    <!-- Creates all the .jar file -->
    <target name="jar" depends="compile" description="Generates the jar files" unless="uptodate">
  
      <mkdir dir="${build.conf}"/>
      <copy todir="${build.conf}" flatten="true">
        <fileset dir="../" includes="LICENSE.txt"/>
        <filterset>
          <filter token="year" value="${year}"/>
        </filterset>
      </copy>
  
      <mkdir dir="${build.lib}"/>
      <jar jarfile="${build.lib}/${jar.name}"
         basedir="${build.classes}"
         compress="${build.compress}"
         manifest="${src.dir}/etc/project.mf">
        <exclude name="**/test/**"/>
        <exclude name="**/playground/**"/>
        <zipfileset dir="${build.conf}" prefix="META-INF/">
          <include name="LICENSE.txt"/>
        </zipfileset>
      </jar>
  
    </target>
  
    <!-- Creates all the Javadocs -->
    <target name="javadocs" depends="compile" 
            description="Generates the javadocs" unless="skip.javadocs">
      <mkdir dir="${build.javadocs}"/>
      <javadoc packagenames="org.apache.avalon.assembly.*"
         sourcepath="${java.dir}"
         destdir="${build.javadocs}">
        <classpath refid="project.class.path" />
        <doclet name="com.sun.tools.doclets.standard.Standard">
          <param name="-author"/>
          <param name="-version"/>
          <param name="-doctitle" value="${Name}"/>
          <param name="-windowtitle" value="${Name} API"/>
          <param name="-link" value="http://java.sun.com/j2se/1.4/docs/api/"/>
          <param name="-link" value="http://java.sun.com/j2ee/sdk_1.3/techdocs/api/"/>
          <param name="-link" value="http://jakarta.apache.org/avalon/api/"/>
          <param name="-link" value="../../meta/api"/>
          <param name="-link" value="../../lifecycle/api"/>
         <param name="-bottom"
             value="&quot;Copyright &#169; ${year} Apache Avalon Project. All Rights Reserved.&quot;"/>
        </doclet>
      </javadoc>
    </target>
  
    <target name="checkstyle" if="do.checkstyle">
      <taskdef classpath="${checkstyle.jar}"
         resource="checkstyletask.properties"/>
  
      <checkstyle
        properties="${etc.dir}/checkstyle.properties" 
        failOnViolation="false">
        <fileset dir="${java.dir}"
                 includes="**/*.java"/>
        <property key="checkstyle.cache.file" file="${checkstyle-cache}"/>
        <formatter type="plain"/>
        <formatter type="xml" toFile="${build.dir}/checkstyle-results.xml"/>
      </checkstyle>
    </target>
  
    <target name="checkstyle-report" depends="checkstyle" if="do.checkstyle"
       description="Generate Checkstyle Report">
      <mkdir dir="${build.reports}"/>
      <property name="checkstyle.pathhack" location="."/>
      <style style="${tools.dir}/etc/checkstyle-frames.xsl" in="${build.dir}/checkstyle-results.xml"
         out="${build.reports}/delete-me.html.html">
              <param name="pathhack" expression="${checkstyle.pathhack}"/>
      </style>
    </target>
  
    <!-- Creates the distribution -->
    <target name="dist"
       depends="dist-jar, checkstyle-report, javadocs"
       description="Generates a distribution (jar + javadocs + unit tests + checkstyle reports)">
  
      <copy file="${build.conf}/LICENSE.txt" todir="${dist.dir}"/>
      <copy file="../KEYS" todir="${dist.dir}"/>
  
      <zip zipfile="${dist.dir}/src.zip" compress="false">
        <zipfileset dir="src/java"/>
      </zip>
  
      <mkdir dir="${dist.base}"/>
  
      <zip zipfile="${dist.base}/${dist.name}.zip" compress="true">
        <zipfileset dir="${dist.dir}" prefix="${dist.name}"/>
      </zip>
  
      <delete dir="${dist.dir}" />
  
    </target>
  
    <!-- Creates a mini jar-only distribution -->
    <target name="dist-jar" depends="jar">
      <mkdir dir="${dist.dir}"/>
      <copy todir="${dist.dir}">
        <fileset dir="${build.lib}">
          <include name="*.jar"/>
        </fileset>
      </copy>
    </target>
  
    <!-- Creates a minimal distribution -->
    <target name="dist.lite"
       depends="dist-jar, javadocs"
       description="Generates a minimal distribution (jar + javadocs)">
  
      <copy file="../LICENSE.txt" todir="${dist.dir}"/>
      <copy file="../KEYS" todir="${dist.dir}"/>
  
    </target>
  
    <target name="docs" depends="javadocs, xdocs" 
       description="generates all the Avalon documentation"/>
  
    <target name="xdocs" description="generates the xdocs-based documentation">
      <ant antfile="${basedir}/../cocoonbuild.xml"/>
    </target>
  
    <target name="site" depends="javadocs, docs" 
       description=" Places Docs ready for hosting on website">
      <mkdir dir="../site/dist/docs/${dir-name}"/>
      <copy todir="../site/dist/docs/${dir-name}">
        <fileset dir="${docs.dir}">
          <include name="**"/>
        </fileset>
      </copy>
    </target>
  
    <!-- Cleans up build and distribution directories -->
    <target name="clean" description="Cleans up the project">
      <delete file="checkstyle.cache"/>
      <delete dir="${build.dir}" />
      <delete dir="${dist.dir}" />
      <delete dir="test" /> <!-- unit testing output directory -->
      <delete>
        <fileset dir="." includes="velocity.*"/>
        <fileset dir="." includes="**/*~" defaultexcludes="no"/>
      </delete>
    </target>
  
    <target name="real-clean" depends="clean" 
       description="Cleans up the project, including distributions">
      <delete dir="${dist.base}" />
    </target>
   
    <!--
    Test
    -->
  
    <!-- Compiles the unit test source code -->
    <target name="compile-test" depends="jar" description="Compiles unit test source code">
  
      <mkdir dir="${build.testsrc}"/>
  
      <!-- Copy over all of the tests applying test filters -->
      <copy todir="${build.testsrc}">
        <fileset dir="${test.dir}"/>
      </copy>
  
      <mkdir dir="${build.testclasses}"/>
  
      <!-- Compile all test classes. -->
      <javac srcdir="${build.testsrc}"
         destdir="${build.testclasses}"
         debug="${build.debug}"
         optimize="${build.optimize}"
         deprecation="${build.deprecation}"
         target="1.2">
         <classpath refid="test.class.path" />
         <include name="**/*.java"/>
      </javac>
  
      <copy todir="${build.testclasses}">
        <fileset dir="${test.dir}">
          <exclude name="**/*.java"/>
          <exclude name="**/package.html"/>
        </fileset>
      </copy>
  
    </target>
  
    <!-- Compiles the unit test source code -->
    <target name="compile-playground" depends="jar" description="Compiles demo sources.">
  
      <mkdir dir="${build.playground}"/>
  
      <!-- Compile all test classes. -->
      <javac srcdir="${test.dir}"
         destdir="${build.playground}"
         debug="${build.debug}"
         optimize="${build.optimize}"
         deprecation="${build.deprecation}"
         target="1.2">
         <classpath refid="project.class.path" />
         <include name="**/playground/*.java"/>
      </javac>
  
      <copy todir="${build.playground}">
        <fileset dir="${test.dir}">
          <exclude name="**/*.java"/>
          <exclude name="**/package.html"/>
          <include name="**/playground/**/*"/>
        </fileset>
      </copy>
  
    </target>
  
  
    <!-- Compiles the unit test source code -->
    <target name="jar-playground" depends="compile-playground" description="Jar the playground.">
      <jar jarfile="${build.lib}/${demo.jar}"
          basedir="${build.playground}"
          compress="${build.compress}"
          manifest="${src.dir}/etc/demo.mf">
        <include name="**/playground/**"/>
        <zipfileset dir="${build.conf}" prefix="META-INF/">
           <include name="LICENSE.txt"/>
        </zipfileset>
      </jar>
    </target>
  
    <target name="test" depends="jar-playground,compile-test" description="Perform the unit tests" unless="skip.tests">
  
      <echo message="Performing Unit Tests" />
  
      <mkdir dir="${build.tests}"/>
  
      <junit fork="true"
          haltonfailure="${junit.failonerror}"
          printsummary="yes"
          dir="${build.tests}">
        <classpath refid="test.class.path"/>
  
        <formatter type="xml"/>    <!-- xml reports for junitreport -->
        <formatter type="plain" usefile="false"/>  <!-- text reports for humans     -->
  
        <batchtest todir="${build.tests}">
          <fileset dir="${build.testclasses}">
            <include name="**/*TestCase.class"/>
          </fileset>
        </batchtest>
      </junit>
    </target>
  
    <target name="test-reports" depends="test" description="Generate Reports for the unit tests">
  
      <ant antfile="${depchecker.prefix}/depchecker.xml" target="checkBSF"/>
  
      <mkdir dir="${build.reports}/junit"/>
  
      <junitreport todir="${build.reports}/junit">
        <fileset dir="${build.tests}">
          <include name="TEST-*.xml"/>
        </fileset>
        <report format="frames" todir="${build.reports}/junit"/>
      </junitreport>
    </target>
  
    <!--
    Misc. utilities.
    -->
  
    <target name="patch">
      <replace dir="src" summary="true"
         token="Apache Avalon Project"
         value="Apache Avalon Project" >
       <include name="**/*.*"/>
      </replace>
    </target>
  
  </project>
  
  
  
  1.1                  avalon-sandbox/assembly/default.properties
  
  Index: default.properties
  ===================================================================
  # -------------------------------------------------------------------
  # B U I L D  P R O P E R T I E S
  # -------------------------------------------------------------------
  # Specifies default property values
  # Overridden by ../default.properties and all ant.properties
  # Not user-editable; use ant.properties files instead
  
  name=avalon-assembly
  Name=Avalon Container Assembly Framework
  dir-name=assembly
  version=1.0
  package-version=1.0
  year=2002
  
  
  # --------------------------------------------------
  #                REQUIRED LIBRARIES
  # --------------------------------------------------
  
  # ----- Avalon Framework -----
  avalon-framework.home=${basedir}/../../jakarta-avalon
  avalon-framework.lib=${avalon-framework.home}/target/lib
  avalon-framework.jar=${avalon-framework.lib}/avalon-framework.jar
  
  # ----- Avalon Sandbox -----
  avalon-sandbox.home=${basedir}/..
  
  # ----- Avalon Meta -----
  avalon-meta.home=${avalon-sandbox.home}/meta
  avalon-meta.lib=${avalon-meta.home}/build/lib
  avalon-meta.jar=${avalon-meta.lib}/avalon-meta-1.0.jar
  
  # ----- Avalon Lifecycle -----
  avalon-lifecycle.home=${avalon-sandbox.home}/lifecycle
  avalon-lifecycle.lib=${avalon-lifecycle.home}/build/lib
  avalon-lifecycle.jar=${avalon-lifecycle.lib}/avalon-lifecycle-1.0.jar
  
  # ----- Excalibur -----
  excalibur.home=${basedir}/../../jakarta-avalon-excalibur
  
  # ----- Excalibur i18n, version 1.0 or later -----
  excalibur-i18n.home=${excalibur.home}/i18n
  excalibur-i18n.lib=${excalibur-i18n.home}/build/lib
  excalibur-i18n.jar=${excalibur-i18n.lib}/excalibur-i18n-1.0.jar
  
  # ----- Excalibur Configuration -----
  excalibur-configuration.home=${excalibur.home}/configuration
  excalibur-configuration.lib=${excalibur-configuration.home}/build/lib
  excalibur-configuration.jar=${excalibur-configuration.lib}/excalibur-configuration-1.0.jar
  
  # ----- Excalibur logger, version 1.0 or later -----
  excalibur-logger.home=${excalibur.home}/logger
  excalibur-logger.lib=${excalibur-logger.home}/build/lib
  excalibur-logger.jar=${excalibur-logger.lib}/excalibur-logger-1.0.jar
  
  # ----- Logkit -----
  logkit.home=${basedir}/../../jakarta-avalon-logkit
  logkit.lib=${logkit.home}/build/lib
  logkit.jar=${logkit.lib}/logkit.jar
  
  # --------------------------------------------------
  
  #  Settings used to configure compile environment
  build.debug = on
  build.optimize = off
  build.deprecation = off
  build.compress = false
  junit.failonerror = false
  
  #  location of intermediate products
  build.dir = build
  build.testsrc = ${build.dir}/testsrc
  build.playground = ${build.dir}/playground
  build.testclasses = ${build.dir}/testclasses
  build.lib = ${build.dir}/lib
  build.conf = ${build.dir}/conf
  build.classes = ${build.dir}/classes
  build.tests = ${build.dir}/tests
  build.reports = ${build.dir}/reports
  build.docs = ${build.dir}/docs
  build.javadocs = ${build.docs}/api
  
  #  Set the properties for source directories
  src.dir = src
  java.dir = ${src.dir}/java
  conf.dir = ${src.dir}/conf
  etc.dir = ${src.dir}/etc
  test.dir = ${src.dir}/test
  
  tools.dir=${basedir}/../../jakarta-avalon/tools
  
  #  Set the properties for distribution directories
  dist.dir = dist
  dist.javadocs = ${dist.dir}/docs/api
  
  #  name of .zip/.tar.gz/.bz2 files and their top-level directory
  dist.name = ${name}-${version}
  
  #  name of jar file
  jar.name = ${name}-${version}.jar
  
  #  property indicating directory where all distribution archives are placed
  dist.base = distributions
  
  
  # project specific properties
  
  lib.dir = lib
  demo.name = demo
  demo.jar = ${name}-${demo.name}-${version}.jar
  sar.name = ${name}-${version}.sar
  
  # misc.
  
  checkstyle-cache = ${build.dir}/checkstyle.cache
  
  #depchecker.prefix=.
  
  
  
  1.1                  avalon-sandbox/assembly/src/etc/checkstyle.properties
  
  Index: checkstyle.properties
  ===================================================================
  checkstyle.lcurly.type=nl
  checkstyle.lcurly.method=nl
  checkstyle.lcurly.other=nl
  
  checkstyle.rcurly=alone
  
  # TODO: Should not be ignored for readability!!!
  checkstyle.ignore.braces=no
  checkstyle.ignore.importlength=yes
  checkstyle.ignore.public.in.interface=no
  checkstyle.ignore.whitespace=yes
  checkstyle.ignore.whitespace.cast=yes
  
  checkstyle.paren.pad=space
  
  # TODO: Try to get the files ot match the default values
  # default 80 maxlinelen
  checkstyle.maxlinelen=250
  # default 2000
  checkstyle.maxfilelen=3000
  # default 150 maxmethodlen
  checkstyle.maxmethodlen=180
  # default 150 maxmethodlen
  checkstyle.maxconstructorlen=100
  
  # default 7
  checkstyle.maxparameters=13
  
  checkstyle.pattern.member=^m_[a-z](_?[a-zA-Z0-9])*$
  checkstyle.pattern.static=^c_[a-z](_?[a-zA-Z0-9])*$
  checkstyle.pattern.const=^[A-Z](_?[A-Z0-9]+)*$
  checkstyle.pattern.method=[a-z](_?[a-zA-Z0-9]+)*$
  checkstyle.pattern.parameter=[a-z](_?[a-zA-Z0-9]+)*$
  checkstyle.pattern.localvar=[a-z](_?[a-zA-Z0-9]+)*$
  
  # TODO: Use an invalid pattern temporarily until the TODOs have been resolved to make the nightly builds work!!!
  checkstyle.pattern.todo=xTODO:x
  
  checkstyle.javadoc.scope=protected
  checkstyle.javadoc.checkUnusedThrows=true
  
  checkstyle.require.packagehtml=yes
  
  checkstyle.allow.noauthor=no
  checkstyle.allow.protected=yes
  checkstyle.allow.package=no
  checkstyle.allow.tabs=no
  
  # The official header file
  checkstyle.header.file=../LICENSE.txt
  
  # These instantiations should be illegal, use the static constants instead. 
  checkstyle.illegalInstantiations=java.lang.Boolean
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/etc/demo.mf
  
  Index: demo.mf
  ===================================================================
  Manifest-Version: 1.0
  Created-By: Apache Avalon
  Extension-List: framework meta lifecycle i18n
  framework-Extension-Name: avalon-framework
  framework-Specification-Version: 1.0
  framework-Implementation-Version: 4.1.2
  meta-Extension-Name: avalon-meta
  meta-Specification-Version: 1.0
  lifecycle-Extension-Name: avalon-lifecycle
  lifecycle-Specification-Version: 1.0
  configuration-Extension-Name: excalibur-configuration
  configuration-Specification-Version: 1.0
  i18n-Extension-Name: excalibur-i18n
  i18n-Specification-Version: 1.0
  
  Name: org/apache/avalon/playground/SimpleComponent.class
  Avalon: Type
  
  Name: org/apache/avalon/playground/TerminalComponent.class
  Avalon: Type
  
  Name: org/apache/avalon/playground/BasicComponent.class
  Avalon: Type
  
  Name: org/apache/avalon/playground/ComplexComponent.class
  Avalon: Type
  
  Name: org/apache/avalon/playground/InvalidComponent.class
  Avalon: Type
  
  Name: org/apache/avalon/playground/ExploitationManager.class
  Avalon: Type
  
  Name: org/apache/avalon/playground/DemoManager.class
  Avalon: Type
  
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/etc/project.mf
  
  Index: project.mf
  ===================================================================
  Manifest-Version: 1.0
  Created-By: Apache Avalon
  Extension-Name: avalon-assembly
  Specification-Vendor: Apache Software Foundation
  Specification-Version: 1.0
  Implementation-Vendor: Apache Software Foundation
  Implementation-Version: 1.0
  Extension-List: framework meta lifecycle configuration i18n logger
  framework-Extension-Name: avalon-framework
  framework-Specification-Version: 1.0
  framework-Implementation-Version: 4.1.2
  meta-Extension-Name: avalon-meta
  meta-Specification-Version: 1.0
  lifecycle-Extension-Name: avalon-lifecycle
  lifecycle-Specification-Version: 1.0
  configuration-Extension-Name: excalibur-configuration
  configuration-Specification-Version: 1.0
  i18n-Extension-Name: excalibur-i18n
  i18n-Specification-Version: 1.0
  logger-Extension-Name: excalibur-logger
  logger-Specification-Version: 1.0
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/appliance/Appliance.java
  
  Index: Appliance.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.appliance;
  
  import org.apache.avalon.meta.info.StageDescriptor;
  import org.apache.avalon.meta.model.Profile;
  
  /**
   * An appliance is a class that encapsulates the deployment criteria
   * for a particular component together with a the state supporting 
   * compoennt assembly and dependency solutions.  The function of an appliace
   * is to server as the aggregation point for the deployment of a component
   * and the access point for services provided by the component implemetation.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:44 $
   */ 
  
  public interface Appliance
  {
      /**
       * Return the profile backing the appliance.
       * @return the profile that this appliance is managing
       */
      Profile getProfile();
  
      /**
       * Set the activation policy for the component.  If TRUE, activation
       * will occur at startup.  If false, activation will be deferred to
       * the first lookup invocation if any (i.e. lazy activation).
       *
       * @param policy TRUE if the appliace is to be activated on startup
       */
      void setActivationPolicy( boolean policy );
  
      /**
       * Return the activation policy for the component.  If TRUE, activation
       * will occur at startup.  If false, activation will be deferred to
       * the first lookup invocation if any (i.e. lazy activation).
       *
       * @return the activation policy
       */
      boolean getActivationPolicy();
  
      /**
       * Test is this profile is enabled.  A profile is enabled unless explicitly disabled by an
       * assembly directive, or implicity disabled as a result of an assembly failure.
       *
       * @return TRUE if the profile is enabled.
       * @see #setEnabled( boolean )
       */
      boolean isEnabled();
  
      /**
       * Set the enabled status of the profile to the supplied value.
       * @param value the enabled status - TRUE or FALSE
       */
      void setEnabled( boolean value );
  
      /**
       * Return the assigned service providers.
       * @return the set of service provider appliances.
       */
      Appliance[] getServiceProviders();
  
      /**
       * Return the dependency associations for component type with specified role.
       *
       * @param role the dependency role name
       * @return the dependency metadata for component with specified role.
       */
      Appliance getServiceProvider( final String role );
  
      /**
       * Add the appliance that will acts as provider for a named dependency.
       * @param role the role against which the supplied appliance is to be associated
       * @param appliance the appliance that will fulfill the provider dependency
       */
      void addServiceProvider( String role, Appliance appliance );
  
      /**
       * Return the assigned extension providers.
       *
       * @return the set of extension provider appliances.
       */
      Appliance[] getExtensionProviders();
  
      /**
       * Returns the appliace assigned to handle the components lifecycle stage.
       * @param stage the lifecycle stage specification
       * @return a reference to the stage extension
       */
      Appliance getExtensionProvider( StageDescriptor stage );
  
      /**
       * Add a lifecycle stage extension.
       * @param stage the identifier of the stage to assign the manager to
       * @param appliance the appliance that will handle the stage
       */
      void addExtensionProvider( StageDescriptor stage, Appliance appliance );
  
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/appliance/ApplianceException.java
  
  Index: ApplianceException.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.appliance;
  
  import org.apache.avalon.framework.CascadingException;
  
  /**
   * Exception to indicate that there was a appliance related error.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:44 $
   */
  public class ApplianceException
      extends CascadingException
  {
  
      /**
       * Construct a new <code>ApplianceException</code> instance.
       *
       * @param message The detail message for this exception.
       */
      public ApplianceException( final String message )
      {
          this( message, null );
      }
  
      /**
       * Construct a new <code>ApplianceException</code> instance.
       *
       * @param message The detail message for this exception.
       * @param throwable the root cause of the exception
       */
      public ApplianceException( final String message, final Throwable throwable )
      {
          super( message, throwable );
      }
  }
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/appliance/ApplianceManager.java
  
  Index: ApplianceManager.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.appliance;
  
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.meta.info.DependencyDescriptor;
  import org.apache.avalon.meta.info.StageDescriptor;
  import org.apache.avalon.meta.model.Profile;
  
  /**
   * An appliance manager implemetation provides support for the 
   * retrival of appliance instances.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:44 $
   */
  public interface ApplianceManager
  {
     /**
      * Creation of a new Appliance instance from a profile and configuration.
      * @param profile the profile to manager
      * @param config the appliance configuration
      * @return a non-initialized appliance instance
      * @exception ApplianceException if a error occurs during appliance creation
      */
      Appliance createAppliance( Profile profile, Configuration config )
        throws ApplianceException;
  
     /**
      * Creation of a new Appliance instance based on a supplied profile, enabled 
      * state and activation policy.
      * @param profile the component deployment profile
      * @param enabled the enabled state of the appliance
      * @param activation the activation policy 
      * @return the appliance
      * @exception ApplianceException if a error occurs during appliance creation
      */
      Appliance createAppliance( Profile profile, boolean enabled, boolean activation )
        throws ApplianceException;
  
     /**
      * Return the set of appliance istances capable of supporting the supplied dependency.
      * @param dependency a service dependency descriptor
      * @return a matching appliance
      */
      Appliance[] getAppliances( DependencyDescriptor dependency );
  
     /**
      * Return the set of appliance instances that provide the supplied extension.
      * @param stage a stage descriptor
      * @return a set of candidate appliances
      */
      Appliance[] getAppliances( StageDescriptor stage );
  
     /**
      * Select an appliance supporting the supplied dependency using a supplied selector.
      * @param dependency a service depedency descriptor
      * @param selector the appliance selector
      * @return the selected appliance (possibly null)
      */
      Appliance getAppliance( DependencyDescriptor dependency, ApplianceSelector selector );
  
     /**
      * Select an appliance capable of supporting the supplied stage 
      * @param stage a lifecycle stage
      * @param selector an appliance selector
      * @return the selected appliance (possibly null)
      */
      Appliance getAppliance( StageDescriptor stage, ApplianceSelector selector );
  
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/appliance/ApplianceRuntimeException.java
  
  Index: ApplianceRuntimeException.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.appliance;
  
  import org.apache.avalon.framework.CascadingRuntimeException;
  
  /**
   * Exception to indicate that there was an appliance related runtime error.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:44 $
   */
  public final class ApplianceRuntimeException
      extends CascadingRuntimeException
  {
  
      /**
       * Construct a new <code>ApplianceRuntimeException</code> instance.
       *
       * @param message The detail message for this exception.
       */
      public ApplianceRuntimeException( final String message )
      {
          this( message, null );
      }
  
      /**
       * Construct a new <code>ApplianceRuntimeException</code> instance.
       *
       * @param message The detail message for this exception.
       * @param throwable the root cause of the exception
       */
      public ApplianceRuntimeException( final String message, final Throwable throwable )
      {
          super( message, throwable );
      }
  }
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/appliance/ApplianceSelector.java
  
  Index: ApplianceSelector.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.appliance;
  
  import org.apache.avalon.meta.info.StageDescriptor;
  import org.apache.avalon.meta.info.DependencyDescriptor;
  import org.apache.avalon.assembly.profile.ProfileSelector;
  
  /**
   * Interface implemented by a service selection implementation mechanism.  Classes
   * implementing the selector interface may be activated during the selection of
   * candidate service providers during assembly.  A component author may declare a 
   * selection class explicitly via a service dependency attribute with the attribute 
   * name of <code>avalon:appliance.selector</code>.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:44 $
   */
  public interface ApplianceSelector extends ProfileSelector
  {
      /**
       * Returns the preferred appliance form an available selection of 
       * candidate service providers.
       * @param appliances the set of candidate appliance instances
       * @param dependency the dependency for which the appliance is required
       * @return the preferred provider or null if no satisfactory provider can be established
       *    from the supplied appliance set.
       */
      Appliance select( Appliance[] appliances, DependencyDescriptor dependency );
  
      /**
       * Returns the preferred appliance form an available selection of candidate 
       * extension providers
       * @param appliances the set of candidate appliance instances
       * @param stage the stage for which the appliance is required
       * @return the preferred provider or null if no satisfactory provider can be established
       *    from the supplied appliance set.
       */
      Appliance select( Appliance[] appliances, StageDescriptor stage );
  
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/appliance/DefaultAppliance.java
  
  Index: DefaultAppliance.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.appliance;
  
  import java.util.Hashtable;
  
  import org.apache.avalon.meta.info.StageDescriptor;
  import org.apache.avalon.meta.model.Profile;
  
  /**
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:44 $
   */
  public class DefaultAppliance implements Appliance
  {
      //=====================================================================
      // state
      //=====================================================================
  
      /**
       * The underlying profile that this appliance is managing.
       */
       private Profile m_profile;
  
      /**
       * The enabled status of the profile.  Normally a profile is enabled however, a
       * failure to assemble will result in the disabling of the profile.
       */
      private boolean m_enabled = true;
  
      /**
       * The activation policy - TRUE if activation on startup, FALSE to activate on request.
       */
      private boolean m_activation = true;
  
      /**
       * The dependencies providers keyed by role name.
       */
      private final Hashtable m_providers = new Hashtable();
  
      /**
       * The stage extension providers keyed by stage descriptor.
       */
      private final Hashtable m_managers = new Hashtable();
  
      //=====================================================================
      // constructor
      //=====================================================================
  
      /**
       * Create an new Appliance instance.
       *
       * @param profile the component profile to be managed by the appliance
       * @param enabled the enabled state of the appliance
       * @param policy the appliance activation policy - TRUE if the appliance should 
       *   should be auto-activated on startup of the host container
       */
      public DefaultAppliance( final Profile profile,
                      final boolean enabled,
                      final boolean policy )
      {
          if( profile == null )
          {
              throw new NullPointerException("profile");
          }
  
          m_profile = profile;
          m_enabled = enabled;
          m_activation = policy;
      }
  
       //=====================================================================
       // implementation
       //=====================================================================
  
      /**
       * Return the profile backing the appliance.
       *
       * @return the profile that this appliance is managing
       */
      public Profile getProfile()
      {
          return m_profile;
      }
  
      /**
       * Set the activation policy for the component.  If TRUE, activation
       * will occur at startup.  If false, activation will be deferred to
       * the first lookup invocation if any (i.e. lazy activation).
       *
       * @param policy the activation policy
       */
      public void setActivationPolicy( boolean policy )
      {
          m_activation = policy;
      }
  
      /**
       * Return the activation policy for the component.  If TRUE, activation
       * will occur at startup.  If false, activation will be deferred to
       * the first lookup invocation if any (i.e. lazy activation).
       *
       * @return the activation policy
       */
      public boolean getActivationPolicy()
      {
          return m_activation;
      }
  
      /**
       * Test is this profile is enabled.  A profile is enabled unless explicitly disabled by an
       * assembly directive, or implicity disabled as a result of an assembly failure.
       *
       * @return TRUE if the profile is enabled.
       * @see #setEnabled( boolean )
       */
      public boolean isEnabled()
      {
          return m_enabled;
      }
  
      /**
       * Set the enabled status of the profile to the supplied value.
       * @param value the enabled status - TRUE or FALSE
       */
      public void setEnabled( boolean value )
      {
          m_enabled = value;
      }
  
      /**
       * Return the assigned service providers.
       *
       * @return the set of service provider assignments.
       */
      public Appliance[] getServiceProviders()
      {
          return (Appliance[])m_providers.values().toArray( new Appliance[ 0 ] );
      }
  
      /**
       * Return the provider appliance for the specified role.
       *
       * @param role the role name
       * @return the appliance servicing the role
       */
      public Appliance getServiceProvider( final String role )
      {
          return (Appliance)m_providers.get( role );
      }
  
      /**
       * Add an appliance servicing for a dependency.
       * @param role the role against which the supplied resource is to be associated
       * @param appliance the appliance that will fulfill the dependency
       */
      public void addServiceProvider( String role, Appliance appliance )
      {
          m_providers.put( role, appliance );
      }
  
      /**
       * Add a lifecycle stage extension.
       * @param stage the identifier of the stage to assign the manager to
       * @param appliance the appliance that will handle the stage
       */
      public void addExtensionProvider( StageDescriptor stage, Appliance appliance )
      {
          m_managers.put( stage, appliance );
      }
  
      /**
       * Return the assigned extension providers.
       *
       * @return the set of extension provider appliances.
       */
      public Appliance[] getExtensionProviders()
      {
          return (Appliance[])m_managers.values().toArray( new Appliance[ 0 ] );
      }
  
      /**
       * Return a reference to the lifecycle stage extension assigned to handle
       * the components custom stage.
       * @param stage the lifecycle stage specification
       * @return the appliance handling the stage extension
       */
      public Appliance getExtensionProvider( StageDescriptor stage )
      {
          return (Appliance)m_managers.get( stage );
      }
  
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/appliance/DefaultApplianceManager.java
  
  Index: DefaultApplianceManager.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.appliance;
  
  import java.util.Map;
  import java.util.Hashtable;
  import java.util.Iterator;
  import java.util.ArrayList;
  
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.context.ContextException;
  import org.apache.avalon.framework.context.Contextualizable;
  import org.apache.avalon.framework.activity.Initializable;
  
  import org.apache.avalon.meta.model.Profile;
  import org.apache.avalon.assembly.appliance.builder.ApplianceBuilder;
  import org.apache.avalon.meta.info.DependencyDescriptor;
  import org.apache.avalon.meta.info.StageDescriptor;
  import org.apache.avalon.meta.info.ReferenceDescriptor;
  
  /**
   * The default appliance manager provides support for {@link Appliance}
   * creation, registration and retrival.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:44 $
   */
  public final class DefaultApplianceManager extends AbstractLogEnabled 
    implements ApplianceManager, Contextualizable, Initializable
  {
  
      //==================================================================
      // static
      //==================================================================
  
     /**
      * The default appliacnce buildier.
      */
      private static final ApplianceBuilder DEFAULT_BUILDER = new ApplianceBuilder();
  
      //==================================================================
      // state
      //==================================================================
  
     /**
      * Flag indicating if contextualization has been performed.
      */
      private boolean m_contextualized = false;
    
     /**
      * Flag indicating if initalization has been performed.
      */
      private boolean m_initialized = false;
    
     /**
      * The parent appliance manager.
      */
      private ApplianceManager m_parent;
  
     /**
      * The classloader.
      */
      private ClassLoader m_classloader;
  
      /**
       * Table of component profiles keyed by profile name.
       */
      private final Map m_appliances = new Hashtable();
  
      //==============================================================
      // Contextualizable
      //==============================================================
  
     /**
      * <p>Application of a runtime context to this component.
      * Context entries that may be supplied to an appliance manager are detailed in the
      * following table.</p>
      * <table>
      *   <tr>
      *     <td>key</td><td>type</td><td>default</td>
      *   </tr>
      *   <tr>
      *     <td>avalon:type.classloader</td>
      *     <td>java.lang.ClassLoader</td>
      *     <td>The context classloader will be used by default if not value is supplied.</td> 
      *   </tr>
      *   <tr>
      *     <td>assembly:parent</td>
      *     <td>{@link org.apache.avalon.assembly.appliance.ApplianceManager}</td>
      *     <td>In no value suppled, this appliance manager will be considered as a root manager.</td> 
      *   </tr>
      * </table>
      * @param context the runtime context
      */
      public void contextualize( Context context )
      {
          try
          {
              m_parent = (ApplianceManager) context.get( "assembly:parent" );
          }
          catch( ContextException e )
          {
              m_parent = null;
          }
  
          try
          {
              m_classloader = (ClassLoader) context.get( "assembly:classloader" );
          }
          catch( ContextException e )
          {
              m_classloader = Thread.currentThread().getContextClassLoader();
          }
  
          m_contextualized = true;
      }
  
      //==============================================================
      // Initializable
      //==============================================================
  
     /**
      * Initialization fo the component by the container.  The implementation
      * validates a logger has been assigned and that the context phase has 
      * been executed, following which it flags initialization as complete and 
      * marks the component as ready to serve requests.
      *
      * @exception Exception if the manager has not been suppied with a context
      */
      public void initialize() throws Exception
      {
          if( !m_contextualized )
          {
              throw new IllegalStateException("contextualize");
          }
          if( getLogger() == null )
          {
              throw new IllegalStateException("logger");
          }
  
          m_initialized = true;
      }
  
      //==================================================================
      // ApplianceManager
      //==================================================================
  
     /**
      * Creation of a new Appliance instance from a profile and configuration.
      * @param profile the profile to manager
      * @param config the appliance configuration
      * @return a non-initialized appliance instance
      * @exception ApplianceException if an applicate creation error occurs
      */
      public Appliance createAppliance( Profile profile, Configuration config )
        throws ApplianceException
      {
          try
          {
              return DEFAULT_BUILDER.createAppliance( profile, config );
          }
          catch( Throwable e )
          {
              final String error = 
                "Build failure while attempting to create appliance for profile: " 
                + profile;
              throw new ApplianceException( error, e );
          }
      }
  
     /**
      * Creation of a new Appliance instance based on a supplied profile, enabled 
      * state and activation policy.
      * @param profile the component deployment profile
      * @param enabled the enabled state of the appliance
      * @param activation the activation policy 
      * @return the appliance
      */
      public Appliance createAppliance( Profile profile, boolean enabled, boolean activation )
      {
          return DEFAULT_BUILDER.createAppliance( profile, enabled, activation );
      }
  
     /**
      * Return the set of appliance istances capable of supporting the supplied dependency.
      * @param dependency a service dependency descriptor
      * @return a matching appliance
      */
      public Appliance[] getAppliances( DependencyDescriptor dependency )
      {
          ArrayList list = new ArrayList();
          if( m_parent != null )
          {
              Appliance[] appliances = m_parent.getAppliances( dependency );
              for( int i=0; i<appliances.length; i++ )
              {
                  list.add( appliances[i] );
              }
          }
  
          ReferenceDescriptor reference = dependency.getReference();
          Iterator iterator = m_appliances.entrySet().iterator();
          while( iterator.hasNext() )
          {
              Appliance appliance = (Appliance) iterator.next();
              Object service = appliance.getProfile().getType().getService( reference );
              if( service != null )
              {
                  list.add( appliance );
              }
          }
  
          return (Appliance[]) list.toArray( new Appliance[0] );
      }
  
     /**
      * Return the set of appliance instances that provide the supplied extension.
      * @param stage a stage descriptor
      * @return a set of appliances capable of supporting the supplied stage
      */
      public Appliance[] getAppliances( StageDescriptor stage )
      {
          ArrayList list = new ArrayList();
          if( m_parent != null )
          {
              Appliance[] appliances = m_parent.getAppliances( stage );
              for( int i=0; i<appliances.length; i++ )
              {
                  list.add( appliances[i] );
              }
          }
  
          Iterator iterator = m_appliances.entrySet().iterator();
          while( iterator.hasNext() )
          {
              Appliance appliance = (Appliance) iterator.next();
              
              if( appliance.isEnabled() 
                && ( appliance.getProfile().getType().getExtension( stage ) != null ) )
              {
                  list.add( appliance );
              }
          }
  
          return (Appliance[]) list.toArray( new Appliance[0] );
      }
  
     /**
      * Select an appliance supporting the supplied dependency using a supplied selector.
      * @param dependency a service depedency descriptor
      * @param selector the applaice selector
      * @return the selected appliance (possibly null)
      */
      public Appliance getAppliance( DependencyDescriptor dependency, ApplianceSelector selector )
      {
          Appliance[] appliances = getAppliances( dependency );
          return selector.select( appliances, dependency );
      }
  
     /**
      * Select an appliance capable of supporting the supplied stage 
      * @param stage a lifecycle stage
      * @param selector an appliance selector
      * @return the selected appliance (possibly null)
      */
      public Appliance getAppliance( StageDescriptor stage, ApplianceSelector selector )
      {
          Appliance[] appliances = getAppliances( stage );
          return selector.select( appliances, stage );
      }
  
      //==================================================================
      // implemetation
      //==================================================================
  
      /**
       * Add a appliance to the manager.
       * @param appliance the appliance to add to the manager
       * @exception DuplicateApplianceException if an appliance has already been registered
       *   for the undrlying profile
       */
      public void addAppliance( Appliance appliance ) throws DuplicateApplianceException
      {
          if( appliance == null )
          {
              throw new NullPointerException( "appliance" );
          }
  
          final String key = appliance.getProfile().getName();
  
          if( m_appliances.get( key ) != null )
          {
              throw new DuplicateApplianceException( key );
          }
  
          m_appliances.put( key, appliance );
      }
  
  
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/appliance/DuplicateApplianceException.java
  
  Index: DuplicateApplianceException.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.appliance;
  
  /**
   * Exception raised in response to an attempt to override the defintion
   * of an existing appliance.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:44 $
   */
  public final class DuplicateApplianceException
      extends ApplianceException
  {
  
      /**
       * Construct a new <code>DuplicateApplianceException</code> instance.
       *
       * @param message The detail message for this exception.
       */
      public DuplicateApplianceException( final String message )
      {
          this( message, null );
      }
  
      /**
       * Construct a new <code>DuplicateApplianceException</code> instance.
       *
       * @param message The detail message for this exception.
       * @param throwable the root cause of the exception
       */
      public DuplicateApplianceException( final String message, final Throwable throwable )
      {
          super( message, throwable );
      }
  }
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/appliance/package.html
  
  Index: package.html
  ===================================================================
  
  <body>
  <p>
  The <code>appliace</code> package contains classes and interfaces for the {@link org.apache.avalon.assembly.appliance.Appliance} and related default implementations supporting the management of the lifecycle and lifestyle of a profiled service provider.
  </p>
  </body>
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/logger/DefaultLoggerManager.java
  
  Index: DefaultLoggerManager.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.logger;
  
  import java.io.File;
  import java.io.IOException;
  import java.util.HashMap;
  
  import org.apache.log.Hierarchy;
  import org.apache.log.LogTarget;
  import org.apache.log.Logger;
  import org.apache.log.Priority;
  import org.apache.log.output.io.FileTarget;
  import org.apache.log.output.io.StreamTarget;
  
  import org.apache.avalon.framework.logger.AvalonFormatter;
  import org.apache.avalon.framework.logger.LogKitLogger;
  import org.apache.avalon.excalibur.i18n.ResourceManager;
  import org.apache.avalon.excalibur.i18n.Resources;
  import org.apache.avalon.excalibur.logger.LoggerManager;
  import org.apache.avalon.meta.model.LoggingDirective;
  import org.apache.avalon.meta.model.Category;
  
  /**
   * A <code>LoggerManager</code> that supports management of a logging hierarchy.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   */
  public class DefaultLoggerManager
      implements LoggerManager
  {
  
      /**
       * The default logging priority value.
       */
      public static final String DEFAULT_PRIORITY = "INFO";
  
      /**
       * The default logging target name.
       */
      public static final String DEFAULT_TARGET = "default";
  
      private static final Resources REZ =
          ResourceManager.getPackageResources( DefaultLoggerManager.class );
  
      private static final String DEFAULT_FORMAT =
          "[%7.7{priority}] (%{category}): %{message}\\n%{throwable}";
  
      /**
       * Base directory of file targets.
       */
      private File m_baseDirectory;
  
      /**
       * log hierarchy.
       */
      private Hierarchy m_logHierarchy;
  
      /**
       * default logger
       */
      private org.apache.avalon.framework.logger.Logger m_logger;
  
      /**
       * default logger target
       */
      private StreamTarget m_stream;
  
      private final HashMap m_targets = new HashMap();
  
      private DefaultLoggerManager m_parent;
  
      private String m_category;
  
      //===============================================================
      // constructor
      //===============================================================
  
      /**
       * Creation of a new LoggerManager.
       * @param base the base directory
       * @exception Exception is an error occurs
       */
      public DefaultLoggerManager( File base ) throws Exception
      {
          this(
              new LoggingDescriptor(
                  "", null, null, new TargetDescriptor[ 0 ],
                  new Category( "logging", "WARN", null ) ), base );
      }
  
      /**
       * Creation of a new LoggerManager.
       * @param descriptor the logging system description
       * @param base the base directory
       * @exception Exception is an error occurs
       */
      public DefaultLoggerManager( final LoggingDescriptor descriptor, File base ) throws Exception
      {
  
          //
          // setup the hierarchy, default logging target, and default priority
          //
  
          m_stream = new StreamTarget( System.out, new AvalonFormatter( DEFAULT_FORMAT ) );
          m_baseDirectory = base;
          m_logHierarchy = new Hierarchy();
          getHierarchy().setDefaultLogTarget( m_stream );
          m_targets.put( DEFAULT_TARGET, m_stream );
          if( descriptor.getPriority() != null )
          {
              getHierarchy().setDefaultPriority(
                  Priority.getPriorityForName( descriptor.getPriority() )
              );
          }
          else
          {
              getHierarchy().setDefaultPriority(
                  Priority.getPriorityForName( DEFAULT_PRIORITY )
              );
          }
  
          //
          // setup the bootstrap logging category
          //
  
          Category bootstrap = descriptor.getBootstrapCategory();
          m_logger = new LogKitLogger(
              addCategory(
                  bootstrap.getName(), bootstrap.getPriority(), bootstrap.getTarget(), false ) );
  
          //
          // build targets based on the information contained in the descriptor
          //
  
          TargetDescriptor[] targets = descriptor.getTargetDescriptors();
          for( int i = 0; i < targets.length; i++ )
          {
              addTarget( targets[ i ] );
          }
  
          //
          // set the default target
          //
  
          String name = descriptor.getTarget();
          if( name != null )
          {
              LogTarget target = (LogTarget)m_targets.get( name );
              if( target != null )
              {
                  getHierarchy().setDefaultLogTarget( target );
              }
              else
              {
                  throw new LoggerException(
                      "Supplied default logging target: '" + name + "' does not exist." );
              }
          }
      }
  
      /**
       * Add a set of category entries using the supplied categories descriptor.
       * @param descriptor a set of category descriptors to be added under the path
       */
      public void addCategories( LoggingDirective descriptor )
      {
          addCategories( "", descriptor );
      }
  
      /**
       * Add a set of category entries relative to the supplied base category
       * path, using the supplied descriptor as the definition of subcategories.
       * @param path the category base path
       * @param descriptor a set of category descriptors to be added under
       *   the base path
       */
      public void addCategories( String path, LoggingDirective descriptor )
      {
          addCategory( path, descriptor.getPriority(), descriptor.getTarget() );
          Category[] categories = descriptor.getCategories();
          for( int i = 0; i < categories.length; i++ )
          {
              Category category = categories[ i ];
              final String priority = category.getPriority();
              final String target = category.getTarget();
              if( path.equals( "" ) )
              {
                  addCategory( category.getName(), priority, target );
              }
              else
              {
                  addCategory( path + "." + category.getName(), priority, target );
              }
          }
      }
  
      /**
       * Create a logging channel configured with the supplied category path,
       * priority and target.
       *
       * @param name logging category path
       * @param target the logging target to assign the channel to
       * @param priority the priority level to assign to the channel
       * @return the logging channel
       * @throws Exception if an error occurs
       */
      public org.apache.avalon.framework.logger.Logger getLoggerForCategory(
          final String name, String target, String priority )
          throws Exception
      {
          return new LogKitLogger( addCategory( name, target, priority ) );
      }
  
      /**
       * Configure Logging channel based on the description supplied in a
       * category descriptor.
       *
       * @param category defintion of the channel category, priority and target
       * @return the logging channel
       * @throws Exception if an error occurs
       */
      public org.apache.avalon.framework.logger.Logger getLoggerForCategory( final Category category )
          throws Exception
      {
          return new LogKitLogger(
              addCategory(
                  category.getName(),
                  category.getPriority(),
                  category.getTarget()
              )
          );
      }
  
      //===============================================================
      // LoggerManager
      //===============================================================
  
      /**
       * Return the Logger for the specified category.
       * @param category the category path
       * @return the logging channel
       */
      public org.apache.avalon.framework.logger.Logger getLoggerForCategory( final String category )
      {
          if( category == null )
          {
              return new LogKitLogger( getHierarchy().getLoggerFor( "" ) );
          }
          else
          {
              String cat;
              if( category.indexOf( "/" ) > -1 )
              {
                  cat = category.replace( '/', '.' );
                  if( cat.startsWith( "." ) )
                  {
                      cat = cat.substring( 1 );
                  }
              }
              else
              {
                  cat = category;
              }
              return new LogKitLogger( getHierarchy().getLoggerFor( cat ) );
          }
      }
  
      /**
       * Return the default Logger.  This is the same
       * as getting the Logger for the "" category.
       * @return the default logging channel
       */
      public org.apache.avalon.framework.logger.Logger getDefaultLogger()
      {
          if( m_logger == null )
          {
              m_logger = getLoggerForCategory( "" );
          }
          return m_logger;
      }
  
      /**
       * Add a single category entries relative to the supplied base category
       * path, using the supplied category.
       * @param path the category base path
       * @param category a category descriptors to be added under the base path
       */
      private Logger addCategory( String path, Category category )
      {
          return addCategory(
              path, category.getPriority(), category.getTarget(), true );
      }
  
      private Logger addCategory( String path, String priority, String target )
      {
          return addCategory( path, priority, target, true );
      }
  
      private Logger addCategory( String path, String priority, String target, boolean notify )
      {
          final Logger logger = getHierarchy().getLoggerFor( path );
          if( priority != null )
          {
              final Priority priorityValue = Priority.getPriorityForName( priority );
              if( !priorityValue.getName().equals( priority ) )
              {
                  final String message = REZ.getString( "unknown-priority", priority, path );
                  throw new IllegalArgumentException( message );
              }
              logger.setPriority( priorityValue );
          }
  
          if( target != null )
          {
              if( !target.equals("default") )
              {
                  final LogTarget logTarget = (LogTarget)m_targets.get( target );
                  if( logTarget != null )
                  {
                      logger.setLogTargets( new LogTarget[]{logTarget} );
                  }
              }
          }
  
          if( notify && getLogger().isInfoEnabled() )
          {
              final String message =
                  REZ.getString( "category-create", path, target, logger.getPriority() );
              getLogger().info( message );
          }
  
          return logger;
      }
  
      private void addTarget( TargetDescriptor target ) throws Exception
      {
          final String name = target.getName();
          TargetProvider provider = target.getProvider();
          if( provider instanceof FileTargetProvider )
          {
              FileTargetProvider fileProvider = (FileTargetProvider)provider;
              String filename = fileProvider.getLocation();
              final AvalonFormatter formatter = new AvalonFormatter( DEFAULT_FORMAT );
              File file = new File( m_baseDirectory, filename );
              try
              {
                  FileTarget logTarget = new FileTarget( file.getAbsoluteFile(), false, formatter );
                  m_targets.put( name, logTarget );
              }
              catch( final IOException ioe )
              {
                  final String message =
                      REZ.getString( "target.nocreate", name, file, ioe.getMessage() );
                  throw new LoggerException( message, ioe );
              }
          }
          else
          {
              final String error =
                  "Unrecognized logging provider: " + provider.getClass().getName();
              throw new IllegalArgumentException( error );
          }
      }
  
      /**
       * Return the internal Logger.
       */
      private org.apache.avalon.framework.logger.Logger getLogger()
      {
          return m_logger;
      }
  
      private Hierarchy getHierarchy()
      {
          if( m_parent != null )
          {
              return m_parent.getHierarchy();
          }
          return m_logHierarchy;
      }
  
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/logger/FileTargetProvider.java
  
  Index: FileTargetProvider.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.logger;
  
  /**
   * File target provider descriptor declares the criteria for the creation of
   * an file based logging target provider.
   *
   * <p><b>XML</b></p>
   * <p>A file target element may be contained within a target element to declare
   * the target as a file based logging sink.</p>
   * <pre>
   *    <font color="gray">&lt;target name="kernel"&gt;</font>
   *       &lt;file location="<font color="darkred">kernel.log</font>" /&gt;
   *    <font color="gray">&lt;/target&gt;</font>
   * </pre>
   *
   * @see TargetDescriptor
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:45 $
   */
  public class FileTargetProvider extends TargetProvider
  {
      private final String m_location;
  
      /**
       * Creation of a new file target.
       * @param location the filename of the logging destination
       */
      public FileTargetProvider( final String location )
      {
          m_location = location;
      }
  
      /**
       * Return the filename of the logging target.
       * @return the filename
       */
      public String getLocation()
      {
          return m_location;
      }
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/logger/LoggerException.java
  
  Index: LoggerException.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.logger;
  
  import org.apache.avalon.framework.CascadingException;
  
  /**
   * Exception to indicate that there was a profile related error.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:45 $
   */
  public class LoggerException
      extends CascadingException
  {
  
      /**
       * Construct a new <code>LoggerException</code> instance.
       *
       * @param message The detail message for this exception.
       */
      public LoggerException( final String message )
      {
          this( message, null );
      }
  
      /**
       * Construct a new <code>LoggerException</code> instance.
       *
       * @param message The detail message for this exception.
       * @param throwable the root cause of the exception
       */
      public LoggerException( final String message, final Throwable throwable )
      {
          super( message, throwable );
      }
  }
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/logger/LoggingDescriptor.java
  
  Index: LoggingDescriptor.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.logger;
  
  import org.apache.avalon.meta.model.Category;
  
  
  /**
   * Description of a top level logging environment.
   *
   * <p><b>XML</b></p>
   * <p>A logging element declares the top level defaults for priority and target name, a set of
   * targets to which logging events shall be directed.
   * The logging element declares the application wide default logging priority.
   * A target element enables defintion of a logging file to which log entries will
   * be directed.  The target name attribute is the name referenced by category elements
   * defined within the loggers element. The priority attribute may container one of the values
   * <code>DEBUG</code>, <code>INFO</code>, <code>WARN</code> or <code>ERROR</code>.
   * The target must contain a single file element with the attribute <code>location</code>
   * the corresponds to the name of the logging file.</p>
   *
   * <pre>
   *    <font color="gray"><i>&lt;!--
   *    Definition of a logging system.
   *    --&gt;</i></font>
   *
   *    &lt;logging name="" priority="<font color="darkred">INFO</font>" target="<font color="darkred">kernel</font>"&gt;
   *      &lt;category name="logging" priority="<font color="darkred">WARN</font>"/&gt;
   *      &lt;target name="<font color="darkred">kernel</font>"&gt;
   *        &lt;file location="<font color="darkred">kernel.log</font>" /&gt;
   *      &lt;/target&gt;
   *    &lt;/logging&gt;
   * </pre>
   *
   * @see TargetDescriptor
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:45 $
   */
  public final class LoggingDescriptor extends Category
  {
  
      /**
       * The dependencies keyed by role name.
       */
      private final TargetDescriptor[] m_targets;
  
      /**
       * The bootstrap logging category.
       */
      private final Category m_bootstrap;
  
      /**
       * Create a LoggingDescriptor instance.
       */
      public LoggingDescriptor()
      {
          this( "", null, null, new TargetDescriptor[ 0 ], new Category( "logging" ) );
      }
  
      /**
       * Create a LoggingDescriptor instance.
       *
       * @param root the root logger category name
       * @param priority the default logging priority
       * @param target the default logging target
       * @param targets the set of logging targets
       * @param bootstrap the bootstrap category to use to log mesages
       *    from the logging system
       */
      public LoggingDescriptor( final String root,
                                final String priority,
                                final String target,
                                final TargetDescriptor[] targets,
                                final Category bootstrap )
      {
          super( root, priority, target );
          m_targets = targets;
          m_bootstrap = bootstrap;
      }
  
      /**
       * Return the set of logging target descriptors.
       *
       * @return the target descriptors
       */
      public TargetDescriptor[] getTargetDescriptors()
      {
          return m_targets;
      }
  
      /**
       * Return the bootstrap logging category to which the logging manager will
       * log information about its own activities.
       *
       * @return the category
       */
      public Category getBootstrapCategory()
      {
          return m_bootstrap;
      }
  
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/logger/TargetDescriptor.java
  
  Index: TargetDescriptor.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.logger;
  
  import java.io.Serializable;
  
  /**
   * A logging target descriptor.
   *
   * <p><b>XML</b></p>
   * A logging target declares target name and a mechanism.</p>
   *
   * <pre>
   *     &lt;target name="<font color="darkred">kernel</font>"&gt;
   *       &lt;file location="<font color="darkred">kernel.log</font>" /&gt;
   *     &lt;/target&gt;
   * </pre>
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:45 $
   */
  public final class TargetDescriptor implements Serializable
  {
      /**
       * The target name.
       */
      private final String m_name;
  
      /**
       * The target provider descriptor.
       */
      private final TargetProvider m_provider;
  
      /**
       * Create a LoggingDescriptor instance.
       *
       * @param name the target name
       * @param provider the target provider description
       */
      public TargetDescriptor( final String name,
                               final TargetProvider provider )
      {
          m_name = name;
          m_provider = provider;
      }
  
      /**
       * Return the target name.
       *
       * @return the target name.
       */
      public String getName()
      {
          return m_name;
      }
  
      /**
       * Return the target provider descriptor
       *
       * @return the provider descriptor
       */
      public TargetProvider getProvider()
      {
          return m_provider;
      }
  
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/logger/TargetProvider.java
  
  Index: TargetProvider.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.logger;
  
  import java.io.Serializable;
  
  /**
   * Abstract logging target provider type.  This is an emty abstract class from
   * all logging providers must inherit.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:45 $
   */
  public abstract class TargetProvider implements Serializable
  {
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/logger/package.html
  
  Index: package.html
  ===================================================================
  
  <body>
  <p>
  The <code>logger</code> package contains the {@link org.apache.avalon.assembly.logger.DefaultLoggerManager} which is an initial bootstrap logging mananager that uses mata inforatrion about logging targets and catagories.  Rhis class is subject to refactoring to bring in into a component model to enable easy specialization and/or replacement.
  </p>
  </body>
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/profile/DefaultProfileManager.java
  
  Index: DefaultProfileManager.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.profile;
  
  import java.util.Hashtable;
  import java.util.ArrayList;
  import java.util.Enumeration;
  
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.context.ContextException;
  import org.apache.avalon.framework.context.Contextualizable;
  import org.apache.avalon.framework.activity.Initializable;
  import org.apache.avalon.assembly.type.TypeManager;
  import org.apache.avalon.assembly.type.UnknownTypeException;
  import org.apache.excalibur.configuration.ConfigurationUtil;
  import org.apache.avalon.meta.model.Profile;
  import org.apache.avalon.meta.model.builder.ProfileBuilder;
  import org.apache.avalon.meta.model.verifier.ProfileVerifier;
  import org.apache.avalon.meta.info.ReferenceDescriptor;
  import org.apache.avalon.meta.info.DependencyDescriptor;
  import org.apache.avalon.meta.info.StageDescriptor;
  import org.apache.avalon.meta.info.Type;
  
  /**
   * A profile manager implemetation provides support for the creation, 
   * storage and retrival of component types.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:45 $
   */
  public class DefaultProfileManager extends AbstractLogEnabled implements ProfileManager, Contextualizable, Initializable
  {
      //==============================================================
      // static
      //==============================================================
  
     /**
      * The profile builder.
      */
      private static final ProfileBuilder PROFILE_BUILDER = new ProfileBuilder();
  
      //==============================================================
      // state
      //==============================================================
  
     /**
      * Flag indicating if contextualization has been performed.
      */
      private boolean m_contextualized = false;
    
     /**
      * Flag indicating if initalization has been performed.
      */
      private boolean m_initialized = false;
    
     /**
      * The classloader supplied to the manager.
      */
      private ClassLoader m_classloader;
  
     /**
      * The parent profile manager (may be null)
      */
      private ProfileManager m_parent;
  
     /**
      * The type manager (supplied via context).
      */
      private TypeManager m_types;
  
      /**
       * Table of component profiles keyed by profile name.
       */
      private final Hashtable m_profiles = new Hashtable();
  
      //==============================================================
      // Contextualizable
      //==============================================================
  
     /**
      * <p>Application of a runtime context to this component.
      * Context entries that may be supplied to a type manager are detailed in the
      * following table.</p>
      * <table>
      *   <tr>
      *     <td>key</td><td>type</td><td>default</td>
      *   </tr>
      *   <tr>
      *     <td>avalon:type.classloader</td>
      *     <td>java.lang.ClassLoader</td>
      *     <td>The context classloader will be used by default if not value is supplied.</td> 
      *   </tr>
      *   <tr>
      *     <td>assembly:parent</td>
      *     <td>{@link org.apache.avalon.assembly.type.TypeManager}</td>
      *     <td>In no value suppled, this type manager will be considered as a root manager.</td> 
      *   </tr>
      * </table>
      * @param context the runtime context
      */
      public void contextualize( Context context ) 
      {
          try
          {
              m_parent = (ProfileManager) context.get( "assembly:parent" );
          }
          catch( ContextException e )
          {
              m_parent = null;
          }
  
          try
          {
              m_classloader = (ClassLoader) context.get( "assembly:classloader" );
          }
          catch( ContextException e )
          {
              m_classloader = Thread.currentThread().getContextClassLoader();
          }
  
          m_contextualized = true;
      }
  
      //==============================================================
      // Initializable
      //==============================================================
  
     /**
      * Initialization fo the component by the container.  The implementation
      * validates a logger has been assigned and that the context phase has 
      * been executed, following which it flags initialization as complete and 
      * marks the component as ready to serve requests.
      *
      * @exception Exception if the manager has not been suppied with a context
      */
      public void initialize() throws Exception
      {
          if( !m_contextualized )
          {
              throw new IllegalStateException("contextualize");
          }
          if( getLogger() == null )
          {
              throw new IllegalStateException("logger");
          }
  
          m_initialized = true;
      }
  
      //==============================================================
      // ProfileManager
      //==============================================================
  
      /**
       * Load a set of packaged profiles associated with the supplied class.
       * Profiles returned from this operation are not included within the 
       * manager.  To register a profile with the manager use the {@link #addProfile}
       * operation.
       *
       * @param type the component type used to locate an packaged profiles
       * @return the set of packaged component profiles
       * @exception ProfileException if an error occurs while loading package profiles
       */
      public Profile[] loadProfiles( Type type ) throws ProfileException
      {
          if( type == null )
          {
              throw new NullPointerException("type");
          }
          
          try
          {
              return PROFILE_BUILDER.build( m_classloader, type );
          }
          catch( Throwable e )
          {
              final String error = 
                "Build error while attempting to create packaged profiles for type: " 
                + type.getInfo().getClassname();
              throw new ProfileException( error, e );
          }
      }
  
      /**
       * Create a profile from a supplied configuration.
       *
       * @param type the component type that the profile qualifies
       * @param config a configuration fragment describing the deployment profile
       * @return the deployment profile
       * @exception ProfileException if an error occurs while attempting to create a profiles
       */
      public Profile createProfile( Type type, Configuration config ) 
        throws ProfileException
      {
          try
          {
              return PROFILE_BUILDER.build( type, config );
          }
          catch( Throwable e )
          {
              final String error = 
                "Profile build error while constructing a profile from supplied configuration:\n"
                + ConfigurationUtil.list( config );
              throw new ProfileException( error, e );
          }
      }
  
     /**
      * Add a profile to the manager.
      * @param profile the depployment profile to add to the manager
      * @exception DuplicateProfileException if a profile of the same name 
      *   is already registered with the manager 
      * @exception ProfileException if a profile verification failure occurs
      * @see #createProfile
      */
      public void addProfile( Profile profile ) throws DuplicateProfileException, ProfileException
      {
          if( profile == null )
          {
              throw new NullPointerException("profile");
          }
  
          if( !m_initialized )
          {
              throw new IllegalStateException("initialization");
          }
  
          try
          {
              getNamedProfile( profile.getName() );
              throw new DuplicateProfileException( 
                profile.getType().getInfo().getClassname()
                + "/" + profile.getName()  );
          }
          catch( UnknownProfileException upe )
          {
              try
              {
                  verify( profile );
              }
              catch( Throwable e )
              {
                  final String error = 
                    "Could not register the profile: " + profile
                    + " due to a verification failure.";
                  throw new ProfileException( error, e );
              }
  
              if( getLogger().isDebugEnabled() )
              {
                  getLogger().debug(
                    "registering profile: " + profile.getName() 
                    + " for the type: " + profile.getType().getInfo().getClassname() );
              }
  
              m_profiles.put( profile.getName(), profile );
          }
      }
  
      /**
       * Returns a profile held locally by the manager based on the profile name.
       * @param name the profile name
       * @return the profile matching the supplied name
       * @exception UnknownProfileException if the profile name is unknown within
       *   the scope of the manager
       */
      public Profile getNamedProfile( String name ) throws UnknownProfileException
      {
          Profile profile = (Profile) m_profiles.get( name );
          if( profile == null )
          {
              throw new UnknownProfileException( name );
          }
          return profile;
      }
      
      /**
       * Get the set of profiles declared for a particular type.
       * @param type the component type
       * @return the set of profile matching the type.
       * @exception UnknownTypeException if the type is unknown to the manager
       */
      public Profile[] getProfiles( Type type ) throws UnknownTypeException
      {
          ArrayList list = new ArrayList();
          if( m_parent != null )
          {
              Profile[] profiles = m_parent.getProfiles( type );
              for( int i=0; i<profiles.length; i++ )
              {
                   list.add( profiles[i] );
              }
          }
          
          Enumeration enum = m_profiles.elements();
          while( enum.hasMoreElements() )
          {
              Profile profile = (Profile) enum.nextElement();
              if( profile.getType().equals( type ) )
              {
                  list.add( type );
              }
          }
  
          return (Profile[]) list.toArray( new Profile[0] );
      }
  
     /**
      * Locate the set of component profiles capable of services the supplied 
      * dependency.
      * @param dependency a service dependency descriptor
      * @return a set of profiles capable of servicing the supplied dependency
      */
      public Profile[] getProfiles( DependencyDescriptor dependency )
      {
          ArrayList list = new ArrayList();
          if( m_parent != null )
          {
              Profile[] profiles = m_parent.getProfiles( dependency );
              for( int i=0; i<profiles.length; i++ )
              {
                  list.add( profiles[i] );
              }
          }
  
          ReferenceDescriptor reference = dependency.getReference();
          Enumeration enum = m_profiles.elements();
          while( enum.hasMoreElements() )
          {
              Profile profile = (Profile) enum.nextElement();
              Object service = profile.getType().getService( reference );
              if( service != null )
              {
                  list.add( profile );
              }
          }
  
          return (Profile[]) list.toArray( new Profile[0] );
      }
  
     /**
      * Locate the set of component profiles that provide the supplied extension.
      * @param stage a stage descriptor
      * @return a set of types that provide the supplied service
      */
      public Profile[] getProfiles( StageDescriptor stage )
      {
          ArrayList list = new ArrayList();
          if( m_parent != null )
          {
              Profile[] profiles = m_parent.getProfiles( stage );
              for( int i=0; i<profiles.length; i++ )
              {
                  list.add( profiles[i] );
              }
          }
  
          Enumeration enum = m_profiles.elements();
          while( enum.hasMoreElements() )
          {
              Profile profile = (Profile) enum.nextElement();
              if( profile.getType().getExtension( stage ) != null )
              {
                  list.add( profile );
              }
          }
  
          return (Profile[]) list.toArray( new Profile[0] );
      }
  
     /**
      * Locate the set of profiles tied to a type capable of supporting a service 
      * referenced by a supplied dependency descriptor using a supplied selector.
      * @param dependency a service depedency descriptor
      * @param selector a profile selector
      * @return a set of profiles capable of servicing the supplied dependency
      */
      public Profile getProfile( DependencyDescriptor dependency, ProfileSelector selector )
      {
          Profile[] profiles = getProfiles( dependency );
          return selector.select( profiles, dependency );
      }
  
     /**
      * Locate a profile tied to a type capable of supporting an extension 
      * referenced by a supplied stage descriptor usign the a suplied selector.
      * @param stage a stage descriptor
      * @param selector a profile selector
      * @return a set of types that provide the supplied service
      */
      public Profile getProfile( StageDescriptor stage, ProfileSelector selector )
      {
          Profile[] profiles = getProfiles( stage );
          return selector.select( profiles, stage );
      }
  
     /**
      * Verify the supplied profile.
      * @param profile the profile to verify
      * @exception ProfileException if the verification failes
      */
      private void verify( Profile profile ) throws ProfileException
      {
          ProfileVerifier verifier = new ProfileVerifier();
          try
          {
              verifier.verifyType( profile, m_classloader );
          }
          catch( Throwable e )
          {
              final String error = "Verification failure for profile: " 
                + profile.getName() + " from type: "
                + profile.getType().getInfo().getClassname();
              throw new ProfileException( error, e );
          }
      }
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/profile/DuplicateProfileException.java
  
  Index: DuplicateProfileException.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.profile;
  
  /**
   * Exception raised in response to an attempt to override the defintion
   * of an existing profile.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:45 $
   */
  public final class DuplicateProfileException
      extends ProfileException
  {
  
      /**
       * Construct a new <code>DuplicateProfileException</code> instance.
       *
       * @param message The detail message for this exception.
       */
      public DuplicateProfileException( final String message )
      {
          this( message, null );
      }
  
      /**
       * Construct a new <code>DuplicateProfileException</code> instance.
       *
       * @param message The detail message for this exception.
       * @param throwable the root cause of the exception
       */
      public DuplicateProfileException( final String message, final Throwable throwable )
      {
          super( message, throwable );
      }
  }
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/profile/ProfileException.java
  
  Index: ProfileException.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.profile;
  
  import org.apache.avalon.framework.CascadingException;
  
  /**
   * Exception to indicate that there was a profile related error.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:45 $
   */
  public class ProfileException
      extends CascadingException
  {
  
      /**
       * Construct a new <code>ProfileException</code> instance.
       *
       * @param message The detail message for this exception.
       */
      public ProfileException( final String message )
      {
          this( message, null );
      }
  
      /**
       * Construct a new <code>ProfileException</code> instance.
       *
       * @param message The detail message for this exception.
       * @param throwable the root cause of the exception
       */
      public ProfileException( final String message, final Throwable throwable )
      {
          super( message, throwable );
      }
  }
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/profile/ProfileManager.java
  
  Index: ProfileManager.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.profile;
  
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.assembly.type.UnknownTypeException;
  import org.apache.avalon.meta.model.Profile;
  import org.apache.avalon.meta.info.Type;
  import org.apache.avalon.meta.info.DependencyDescriptor;
  import org.apache.avalon.meta.info.StageDescriptor;
  
  /**
   * A profile manager implemetation provides support for the creation, 
   * storage and retrival of component profiles.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:45 $
   */
  public interface ProfileManager 
  {
      /**
       * Load a set of packaged profiles associated with the supplied class.
       *
       * @param type the component type used to locate an packaged profiles
       * @return the set of packaged component profiles
       * @exception ProfileException if a error occurs while attempt to
       *   load packaged profiles 
       */
      Profile[] loadProfiles( Type type ) throws ProfileException;
  
      /**
       * Create a profile from a supplied configuration.
       *
       * @param type the component type that the profile qualifies
       * @param config a configuration fragment describing the deployment profile
       * @return the deployment profile
       * @exception ProfileException if a profile creation error occurs
       */
      Profile createProfile( Type type, Configuration config ) 
        throws ProfileException;
  
     /**
      * Add a profile to the manager.
      * @param profile the depployment profile to add to the manager
      * @exception DuplicateProfileException if the supplied type is already registered
      * @exception ProfileException if a profile verification failure occurs
      * @see #createProfile
      */
      void addProfile( Profile profile ) 
        throws DuplicateProfileException, ProfileException;
  
      /**
       * Returns a profile held locally by the manager based on the profile name.
       * @param name the profile name
       * @return the profile matching the name
       * @exception UnknownProfileException if the profile name is unknown within
       *   the scope of the manager
       */
      Profile getNamedProfile( String name ) 
        throws UnknownProfileException;
  
      /**
       * Locate the set of {@link Profile} instances associated with the 
       * supplied component type.
       *
       * @param type the component type
       * @return the profiles for the supplied classname.
       * @exception UnknownTypeException if a matching type cannot be found
       */
      Profile[] getProfiles( Type type ) 
        throws UnknownTypeException;
  
     /**
      * Locate the set of component profiles capable of services the supplied 
      * dependency.
      *
      * @param dependency a service dependency descriptor
      * @return a set of profiles capable of servicing the supplied dependency
      */
      Profile[] getProfiles( DependencyDescriptor dependency );
  
     /**
      * Locate the set of component profiles that provide the supplied extension.
      *
      * @param stage a stage descriptor
      * @return a set of types that provide the supplied service
      */
      Profile[] getProfiles( StageDescriptor stage );
  
     /**
      * Locate the set of profiles tied to a type capable of supporting a service 
      * referenced by a supplied dependency descriptor using a supplied selector.
      *
      * @param dependency a service depedency descriptor
      * @param selector the profile selector
      * @return a set of types capable of servicing the supplied dependency
      */
      Profile getProfile( DependencyDescriptor dependency, ProfileSelector selector );
  
     /**
      * Locate a profile tied to a type capable of supporting an extension 
      * referenced by a supplied stage descriptor usign the a suplied selector.
      *
      * @param stage a stage descriptor
      * @param selector the profile selector
      * @return a set of types that provide the supplied service
      */
      Profile getProfile( StageDescriptor stage, ProfileSelector selector );
  
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/profile/ProfileSelector.java
  
  Index: ProfileSelector.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.profile;
  
  import org.apache.avalon.meta.model.Profile;
  import org.apache.avalon.meta.info.StageDescriptor;
  import org.apache.avalon.meta.info.DependencyDescriptor;
  
  /**
   * Interface implemented by a service selection implementation mechanism.  Classes
   * implementing the selector interface may be activated during the selection of
   * candidate service providers in an autom assembly process.  A selector my be
   * declared via inclusion a implemetation class nameed <code>&lt;service-type&gt;Selector</code>.
   * Alternatively, a component author may declare a selection class explicitly via a
   * service dependency attribute with the attribute name of <code>avalon:service.selector</code>.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:45 $
   */
  public interface ProfileSelector
  {
  
      /**
       * Returns the preferred profile form an available selection of 
       * candidate profiles.
       * @param profiles the set of candidate profiles
       * @param dependency the service dependency
       * @return the preferred profile or null if no satisfactory provider can be established
       */
      Profile select( Profile[] profiles, DependencyDescriptor dependency );
  
      /**
       * Returns the preferred profile form an available selection of candidates
       * @param profiles the set of profiles of potential extension providers
       * @param stage the stage dependency
       * @return the preferred provider or null if no satisfactory provider can be established
       */
      Profile select( Profile[] profiles, StageDescriptor stage );
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/profile/UnknownProfileException.java
  
  Index: UnknownProfileException.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.profile;
  
  import org.apache.avalon.framework.CascadingException;
  
  /**
   * Exception to indicate that a profile is unknown.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:45 $
   */
  public final class UnknownProfileException
      extends CascadingException
  {
  
      /**
       * Construct a new <code>ApplianceException</code> instance.
       *
       * @param message The detail message for this exception.
       */
      public UnknownProfileException( final String message )
      {
          this( message, null );
      }
  
      /**
       * Construct a new <code>ApplianceException</code> instance.
       *
       * @param message The detail message for this exception.
       * @param throwable the root cause of the exception
       */
      public UnknownProfileException( final String message, final Throwable throwable )
      {
          super( message, throwable );
      }
  }
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/profile/package.html
  
  Index: package.html
  ===================================================================
  
  <body>
  <p>
  The <code>profile</code> package contains classes and interfaces for the {@link org.apache.avalon.assembly.profile.ProfileManager} and related default implementations supporting the management of a repository of profiles.
  </p>
  </body>
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/service/DefaultServiceManager.java
  
  Index: DefaultServiceManager.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.service;
  
  import java.util.Map;
  import java.util.Hashtable;
  
  import org.apache.avalon.framework.Version;
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.context.ContextException;
  import org.apache.avalon.framework.context.Contextualizable;
  import org.apache.avalon.framework.activity.Initializable;
  import org.apache.avalon.meta.info.Service;
  import org.apache.avalon.meta.info.builder.ServiceBuilder;
  
  /**
   * A service manager implemetation provides support for the creation, 
   * storage and retrival of service defintions.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:45 $
   */
  public class DefaultServiceManager extends AbstractLogEnabled implements ServiceManager, Contextualizable, Initializable
  {
      //==============================================================
      // state
      //==============================================================
  
     /**
      * Flag indicating if contextualization has been performed.
      */
      private boolean m_contextualized = false;
    
     /**
      * Flag indicating if initalization has been performed.
      */
      private boolean m_initialized = false;
  
     /**
      * The classloader supplied to the manager.
      */
      private ClassLoader m_classloader;
  
     /**
      * The parent service manager (may be null)
      */
      private ServiceManager m_parent;
  
     /**
      * The service builder.
      */
      private static final ServiceBuilder DEFAULT_BUILDER = new ServiceBuilder();
  
      /**
       * Table of component types keyed by implementation classname.
       */
      private Hashtable m_services = new Hashtable();
  
      //==============================================================
      // Contextualizable
      //==============================================================
  
     /**
      * <p>Application of a runtime context to this component.
      * Context entries that may be supplied to a type manager are detailed in the
      * following table.</p>
      * <table>
      *   <tr>
      *     <td>key</td><td>type</td><td>default</td>
      *   </tr>
      *   <tr>
      *     <td>avalon:type.classloader</td>
      *     <td>java.lang.ClassLoader</td>
      *     <td>The context classloader will be used by default if not value is supplied.</td> 
      *   </tr>
      *   <tr>
      *     <td>assembly:parent</td>
      *     <td>org.apache.avalon.assembly.service.ServiceManager</td>
      *     <td>In no value suppled, this service manager will be considered as a root manager.</td> 
      *   </tr>
      * </table>
      * @param context the runtime context
      */
      public void contextualize( Context context )
      {
          if( context == null )
          {
              throw new NullPointerException("context");
          }
  
          try
          {
              m_parent = (ServiceManager) context.get( "assembly:parent" );
          }
          catch( ContextException e )
          {
              m_parent = null;
          }
  
          try
          {
              m_classloader = (ClassLoader) context.get( "assembly:classloader" );
          }
          catch( ContextException e )
          {
              m_classloader = Thread.currentThread().getContextClassLoader();
          }
  
          m_contextualized = true;
      }
  
      //==============================================================
      // Initializable
      //==============================================================
  
     /**
      * Initialization fo the component by the container.  The implementation
      * validates a logger has been assigned and that the context phase has 
      * been executed, following which it flags initialization as complete and 
      * marks the component as ready to serve requests.
      *
      * @exception Exception if the manager has not been suppied with a context
      */
      public void initialize() throws Exception
      {
          if( !m_contextualized )
          {
              throw new IllegalStateException("contextualize");
          }
          if( getLogger() == null )
          {
              throw new IllegalStateException("logger");
          }
  
          m_initialized = true;
      }
  
      //==============================================================
      // ServiceManager
      //==============================================================
  
      /**
       * Create a services associated from a supplied path. 
       *
       * @param clazz the service class
       * @return the service defintions
       * @exception ServiceException if an error occurs during service creation
       */
      public Service createService( Class clazz ) throws ServiceException
      {
          if( clazz == null )
          {
              throw new NullPointerException("clazz");
          }
  
          try
          {
              return DEFAULT_BUILDER.build( clazz.getName(), clazz.getClassLoader() );
          }
          catch( Throwable e )
          {
              final String error = 
                 "Could not create a service relative to the path: " 
                 + clazz.getName() + " due to a service build error.";
              throw new ServiceException( error, e );
          }
      }
  
      /**
       * Create a service instance based on a supplied classname.
       *
       * @param classname the component implementation classname
       * @return the service defintion
       * @exception ServiceException if an error occurs during service creation
       */
      public Service createService( String classname ) throws ServiceException
      {
          if( classname == null )
          {
              throw new NullPointerException("classname");
          }
  
          try
          {
              Class clazz = m_classloader.loadClass( classname );
              return createService( clazz );
          }
          catch( Throwable e )
          {
              final String error = 
                "Unexpected error while attempting to build a service from the classname: " + classname;
              throw new ServiceException( error, e );
          }
      }
  
      /**
       * Locate a {@link Service} instances associated with the 
       * supplied classname and version. If a service defintion is not
       * found locally, the implementation redirects the request to 
       * the parent service manager.
       *
       * @param classname the service class name
       * @param version the service version
       * @return the service matching the supplied classname and version.
       * @exception UnknownServiceException if a matching service cannot be found
       */
      public Service getService( String classname, Version version ) throws UnknownServiceException
      {
          Map map = getServiceMap( classname, false );
          if( map != null )
          {
              Service service = (Service) map.get( version );
              if( service != null )
              {
                  return service;
              }
          }
  
          //
          // check the parent first
          //
  
          if( m_parent != null )
          {
              return m_parent.getService( classname, version );
          }
          else
          {
              final String error = "Unknown service defintion: " + classname + "/" + version;
              throw new UnknownServiceException( error );
          }
      }
  
      /**
       * Add a service to the manager.
       *
       * @param service the service defintion
       * @exception DuplicateServiceException if the service already exists
       * @exception ServiceException if the service definition is invalid
      */
      public void addService( Service service ) throws DuplicateServiceException, ServiceException
      {
          //
          // make sure we are dealing with a service that is verified
          //
  
          verifyService( service );
  
          //
          // make sure that there is not already a local defintion for 
          // this service
          //
  
          String classname = service.getClassname();
          Version version = service.getVersion();
          Map map = getServiceMap( classname, false );
          if( map != null )
          {
              if( map.get( version ) != null )
              {
                  final String error = 
                    "Duplicate service defintion: " + service;
                  throw new ServiceException( error );
              }            
          }
          else
          {
              map = getServiceMap( classname, true );
          }
   
          if( getLogger().isDebugEnabled() )
          {
              StringBuffer buffer = new StringBuffer();
              buffer.append( "adding service: " + classname );
              buffer.append( "/" + service.getVersion() );
              String[] names = service.getAttributeNames();
              for( int i = 0; i < names.length; i++ )
              {
                  String name = names[ i ];
                  String value = service.getAttribute( name );
                  buffer.append( "\n  attribute " + name + " = " + value );
              }
              getLogger().debug( buffer.toString() );
          }
  
          map.put( version, service );
      }
  
     /**
      * Internal utility that returns a map of services keyed by version.  The 
      * map is resolved from the m_services list based on the classname key.
      * @param classname the classname key
      * @param create if TRUE create a new map if no map found
      * @return the service map for the class
      */
      private Map getServiceMap( String classname, boolean create )
      {
          Map map = (Map) m_services.get( classname );
          if(( map == null ) && create )
          {
              map = new Hashtable();
              m_services.put( classname, map );
          }
          return map;
      }
  
  
     /**
      * Verify that a class exists within the classloader representing the 
      * service type.
      * @param service the service to verify
      * @exception ServiceException if a verification error occurs
      */
      private void verifyService( Service service ) throws ServiceException
      {
          Class clazz;
          try
          {
              clazz = m_classloader.loadClass( service.getClassname() );
          }
          catch( Throwable e )
          {
              final String error = "Unresolvable service class.";
              throw new ServiceException( error, e );
          }
      }
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/service/DuplicateServiceException.java
  
  Index: DuplicateServiceException.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.service;
  
  import org.apache.avalon.framework.CascadingException;
  
  /**
   * Exception raised in response to an attempt to override 
   * an existing service defintion.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:45 $
   */
  public final class DuplicateServiceException
      extends CascadingException
  {
  
      /**
       * Construct a new <code>DuplicateServiceException</code> instance.
       *
       * @param message The detail message for this exception.
       */
      public DuplicateServiceException( final String message )
      {
          this( message, null );
      }
  
      /**
       * Construct a new <code>DuplicateServiceException</code> instance.
       *
       * @param message The detail message for this exception.
       * @param throwable the root cause of the exception
       */
      public DuplicateServiceException( final String message, final Throwable throwable )
      {
          super( message, throwable );
      }
  }
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/service/ServiceException.java
  
  Index: ServiceException.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.service;
  
  import org.apache.avalon.framework.CascadingException;
  
  /**
   * Exception to indicate that there was a service related error.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:45 $
   */
  public class ServiceException
      extends CascadingException
  {
  
      /**
       * Construct a new <code>ServiceException</code> instance.
       *
       * @param message The detail message for this exception.
       */
      public ServiceException( final String message )
      {
          this( message, null );
      }
  
      /**
       * Construct a new <code>ServiceException</code> instance.
       *
       * @param message The detail message for this exception.
       * @param throwable the root cause of the exception
       */
      public ServiceException( final String message, final Throwable throwable )
      {
          super( message, throwable );
      }
  }
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/service/ServiceManager.java
  
  Index: ServiceManager.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.service;
  
  import org.apache.avalon.framework.Version;
  
  import org.apache.avalon.meta.info.Service;
  
  /**
   * A service manager implementation provides support for the creation, 
   * storage and retrival of service defintions.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:45 $
   */
  public interface ServiceManager
  {
  
      /**
       * Create a services associated from a supplied path. 
       *
       * @param clazz the service class
       * @return the service defintions
       * @exception ServiceException if an error occurs during service creation
       */
      Service createService( Class clazz ) throws ServiceException;
  
      /**
       * Create a service instance based on a supplied classname.
       *
       * @param classname the component implementation classname
       * @return the service defintion
       * @exception ServiceException if an error occurs during creation
       *   of a service defintion
       */
      Service createService( String classname ) throws ServiceException;
  
      /**
       * Add a service to the manager.
       *
       * @param service the service to add to the repository
       * @exception ServiceException if the service definition is invalid
       * @exception DuplicateServiceException if the service definition already exists
       */
      void addService( Service service ) throws ServiceException, DuplicateServiceException;
  
      /**
       * Locate a {@link Service} instances associated with the 
       * supplied classname and version. 
       * @param classname the service class name
       * @param version the service version
       * @return the service matching the supplied classname
       *   and version
       * @exception UnknownServiceException if a matching service cannot be found
       */
      Service getService( String classname, Version version ) throws UnknownServiceException;
  
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/service/ServiceRuntimeException.java
  
  Index: ServiceRuntimeException.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.service;
  
  import org.apache.avalon.framework.CascadingRuntimeException;
  
  /**
   * Exception to indicate that there was a seervice related runtime error.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:45 $
   */
  public final class ServiceRuntimeException
      extends CascadingRuntimeException
  {
  
      /**
       * Construct a new <code>ServiceRuntimeException</code> instance.
       *
       * @param message The detail message for this exception.
       */
      public ServiceRuntimeException( final String message )
      {
          this( message, null );
      }
  
      /**
       * Construct a new <code>ServiceRuntimeException</code> instance.
       *
       * @param message The detail message for this exception.
       * @param throwable the root cause of the exception
       */
      public ServiceRuntimeException( final String message, final Throwable throwable )
      {
          super( message, throwable );
      }
  }
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/service/UnknownServiceException.java
  
  Index: UnknownServiceException.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.service;
  
  /**
   * Exception to indicate that a service defintioon is unknown within 
   * the scope of a service manager.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:45 $
   */
  public final class UnknownServiceException
      extends ServiceException
  {
  
      /**
       * Construct a new <code>UnknownServiceException</code> instance.
       *
       * @param message The detail message for this exception.
       */
      public UnknownServiceException( final String message )
      {
          this( message, null );
      }
  
      /**
       * Construct a new <code>UnknownServiceException</code> instance.
       *
       * @param message The detail message for this exception.
       * @param throwable the root cause of the exception
       */
      public UnknownServiceException( final String message, final Throwable throwable )
      {
          super( message, throwable );
      }
  }
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/service/package.html
  
  Index: package.html
  ===================================================================
  
  <body>
  <p>
  The <code>type</code> package contains classes and interfaces for the {@link org.apache.avalon.assembly.type.TypeManager} and related default implementations supporting the management of a repository of component types.
  </p>
  </body>
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/type/DefaultTypeManager.java
  
  Index: DefaultTypeManager.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.type;
  
  import java.util.Hashtable;
  import java.util.Iterator;
  import java.util.Enumeration;
  import java.util.ArrayList;
  
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.context.ContextException;
  import org.apache.avalon.framework.context.Contextualizable;
  import org.apache.avalon.framework.activity.Initializable;
  import org.apache.avalon.meta.info.Type;
  import org.apache.avalon.meta.info.builder.TypeBuilder;
  import org.apache.avalon.meta.info.ReferenceDescriptor;
  import org.apache.avalon.meta.info.DependencyDescriptor;
  import org.apache.avalon.meta.info.ServiceDescriptor;
  import org.apache.avalon.meta.info.StageDescriptor;
  import org.apache.avalon.meta.verifier.ComponentVerifier;
  
  /**
   * A type manager implemetation provides support for the creation, 
   * storage and retrival of component types.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:46 $
   */
  public class DefaultTypeManager extends AbstractLogEnabled implements TypeManager, Contextualizable, Initializable
  {
      //==============================================================
      // static
      //==============================================================
  
     /**
      * The type builder.
      */
      private static final TypeBuilder DEFAULT_BUILDER = new TypeBuilder();
  
      //==============================================================
      // state
      //==============================================================
  
     /**
      * Flag indicating if contextualization has been performed.
      */
      private boolean m_contextualized = false;
    
     /**
      * Flag indicating if initalization has been performed.
      */
      private boolean m_initialized = false;
    
     /**
      * The classloader supplied to the manager.
      */
      private ClassLoader m_classloader;
  
     /**
      * The parent type manager (may be null)
      */
      private TypeManager m_parent;
  
      /**
       * Table of component types keyed by implementation classname.
       */
      private final Hashtable m_types = new Hashtable();
  
      //==============================================================
      // Contextualizable
      //==============================================================
  
     /**
      * <p>Application of a runtime context to this component.
      * Context entries that may be supplied to a type manager are detailed in the
      * following table.</p>
      * <table>
      *   <tr>
      *     <td>key</td><td>type</td><td>default</td>
      *   </tr>
      *   <tr>
      *     <td>avalon:type.classloader</td>
      *     <td>java.lang.ClassLoader</td>
      *     <td>The context classloader will be used by default if not value is supplied.</td> 
      *   </tr>
      *   <tr>
      *     <td>assembly:parent</td>
      *     <td>{@link org.apache.avalon.assembly.type.TypeManager}</td>
      *     <td>In no value suppled, this type manager will be considered as a root manager.</td> 
      *   </tr>
      * </table>
      * @param context the runtime context
      */
      public void contextualize( Context context )
      {
          try
          {
              m_parent = (TypeManager) context.get( "assembly:parent" );
          }
          catch( ContextException e )
          {
              m_parent = null;
          }
  
          try
          {
              m_classloader = (ClassLoader) context.get( "assembly:classloader" );
          }
          catch( ContextException e )
          {
              m_classloader = Thread.currentThread().getContextClassLoader();
          }
  
          m_contextualized = true;
      }
  
      //==============================================================
      // Initializable
      //==============================================================
  
     /**
      * Initialization fo the component by the container.  The implementation
      * validates a logger has been assigned and that the context phase has 
      * been executed, following which it flags initialization as complete and 
      * marks the component as ready to serve requests.
      *
      * @exception Exception if the manager has not been suppied with a context
      */
      public void initialize() throws Exception
      {
          if( !m_contextualized )
          {
              throw new IllegalStateException("contextualize");
          }
          if( getLogger() == null )
          {
              throw new IllegalStateException("logger");
          }
  
          m_initialized = true;
      }
  
      //==============================================================
      // TypeManager
      //==============================================================
  
      /**
       * Create a new type instance.  The type instance returned is not 
       * registered with the manager.  To register the type the client 
       * must explicity declare the type using the {@link #addType} 
       * operation.
       *
       * @param clazz the component implementation class
       * @return the component type
       * @exception TypeException is a type creation error occurs
       * @see #addType
       */
      public Type createType( Class clazz ) throws TypeException
      {
          if( clazz == null )
          {
              throw new NullPointerException("clazz");
          }
  
          try
          {
              return DEFAULT_BUILDER.build( clazz.getName(), clazz.getClassLoader() );
          }
          catch( Throwable e )
          {
              final String error = 
                "Could not register a type relative to the path: " 
                + clazz.getName()
                + " due to a type build error.";
              throw new TypeException( error, e );
          }
      }
  
      /**
       * Create a type instance based on a supplied classname and classloader.
       *
       * @param classname the component implementation classname
       * @return the component type
       * @exception TypeException is a type creation error occurs
       */
      public Type createType( String classname ) throws TypeException
      {
          if( classname == null )
          {
              throw new NullPointerException("classname");
          }
  
          try
          {
              Class clazz = m_classloader.loadClass( classname );
              return createType( clazz );
          }
          catch( Throwable e )
          {
              final String error = 
                "Unexpected error while attempting to build a type from the classname: " + classname;
              throw new TypeException( error, e );
          }
      }
  
     /**
      * Add a type to the manager.
      * @param type the component type description.
      * @exception DuplicateTypeException if the supplied type is already registered
      * @exception TypeException if a type verification failure occurs
      * @see #createType
      */
      public void addType( Type type ) throws DuplicateTypeException, TypeException
      {
          if( type == null )
          {
              throw new NullPointerException("type");
          }
  
          if( !m_initialized )
          {
              throw new IllegalStateException("initialization");
          }
  
          final String classname = type.getInfo().getClassname();
  
          try
          {
              type = getType( classname );
              throw new DuplicateTypeException( classname );
          }
          catch( UnknownTypeException ute )
          {
              try
              {
                  verify( type );
              }
              catch( Throwable e )
              {
                  final String error = 
                    "Could not register the type: " + classname
                    + " due to a verification failure.";
                  throw new TypeException( error, e );
              }
  
              if( getLogger().isDebugEnabled() )
              {
                  getLogger().debug("registering type: " + classname );
              }
  
              m_types.put( classname, type );
          }
      }
  
      /**
       * Locate a {@link Type} instances associated with the 
       * supplied implementation classname.
       * @param clazz the component type implementation class.
       * @return the type matching the supplied implementation classname.
       * @exception UnknownTypeException if a matching type cannot be found
       */
      public Type getType( Class clazz ) throws UnknownTypeException
      {
          if( clazz == null )
          {
              throw new NullPointerException("clazz");
          }
          if( !m_initialized )
          {
              throw new IllegalStateException("initialization");
          }
  
          return getType( clazz.getName() );
      }
  
      /**
       * Locate a {@link Type} instances associated with the 
       * supplied implementation classname.
       * @param classname the component type implementation class name.
       * @return the type matching the supplied implementation classname.
       * @exception UnknownTypeException if a matching type cannot be found
       */
      public Type getType( String classname ) throws UnknownTypeException
      {
          if( classname == null )
          {
              throw new NullPointerException("classname");
          }
          if( !m_initialized )
          {
              throw new IllegalStateException("initialization");
          }
  
  
          Type type = (Type) m_types.get( classname );
          if( type == null )
          {
              if( m_parent != null )
              {
                  return m_parent.getType( classname );
              }
              else
              {
                  throw new UnknownTypeException( classname );
              }
          }
          return type;
      }
  
     /**
      * Locate the set of component types capable of services the supplied 
      * dependency.
      * @param dependency a service dependency descriptor
      * @return a set of types capable of servicing the supplied dependency
      */
      public Type[] getTypes( DependencyDescriptor dependency )
      {
          if( dependency == null )
          {
              throw new NullPointerException("dependency");
          }
          if( !m_initialized )
          {
              throw new IllegalStateException("initialization");
          }
  
          ArrayList list = new ArrayList();
          if( m_parent != null )
          {
              Type[] types = m_parent.getTypes( dependency );
              for( int i=0; i<types.length; i++ )
              {
                  list.add( types[i] );
              }
          }
  
          ReferenceDescriptor reference = dependency.getReference();
          Enumeration enum = m_types.elements();
          while( enum.hasMoreElements() )
          {
              Type type = (Type) enum.nextElement();
              Object service = type.getService( reference );
              if( service != null )
              {
                  list.add( type );
              }
          }
          return (Type[]) list.toArray( new Type[0] );
      }
  
     /**
      * Locate the set of component types that provide the supplied extension.
      * @param stage a stage descriptor
      * @return a set of types that support the supplied stage
      */
      public Type[] getTypes( StageDescriptor stage )
      {
          if( stage == null )
          {
              throw new NullPointerException("stage");
          }
          if( !m_initialized )
          {
              throw new IllegalStateException("initialization");
          }
  
          ArrayList list = new ArrayList();
          if( m_parent != null )
          {
              Type[] types = m_parent.getTypes( stage );
              for( int i=0; i<types.length; i++ )
              {
                  list.add( types[i] );
              }
          }
  
          Iterator iterator = m_types.entrySet().iterator();
          while( iterator.hasNext() )
          {
              Type type = (Type) iterator.next();
              if( type.getExtension( stage ) != null )
              {
                  list.add( type );
              }
          }
  
          return (Type[]) list.toArray( new Type[0] );
      }
  
     /**
      * Verify the intergrity of the supplied type.
      * @param type the type to verify
      * @exception Exception if an verification failure occurs
      */
      private void verify( Type type ) throws Exception
      {
          String name = type.getInfo().getName();
          Class clazz = getComponentClass( type );
          Class[] classes = getServiceClasses( type );
          ComponentVerifier verifier = new ComponentVerifier();
          verifier.verifyComponent( name, clazz, classes );
      }
  
      /**
       * Return the set of interface classes for a given type that are declared
       * or default to the "native" service access protocol and where the
       * service access model is undefined (i.e. native implementation).
       * access mode.
       *
       * @param type the component type
       * @return an array of classes represnting the type's service interfaces
       */
      private Class[] getServiceClasses( Type type )
      {
          ArrayList list = new ArrayList();
          ServiceDescriptor[] services = type.getServices();
          for( int i = 0; i < services.length; i++ )
          {
              ServiceDescriptor service = services[ i ];
              if( ( service.getAttribute( 
                "avalon:service.protocol", "native" ).equals( "native" ) )
                && ( service.getAttribute( "avalon:service.accessor", null ) == null ) )
              {
                  list.add( getServiceClass( services[ i ] ) );
              }
          }
          return ( Class[]) list.toArray( new Class[0] );
      }
  
      /**
       * Returns the component type implementation class.
       * @param type the component type descriptor
       * @return the class implementing the component type
       * @exception TypeException if a classloader error occurs
       */
      private Class getComponentClass( Type type ) throws TypeException
      {
          if( null == type )
          {
              throw new NullPointerException( "type" );
          }
  
          final String classname = type.getInfo().getClassname();
  
          try
          {
              return m_classloader.loadClass( classname );
          }
          catch( Throwable e )
          {
              final String error = 
                "Could not load implementation class for component type: "
                + classname;
              throw new TypeException( error, e );
          }
      }
  
      /**
       * Returns the service type implementation class.
       * @param service the service type descriptor
       * @return the class implementing the service type
       * @exception TypeRuntimeException if a classloader error occurs
       */
      private Class getServiceClass( ServiceDescriptor service ) throws TypeRuntimeException
      {
          final String classname = service.getReference().getClassname();
          try
          {
              return m_classloader.loadClass( classname );
          }
          catch( Throwable e )
          {
              final String error = 
                "Could not load implementation class for service type: "
                + classname;
              throw new TypeRuntimeException( error, e );
          }
      }
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/type/DuplicateTypeException.java
  
  Index: DuplicateTypeException.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.type;
  
  /**
   * Exception raised in response to an attempt to override the defintion
   * of an existing type.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:46 $
   */
  public final class DuplicateTypeException
      extends TypeException
  {
  
      /**
       * Construct a new <code>DuplicateTypeException</code> instance.
       *
       * @param message The detail message for this exception.
       */
      public DuplicateTypeException( final String message )
      {
          this( message, null );
      }
  
      /**
       * Construct a new <code>DuplicateTypeException</code> instance.
       *
       * @param message The detail message for this exception.
       * @param throwable the root cause of the exception
       */
      public DuplicateTypeException( final String message, final Throwable throwable )
      {
          super( message, throwable );
      }
  }
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/type/TypeException.java
  
  Index: TypeException.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.type;
  
  import org.apache.avalon.framework.CascadingException;
  
  /**
   * Exception to indicate that there was a type related error.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:46 $
   */
  public class TypeException
      extends CascadingException
  {
  
      /**
       * Construct a new <code>TypeException</code> instance.
       *
       * @param message The detail message for this exception.
       */
      public TypeException( final String message )
      {
          this( message, null );
      }
  
      /**
       * Construct a new <code>TypeException</code> instance.
       *
       * @param message The detail message for this exception.
       * @param throwable the root cause of the exception
       */
      public TypeException( final String message, final Throwable throwable )
      {
          super( message, throwable );
      }
  }
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/type/TypeManager.java
  
  Index: TypeManager.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.type;
  
  import org.apache.avalon.meta.info.Type;
  import org.apache.avalon.meta.info.DependencyDescriptor;
  import org.apache.avalon.meta.info.StageDescriptor;
  
  /**
   * A type manager implemetation provides support for the creation, 
   * storage and retrival of component types.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:46 $
   */
  public interface TypeManager
  {
      /**
       * Create a new type instance.  The type instance returned is not 
       * registered with the manager.  To register the type the client 
       * must explicity declare the type using the {@link #addType} 
       * operation.
       *
       * @param clazz the component implementation class
       * @return the component type
       * @exception TypeException is a type creation error occurs
       * @see #addType
       */
      Type createType( Class clazz ) throws TypeException;
  
      /**
       * Create a type instance based on a supplied classname and classloader.
       *
       * @param classname the component implementation classname
       * @return the component type
       * @exception TypeException is a type creation error occurs
       */
      Type createType( String classname ) throws TypeException;
  
     /**
      * Add a type to the manager.
      * @param type the component type description.
      * @exception DuplicateTypeException if the supplied type is already registered
      * @exception TypeException if a type verification failure occurs
      * @see #createType
      */
      void addType( Type type ) throws DuplicateTypeException, TypeException;
  
      /**
       * Locate a {@link Type} instances associated with the 
       * supplied implementation classname.
       * @param clazz the component type implementation class.
       * @return the type matching the supplied implementation classname.
       * @exception UnknownTypeException if a matching type cannot be found
       */
      Type getType( Class clazz ) throws UnknownTypeException;
  
      /**
       * Locate a {@link Type} instances associated with the 
       * supplied implementation classname.
       * @param classname the component type implementation class name.
       * @return the type matching the supplied implementation classname.
       * @exception UnknownTypeException if a matching type cannot be found
       */
      Type getType( String classname ) throws UnknownTypeException;
  
     /**
      * Locate the set of component types capable of servicing the supplied 
      * dependency.
      * @param dependency a service dependency descriptor
      * @return a set of types capable of servicing the supplied dependency
      */
      Type[] getTypes( DependencyDescriptor dependency );
  
     /**
      * Locate the set of component types that provide the supplied extension stage.
      * @param stage a stage descriptor
      * @return a set of types that are capable of supporting the supplied stage
      */
      Type[] getTypes( StageDescriptor stage );
  
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/type/TypeRuntimeException.java
  
  Index: TypeRuntimeException.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.type;
  
  import org.apache.avalon.framework.CascadingRuntimeException;
  
  /**
   * Exception to indicate that there was a type related runtime error.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:46 $
   */
  public final class TypeRuntimeException
      extends CascadingRuntimeException
  {
  
      /**
       * Construct a new <code>TypeRuntimeException</code> instance.
       *
       * @param message The detail message for this exception.
       */
      public TypeRuntimeException( final String message )
      {
          this( message, null );
      }
  
      /**
       * Construct a new <code>TypeRuntimeException</code> instance.
       *
       * @param message The detail message for this exception.
       * @param throwable the root cause of the exception
       */
      public TypeRuntimeException( final String message, final Throwable throwable )
      {
          super( message, throwable );
      }
  }
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/type/UnknownTypeException.java
  
  Index: UnknownTypeException.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
      "Apache Software Foundation"  must not be used to endorse or promote
      products derived  from this  software without  prior written
      permission. For written permission, please contact apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation. For more  information on the
   Apache Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.avalon.assembly.type;
  
  /**
   * Exception to indicate that a type is unknown within the scope of a type manager.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2002/11/24 12:50:46 $
   */
  public final class UnknownTypeException
      extends TypeException
  {
  
      /**
       * Construct a new <code>UnknownTypeException</code> instance.
       *
       * @param message The detail message for this exception.
       */
      public UnknownTypeException( final String message )
      {
          this( message, null );
      }
  
      /**
       * Construct a new <code>UnknownTypeException</code> instance.
       *
       * @param message The detail message for this exception.
       * @param throwable the root cause of the exception
       */
      public UnknownTypeException( final String message, final Throwable throwable )
      {
          super( message, throwable );
      }
  }
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/type/package.html
  
  Index: package.html
  ===================================================================
  
  <body>
  <p>
  The <code>type</code> package contains classes and interfaces for the {@link org.apache.avalon.assembly.type.TypeManager} and related default implementations supporting the management of a repository of component types.
  </p>
  </body>
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/assembly/TestCaseBase.java
  
  Index: TestCaseBase.java
  ===================================================================
  /*
  * Copyright (C) The Apache Software Foundation. All rights reserved.
  *
  * This software is published under the terms of the Apache Software License
  * version 1.1, a copy of which has been included with this distribution in
  * the LICENSE.txt file.
  */
  
  package org.apache.avalon.assembly;
  
  import java.io.File;
  import junit.framework.TestCase;
  import org.apache.avalon.assembly.logger.DefaultLoggerManager;
  import org.apache.avalon.framework.logger.*;
  
  /**
   * A testcase for the @link{TypeManager}.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   */
  public abstract class TestCaseBase extends TestCase
  {
  
      protected ClassLoader m_loader;
      protected DefaultLoggerManager m_logManager;
  
      public TestCaseBase( String name )
      {
          super( name );
      }
  
      protected void setUp() throws Exception
      {
          m_loader = Thread.currentThread().getContextClassLoader();
          final File base = new File( System.getProperty( "user.dir" ) );
          m_logManager = new DefaultLoggerManager( base );
      }
  
      protected Logger getLogger()
      {
          return m_logManager.getLoggerForCategory("test");
      }
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/assembly/profile/ProfileManagerTestCase.java
  
  Index: ProfileManagerTestCase.java
  ===================================================================
  /*
  * Copyright (C) The Apache Software Foundation. All rights reserved.
  *
  * This software is published under the terms of the Apache Software License
  * version 1.1, a copy of which has been included with this distribution in
  * the LICENSE.txt file.
  */
  
  package org.apache.avalon.assembly.profile;
  
  import java.io.File;
  import junit.framework.TestCase;
  import org.apache.avalon.framework.Version;
  import org.apache.avalon.framework.context.*;
  import org.apache.avalon.framework.logger.*;
  import org.apache.avalon.assembly.service.*;
  import org.apache.avalon.assembly.type.*;
  import org.apache.avalon.assembly.profile.*;
  import org.apache.avalon.meta.info.*;
  import org.apache.avalon.meta.model.*;
  import org.apache.avalon.assembly.TestCaseBase;
  
  /**
   * A testcase for the @link{ProfileManager}.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   */
  public class ProfileManagerTestCase extends TestCaseBase
  {
  
      private ProfileManager m_manager;
      private TypeManager m_types;
  
      public ProfileManagerTestCase()
      {
          this( "ProfileManagerTestCase" );
      }
  
      public ProfileManagerTestCase( String name )
      {
          super( name );
      }
  
      protected void setUp() throws Exception
      {
          super.setUp();
          m_types = createTypeManager();
          m_manager = createProfileManager();
      }
  
      public void testPackagedProfileImport()
      {
          final String classname = "org.apache.avalon.playground.BasicComponent";
            
          try
          {
              Type type = m_types.createType( classname );
              Profile[] profiles = m_manager.loadProfiles( type );
              assertTrue( profiles.length > 0 );
          }
          catch( Throwable e )
          {
              System.out.println("failure to create packaged profiles for : " + classname );
              assertTrue( false );
              e.printStackTrace();
          }
      }
  
      public void testProfileRegistrationAndRetrival() throws Exception
      {
          final String classname = "org.apache.avalon.playground.BasicComponent";
          
          ReferenceDescriptor ref = 
            new ReferenceDescriptor(
              "org.apache.avalon.playground.BasicService",
              Version.getVersion( "1.1" ) );
  
          DependencyDescriptor dep = 
            new DependencyDescriptor( "test", ref );
  
          try
          {
              Type type = m_types.createType( classname );
              Profile[] profiles = m_manager.loadProfiles( type );
              for( int i=0; i<profiles.length; i++ )
              {
                  m_manager.addProfile( profiles[i] );
              }
  
              Profile[] candidates = m_manager.getProfiles( dep );
              assertTrue( candidates.length > 0 );
          }
          catch( Throwable e )
          {
              System.out.println("failure to resolve profile for : " + ref );
              e.printStackTrace();
              assertTrue( false );
          }
      }
  
      protected void tearDown() throws Exception
      {
          m_manager = null;
          m_types = null;
      }
  
      private TypeManager createTypeManager() throws Exception
      {
          DefaultTypeManager manager = new DefaultTypeManager();
          manager.enableLogging( getLogger().getChildLogger("types") );
          DefaultContext context = new DefaultContext();
          context.put( "assembly:classloader", m_loader );
          context.makeReadOnly();
          manager.contextualize( context );
          manager.initialize();
          return manager;
      }
  
      private ProfileManager createProfileManager() throws Exception
      {
          DefaultProfileManager manager = new DefaultProfileManager();
          manager.enableLogging( getLogger().getChildLogger("profiles") );
          DefaultContext context = new DefaultContext();
          context.put( "assembly:classloader", m_loader );
          context.makeReadOnly();
          manager.contextualize( context );
          manager.initialize();
          return manager;
      }
  
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/assembly/service/DefaultServiceManagerTestCase.java
  
  Index: DefaultServiceManagerTestCase.java
  ===================================================================
  /*
  * Copyright (C) The Apache Software Foundation. All rights reserved.
  *
  * This software is published under the terms of the Apache Software License
  * version 1.1, a copy of which has been included with this distribution in
  * the LICENSE.txt file.
  */
  
  package org.apache.avalon.assembly.service;
  
  import java.io.File;
  import junit.framework.TestCase;
  import org.apache.avalon.framework.Version;
  import org.apache.avalon.framework.context.*;
  import org.apache.avalon.framework.logger.*;
  import org.apache.avalon.assembly.service.*;
  import org.apache.avalon.assembly.type.*;
  import org.apache.avalon.meta.info.*;
  import org.apache.avalon.assembly.TestCaseBase;
  
  /**
   * A testcase for the @link{DefaultServiceManager}.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   */
  public class DefaultServiceManagerTestCase extends TestCaseBase
  {
  
      private ServiceManager m_manager;
  
      public DefaultServiceManagerTestCase()
      {
          this( "DefaultServiceManager" );
      }
  
      public DefaultServiceManagerTestCase( String name )
      {
          super( name );
      }
  
      protected void setUp() throws Exception
      {
          super.setUp();
          DefaultServiceManager manager = new DefaultServiceManager();
          manager.enableLogging( getLogger().getChildLogger("services") );
          DefaultContext context = new DefaultContext();
          context.put( "assembly:classloader", m_loader );
          context.makeReadOnly();
          manager.contextualize( context );
          manager.initialize();
          m_manager = manager;
      }
  
      public void testCreateBasicService()
      {
          final String classname = "org.apache.avalon.playground.BasicService";
            
          try
          {
              assertTrue( m_manager.createService( classname ) != null );
          }
          catch( Throwable e )
          {
              System.out.println("static operation failure for create type using : " + classname );
              e.printStackTrace();
              assertTrue( false );
          }
      }
  
      public void testCreateNull()
      {          
          try
          {
              m_manager.createService( (String) null );
              assertTrue( false );
          }
          catch( NullPointerException e )
          {
              assertTrue( true );
          }
          catch( Throwable e )
          {
              System.out.println("static operation failure for create type using : " + null );
              assertTrue( false );
              e.printStackTrace();
          }
      }
  
      public void testCreateBadService()
      {          
          final String classname = "org.something.else";
          try
          {
              Service service = m_manager.createService( classname );
              assertTrue( false );
          }
          catch( ServiceException e )
          {
              assertTrue( true );
          }
          catch( Throwable e )
          {
              System.out.println(
                "static operation anti-failure for creation of invalid service using : " 
                + classname );
              e.printStackTrace();
              assertTrue( false );
          }
      }
  
      public void testServiceRegistrationAndRetrival() throws Exception
      {
          final String classname = "org.apache.avalon.playground.BasicService";
  
          Service service = m_manager.createService( classname );
          try
          {
              m_manager.addService( service );
              assertTrue( true );
          }
          catch( Throwable e )
          {
              System.out.println( "type addition failure" );
              e.printStackTrace();
              assertTrue( false );
          }
  
          //
          // try to add the service again (which should fail)
          //
  
          try
          {
              m_manager.addService( service );
              System.out.println( "type replacement check failure" );
              assertTrue( false );
          }
          catch( Throwable e )
          {
              assertTrue( true );
          }
  
          //
          // validate service retrival by classname and version
          //
  
          try
          {
              service.equals( m_manager.getService( service.getClassname(), service.getVersion() ) );
              assertTrue( true );
          }
          catch( Throwable e )
          {
              System.out.println( "service retrival by classname/version failure" );
              e.printStackTrace();
              assertTrue( false );
          }
  
          //
          // validate service retrival by classname and version using a bad version
          //
  
          try
          {
              Version version = Version.getVersion( "111.111" );
              service.equals( m_manager.getService( service.getClassname(), version ) );
              System.out.println( "service retrival by classname/version failure on bad version" );
              assertTrue( false );
          }
          catch( Throwable e )
          {
              assertTrue( true );
          }
      }
  
      protected void tearDown() throws Exception
      {
          m_loader = null;
          m_manager = null;
      }
  
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/assembly/type/TypeManagerTestCase.java
  
  Index: TypeManagerTestCase.java
  ===================================================================
  /*
  * Copyright (C) The Apache Software Foundation. All rights reserved.
  *
  * This software is published under the terms of the Apache Software License
  * version 1.1, a copy of which has been included with this distribution in
  * the LICENSE.txt file.
  */
  
  package org.apache.avalon.assembly.type;
  
  import java.io.File;
  import junit.framework.TestCase;
  import org.apache.avalon.framework.context.*;
  import org.apache.avalon.framework.logger.*;
  import org.apache.avalon.assembly.service.*;
  import org.apache.avalon.assembly.type.*;
  import org.apache.avalon.meta.info.*;
  import org.apache.avalon.assembly.TestCaseBase;
  
  /**
   * A testcase for the @link{TypeManager}.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   */
  public class TypeManagerTestCase extends TestCaseBase
  {
  
      private TypeManager m_manager;
  
      public TypeManagerTestCase()
      {
          this( "TypeManagerTestCase" );
      }
  
      public TypeManagerTestCase( String name )
      {
          super( name );
      }
  
      protected void setUp() throws Exception
      {
          super.setUp();
          DefaultTypeManager manager = new DefaultTypeManager();
          manager.enableLogging( getLogger().getChildLogger("types") );
          DefaultContext context = new DefaultContext();
          context.put( "assembly:classloader", m_loader );
          context.makeReadOnly();
          manager.contextualize( context );
          manager.initialize();
          m_manager = manager;
      }
  
      public void testBasic()
      {
          final String classname = "org.apache.avalon.playground.BasicComponent";
            
          try
          {
              assertTrue( m_manager.createType( classname ) != null );
          }
          catch( Throwable e )
          {
              System.out.println("failure to create type using : " + classname );
              assertTrue( false );
              e.printStackTrace();
          }
      }
  
      public void testSimple()
      {
          final String classname = "org.apache.avalon.playground.SimpleComponent";
            
          try
          {
              assertTrue( m_manager.createType( classname ) != null );
          }
          catch( Throwable e )
          {
              System.out.println("failure for create type using : " + classname );
              assertTrue( false );
              e.printStackTrace();
          }
      }
  
      public void testComplex()
      {
          final String classname = "org.apache.avalon.playground.ComplexComponent";
            
          try
          {
              assertTrue( m_manager.createType( classname ) != null );
          }
          catch( Throwable e )
          {
              System.out.println("failure for create type using : " + classname );
              assertTrue( false );
              e.printStackTrace();
          }
      }
  
      public void testNull()
      {          
          try
          {
              m_manager.createType( (String) null );
              assertTrue( false );
          }
          catch( NullPointerException e )
          {
              assertTrue( true );
          }
          catch( Throwable e )
          {
              System.out.println("failure for create type using : " + null );
              assertTrue( false );
              e.printStackTrace();
          }
      }
  
      public void testBadType()
      {          
          final String classname = "org.something.else";
          try
          {
              Type type = m_manager.createType( classname );
              assertTrue( false );
          }
          catch( TypeException e )
          {
              assertTrue( true );
          }
          catch( Throwable e )
          {
              System.out.println(
                "anti-failure for creation of invalid type using : " 
                + classname );
              e.printStackTrace();
              assertTrue( false );
          }
      }
  
      public void testTypeRegistrationAndRetrival() throws Exception
      {
          final String complex = "org.apache.avalon.playground.ComplexComponent";
          final String basic = "org.apache.avalon.playground.BasicComponent";
          final String simple = "org.apache.avalon.playground.SimpleComponent";
  
          Type complexType = m_manager.createType( complex );
          Type basicType = m_manager.createType( basic );
          Type simpleType = m_manager.createType( simple );
          try
          {
  
              m_manager.addType( complexType );
              m_manager.addType( basicType );
              m_manager.addType( simpleType );
  
              assertTrue( true );
          }
          catch( Throwable e )
          {
              System.out.println( "type addition failure" );
              e.printStackTrace();
              assertTrue( false );
          }
  
          //
          // validate type retrival by classname
          //
  
          try
          {
              complexType.equals( m_manager.getType( complex ) );
              basicType.equals( m_manager.getType( basic ) );
              simpleType.equals( m_manager.getType( simple ) );
              assertTrue( true );
          }
          catch( Throwable e )
          {
              System.out.println( "type retrival by classname failure" );
              e.printStackTrace();
              assertTrue( false );
          }
  
          //
          // validate retrival by dependency
          //
  
          DependencyDescriptor constraint = complexType.getDependency( "simple" );
          Type[] solutions = m_manager.getTypes( constraint );
          assertTrue( solutions.length > 0 );
      }
  
      protected void tearDown() throws Exception
      {
          m_loader = null;
      }
  
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/playground/BasicComponent.java
  
  Index: BasicComponent.java
  ===================================================================
  /* ==================================================================== 
   * The Apache Software License, Version 1.1 
   * 
   * Copyright (c) 2002 The Apache Software Foundation. All rights 
   * reserved. 
   * 
   * Redistribution and use in source and binary forms, with or without 
   * modification, are permitted provided that the following conditions 
   * are met: 
   * 
   * 1. Redistributions of source code must retain the above copyright 
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software 
   *    itself, if and wherever such third-party acknowledgments  
   *    normally appear.
   *
   * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation" 
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see 
   * <http://www.apache.org/>.
   */ 
  
  package org.apache.avalon.playground;
  
  import java.io.File;
  import org.apache.avalon.framework.activity.Disposable;
  import org.apache.avalon.framework.activity.Initializable;
  import org.apache.avalon.framework.activity.Startable;
  import org.apache.avalon.framework.configuration.Configurable;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.context.Contextualizable;
  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:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   */
  public class BasicComponent extends AbstractLogEnabled
      implements Contextualizable, Configurable, Initializable, Startable, BasicService, NullService, Disposable
  {
  
      private String m_location;
      private String m_message;
      private File m_home;
  
      /**
       * Supply of the the component context to the component type.
       * @param context the context value
       */
      public void contextualize( Context context )
      {
          BasicContextInterface c = (BasicContextInterface)context;
          m_location = c.getLocation();
          m_home = c.getWorkingDirectory();
      }
  
      //=======================================================================
      // Configurable
      //=======================================================================
  
      /**
       * Supply of the the component configuration to the type.
       * @param config the configuration value
       */
      public void configure( Configuration config )
      {
          getLogger().debug( "configure" );
          m_message = config.getChild( "message" ).getValue( null );
      }
  
      //=======================================================================
      // Initializable
      //=======================================================================
  
      /**
       * Initialization of the component type by its container.
       */
      public void initialize()
      {
          getLogger().debug( "initialize" );
          getLogger().debug( "location: " + m_location );
          getLogger().debug( "home: " + m_home );
          getLogger().debug( "message: " + m_message );
      }
  
      //=======================================================================
      // Startable
      //=======================================================================
  
      /**
       * Start the component.
       */
      public void start()
      {
          doPrimeObjective();
      }
  
      /**
       * Stop the component.
       */
      public void stop()
      {
          getLogger().info( "stopping" );
      }
  
      /**
       * Dispose of the component.
       */
      public void dispose()
      {
          getLogger().debug( "dispose" );
      }
  
      //=======================================================================
      // BasicService
      //=======================================================================
  
      /**
       * Service interface implementation.
       */
      public void doPrimeObjective()
      {
          getLogger().info( m_message + " from '" + m_location + "'." );
      }
  
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/playground/BasicComponent.xconfig
  
  Index: BasicComponent.xconfig
  ===================================================================
  <?xml version="1.0"?>
  
  <!--  
  Copyright (C) The Apache Software Foundation. All rights reserved.
  This software is published under the terms of the Apache Software License
  version 1.1, a copy of which has been included with this distribution in
  the LICENSE.txt file.
  
  @author  Avalon Development Team
  @version 1.0 12/03/2001
  -->
  
  <!--
  The .xconfig file contains the default configuration for the component.
  -->
  
  <configuration>
     <message>Hello.</message>
  </configuration>
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/playground/BasicComponent.xinfo
  
  Index: BasicComponent.xinfo
  ===================================================================
  <?xml version="1.0"?>
  <!DOCTYPE type
        PUBLIC "-//AVALON/Component Type DTD Version 1.0//EN"
               "http://jakarta.apache.org/avalon/dtds/meta/type_1_1.dtd" >
  
  <!--  
  Copyright (C) The Apache Software Foundation. All rights reserved.
  This software is published under the terms of the Apache Software License
  version 1.1, a copy of which has been included with this distribution in
  the LICENSE.txt file.
  
  @author  Avalon Development Team
  @version 1.0 12/03/2001
  -->
  
  <type>
  
    <info>
      <name>basic</name>
    </info>
  
    <context>
      <entry key="location"/>
      <entry key="home" type="java.io.File"/>
    </context>
  
    <services>
      <service> 
        <reference type="org.apache.avalon.playground.BasicService" version="1.1"/>
      </service> 
      <service> 
        <reference type="org.apache.avalon.playground.NullService"/>
      </service> 
    </services>
  
  </type>
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/playground/BasicComponent.xprofile
  
  Index: BasicComponent.xprofile
  ===================================================================
  <?xml version="1.0"?>
  
  <!--  
  Copyright (C) The Apache Software Foundation. All rights reserved.
  This software is published under the terms of the Apache Software License
  version 1.1, a copy of which has been included with this distribution in
  the LICENSE.txt file.
  
  @author  Avalon Development Team
  @version 1.0 12/03/2001
  -->
  
  <profiles>
     
     <!-- 
     A packaged profile is equivalent to a component declaration inside a container, 
     except that it is provided by a component type.  A PACKAGED profiles take priority
     over an IMPLICIT profile. An EXPLICIT profile declared inside a container definition 
     will take priority over PACKAGED profiles.
     -->
   
     <component name="basic">
       <context class="org.apache.avalon.playground.BasicContext">
         <import key="home" name="avalon:home"/>
         <entry key="location">Paris</entry>
       </context>
     </component>
  
  </profiles>
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/playground/BasicContext.java
  
  Index: BasicContext.java
  ===================================================================
  /* ==================================================================== 
   * The Apache Software License, Version 1.1 
   * 
   * Copyright (c) 2002 The Apache Software Foundation. All rights 
   * reserved. 
   * 
   * Redistribution and use in source and binary forms, with or without 
   * modification, are permitted provided that the following conditions 
   * are met: 
   * 
   * 1. Redistributions of source code must retain the above copyright 
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software 
   *    itself, if and wherever such third-party acknowledgments  
   *    normally appear.
   *
   * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation" 
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see 
   * <http://www.apache.org/>.
   */ 
  
  package org.apache.avalon.playground;
  
  import java.io.File;
  import java.util.Map;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.context.DefaultContext;
  
  /**
   * This is example of a custom context class.  It is used in the demonsteation
   * of a context management fraework to show how a context class can be
   * supplied to a component declaring a context interface criteria.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   */
  public class BasicContext extends DefaultContext implements BasicContextInterface
  {
  
      /**
       * Creation of a new custom context instance.
       * @param map the context name/value map
       * @param parent a possibly parent context
       */
      public BasicContext( Map map, Context parent )
      {
          super( map, parent );
      }
  
      /**
       * @return the location
       */
      public String getLocation()
      {
          try
          {
              return (String)super.get( "location" );
          }
          catch( Throwable e )
          {
              return "Unknown";
          }
      }
  
      /**
       * @return the working directory
       */
      public File getWorkingDirectory()
      {
          try
          {
              return (File)super.get( "home" );
          }
          catch( Throwable e )
          {
              throw new RuntimeException( "context object does not provide required home entry." );
          }
      }
  
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/playground/BasicContextInterface.java
  
  Index: BasicContextInterface.java
  ===================================================================
  /* ==================================================================== 
   * The Apache Software License, Version 1.1 
   * 
   * Copyright (c) 2002 The Apache Software Foundation. All rights 
   * reserved. 
   * 
   * Redistribution and use in source and binary forms, with or without 
   * modification, are permitted provided that the following conditions 
   * are met: 
   * 
   * 1. Redistributions of source code must retain the above copyright 
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software 
   *    itself, if and wherever such third-party acknowledgments  
   *    normally appear.
   *
   * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation" 
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see 
   * <http://www.apache.org/>.
   */ 
  
  package org.apache.avalon.playground;
  
  import java.io.File;
  import org.apache.avalon.framework.context.Context;
  
  /**
   * Simple non-standard Context interface to demonstration context
   * management at the level of different context types.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   */
  public interface BasicContextInterface extends Context
  {
      /**
       * @return a string containing a location value
       */
      String getLocation();
  
      /**
       * @return a file representing the working directory
       */
      File getWorkingDirectory();
  
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/playground/BasicService.java
  
  Index: BasicService.java
  ===================================================================
  /* ==================================================================== 
   * The Apache Software License, Version 1.1 
   * 
   * Copyright (c) 2002 The Apache Software Foundation. All rights 
   * reserved. 
   * 
   * Redistribution and use in source and binary forms, with or without 
   * modification, are permitted provided that the following conditions 
   * are met: 
   * 
   * 1. Redistributions of source code must retain the above copyright 
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software 
   *    itself, if and wherever such third-party acknowledgments  
   *    normally appear.
   *
   * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation" 
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see 
   * <http://www.apache.org/>.
   */ 
  
  package org.apache.avalon.playground;
  
  /**
   * The <code>BasicService</code> executes a prime objective.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   */
  public interface BasicService
  {
  
      /**
       * Execute the prime objective of this services.
       */
      void doPrimeObjective();
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/playground/BasicService.xservice
  
  Index: BasicService.xservice
  ===================================================================
  <?xml version="1.0"?>
  <!DOCTYPE type
        PUBLIC "-//AVALON/Component Type DTD Version 1.0//EN"
               "http://jakarta.apache.org/avalon/dtds/meta/type_1_1.dtd" >
  
  <!--  
  Copyright (C) The Apache Software Foundation. All rights reserved.
  This software is published under the terms of the Apache Software License
  version 1.1, a copy of which has been included with this distribution in
  the LICENSE.txt file.
  
  @author  Avalon Development Team
  @version 1.0 12/03/2001
  -->
  
  <service>
    <version>1.1</version>
    <attributes>
      <attribute key="avalon:service.name" value="basic"/>
      <attribute key="avalon:service.description">
        A demonstration service used within the scope of the 
        playground package for eduction and unit testing.
      </attribute>
    </attributes>
  </service>
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/playground/ComplexComponent.java
  
  Index: ComplexComponent.java
  ===================================================================
  /* ==================================================================== 
   * The Apache Software License, Version 1.1 
   * 
   * Copyright (c) 2002 The Apache Software Foundation. All rights 
   * reserved. 
   * 
   * Redistribution and use in source and binary forms, with or without 
   * modification, are permitted provided that the following conditions 
   * are met: 
   * 
   * 1. Redistributions of source code must retain the above copyright 
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software 
   *    itself, if and wherever such third-party acknowledgments  
   *    normally appear.
   *
   * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation" 
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see 
   * <http://www.apache.org/>.
   */ 
  
  package org.apache.avalon.playground;
  
  import org.apache.avalon.framework.activity.Disposable;
  import org.apache.avalon.framework.activity.Initializable;
  import org.apache.avalon.framework.activity.Startable;
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.avalon.framework.service.ServiceManager;
  import org.apache.avalon.framework.service.Serviceable;
  
  /**
   * This is a demonstration component that declares no interface but
   * has dependecies on two services.  These include SimpleService and
   * BasicService.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   */
  
  public class ComplexComponent extends AbstractLogEnabled
      implements Serviceable, Initializable, Startable, Disposable
  {
  
      private ServiceManager m_manager;
      private SimpleService m_simple;
      private BasicService m_basic;
      private Thread m_thread;
      private boolean m_continue = false;
  
      //=================================================================
      // 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 )
      {
          if( getLogger().isDebugEnabled() )
          {
              getLogger().debug( "service" );
          }
          m_manager = manager;
      }
  
  
      //=======================================================================
      // Initializable
      //=======================================================================
  
      /**
       * Initialization of the componet.
       * @exception Exception if an initialization error occurs
       */
      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" );
  
          getLogger().getChildLogger( "init" ).debug( "ready" );
          if( getLogger().isInfoEnabled() )
          {
              getLogger().info( "ready" );
          }
      }
  
      //=======================================================================
      // Startable
      //=======================================================================
  
      /**
       * Start the component.
       * @exception Exception if an error eoccurs
       */
      public void start() throws Exception
      {
          getLogger().debug( "starting" );
          m_continue = true;
          m_thread = new Thread(
              new Runnable()
              {
                  public void run()
                  {
                      while( m_continue )
                      {
                          try
                          {
                              Thread.currentThread().sleep( 100 );
                          }
                          catch( Throwable e )
                          {
                              // ignore it
                          }
                      }
                  }
              }
          );
          m_thread.start();
          getLogger().debug( "started" );
      }
  
      /**
       * Stop the component.
       */
      public void stop()
      {
          getLogger().debug( "stopping" );
          m_continue = false;
          try
          {
              m_thread.join();
          }
          catch( Throwable e )
          {
              // timeout
          }
      }
  
  
      //=======================================================================
      // Disposable
      //=======================================================================
  
      /**
       * Dispose of the component.
       */
      public void dispose()
      {
          if( getLogger().isDebugEnabled() )
          {
              getLogger().debug( "dispose" );
          }
  
          m_manager.release( m_simple );
          m_manager.release( m_basic );
          m_manager = null;
      }
  
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/playground/ComplexComponent.xinfo
  
  Index: ComplexComponent.xinfo
  ===================================================================
  <?xml version="1.0"?>
  <!DOCTYPE type
        PUBLIC "-//AVALON/Component Type DTD Version 1.0//EN"
               "http://jakarta.apache.org/avalon/dtds/meta/type_1_1.dtd" >
  
  <!--  
  Copyright (C) The Apache Software Foundation. All rights reserved.
  This software is published under the terms of the Apache Software License
  version 1.1, a copy of which has been included with this distribution in
  the LICENSE.txt file.
  
  @author  Avalon Development Team
  @version 1.0 12/03/2001
  -->
  
  <type>
  
    <info>
      <name>complex</name>
    </info>
  
    <loggers>
       <logger name="init"/>
    </loggers>
  
    <dependencies>
        <dependency>
          <role>basic</role>
          <reference type="org.apache.avalon.playground.BasicService" version="1.1"/>
        </dependency>
        <dependency>
          <role>simple</role>
          <reference type="org.apache.avalon.playground.SimpleService"/>
        </dependency>
    </dependencies>
  
  </type>
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/playground/DemoManager.java
  
  Index: DemoManager.java
  ===================================================================
  /* ==================================================================== 
   * The Apache Software License, Version 1.1 
   * 
   * Copyright (c) 2002 The Apache Software Foundation. All rights 
   * reserved. 
   * 
   * Redistribution and use in source and binary forms, with or without 
   * modification, are permitted provided that the following conditions 
   * are met: 
   * 
   * 1. Redistributions of source code must retain the above copyright 
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software 
   *    itself, if and wherever such third-party acknowledgments  
   *    normally appear.
   *
   * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation" 
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see 
   * <http://www.apache.org/>.
   */ 
  
  package org.apache.avalon.playground;
  
  import org.apache.avalon.framework.activity.Disposable;
  import org.apache.avalon.framework.activity.Initializable;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.avalon.lifecycle.Accessor;
  import org.apache.avalon.lifecycle.Creator;
  
  /**
   * Definition of an extension type that logs messages related to
   * all lifestyle stages.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   */
  public class DemoManager extends AbstractLogEnabled
      implements Creator, Accessor, Initializable, Disposable
  {
  
      //=======================================================================
      // Initializable
      //=======================================================================
  
      /**
       * Initialization of the component. Simply demonstrates that this is
       * a real componet that can implement any lifcycle stage in the role of
       * classic component.
       */
      public void initialize()
      {
          getLogger().debug( "initializing extension" );
      }
  
      //=======================================================================
      // Creator
      //=======================================================================
  
      /**
       * Invoked by a container to handle a create stage action.
       * @param target the object to handle
       * @param context the context supplied to the extension by container
       *   corresponding to its extension context criteria
       * @exception Exception if an error occurs
       */
      public void create( Object target, Context context ) throws Exception
      {
          if( target instanceof Demonstratable )
          {
              ( (Demonstratable)target ).demo( "create id: "
                                               + System.identityHashCode( this )
                                               + ", " + Thread.currentThread() );
          }
      }
  
      /**
       * Invoked by a container to handle a destroy stage action.
       * @param target the object to handle
       * @param context the context supplied to the extension by container
       *   corresponding to its extension context criteria
       */
      public void destroy( Object target, Context context )
      {
          if( target instanceof Demonstratable )
          {
              ( (Demonstratable)target ).demo( "destroy id: "
                                               + System.identityHashCode( this )
                                               + ", " + Thread.currentThread() );
          }
      }
  
      /**
       * Invoked by a container to handle a access stage action.
       * @param target the object to handle
       * @param context the context supplied to the extension by container
       *   corresponding to its extension context criteria
       * @exception Exception if an error occurs
       */
      public void access( Object target, Context context ) throws Exception
      {
          if( target instanceof Demonstratable )
          {
              ( (Demonstratable)target ).demo( "access id: "
                                               + System.identityHashCode( this )
                                               + ", " + Thread.currentThread() );
          }
      }
  
      /**
       * Invoked by a container to handle a release stage action.
       * @param target the object to handle
       * @param context the context supplied to the extension by container
       *   corresponding to its extension context criteria
       */
      public void release( Object target, Context context )
      {
          if( target instanceof Demonstratable )
          {
              ( (Demonstratable)target ).demo( "release id: "
                                               + System.identityHashCode( this )
                                               + ", " + Thread.currentThread() );
          }
      }
  
      //=======================================================================
      // Disposable
      //=======================================================================
  
      /**
       * Disposal of the component.
       */
      public void dispose()
      {
          if( getLogger().isDebugEnabled() )
          {
              getLogger().debug( "dispose" );
          }
      }
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/playground/DemoManager.xinfo
  
  Index: DemoManager.xinfo
  ===================================================================
  <?xml version="1.0"?>
  <!DOCTYPE type
        PUBLIC "-//AVALON/Component Type DTD Version 1.0//EN"
               "http://jakarta.apache.org/avalon/dtds/meta/type_1_1.dtd" >
  
  <!--  
  Copyright (C) The Apache Software Foundation. All rights reserved.
  This software is published under the terms of the Apache Software License
  version 1.1, a copy of which has been included with this distribution in
  the LICENSE.txt file.
  
  @author  Avalon Development Team
  @version 1.0 12/03/2001
  -->
  
  <!--
  Definition of the extension type phase support.  This demonstrates the 
  use of a lifestyle policy inside an extension handler.
  -->
  
  <type>
  
    <info>
      <name>demonstratable</name>
      <attributes>
        <attribute key="avalon:lifestyle" value="thread"/>
      </attributes>
    </info>
  
    <!--
    Declaration of the lifecycle support phases that this manager provides. 
    -->
    <extensions>
  
      <!--
      Each extension has a name, a versioned interface reference, and optional 
      attributes.
      -->
      <extension stage="ALL">
        <name>demonstrate</name>
        <reference type="org.apache.avalon.playground.Demonstratable" version="1.0"/>
        <attributes>
          <attribute key="status" value="experimental"/>
        </attributes>
      </extension>
  
    </extensions>
  
  </type>
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/playground/Demonstratable.java
  
  Index: Demonstratable.java
  ===================================================================
  /* ==================================================================== 
   * The Apache Software License, Version 1.1 
   * 
   * Copyright (c) 2002 The Apache Software Foundation. All rights 
   * reserved. 
   * 
   * Redistribution and use in source and binary forms, with or without 
   * modification, are permitted provided that the following conditions 
   * are met: 
   * 
   * 1. Redistributions of source code must retain the above copyright 
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software 
   *    itself, if and wherever such third-party acknowledgments  
   *    normally appear.
   *
   * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation" 
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see 
   * <http://www.apache.org/>.
   */ 
  
  package org.apache.avalon.playground;
  
  /**
   * A stage interface.
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   */
  public interface Demonstratable
  {
      /**
       * Do something or other.
       * @param stage the stage being applied (as a string)
       */
      void demo( String stage );
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/playground/Exploitable.java
  
  Index: Exploitable.java
  ===================================================================
  /* ==================================================================== 
   * The Apache Software License, Version 1.1 
   * 
   * Copyright (c) 2002 The Apache Software Foundation. All rights 
   * reserved. 
   * 
   * Redistribution and use in source and binary forms, with or without 
   * modification, are permitted provided that the following conditions 
   * are met: 
   * 
   * 1. Redistributions of source code must retain the above copyright 
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software 
   *    itself, if and wherever such third-party acknowledgments  
   *    normally appear.
   *
   * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation" 
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see 
   * <http://www.apache.org/>.
   */ 
  
  package org.apache.avalon.playground;
  
  /**
   * Another example extension stage interface.
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   */
  public interface Exploitable
  {
      /**
       * Method invoked by the extension handler for this type during
       * the create stage.
       */
      void incarnate();
  
      /**
       * Method invoked by the extension handler for this type during
       * the destroy stage.
       */
      void etherialize();
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/playground/ExploitationManager.java
  
  Index: ExploitationManager.java
  ===================================================================
  /* ==================================================================== 
   * The Apache Software License, Version 1.1 
   * 
   * Copyright (c) 2002 The Apache Software Foundation. All rights 
   * reserved. 
   * 
   * Redistribution and use in source and binary forms, with or without 
   * modification, are permitted provided that the following conditions 
   * are met: 
   * 
   * 1. Redistributions of source code must retain the above copyright 
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software 
   *    itself, if and wherever such third-party acknowledgments  
   *    normally appear.
   *
   * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation" 
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see 
   * <http://www.apache.org/>.
   */ 
  
  package org.apache.avalon.playground;
  
  import org.apache.avalon.framework.activity.Disposable;
  import org.apache.avalon.framework.activity.Initializable;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.avalon.lifecycle.Creator;
  
  /**
   * Definition of an extension handler that handles the Expoitable
   * extension stage interface.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   */
  public class ExploitationManager extends AbstractLogEnabled implements Creator, Initializable, Disposable
  {
  
      //=======================================================================
      // Initializable
      //=======================================================================
  
      /**
       * Initialization of the handler.
       */
      public void initialize()
      {
          getLogger().info( "initialize" );
      }
  
      //=======================================================================
      // Disposable
      //=======================================================================
  
      /**
       * Disposal of the handler.
       */
      public void dispose()
      {
          getLogger().info( "dispose" );
      }
  
      //=======================================================================
      // Extension
      //=======================================================================
  
      /**
       * Handle the creation stage.
       * @param object the object to handle
       * @param context the extension stage context
       * @exception Exception if a stage execution error occurs
       */
      public void create( Object object, Context context ) throws Exception
      {
          if( object instanceof Exploitable )
          {
              ( (Exploitable)object ).incarnate();
          }
      }
  
      /**
       * Handle the destroy stage.
       * @param object the object to handle
       * @param context the extension stage context
       */
      public void destroy( Object object, Context context )
      {
          if( object instanceof Exploitable )
          {
              ( (Exploitable)object ).etherialize();
          }
      }
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/playground/ExploitationManager.xinfo
  
  Index: ExploitationManager.xinfo
  ===================================================================
  <?xml version="1.0"?>
  <!DOCTYPE type
        PUBLIC "-//AVALON/Component Type DTD Version 1.0//EN"
               "http://jakarta.apache.org/avalon/dtds/meta/type_1_1.dtd" >
  
  <!--  
  Copyright (C) The Apache Software Foundation. All rights reserved.
  This software is published under the terms of the Apache Software License
  version 1.1, a copy of which has been included with this distribution in
  the LICENSE.txt file.
  
  @author  Avalon Development Team
  @version 1.0 12/03/2001
  -->
  
  <!--
  Definition of the extension type phase support.
  -->
  
  <type>
  
    <info>
      <name>exploit</name>
    </info>
  
    <!--
    Declaration of the lifecycle support phases that this manager provides. 
    -->
    <extensions>
  
      <!--
      Each extension has a name, a versioned interface reference, and optional 
      attributes.
      -->
      <extension stage="ALL">
        <name>exploit</name>
        <reference type="org.apache.avalon.playground.Exploitable" version="1.0"/>
        <attributes>
          <attribute key="status" value="experimental"/>
        </attributes>
      </extension>
  
    </extensions>
  
  </type>
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/playground/InvalidComponent.java
  
  Index: InvalidComponent.java
  ===================================================================
  /* ==================================================================== 
   * The Apache Software License, Version 1.1 
   * 
   * Copyright (c) 2002 The Apache Software Foundation. All rights 
   * reserved. 
   * 
   * Redistribution and use in source and binary forms, with or without 
   * modification, are permitted provided that the following conditions 
   * are met: 
   * 
   * 1. Redistributions of source code must retain the above copyright 
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software 
   *    itself, if and wherever such third-party acknowledgments  
   *    normally appear.
   *
   * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation" 
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see 
   * <http://www.apache.org/>.
   */ 
  
  package org.apache.avalon.playground;
  
  /**
   * This is a minimal demonstration component that is declared with an invalid service dependency.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   */
  public class InvalidComponent
  {
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/playground/InvalidComponent.xinfo
  
  Index: InvalidComponent.xinfo
  ===================================================================
  <?xml version="1.0"?>
  <!DOCTYPE type
        PUBLIC "-//AVALON/Component Type DTD Version 1.0//EN"
               "http://jakarta.apache.org/avalon/dtds/meta/type_1_1.dtd" >
  
  <!--  
  Copyright (C) The Apache Software Foundation. All rights reserved.
  This software is published under the terms of the Apache Software License
  version 1.1, a copy of which has been included with this distribution in
  the LICENSE.txt file.
  
  @author  Avalon Development Team
  @version 1.0 12/03/2001
  -->
  
  <type>
  
    <info>
      <name>invalid</name>
    </info>
  
    <dependencies>
        <dependency>
            <role>silly</role>
            <reference type="org.apache.avalon.playground.InvalidService"/>
        </dependency>
    </dependencies>
  
  </type>
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/playground/NullService.java
  
  Index: NullService.java
  ===================================================================
  /* ==================================================================== 
   * The Apache Software License, Version 1.1 
   * 
   * Copyright (c) 2002 The Apache Software Foundation. All rights 
   * reserved. 
   * 
   * Redistribution and use in source and binary forms, with or without 
   * modification, are permitted provided that the following conditions 
   * are met: 
   * 
   * 1. Redistributions of source code must retain the above copyright 
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software 
   *    itself, if and wherever such third-party acknowledgments  
   *    normally appear.
   *
   * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation" 
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see 
   * <http://www.apache.org/>.
   */ 
  
  package org.apache.avalon.playground;
  
  /**
   * The <code>NullService</code> does nothing.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   */
  public interface NullService
  {
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/playground/SimpleComponent.java
  
  Index: SimpleComponent.java
  ===================================================================
  /* ==================================================================== 
   * The Apache Software License, Version 1.1 
   * 
   * Copyright (c) 2002 The Apache Software Foundation. All rights 
   * reserved. 
   * 
   * Redistribution and use in source and binary forms, with or without 
   * modification, are permitted provided that the following conditions 
   * are met: 
   * 
   * 1. Redistributions of source code must retain the above copyright 
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software 
   *    itself, if and wherever such third-party acknowledgments  
   *    normally appear.
   *
   * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation" 
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see 
   * <http://www.apache.org/>.
   */ 
  
  package org.apache.avalon.playground;
  
  import org.apache.avalon.framework.activity.Disposable;
  import org.apache.avalon.framework.activity.Initializable;
  import org.apache.avalon.framework.activity.Startable;
  import org.apache.avalon.framework.configuration.Configurable;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.avalon.framework.service.ServiceException;
  import org.apache.avalon.framework.service.ServiceManager;
  import org.apache.avalon.framework.service.Serviceable;
  
  /**
   * This is a minimal demonstration component that a dependency on
   * BasicService and provides SimpleService.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   */
  public class SimpleComponent extends AbstractLogEnabled
      implements Configurable, Serviceable, Initializable, Startable, SimpleService,
      Exploitable, Demonstratable, Disposable
  {
  
      private String m_message;
      private BasicService m_basic;
      private Thread m_thread;
      private boolean m_continuation = false;
  
      //=======================================================================
      // Configurable
      //=======================================================================
  
      /**
       * Configurate the component.
       * @param config the configuration
       */
      public void configure( Configuration config )
      {
          getLogger().debug( "configure" );
          m_message = config.getChild( "message" ).getValue( null );
      }
  
      //=======================================================================
      // Serviceable
      //=======================================================================
  
      /**
       * Service the component.
       * @param manager the service manager holding the depedent services
       * @exception ServiceException if a service error occurs
       */
      public void service( ServiceManager manager ) throws ServiceException
      {
          getLogger().debug( "service" );
          m_basic = (BasicService)manager.lookup( "basic" );
          manager.release( m_basic );
      }
  
      //=======================================================================
      // Exploitable
      //=======================================================================
  
      /**
       * The create stage interface implementation for the Exloitable extension.
       */
      public void incarnate()
      {
          getLogger().info( "incarnation stage" );
      }
  
      /**
       * The destroy stage interface implementation for the Exloitable extension.
       */
      public void etherialize()
      {
          getLogger().info( "etherialize stage" );
      }
  
  
      //=======================================================================
      // Demonstratable
      //=======================================================================
  
      /**
       * Prints out the supplied message.
       * @param message the message to print
       */
      public void demo( String message )
      {
          getLogger().info( message );
      }
  
      //=======================================================================
      // Initializable
      //=======================================================================
  
      /**
       * Initialization of the component.
       */
      public void initialize()
      {
          getLogger().debug( "initialize" );
          getLogger().info( "context type manager: " + Thread.currentThread().getContextClassLoader() );
          doObjective();
      }
  
      //=======================================================================
      // Startable
      //=======================================================================
  
      /**
       * Starts the component.
       * @exception Exception if an error occurs
       */
      public void start() throws Exception
      {
          getLogger().debug( "starting" );
          m_continuation = true;
          m_thread = new Thread(
              new Runnable()
              {
                  public void run()
                  {
                      while( m_continuation )
                      {
                          try
                          {
                              Thread.currentThread().sleep( 100 );
                          }
                          catch( Throwable e )
                          {
                              // ignore it
                          }
                      }
                  }
              }
          );
          m_thread.start();
          getLogger().debug( "started" );
      }
  
      /**
       * Stops the component.
       */
      public void stop()
      {
          getLogger().debug( "stopping" );
          m_continuation = false;
          try
          {
              m_thread.join();
          }
          catch( Throwable e )
          {
              // timeout
          }
      }
  
      //=======================================================================
      // Disposable
      //=======================================================================
  
      /**
       * Dispose of the component.
       */
      public void dispose()
      {
          getLogger().debug( "dispose" );
      }
  
      //=======================================================================
      // PrimaryService
      //=======================================================================
  
      /**
       * Prints out the message derived from the configuration.
       */
      public void doObjective()
      {
          getLogger().info( "message: " + m_message );
      }
  
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/playground/SimpleComponent.xconfig
  
  Index: SimpleComponent.xconfig
  ===================================================================
  <?xml version="1.0"?>
  
  <!--  
  Copyright (C) The Apache Software Foundation. All rights reserved.
  This software is published under the terms of the Apache Software License
  version 1.1, a copy of which has been included with this distribution in
  the LICENSE.txt file.
  
  @author  Avalon Development Team
  @version 1.0 12/03/2001
  -->
  
  <!--
  The .xconfig file contains the default configuration for the component.
  -->
  
  <configuration>
     <message>Hello.</message>
  </configuration>
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/playground/SimpleComponent.xinfo
  
  Index: SimpleComponent.xinfo
  ===================================================================
  <?xml version="1.0"?>
  <!DOCTYPE type
        PUBLIC "-//AVALON/Component Type DTD Version 1.0//EN"
               "http://jakarta.apache.org/avalon/dtds/meta/type_1_1.dtd" >
  
  <!--  
  Copyright (C) The Apache Software Foundation. All rights reserved.
  This software is published under the terms of the Apache Software License
  version 1.1, a copy of which has been included with this distribution in
  the LICENSE.txt file.
  
  @author  Avalon Development Team
  @version 1.0 12/03/2001
  -->
  
  <type>
  
    <info>
      <name>simple</name>
    </info>
  
    <services>
      <service>
        <attributes>
          <attribute key="avalon:service.servlet" 
            value="simple.jsp"/>
        </attributes> 
        <reference type="org.apache.avalon.playground.SimpleService"/>
      </service>
    </services>
  
    <dependencies>
  
        <!-- 
        Declaration of the services that this component type is 
        dependent on.
        -->
        <dependency>
          <role>basic</role>
          <reference type="org.apache.avalon.playground.BasicService" version="1.1"/>
        </dependency>
  
    </dependencies>
  
    <!-- 
    Declaration of the extended lifecycle phases that this component type will require.  
    Each phase element contains a reference to a lifecycle phase interface that 
    the container has to manage.
    -->
    <stages>
       <stage>
          <reference type="org.apache.avalon.playground.Exploitable" version="1.0"/>
       </stage>
       <stage>
          <reference type="org.apache.avalon.playground.Demonstratable"/>
       </stage>
    </stages>
  
  </type>
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/playground/SimpleService.java
  
  Index: SimpleService.java
  ===================================================================
  /* ==================================================================== 
   * The Apache Software License, Version 1.1 
   * 
   * Copyright (c) 2002 The Apache Software Foundation. All rights 
   * reserved. 
   * 
   * Redistribution and use in source and binary forms, with or without 
   * modification, are permitted provided that the following conditions 
   * are met: 
   * 
   * 1. Redistributions of source code must retain the above copyright 
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software 
   *    itself, if and wherever such third-party acknowledgments  
   *    normally appear.
   *
   * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation" 
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see 
   * <http://www.apache.org/>.
   */ 
  
  package org.apache.avalon.playground;
  
  /**
   * The <code>SimpleService</code> executes an objective.
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   */
  
  public interface SimpleService
  {
  
      /**
       * Execute the prime objective of this services.
       */
      void doObjective();
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/playground/TerminalComponent.java
  
  Index: TerminalComponent.java
  ===================================================================
  /* ==================================================================== 
   * The Apache Software License, Version 1.1 
   * 
   * Copyright (c) 2002 The Apache Software Foundation. All rights 
   * reserved. 
   * 
   * Redistribution and use in source and binary forms, with or without 
   * modification, are permitted provided that the following conditions 
   * are met: 
   * 
   * 1. Redistributions of source code must retain the above copyright 
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *    "This product includes software developed by the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software 
   *    itself, if and wherever such third-party acknowledgments  
   *    normally appear.
   *
   * 4. The names "Jakarta", "Avalon", and "Apache Software Foundation" 
   *    must not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see 
   * <http://www.apache.org/>.
   */ 
  
  package org.apache.avalon.playground;
  
  import org.apache.avalon.framework.activity.Disposable;
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  
  /**
   * This is a minimal demonstration component that provides BasicService
   * and has no dependencies
   *
   * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a>
   */
  public class TerminalComponent extends AbstractLogEnabled
      implements BasicService, Disposable
  {
  
      //=======================================================================
      // BasicService
      //=======================================================================
  
      /**
       * Does something trivial.
       */
      public void doPrimeObjective()
      {
          getLogger().info( "hello from TerminalComponent" );
      }
  
      /**
       * Disposal of the componet.
       */
      public void dispose()
      {
          getLogger().debug( "dispose" );
      }
  
  }
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/playground/TerminalComponent.xinfo
  
  Index: TerminalComponent.xinfo
  ===================================================================
  <?xml version="1.0"?>
  <!DOCTYPE type
        PUBLIC "-//AVALON/Component Type DTD Version 1.0//EN"
               "http://jakarta.apache.org/avalon/dtds/meta/type_1_1.dtd" >
  
  <type>
  
    <info>
      <name>terminal-component</name>
    </info>
  
    <services>
      <service> 
        <reference type="org.apache.avalon.playground.BasicService" version="1.1"/>
      </service> 
    </services>
  
  </type>
  
  
  
  
  1.1                  avalon-sandbox/assembly/src/test/org/apache/avalon/playground/package.html
  
  Index: package.html
  ===================================================================
  
  <body>
  <p>
  Demonstration components.
  </p>
  
  </body>
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>