mcconnell 2003/01/26 19:27:46 Modified: merlin build.xml default.properties merlin/src/java/org/apache/avalon/merlin/kernel/impl DefaultKernel.java KernelLoader.java package.html merlin/src/test/config james.xml Added: merlin merlin.bat merlin/config demo.xml james.xml merlin/external commons-cli-1.0.jar merlin/src/java BootstrapRuntimeException.java Merlin.java Resources.properties Resources_fr.properties package.html Removed: merlin blocks.xml demo.bat kernel.xml merlin.properties merlin/src/java/org/apache/avalon/merlin/bootstrap BootstrapRuntimeException.java Merlin.java package.html Log: Reimplimentation of the bootstrap classes using the commons CLI package. Revision Changes Path 1.12 +54 -10 avalon-sandbox/merlin/build.xml Index: build.xml =================================================================== RCS file: /home/cvs/avalon-sandbox/merlin/build.xml,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- build.xml 19 Jan 2003 15:49:03 -0000 1.11 +++ build.xml 27 Jan 2003 03:27:45 -0000 1.12 @@ -19,6 +19,12 @@ <property file="${basedir}/default.properties"/> <!-- Classpath for product --> + <path id="bootstrap.class.path"> + <pathelement location="${commons-cli.jar}"/> + <pathelement location="${excalibur-i18n.jar}"/> + </path> + + <!-- Classpath for product --> <path id="project.class.path"> <pathelement location="${logkit.jar}"/> <pathelement location="${avalon-framework.jar}"/> @@ -97,8 +103,9 @@ <target name="context-bootstrap"> <mkdir dir="${lib.dir}"/> <uptodate property="uptodate-bootstrap" targetfile="${build.lib}/${bootstrap.jar}"> - <srcfiles dir="${src.dir}"> + <srcfiles dir="${java.dir}"> <include name="**/bootstrap/**/*.*"/> + <include name="*.*"/> </srcfiles> <srcfiles dir="${lib.dir}"> <include name="**/*.*"/> @@ -123,8 +130,10 @@ target="1.2"> <src path="${java.dir}" /> <classpath refid="project.class.path" /> + <exclude name="Merlin.java"/> + <exclude name="BootstrapRuntimeException.java"/> + <exclude name="Resources.properties"/> <exclude name="**/playground/**/*.java"/> - <exclude name="**/bootstrap/**/*.java"/> <include name="**/*.java"/> </javac> @@ -153,7 +162,10 @@ deprecation="${build.deprecation}" target="1.2"> <src path="${java.dir}" /> - <include name="**/bootstrap/**/*.java"/> + <include name="Merlin.java"/> + <include name="BootstrapRuntimeException.java"/> + <include name="Resources.properties"/> + <classpath refid="bootstrap.class.path" /> </javac> </target> @@ -193,14 +205,41 @@ </target> - <target name="bootstrap.jar" depends="compile-bootstrap" description="Generates the jar files" unless="uptodate-bootstrap"> + + <!-- + Creation of the bootstrap jar file. This contains the Excalibut i18n classes and the + commons CLI classes together with a Merlin bootstrap and related i18n resource class. + --> + + <target name="bootstrap.jar" depends="compile-bootstrap" + description="Generates the jar files" unless="uptodate-bootstrap"> + <mkdir dir="${build.lib}"/> + + <unzip src="${excalibur-i18n.jar}" dest="${build.bootstrap}"/> + <unzip src="${commons-cli.jar}" dest="${build.bootstrap}"/> + + <copy todir="${build.bootstrap}"> + <fileset dir="${java.dir}"> + <exclude name="*.java"/> + </fileset> + </copy> + <jar jarfile="${build.lib}/${bootstrap.jar}" basedir="${build.bootstrap}" compress="${build.compress}" > + + <exclude name="META-INF/**/*.*"/> + + <manifest> + <attribute name="Main-Class" value="Merlin"/> + </manifest> + </jar> + </target> + <target name="deploy" depends="jar"> <mkdir dir="${common.dir}"/> @@ -239,11 +278,11 @@ <target name="javadocs" depends="compile" description="Generates the javadocs" unless="skip.javadocs"> <mkdir dir="${build.javadocs}"/> - <javadoc packagenames="org.apache.avalon.merlin.*" - sourcepath="${java.dir}" - destdir="${build.javadocs}"> - <classpath refid="project.class.path" /> + <javadoc sourcepath="${java.dir}" packagenames="*,*.*" + destdir="${build.javadocs}" overview="${java.dir}/package.html"> + <classpath refid="project.class.path" /> <group title="Kernel"> + <package name=""/> <package name="org.apache.avalon.merlin"/> <package name="org.apache.avalon.merlin.kernel"/> <package name="org.apache.avalon.merlin.kernel.*"/> @@ -343,7 +382,12 @@ </target> <target name="docs" depends="xdocs, javadocs" - description="generates all the Avalon documentation"/> + description="generates all the Avalon documentation"> + <copy todir="${dist.docs}"> + <fileset dir="${build.docs}/docs"> + </fileset> + </copy> + </target> <target name="xdocs" description="generates the xdocs-based documentation"> <ant antfile="${basedir}/../cocoonbuild.xml"/> @@ -354,7 +398,7 @@ <mkdir dir="../site/dist/docs/${dir-name}"/> <copy todir="../site/dist/docs/${dir-name}"> <fileset dir="${build.docs}"> - <include name="**"/> + <exclude name="api/**"/> </fileset> </copy> </target> 1.11 +10 -3 avalon-sandbox/merlin/default.properties Index: default.properties =================================================================== RCS file: /home/cvs/avalon-sandbox/merlin/default.properties,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- default.properties 23 Jan 2003 23:25:03 -0000 1.10 +++ default.properties 27 Jan 2003 03:27:45 -0000 1.11 @@ -5,7 +5,8 @@ # Overridden by ../default.properties and all ant.properties # Not user-editable; use ant.properties files instead -name=avalon-merlin +codename=merlin +name=avalon-${codename} Name=Merlin Service Management System dir-name=merlin version=1.0 @@ -18,6 +19,10 @@ # REQUIRED LIBRARIES # -------------------------------------------------- +# ----- External jars ----- +external.lib=${basedir}/external +commons-cli.jar=${external.lib}/commons-cli-1.0.jar + # ----- Avalon Framework ----- avalon-framework.home=${basedir}/../../jakarta-avalon avalon-framework.lib=${avalon-framework.home}/target/lib @@ -112,6 +117,7 @@ # location of intermediate products build.dir = build +build.merge = ${build.dir}/merge build.testsrc = ${build.dir}/testsrc build.bootstrap = ${build.dir}/bootstrap build.playground = ${build.dir}/playground @@ -137,14 +143,15 @@ # Set the properties for distribution directories dist.dir = dist -dist.javadocs = ${dist.dir}/docs/api +dist.docs = ${dist.dir}/docs +dist.javadocs = ${dist.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}-${package-version}.jar -bootstrap.jar = ${name}-bootstrap-${package-version}.jar +bootstrap.jar = ${codename}-bootstrap-${package-version}.jar # property indicating directory where all distribution archives are placed dist.base = distributions 1.1 avalon-sandbox/merlin/merlin.bat Index: merlin.bat =================================================================== @echo off java -jar build\lib\merlin-bootstrap-2.1.jar %1 %2 %3 %4 %5 %6 1.1 avalon-sandbox/merlin/config/demo.xml Index: demo.xml =================================================================== <kernel> <!-- The kernel can contain the following declarations: 1. a system descriptor 2. a logging descriptor 3. a logging catagories descriptor that establishes logging priority for the kernel messages 4. an engine descriptor 5. a blocks descriptor --> <system host="localhost"/> <logging target="default" priority="INFO"> <category name="/sys/logger" priority="WARN"/> <target name="kernel"> <file location="kernel.log" /> </target> </logging> <categories> <category name="/sys" priority="INFO"/> </categories> <engine/> <blocks> <block name="playground" path="../assembly/build/lib/avalon-assembly-demo-1.0.jar" enabled="true" /> <block name="demo" src="src/test/config/demo.xml" enabled="true"> <configuration target="standard"> <message>Configuration from target in blocks.xml.</message> </configuration> </block> </blocks> </kernel> 1.1 avalon-sandbox/merlin/config/james.xml Index: james.xml =================================================================== <kernel> <!-- The kernel can contain the following declarations: 1. a system descriptor 2. a logging descriptor 3. a logging catagories descriptor that establishes logging priority for the kernel messages 4. an engine descriptor --> <system host="localhost"/> <logging target="default" priority="INFO"> <category name="/sys/logger" priority="WARN"/> <target name="kernel"> <file location="kernel.log" /> </target> </logging> <categories> <category name="/sys" priority="INFO"/> </categories> <engine/> <blocks> <block name="james" src="src/test/config/james.xml" enabled="true" > <configuration target="dns"> <servers> <server>212.198.0.66</server> <server>212.198.0.67</server> <server>192.112.36.4</server> </servers> <authoritative>false</authoritative> </configuration> <configuration target="remote"> <port>4555</port> <helloName autodetect="TRUE">myMailServer</helloName> <administrator_accounts> <account login="root" password="root"/> </administrator_accounts> <connectiontimeout> 60000 </connectiontimeout> </configuration> </block> </blocks> </kernel> 1.1 avalon-sandbox/merlin/external/commons-cli-1.0.jar <<Binary file>> 1.1 avalon-sandbox/merlin/src/java/BootstrapRuntimeException.java Index: BootstrapRuntimeException.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 [EMAIL PROTECTED] 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/>. */ /** * Exception to indicate that there was a bootstrap related runtime error. * * @author <a href="mailto:avalon-dev@jakarta.apache.org">Avalon Development Team</a> * @version $Revision: 1.1 $ $Date: 2003/01/27 03:27:45 $ */ public final class BootstrapRuntimeException extends RuntimeException { private Throwable m_cause; private String[] m_actions = new String[0]; /** * Construct a new <code>BootstrapRuntimeException</code> instance. * * @param message The detail message for this exception. */ public BootstrapRuntimeException( final String message ) { this( message, (String) null, (Throwable) null ); } /** * Construct a new <code>BootstrapRuntimeException</code> instance. * * @param message The detail message for this exception. * @param throwable the root cause of the exception */ public BootstrapRuntimeException( final String message, final Throwable throwable ) { this( message, (String) null, throwable ); } /** * Construct a new <code>BootstrapRuntimeException</code> instance. * * @param message The detail message for this exception. * @param action recommended action */ public BootstrapRuntimeException( final String message, String action ) { this( message, action, null ); } /** * Construct a new <code>BootstrapRuntimeException</code> instance. * * @param message The detail message for this exception. * @param action recommended action * @param throwable the root cause of the exception */ public BootstrapRuntimeException( final String message, String action, final Throwable throwable ) { this( message, new String[]{ action }, null ); } /** * Construct a new <code>BootstrapRuntimeException</code> instance. * * @param message The detail message for this exception. * @param action recommended action * @param throwable the root cause of the exception */ public BootstrapRuntimeException( final String message, String[] actions, final Throwable throwable ) { super( message ); m_cause = throwable; m_actions = actions; } /** * Returns the cause of the error. * @return the causal exception */ public Throwable getCause() { return m_cause; } /** * Returns the recommended corrective action pertaining to the error condition. * @return the recommended corrective action. */ public String[] getActions() { return m_actions; } } 1.1 avalon-sandbox/merlin/src/java/Merlin.java Index: Merlin.java =================================================================== import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.FileNotFoundException; import java.io.InputStream; import java.util.Properties; import java.util.Date; import java.util.List; import java.util.ArrayList; import java.util.Locale; import java.net.URL; import java.net.URLClassLoader; import java.lang.reflect.Constructor; import org.apache.commons.cli.Option; import org.apache.commons.cli.Options; import org.apache.commons.cli.OptionBuilder; import org.apache.commons.cli.CommandLineParser; import org.apache.commons.cli.BasicParser; import org.apache.commons.cli.ParseException; import org.apache.commons.cli.HelpFormatter; import org.apache.commons.cli.CommandLine; import org.apache.avalon.excalibur.i18n.ResourceManager; import org.apache.avalon.excalibur.i18n.Resources; /** * Merlin commandline bootstrap handler. */ public class Merlin { //-------------------------------------------------------------------------- // static //-------------------------------------------------------------------------- private static final String PRODUCT = "Merlin"; private static final String VERSION = "2.1"; private static final File HOME = new File( System.getProperty( "user.dir" ) ); private static final String MERLIN_KERNEL_LOADER_CLASSNAME = "org.apache.avalon.merlin.kernel.impl.KernelLoader"; private static Resources I18N = ResourceManager.getPackageResources( Merlin.class ); private static Options CL_OPTIONS = buildCommandLineOptions(); private static URLClassLoader CLASSLOADER; private static URLClassLoader COMMON; private static File BASE; private static File PROFILE; private static Options buildCommandLineOptions() { // create Options object Options options = new Options(); Option help = new Option( "help", I18N.getString( "cli-help-description" ) ); Option version = new Option( "version", I18N.getString( "cli-version-description" ) ); Option debug = new Option( "debug", I18N.getString( "cli-debug-description" ) ); Option locale = OptionBuilder .hasArg() .withArgName( "code" ) .withDescription( I18N.getString( "cli-language-description" ) ) .create( "language" ); Option home = OptionBuilder .hasArg() .withArgName( I18N.getString( "directory" ) ) .withDescription( I18N.getString( "cli-home-description" ) ) .create( "home" ); Option system = OptionBuilder .hasArg() .withArgName( I18N.getString( "directory" ) ) .withDescription( I18N.getString( "cli-system-description" ) ) .create( "system" ); Option profile = OptionBuilder .hasArg() .withArgName( I18N.getString( "file" ) ) .withDescription( I18N.getString( "cli-profile-description" ) ) .create( "profile" ); options.addOption( help ); options.addOption( version ); options.addOption( debug ); options.addOption( system ); options.addOption( home ); options.addOption( profile ); options.addOption( locale ); return options; } //-------------------------------------------------------------------------- // state //-------------------------------------------------------------------------- /** * Command line entry point to the Merlin system. * The main method handles the establishment of a bootstrap classloader, * installation directory and base working directory from which a root * [EMAIL PROTECTED] Kernel} is instantiated. * * @param args a set command line arguments * @see DefaultKernel */ public static void main( String[] args ) { CommandLineParser parser = new BasicParser(); try { CommandLine line = parser.parse( CL_OPTIONS, args ); if( line.hasOption( "language" ) ) { ResourceManager.clearResourceCache(); String language = line.getOptionValue( "language" ); Locale locale = new Locale( language ); I18N = ResourceManager.getPackageResources( Merlin.class, locale ); CL_OPTIONS = buildCommandLineOptions(); } if( line.hasOption( "help" ) ) { doHelp(); return; } if( line.hasOption( "version" ) ) { System.out.println( getVersionString() ); return; } // // it's this is a genuine deployment scenario - we need to resolve // the home and system directories, and the filename of the kernel // profile we are using // File home = getHomePath( line ); File system = getSystemPath( line ); File profile = getProfile( home, line ); if( !profile.exists() ) { File base = profile.getParentFile(); if( !base.exists() ) { final String error = "Deployment path directory does not exist.\ndirectory: " + base; throw new IllegalArgumentException( error ); } else { final String error = "Deployment profile does not exist\nfile: " + profile; throw new IllegalArgumentException( error ); } } if( !system.exists() ) { final String error = "System directory does not exist.\ndirectory: " + system; throw new IllegalArgumentException( error ); } if( !home.exists() ) { final String error = "Home directory does not exist.\ndirectory: " + home; throw new IllegalArgumentException( error ); } // // if we get this far we have a valid system, home and profile // so we can not go ahead with bootdstrap classpath construction // BASE = home; PROFILE = profile; boolean debug = line.hasOption( I18N.getString( "cli-debug-key" ) ); if( debug ) { System.out.println( "\n " + getVersionString() ); System.out.println( " " + new Date() ); System.out.println( "\n urn:merlin:system.dir: " + system ); System.out.println( " urn:merlin:system.profile: " + profile ); System.out.println( " urn:merlin:home.dir: " + home ); } File common = new File( system, "common" ); URL[] targets = getJarFiles( common ); COMMON = new URLClassLoader( targets ); if( debug ) { System.out.println( "\n shared libraries:\n" ); for( int i=0; i<targets.length; i++ ) { System.out.println(" " + targets[i] ); } } File lib = new File( system, "lib" ); URL[] libs = getJarFiles( lib ); CLASSLOADER = new URLClassLoader( libs, COMMON ); if( debug ) { System.out.println( "\n system libraries:\n" ); for( int i=0; i<libs.length; i++ ) { System.out.println(" " + libs[i] ); } } if( debug ) { System.out.println( "\n" ); } Thread.currentThread().setContextClassLoader( CLASSLOADER ); } catch( ParseException e ) { final String error = "\n" + e.getMessage(); System.err.println( error ); return; } catch( FileNotFoundException e ) { final String error = "\n" + e.getMessage(); System.err.println( error ); return; } catch( IllegalArgumentException e ) { final String error = "\n" + e.getMessage(); System.err.println( error ); return; } catch( IOException e ) { final String error = "\n" + e.toString(); System.err.println( error ); return; } Object kernelLoader = null; Class clazz; try { clazz = CLASSLOADER.loadClass( MERLIN_KERNEL_LOADER_CLASSNAME ); } catch( Throwable e ) { final String error = "Internal error during loader class creation."; throw new BootstrapRuntimeException( error, e ); } try { Constructor constructor = clazz.getConstructor( new Class[]{ClassLoader.class, ClassLoader.class, File.class, File.class } ); kernelLoader = constructor.newInstance( new Object[]{ CLASSLOADER, COMMON, BASE, PROFILE } ); } catch( Throwable e ) { final String error = "Internal error during loader instantiation."; e.printStackTrace(); throw new BootstrapRuntimeException( error, e ); } } private static String getVersionString() { return PRODUCT + " " + VERSION; } private static void doHelp() { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp( "merlin", CL_OPTIONS ); } private static File getProfile( File home, CommandLine command ) throws IOException { boolean flag = false; String filename = null; final String key = "profile"; if( command.hasOption( key ) ) { filename = command.getOptionValue( key ); } else { flag = true; filename = "profile.xml"; } try { File file = getFile( home, filename ); if( !file.isFile() ) { final String error = "Supplied profile argument does not refer to a file: " + file; } return file; } catch( FileNotFoundException fnfe ) { String error = "Could not locate profile: " + filename + " is the home directory: " + home; throw new FileNotFoundException( error ); } } private static File getHomePath( CommandLine command ) throws IOException { String path = null; File file = null; final String key = "home"; if( command.hasOption( key ) ) { path = command.getOptionValue( key ); file = getFile( HOME, path ); } else { file = HOME; } return file; } private static File getSystemPath( CommandLine command ) throws IOException { File file = getSysPath( command ); if( !file.exists() ) { final String error = "Supplied system path does not exist: " + file; throw new IllegalArgumentException( error ); } if( !file.isDirectory() ) { final String error = "Supplied system path does not refer to a directory: " + file; throw new IllegalArgumentException( error ); } File common = new File( file, "common" ); if( !common.exists() ) { final String error = "Supplied system path does not contain a 'common' subdirectory: " + file; throw new IllegalArgumentException( error ); } File lib = new File( file, "lib" ); if( !lib.exists() ) { final String error = "Supplied system path does not contain a 'lib' subdirectory: " + file; throw new IllegalArgumentException( error ); } return file; } private static File getSysPath( CommandLine command ) throws IOException { String path = null; final String key = "system"; if( command.hasOption( key ) ) { path = command.getOptionValue( key ); try { return getFile( HOME, path ); } catch( FileNotFoundException fnfe ) { final String error = "Supplied home path does not exist: " + path; throw new FileNotFoundException( error ); } } else { return HOME; } } private static File getFile( File base, String path ) throws IOException { if( path == null ) { throw new NullPointerException( "path" ); } if( base == null ) { throw new NullPointerException( "base" ); } File file = new File( path ); if( file.isAbsolute() ) { return file.getCanonicalFile(); } else { return new File( base, path ).getCanonicalFile(); } } private static URL[] getJarFiles( File base ) { List list = new ArrayList(); populateJars( list, base ); return (URL[]) list.toArray( new URL[0] ); } private static void populateJars( List list, File base ) { try { File[] files = base.listFiles(); for( int i=0; i<files.length; i++ ) { File file = files[i]; if( file.getName().endsWith( ".jar" ) ) { list.add( file.toURL() ); } } } catch( Throwable e ) { final String error = "Unexpected error while scanning files in common directory: " + base; throw new RuntimeException( error, e ); } } } 1.1 avalon-sandbox/merlin/src/java/Resources.properties Index: Resources.properties =================================================================== directory=directory file=file cli-help-description=Prints this message. cli-language-description=A two-letter language code. cli-version-description=Prints the Merlin system version number. cli-debug-description=Enable debug messages during the bootstrap phase. cli-home-description=A relative or absolute path to a working home directory. If not suppled, the system will default to the current directory. If the resolved home path does not exist it will be created. cli-system-description=An absolute or relative path to the directory containining the /common and /lib system directories. If not supplied the default value shall correspond to the value System "user.work". A relative path name will be resolved relative the System "user.work" directory. cli-profile-description=An absolute or relative filename of a configuration containing the kernel and block deployment information. If the supplied filename is relative it will resolved relative to the home directory. If not supplied, the system will attempt to locate a file named "profile.xml" in the home directory. 1.1 avalon-sandbox/merlin/src/java/Resources_fr.properties Index: Resources_fr.properties =================================================================== directory=annuaire file=dossier cli-help-description=Imprime ce message. cli-language-description=Un code de pays de deux lettres. cli-version-description=Imprime le nombre de version de système de Merlin. cli-debug-description=Présentation des messages debug pendant la phase d'initialisation. cli-home-description=Un chemin relatif ou absolu à un répertoire local de fonctionnement. Si non fourni la valeur par défaut correspondra au système "user.work" de valeur. Un nom releative de chemin sera parent résolu annuaire du système l'"user.work". cli-system-description=Un chemin absolu ou relatif à l'annuaire contenant les annuaires de système de /common et de /lib. Si non fourni la valeur par défaut correspondra à la valeur propriété du système de l'"user.work". Un chemin relatif sera parent résolu annuaire du système l'"user.work". cli-profile-description=Un nom de fichier absolu ou relatif d'une configuration contenant l'information d'déploiement de grain et de bloc. Si le nom de fichier fourni est relatif il résolu relativement au répertoire local. Si non fourni, le système essayera de localiser un dossier appelé "profile.xml" dans le répertoire local. 1.1 avalon-sandbox/merlin/src/java/package.html Index: package.html =================================================================== <body> <a name="description"><h3>Description</h3></a> <p>The Merlin system is established through a bootstrap loader. To startup Merlin from the command line you use either of the commands listed below. These command handle the establishment of the system directory, the working home directory, and the filename of the deployment profile.</p> <pre> java -classpath build\lib\merlin-bootstrap-2.1.jar Merlin -profile <profile> java -jar build\lib\merlin-bootstrap-2.1.jar -profile <profile> </pre> <p> To validate your instalation try running the demo deployment profile using the following command line: </p> <pre> java -jar build\lib\merlin-bootstrap-2.1.jar -profile config/demo.xml </pre> <p> Information concerning command line options are available using the -help option. </p> <pre> java -jar build\lib\merlin-bootstrap-2.1.jar -help </pre> </body> 1.3 +20 -6 avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernel.java Index: DefaultKernel.java =================================================================== RCS file: /home/cvs/avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernel.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- DefaultKernel.java 19 Jan 2003 18:18:50 -0000 1.2 +++ DefaultKernel.java 27 Jan 2003 03:27:46 -0000 1.3 @@ -156,6 +156,11 @@ //============================================================== /** + * The kernel profile file. + */ + private File m_profile; + + /** * The kernel configuration. */ private Configuration m_kernelConfig; @@ -186,6 +191,11 @@ private ClassLoader m_bootstrap; /** + * The common classloader. + */ + private ClassLoader m_common; + + /** * The assembly engine. */ private EngineClassLoader m_engine; @@ -232,8 +242,10 @@ */ public void contextualize( Locator context ) throws ContextException { - m_home = (File) context.get( "urn:assembly:home" ); - m_bootstrap = (ClassLoader) context.get( "urn:avalon:classloader" ); + m_home = (File) context.get( "urn:merlin:home" ); + m_common = (ClassLoader) context.get( "urn:merlin:classloader.common" ); + m_bootstrap = (ClassLoader) context.get( "urn:merlin:classloader.system" ); + m_profile = (File) context.get( "urn:merlin:profile" ); } //============================================================== @@ -259,16 +271,16 @@ // load the kernel configuration // - File kernelFile = new File( m_home, "kernel.xml" ); try { - m_kernelConfig = getConfiguration( kernelFile ); + m_kernelConfig = getConfiguration( m_profile ); + m_configuration = m_kernelConfig.getChild( "blocks" ); } catch( Throwable e ) { final String error = "Unable to load kernel configuration from file: " - + kernelFile; + + m_profile; throw new CascadingException( error, e ); } @@ -276,6 +288,7 @@ // load the blocks configuration // + /* File blocksFile = new File( m_home, "blocks.xml" ); try { @@ -288,6 +301,7 @@ + kernelFile; throw new CascadingException( error, e ); } + */ // // Setup the logging system 1.2 +6 -15 avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/kernel/impl/KernelLoader.java Index: KernelLoader.java =================================================================== RCS file: /home/cvs/avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/kernel/impl/KernelLoader.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- KernelLoader.java 19 Jan 2003 15:53:56 -0000 1.1 +++ KernelLoader.java 27 Jan 2003 03:27:46 -0000 1.2 @@ -48,20 +48,9 @@ private DefaultKernel m_kernel; - public KernelLoader( ClassLoader loader, File base ) + public KernelLoader( ClassLoader system, ClassLoader common, File base, File profile ) { - try - { - m_kernel = new DefaultKernel(); - } - catch( Throwable e ) - { - final String error = - "\nUnexpected exception while attempting to load kernel loader from classloader: " - + loader + " with parent: " + loader.getParent(); - e.printStackTrace(); - throw new KernelRuntimeException( error, e ); - } + m_kernel = new DefaultKernel(); try { @@ -107,8 +96,10 @@ } DefaultLocator context = new DefaultLocator(); - context.put( "urn:assembly:home", base ); - context.put( "urn:avalon:classloader", loader ); + context.put( "urn:merlin:home", base ); + context.put( "urn:merlin:classloader.common", common ); + context.put( "urn:merlin:classloader.system", system ); + context.put( "urn:merlin:profile", profile ); context.makeReadOnly(); try 1.2 +1 -1 avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/kernel/impl/package.html Index: package.html =================================================================== RCS file: /home/cvs/avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/kernel/impl/package.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- package.html 19 Jan 2003 15:53:56 -0000 1.1 +++ package.html 27 Jan 2003 03:27:46 -0000 1.2 @@ -8,7 +8,7 @@ <tr bgcolor="#ccccff"> <td colspan="2"><font size="+2"><b>Component Summary</b></font></td> <tr> - <td width="20%" valign="top"><strong>[EMAIL PROTECTED] org.apache.avalon.merlin.kernel.DefaultKernel}</strong></td> + <td width="20%" valign="top"><strong>[EMAIL PROTECTED] org.apache.avalon.merlin.kernel.impl.DefaultKernel}</strong></td> <td>A <code>[EMAIL PROTECTED] org.apache.avalon.merlin.kernel.Kernel}</code> implementation that provides support the establishment, deployment and decommissioning of a set of [EMAIL PROTECTED] org.apache.avalon.merlin.block.Block } instances.</td></tr> </tr> </table> 1.10 +1 -14 avalon-sandbox/merlin/src/test/config/james.xml Index: james.xml =================================================================== RCS file: /home/cvs/avalon-sandbox/merlin/src/test/config/james.xml,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- james.xml 25 Jan 2003 00:20:58 -0000 1.9 +++ james.xml 27 Jan 2003 03:27:46 -0000 1.10 @@ -20,7 +20,7 @@ --> <implementation> - <categories priority="INFO"/> + <categories priority="WARN"/> <engine> <classpath> @@ -82,12 +82,6 @@ <port>110</port> <helloName autodetect="true">myMailServer</helloName> <connectiontimeout>120000</connectiontimeout> - <!-- - <handler> - <helloName autodetect="true">myMailServer</helloName> - <connectiontimeout>120000</connectiontimeout> - </handler> - --> </configuration> </appliance> @@ -99,13 +93,6 @@ <helloName autodetect="true">myMailServer</helloName> <connectiontimeout>360000</connectiontimeout> <maxmessagesize>0</maxmessagesize> - <!-- - <handler> - <helloName autodetect="true">myMailServer</helloName> - <connectiontimeout>360000</connectiontimeout> - <maxmessagesize>0</maxmessagesize> - </handler> - --> </configuration> </appliance>
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>