avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon-sandbox/kernel/unit/conf override.xml
Date Sat, 06 Dec 2003 06:37:44 GMT
mcconnell    2003/12/05 22:37:44

  Modified:    kernel   maven.xml project.xml
               kernel/api/src/java/org/apache/avalon/merlin
                        KernelCriteria.java
               kernel/cli maven.xml project.properties
               kernel/cli/src/java/org/apache/avalon/merlin/cli Main.java
                        Resources.properties
               kernel/impl project.xml
               kernel/impl/conf merlin.properties
               kernel/impl/src/java/org/apache/avalon/merlin/impl
                        DefaultCriteria.java DefaultFactory.java
                        Resources.properties
               kernel/unit/conf override.xml
  Log:
  Updates to the cli handler to deal with extra command parameters and runtime semantics.
  
  Revision  Changes    Path
  1.8       +3 -3      avalon-sandbox/kernel/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/kernel/maven.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- maven.xml	5 Dec 2003 08:27:45 -0000	1.7
  +++ maven.xml	6 Dec 2003 06:37:43 -0000	1.8
  @@ -3,17 +3,17 @@
     <maven:snapshot project="${pom}"/>
   
     <ant:property name="pom.organization.identifier" value="ASF"/>
  -  <ant:property name="pom.specificationVersion" value="1.0"/>
  +  <ant:property name="pom.specificationVersion" value="3.2"/>
   
     <goal name="avalon:build" description="Build all projects.">
       <maven:reactor basedir="${basedir}"
         includes="**/project.xml"
  -      excludes="**/target/**,unit/**,project.xml"
  +      excludes="**/target/**,unit/**,cli/**,project.xml"
         goals=""
         banner="Building:"
         ignoreFailures="false" />
       <maven:reactor basedir="${basedir}"
  -      includes="unit/project.xml"
  +      includes="unit/project.xml,cli/project.xml"
         goals=""
         banner="Building:"
         ignoreFailures="false" />
  
  
  
  1.4       +1 -0      avalon-sandbox/kernel/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/kernel/project.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- project.xml	24 Nov 2003 21:26:36 -0000	1.3
  +++ project.xml	6 Dec 2003 06:37:43 -0000	1.4
  @@ -208,6 +208,7 @@
       <unitTest>
         <includes>
           <include>**/*TestCase.*</include>
  +        <include>**/*Test.*</include>
         </includes>
         <excludes>
           <include>**/Abstract*.*</include>
  
  
  
  1.4       +106 -1    avalon-sandbox/kernel/api/src/java/org/apache/avalon/merlin/KernelCriteria.java
  
  Index: KernelCriteria.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/kernel/api/src/java/org/apache/avalon/merlin/KernelCriteria.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- KernelCriteria.java	5 Dec 2003 01:29:05 -0000	1.3
  +++ KernelCriteria.java	6 Dec 2003 06:37:43 -0000	1.4
  @@ -62,6 +62,111 @@
   public interface KernelCriteria extends Map
   {
      /**
  +    * Shared application repository root directory.
  +    */
  +    String MERLIN_REPOSITORY = 
  +      "merlin.repository";
  +
  +   /**
  +    * Repository parameter descriptor.
  +    */
  +    String MERLIN_HOME = 
  +      "merlin.home";
  +
  +   /**
  +    * Repository parameter descriptor.
  +    */
  +    String MERLIN_SYSTEM = 
  +      "merlin.system";
  +
  +   /**
  +    * Repository parameter descriptor.
  +    */
  +    String MERLIN_CONFIG = 
  +      "merlin.config";
  +
  +   /**
  +    * Repository parameter descriptor.
  +    */
  +    String MERLIN_DEPLOYMENT = 
  +      "merlin.deployment";
  +
  +   /**
  +    * Merlin kernel url key.
  +    */
  +    String MERLIN_KERNEL = 
  +      "merlin.kernel";
  +
  +   /**
  +    * Merlin target configuration override path.
  +    */
  +    String MERLIN_OVERRIDE = 
  +      "merlin.override";
  +
  +   /**
  +    * Home directory parameter descriptor.
  +    */
  +    String MERLIN_DIR = 
  +      "merlin.dir";
  +
  +   /**
  +    * The temp directory parameter descriptor.
  +    */
  +    String MERLIN_TEMP = 
  +      "merlin.temp";
  +
  +   /**
  +    * Base directory parameter descriptor.
  +    */
  +    String MERLIN_CONTEXT = 
  +      "merlin.context";
  +
  +   /**
  +    * Anchor directory for extension and classpath 
  +    * relative references.
  +    */
  +    String MERLIN_ANCHOR = 
  +      "merlin.anchor";
  +
  +   /**
  +    * Info policy parameter descriptor.
  +    */
  +    String MERLIN_INFO = 
  +      "merlin.info";
  +
  +   /**
  +    * Debug policy parameter descriptor.
  +    */
  +    String MERLIN_DEBUG = 
  +      "merlin.debug";
  +
  +   /**
  +    * Server model parameter descriptor.
  +    */
  +    String MERLIN_SERVER = 
  +      "merlin.server";
  +
  +   /**
  +    * Auto start mode.
  +    */
  +    String MERLIN_AUTOSTART = 
  +      "merlin.autostart";
  +
  +   /**
  +    * Auto start mode.
  +    */
  +    String MERLIN_LANG = 
  +      "merlin.lang";
  +
  +
  +   /**
  +    * Return the lang code.  A null value indicates that the 
  +    * default language applies.
  +    * @return the language code
  +    */
  +    String getLanguageCode();
  +
  +   /**
       * Return the root directory to the shared repository.
       * @return the root common repository directory
       */
  
  
  
  1.2       +11 -40    avalon-sandbox/kernel/cli/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/kernel/cli/maven.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- maven.xml	6 Dec 2003 05:55:26 -0000	1.1
  +++ maven.xml	6 Dec 2003 06:37:43 -0000	1.2
  @@ -5,45 +5,16 @@
       <attainGoal name="avalon:artifact"/>
     </postGoal>
   
  -  <!--
  -  ###########################################################################
  -  # Create the target .meta metadata.                                       #
  -  # This contains the information used by the factory to identify the       #
  -  # the implementation artifact classpath, factory, and whatever else       #
  -  # we need to include this jar as the implementation strategy.             #
  -  ###########################################################################
  -  -->
  -
  -  <postGoal name="java:compile">
  -
  -    <ant:echo file="${maven.build.dir}/${pom.artifactId}.meta">
  -#
  -# Metadata identification.
  -# This file if generated under the Avalon Repository Main build process.  
  -# It contains a target artifact reference and factory parameters using 
  -# during the bootstrapping of the repository implementation.
  -#
  -
  -meta.domain = avalon
  -meta.classifier = target
  -meta.version = 1.0
  -
  -#
  -# Merlin Implementation target description.
  -# 
  -
  -avalon.target.group = ${pom.groupId}
  -avalon.target.name = ${pom.artifactId}
  -avalon.target.version = ${pom.currentVersion}
  -avalon.target.factory = org.apache.avalon.merlin.cli.Main
  -
  -#
  -# EOF
  -#
  -</ant:echo>
  -    <ant:mkdir dir="${maven.repo.local}/${pom.groupId}"/>
  -    <ant:copy toDir="${maven.repo.local}/${pom.groupId}" 
  -       file="${maven.build.dir}/${pom.artifactId}.meta" verbose="yes"/>
  -  </postGoal>
  +  <preGoal name="jar:jar">
  +    <j:forEach var="dep" items="${pom.dependencies}">
  +        <unzip src="${pom.getDependencyPath( dep.getId() )}" 
  +          dest="${maven.build.dir}/classes">
  +          <patternset>
  +            <exclude name="META-INF/**"/>
  +            <exclude name="*.meta"/>
  +          </patternset>
  +        </unzip>
  +    </j:forEach>
  +  </preGoal>
   
   </project>
  
  
  
  1.2       +4 -0      avalon-sandbox/kernel/cli/project.properties
  
  Index: project.properties
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/kernel/cli/project.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- project.properties	6 Dec 2003 05:55:26 -0000	1.1
  +++ project.properties	6 Dec 2003 06:37:43 -0000	1.2
  @@ -3,4 +3,8 @@
   #
   avalon.artifact.factory = org.apache.avalon.merlin.cli.DefaultFactory
   
  +#
  +# main class
  +# 
  +maven.jar.mainclass = org.apache.avalon.merlin.cli.Main
   
  
  
  
  1.2       +3 -2      avalon-sandbox/kernel/cli/src/java/org/apache/avalon/merlin/cli/Main.java
  
  Index: Main.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/kernel/cli/src/java/org/apache/avalon/merlin/cli/Main.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Main.java	6 Dec 2003 05:55:28 -0000	1.1
  +++ Main.java	6 Dec 2003 06:37:43 -0000	1.2
  @@ -279,7 +279,8 @@
   
       private void printHelpInfo()
       {
  -        System.out.println( "HELP INFO" ); 
  +        HelpFormatter formatter = new HelpFormatter();
  +        formatter.printHelp( "merlin [block]", " ", CL_OPTIONS, "", true );
       }
   
       private void handleCommandLine( Map criteria, CommandLine line )
  
  
  
  1.2       +0 -2      avalon-sandbox/kernel/cli/src/java/org/apache/avalon/merlin/cli/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/kernel/cli/src/java/org/apache/avalon/merlin/cli/Resources.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Resources.properties	6 Dec 2003 05:55:28 -0000	1.1
  +++ Resources.properties	6 Dec 2003 06:37:43 -0000	1.2
  @@ -33,8 +33,6 @@
   
   cli-info-description=Lists info about the deployment context.
   
  -cli-jmx-description=Bootstrap Merlin under a JMX server.
  -
   cli-install-description=Install a block archive into the local repository.
   
   cli-debug-description=Enables debug mode.
  
  
  
  1.14      +1 -1      avalon-sandbox/kernel/impl/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/kernel/impl/project.xml,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- project.xml	3 Dec 2003 20:44:25 -0000	1.13
  +++ project.xml	6 Dec 2003 06:37:43 -0000	1.14
  @@ -227,11 +227,11 @@
       <!-- commons dependencies -->
   
       <!--
  -    -->
       <dependency>
         <id>commons-cli</id>
         <version>1.0</version>
       </dependency>
  +    -->
   
       <dependency>
         <id>commons-collections</id>
  
  
  
  1.5       +2 -0      avalon-sandbox/kernel/impl/conf/merlin.properties
  
  Index: merlin.properties
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/kernel/impl/conf/merlin.properties,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- merlin.properties	27 Nov 2003 00:00:13 -0000	1.4
  +++ merlin.properties	6 Dec 2003 06:37:43 -0000	1.5
  @@ -36,6 +36,8 @@
   
   #
   # The working directory.
  +# If the system property ${basedir} is defined it will take priority
  +# over the value defined here.
   #
   merlin.dir = ${user.dir}
   
  
  
  
  1.7       +75 -124   avalon-sandbox/kernel/impl/src/java/org/apache/avalon/merlin/impl/DefaultCriteria.java
  
  Index: DefaultCriteria.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/kernel/impl/src/java/org/apache/avalon/merlin/impl/DefaultCriteria.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DefaultCriteria.java	5 Dec 2003 01:29:05 -0000	1.6
  +++ DefaultCriteria.java	6 Dec 2003 06:37:44 -0000	1.7
  @@ -105,97 +105,6 @@
         new File( USER_HOME, ".merlin" );
   
      /**
  -    * Shared application repository root directory.
  -    */
  -    public static final String MERLIN_REPOSITORY = 
  -      "merlin.repository";
  -
  -   /**
  -    * Repository parameter descriptor.
  -    */
  -    public static final String MERLIN_HOME = 
  -      "merlin.home";
  -
  -   /**
  -    * Repository parameter descriptor.
  -    */
  -    public static final String MERLIN_SYSTEM = 
  -      "merlin.system";
  -
  -   /**
  -    * Repository parameter descriptor.
  -    */
  -    public static final String MERLIN_CONFIG = 
  -      "merlin.config";
  -
  -   /**
  -    * Repository parameter descriptor.
  -    */
  -    public static final String MERLIN_DEPLOYMENT = 
  -      "merlin.deployment";
  -
  -   /**
  -    * Merlin kernel url key.
  -    */
  -    public static final String MERLIN_KERNEL = 
  -      "merlin.kernel";
  -
  -   /**
  -    * Merlin target configuration override path.
  -    */
  -    public static final String MERLIN_OVERRIDE = 
  -      "merlin.override";
  -
  -   /**
  -    * Home directory parameter descriptor.
  -    */
  -    public static final String MERLIN_DIR = 
  -      "merlin.dir";
  -
  -   /**
  -    * The temp directory parameter descriptor.
  -    */
  -    public static final String MERLIN_TEMP = 
  -      "merlin.temp";
  -
  -   /**
  -    * Base directory parameter descriptor.
  -    */
  -    public static final String MERLIN_CONTEXT = 
  -      "merlin.context";
  -
  -   /**
  -    * Anchor directory for extension and classpath 
  -    * relative references.
  -    */
  -    public static final String MERLIN_ANCHOR = 
  -      "merlin.anchor";
  -
  -   /**
  -    * Info policy parameter descriptor.
  -    */
  -    public static final String MERLIN_INFO = 
  -      "merlin.info";
  -
  -   /**
  -    * Debug policy parameter descriptor.
  -    */
  -    public static final String MERLIN_DEBUG = 
  -      "merlin.debug";
  -
  -   /**
  -    * Server model parameter descriptor.
  -    */
  -    public static final String MERLIN_SERVER = 
  -      "merlin.server";
  -
  -   /**
  -    * Auto start mode.
  -    */
  -    public static final String MERLIN_AUTOSTART = 
  -      "merlin.autostart";
  -
  -   /**
       * The factory parameters template.
       */
       private static final Parameter[] PARAMS = 
  @@ -212,8 +121,8 @@
           new Parameter( 
             MERLIN_CONFIG,
             File.class, new File( MERLIN_HOME_DIR, "config" ) ),
  -        new DeploymentURLTokenizer( 
  -          MERLIN_DEPLOYMENT, ",", new URL[0], getBaseDirectory() ),
  +        new DeploymentTokenizer( 
  +          MERLIN_DEPLOYMENT, ",", new String[0] ),
           new Parameter( 
             MERLIN_KERNEL, URL.class, null ),
           new Parameter( 
  @@ -234,7 +143,9 @@
           new Parameter( 
             MERLIN_SERVER, Boolean.class, new Boolean( false ) ),
           new Parameter( 
  -          MERLIN_AUTOSTART, Boolean.class, new Boolean( true ) )
  +          MERLIN_AUTOSTART, Boolean.class, new Boolean( true ) ),
  +        new Parameter( 
  +          MERLIN_LANG, String.class, null )
         };
   
       private static final String [] SINGLE_KEYS = 
  @@ -254,6 +165,8 @@
       {
           super( PARAMS );
   
  +        
  +
           Properties avalonStatic = getStaticProperties( AVALON );
           Properties merlinStatic = getStaticProperties( MERLIN );
   
  @@ -324,6 +237,18 @@
           }
   
           //
  +        // deal with the special case of a ${basedir} declaration
  +        // which is equivalent to the overriding of the merlin.dir
  +        // property
  +        //
  +
  +        String basedir = System.getProperty( "basedir" );
  +        if( null != basedir ) 
  +        {
  +            put( "merlin.dir", basedir );
  +        }
  +
  +        //
           // check for any errors created in the process and dump a 
           // notice to System.err
           //
  @@ -367,6 +292,16 @@
       }
   
      /**
  +    * Return the lang code.  A null value indicates that the 
  +    * default language applies.
  +    * @return the language code
  +    */
  +    public String getLanguageCode()
  +    {
  +        return (String) get( MERLIN_LANG );
  +    }
  +
  +   /**
       * Return the root directory to the merlin installation
       * @return the merlin home directory
       */
  @@ -390,7 +325,27 @@
       */
       public URL[] getDeploymentURLs()
       {
  -        return (URL[]) get( MERLIN_DEPLOYMENT );
  +        String[] blocks = (String[]) get( MERLIN_DEPLOYMENT );
  +        ArrayList list = new ArrayList();
  +        File base = getWorkingDirectory();
  +        for( int i=0; i<blocks.length; i++ )
  +        {
  +            String path = blocks[i];
  +            try
  +            {
  +                URL url = resolveURL( base, path );
  +                list.add( url );
  +            }
  +            catch( Throwable e )
  +            {
  +                final String error = 
  +                 "Unable to transform the token: ["
  +                 + path
  +                 + "] due to an unexpected error.";
  +                throw new KernelRuntimeException( error, e );
  +            }
  +        }
  +        return (URL[]) list.toArray( new URL[0] ); 
       }
   
      /**
  @@ -614,31 +569,29 @@
           }
       }
   
  -    private static class DeploymentURLTokenizer extends Parameter
  +    private static class DeploymentTokenizer extends Parameter
       {
  -        private final Class m_base = URL[].class;
  +        private final Class m_base = String[].class;
           private final String m_delimiter;
  -        private final File m_basedir;
   
           /**
            * Transform a string to a url array.
            * @param object the value to transform
            * @return the transformed object
            */
  -         public DeploymentURLTokenizer( 
  +         public DeploymentTokenizer( 
              final String key, final String delimiter, 
  -           URL[] defaults, File base ) 
  +           String[] defaults ) 
            {
  -             super( key, URL[].class, defaults );
  +             super( key, String[].class, defaults );
                m_delimiter = delimiter;
  -             m_basedir = base;
            }
   
            public Object resolve( Object value ) 
              throws FactoryException
            {
               if( value == null ) return null;
  -            if( value instanceof URL[] )
  +            if( value instanceof String[] )
               {
                   return value;
               }
  @@ -650,42 +603,40 @@
                     new StringTokenizer( s, m_delimiter );
                   while( tokenizer.hasMoreTokens() )
                   {
  -                    String v = tokenizer.nextToken();
  -                    try
  -                    {
  -                        URL url = resolveURL( m_basedir, v );
  -                        list.add( url );
  -                    }
  -                    catch( Throwable e )
  -                    {
  -                        final String error = 
  -                          "Unable to transform the token: ["
  -                          + v
  -                          + " due to an unexpected error.";
  -                        throw new FactoryException( error, e );
  -                    }
  +                    list.add( tokenizer.nextToken() );
                   }
  -                return list.toArray( new URL[0] );
  +                return list.toArray( new String[0] );
               }
               else
               {
                   final String error = 
                     "Don't know how to transform an instance of [" 
                     + value.getClass().getName() 
  -                  + " to a URL[].";
  +                  + " to a String[].";
                   throw new FactoryException( error );
               }
           }
  +    }
   
  -        private URL resolveURL( File base, String value ) throws Exception
  +    private URL resolveURL( File base, String value ) throws Exception
  +    {
  +        try
  +        {
  +            return new URL( value );
  +        }
  +        catch( Exception e )
           {
               try
               {
  -                return new URL( value );
  +                return new File( base, value ).toURL();
               }
  -            catch( Exception e )
  +            catch( Throwable ee )
               {
  -                return new File( base, value ).toURL();
  +                final String error = 
  +                  "Unable to transform the block path [" 
  +                  + value
  +                  + "] to a URL.";
  +                throw new KernelRuntimeException( error, ee );
               }
           }
       }
  
  
  
  1.9       +67 -14    avalon-sandbox/kernel/impl/src/java/org/apache/avalon/merlin/impl/DefaultFactory.java
  
  Index: DefaultFactory.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/kernel/impl/src/java/org/apache/avalon/merlin/impl/DefaultFactory.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- DefaultFactory.java	5 Dec 2003 08:27:45 -0000	1.8
  +++ DefaultFactory.java	6 Dec 2003 06:37:44 -0000	1.9
  @@ -8,6 +8,7 @@
   import java.util.Map;
   import java.util.ArrayList;
   import java.util.Iterator;
  +import java.util.Locale;
   
   import org.apache.avalon.activation.appliance.Block;
   import org.apache.avalon.activation.appliance.Composite;
  @@ -171,6 +172,21 @@
           }
   
           //
  +        // set the language code
  +        //
  +
  +        String language = criteria.getLanguageCode();
  +        if( null != language )
  +        { 
  +            ResourceManager.clearResourceCache();
  +            Locale locale = new Locale( language, "" );
  +            Locale.setDefault( locale );
  +            REZ = 
  +              ResourceManager.getPackageResources( 
  +                DefaultFactory.class );
  +        }
  +
  +        //
           // create the kernel configuration
           //
   
  @@ -200,23 +216,35 @@
   
           if( criteria.isInfoEnabled() )
           {
  -            StringBuffer buffer = new StringBuffer( "Merlin Kernel Environment Listing\n");
  +            StringBuffer buffer = 
  +              new StringBuffer( REZ.getString( "info.listing" ) );
  +
  +            buffer.append( "\n" );
  +            buffer.append( "\n  ${user.dir} == " + System.getProperty( "user.dir" ) );
  +            buffer.append( "\n  ${user.home} == " + System.getProperty( "user.home" ) );
  + 
  +            buffer.append( "\n" );
               Iterator keys = criteria.keySet().iterator();
               while( keys.hasNext() )
               {
                   String key = (String) keys.next();
  -                Object value = criteria.get( key );
  -                buffer.append( "\n  ${" + key + "} == " + value );
  +                if( !key.equals( "merlin.deployment" ) )
  +                {
  +                    Object value = criteria.get( key );
  +                    buffer.append( "\n  ${" + key + "} == " + value );
  +                }
  +            }
  +            buffer.append( "\n  ${merlin.deployment} == " );
  +            URL[] urls = criteria.getDeploymentURLs();
  +            for( int i=0; i<urls.length; i++ )
  +            {   
  +                if( i>0 ) buffer.append( "," );  
  +                buffer.append( StringHelper.toString( urls[i] ) );
               }
               buffer.append( "\n" );
               getLogger().info( buffer.toString() );
           }
   
  -        if( criteria.isDebugEnabled() )
  -        {
  -            getLogger().debug( "kernel configuration:\n" + listing );
  -        }
  -
           //
           // create the common repository
           //
  @@ -356,13 +384,16 @@
           // customize the meta model
           //
   
  +        getLogger().debug( "customize phase" );
           try
           {
               final String path = criteria.getOverridePath();
  -            if( null == path ) return new TargetDirective[0];
  -            File base = criteria.getWorkingDirectory();
  -            URL url = resolveURL( base, path );
  -            application.applyTargets( url );
  +            if( null != path ) 
  +            {
  +                File base = criteria.getWorkingDirectory();
  +                URL url = resolveURL( base, path );
  +                application.applyTargets( url );
  +            }
           }
           catch( Throwable e )
           {
  @@ -375,6 +406,7 @@
           // instantiate the runtime root application block
           //
   
  +        getLogger().debug( "activation phase" );
           try
           {
               m_application = 
  @@ -393,9 +425,10 @@
   
           Kernel kernel = 
             createKernel( getLogger(), criteria, m_system, m_application );
  -        setShutdownHook( kernel );
  +        setShutdownHook( getLogger(), kernel );
           if( criteria.isAutostartEnabled() )
           {
  +            getLogger().debug( "startup phase" );
               try
               {
                   kernel.startup();
  @@ -406,6 +439,25 @@
                     "Kernel startup failure.";
                   throw new KernelException( error, e );
               }
  +
  +            if( !criteria.isServerEnabled() )
  +            {
  +                getLogger().debug( "shutdown phase" );
  +                try
  +                {
  +                    kernel.shutdown();
  +                }
  +                catch( Throwable e )
  +                {
  +                    final String error = 
  +                      "Kernel startup failure.";
  +                    throw new KernelException( error, e );
  +                }
  +            }
  +        }
  +        else
  +        {
  +            getLogger().debug( "autostart disabled" );
           }
   
           return kernel;
  @@ -799,7 +851,7 @@
       * Create a shutdown hook that will trigger shutdown of the supplied kernel.
       * @param kernel the kernel to be shutdown
       */
  -    private void setShutdownHook( final Kernel kernel )
  +    private void setShutdownHook( final Logger logger, final Kernel kernel )
       {
           //
           // Create a shutdown hook to trigger clean disposal of the
  @@ -813,6 +865,7 @@
                 {
                     try
                     {
  +                      logger.debug("shutdown event");
                         kernel.shutdown();
                     }
                     catch( Throwable e )
  
  
  
  1.2       +3 -1      avalon-sandbox/kernel/impl/src/java/org/apache/avalon/merlin/impl/Resources.properties
  
  Index: Resources.properties
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/kernel/impl/src/java/org/apache/avalon/merlin/impl/Resources.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Resources.properties	30 Nov 2003 05:55:30 -0000	1.1
  +++ Resources.properties	6 Dec 2003 06:37:44 -0000	1.2
  @@ -1,7 +1,9 @@
   
  +info.listing=Merlin Kernel Environment Listing
  +
   template-description=Merlin Service Manangement Platform.
   
  -template-repository-dir=The root directory for the local application repository. This directory
will used for the caching of artifacts such as jar files referenced by block include directives
and classloader resource references.  If not supplied the default value resolves to ${merlin.home}/repository.
  +template-repository-dir=The root directory for the local application repository. This directory
will used for the caching of artifacts such as jar files referenced by block include directives
and classloader resource references.  If not supplied the default value resolves to ${avalon.home}.
   
   template-library-dir=The directory used as the base anchor for resolution of relative path
references for jar extension library directory statements in classloader directives. If not
supplied the value defaults to the current working directory.
   
  
  
  
  1.2       +1 -1      avalon-sandbox/kernel/unit/conf/override.xml
  
  Index: override.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/kernel/unit/conf/override.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- override.xml	5 Dec 2003 06:31:54 -0000	1.1
  +++ override.xml	6 Dec 2003 06:37:44 -0000	1.2
  @@ -3,7 +3,7 @@
   <targets>
   
     <target path="/tutorial/hello">
  -    <categories priority="DEBUG"/>
  +    <categories priority="INFO"/>
     </target>
   
   </targets>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message