Return-Path: Delivered-To: apmail-avalon-cvs-archive@www.apache.org Received: (qmail 25649 invoked from network); 6 Dec 2003 06:37:45 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 6 Dec 2003 06:37:45 -0000 Received: (qmail 37930 invoked by uid 500); 6 Dec 2003 06:37:23 -0000 Delivered-To: apmail-avalon-cvs-archive@avalon.apache.org Received: (qmail 37880 invoked by uid 500); 6 Dec 2003 06:37:22 -0000 Mailing-List: contact cvs-help@avalon.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Avalon CVS List" Reply-To: "Avalon Developers List" Delivered-To: mailing list cvs@avalon.apache.org Received: (qmail 37867 invoked by uid 500); 6 Dec 2003 06:37:22 -0000 Received: (qmail 37863 invoked from network); 6 Dec 2003 06:37:22 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 6 Dec 2003 06:37:22 -0000 Received: (qmail 25623 invoked by uid 1438); 6 Dec 2003 06:37:44 -0000 Date: 6 Dec 2003 06:37:44 -0000 Message-ID: <20031206063744.25622.qmail@minotaur.apache.org> From: mcconnell@apache.org To: avalon-sandbox-cvs@apache.org Subject: cvs commit: avalon-sandbox/kernel/unit/conf override.xml X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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 @@ - + 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 @@ **/*TestCase.* + **/*Test.* **/Abstract*.* 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 @@ - - - - - -# -# 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 -# - - - - + + + + + + + + + + 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-cli 1.0 + --> commons-collections 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; i0 ) 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 @@ - + --------------------------------------------------------------------- To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org For additional commands, e-mail: cvs-help@avalon.apache.org