mcconnell 2003/08/17 08:06:41
Modified: merlin STRUCTURE.TXT
merlin/activation/src/java/org/apache/avalon/activation/appliance/impl
DefaultBlock.java
merlin/composition/src/java/org/apache/avalon/composition/model/impl
DefaultContainmentModel.java
merlin/kernel/bootstrap/src/etc merlin.properties
merlin/kernel/bootstrap/src/java Merlin.java
merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl
CLIKernelLoader.java DefaultKernel.java
DefaultKernelContext.java Resources.properties
merlin/merlin-platform/src/bin merlin.bat merlin.sh
Log:
Improvements to command line handling and error reporting.
Revision Changes Path
1.4 +24 -28 avalon-sandbox/merlin/STRUCTURE.TXT
Index: STRUCTURE.TXT
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/STRUCTURE.TXT,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- STRUCTURE.TXT 7 Aug 2003 17:23:00 -0000 1.3
+++ STRUCTURE.TXT 17 Aug 2003 15:06:41 -0000 1.4
@@ -12,32 +12,33 @@
merlin
|
- +-- assembly assembly implementation
- +-- assembly-spi assembly SPI interfaces and classes
+ +-- activation activation implementation
+ +-- activation-spi activation SPI interfaces and classes
+-- composition composition implementation
+-- composition-spi composition SPI interfaces and classes
+-- extension jar manegement implementation
+-- extension-spi jar manegement SPI interfaces and classes
- +-- merlin-cli merlin command line handler
- +-- merlin-core merlin kernel, block, and container
- +-- merlin-spi merlin SPI interfaces and classes
- +-- merlin-plugin plugin for Maven
+ +-- kernel
+ +- bootstrap kernel bootstrap
+ +- spi kernel interfaces
+ +- impl kernel implementation
+ +-- merlin-plugin plugin for Maven
+-- merlin-extensions
- +- merlin-jndi merlin JNDI connector
+ +- merlin-jndi merlin JNDI connector (work-in-progress)
+- merlin-jndi-new extended JNDI implementation (work-in-progress)
+- merlin-jmx merlin JMX adapter implementation
(work-in-progress)
- +- merlin-servlet merlin Servlet utilities
+ +- merlin-servlet merlin Servlet utilities (work-in-progress)
+-- merlin-platform site and installation resources
+- src resources used to build a merlin installation
+- tutorials several merlin tutorials
+- examples example applications
+- target
+- docs generate site documentation
- +-- meta meta package implementation
- +-- meta-spi meta SPI interfaces and classes
- +-- meta-tools meta info generator task
- +-- target
- +- inst the generated installation (see
+ +-- repository
+ +- spi resource repository interfaces
+ +- impl resource repository implementation
+ +-- target generated build
+ +- merlin the generated installation (see
build procedure detailed below)
@@ -46,32 +47,27 @@
The Merlin project requires the Maven project management tool.
-If you have already a MERLIN_HOME environment variable defined, then all
-you need to do is invoke the merlin-install goal (although it is
-recommended to discard installed jar files beforehand).
-
- $ maven merlin-install
-
The merlin-dist goal builds a Merlin installation directory under the
-default /target/inst. Please note that the installation build
-does not generate a demonstration apps at this time (this should be
-resolved shortly).
+default /target/merlin.
$ maven merlin-dist
Following the creation of an installation you need to declare the environment
variable MERLIN_HOME with a value corresponding to the directory in which you
choose to deploy the merlin system. Please also make sure that you include
-MERLIN_HOME/bin in your PATH environment variable. You can then copy the inst
+MERLIN_HOME/bin in your PATH environment variable. You can then move the merlin
directory to MERLIN_HOME following which the Merlin command line utilities
should function properly. You can confirm this (on NT) by opening a new DOS
window and invoking the following command:
- $ merlin -help
+ $ merlin -version
Support for the installation and execution of Merlin as an NT process is
now included in the package (refer bin directory) - special thanks to Leif
-for helping to set this up.
+for helping to set this up. When updating an existing installation, the
+maven goal merlin-libs invokes the classic merlin-dist and updates your local
+merlin repository. This is often convinient if you are frequently updating
+the merlin core.
For additional information please check the documentation and also use the
Avalon Users list (subscription details in the doc). The merlin-site goal
@@ -82,7 +78,7 @@
$ maven merlin-site
Finally, please keep in mind that while Merlin is nearing completion and
-readiness for a first release, it is still alpha, APIs are changing, and
-documentation is evolving.
+readiness for a first release, it should be considered as beta software as
+APIs are changing, and documentation is evolving.
-SJM 15 April 2003
+SJM 17 August 2003
1.5 +5 -14
avalon-sandbox/merlin/activation/src/java/org/apache/avalon/activation/appliance/impl/DefaultBlock.java
Index: DefaultBlock.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/activation/src/java/org/apache/avalon/activation/appliance/impl/DefaultBlock.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DefaultBlock.java 17 Aug 2003 06:35:51 -0000 1.4
+++ DefaultBlock.java 17 Aug 2003 15:06:41 -0000 1.5
@@ -634,17 +634,10 @@
*/
public void decommission()
{
- if( !isAssembled() )
- {
- throw new IllegalStateException( "assembly" );
- }
-
+ if( !isAssembled() ) return;
synchronized( m_deployment )
{
- if( !m_deployment.isEnabled() )
- {
- return;
- }
+ if( !m_deployment.isEnabled() ) return;
Appliance[] appliances = getLocalShutdownSequence();
if( getLogger().isDebugEnabled() )
@@ -739,10 +732,8 @@
{
synchronized( m_self )
{
- if( !m_self.isEnabled() )
- {
- return;
- }
+ if( !m_self.isEnabled() ) return;
+
getLogger().debug( "disposal phase" );
Appliance[] appliances = m_repository.getAppliances();
for( int i=0; i<appliances.length; i++ )
1.24 +25 -13
avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java
Index: DefaultContainmentModel.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultContainmentModel.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- DefaultContainmentModel.java 12 Aug 2003 05:30:44 -0000 1.23
+++ DefaultContainmentModel.java 17 Aug 2003 15:06:41 -0000 1.24
@@ -500,16 +500,28 @@
final URL jarURL = convertToJarURL( url );
final URL blockURL = new URL( jarURL, "/BLOCK-INF/block.xml" );
final InputStream stream = blockURL.openStream();
- final ContainmentProfile profile =
- BUILDER.createContainmentProfile( stream );
- final String message =
- "including composite block: " + blockURL.toString();
- getLogger().debug( message );
+ try
+ {
+ final ContainmentProfile profile =
+ BUILDER.createContainmentProfile( stream );
+
+ final String message =
+ "including composite block: " + blockURL.toString();
+ getLogger().debug( message );
- return createContainmentModel(
- getName( name, profile ), profile, new URL[]{ url } );
-
+ return createContainmentModel(
+ getName( name, profile ), profile, new URL[]{ url } );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Unable to create block from embedded descriptor [" +
blockURL.toString()
+ + "] in the containmment model ["
+ + getQualifiedName()
+ + "] due to a build related error.";
+ throw new ModelException( error, e );
+ }
}
else if( path.endsWith( ".xml" ) )
{
@@ -536,7 +548,7 @@
catch( MalformedURLException e )
{
final String error =
- "Unable to include block [" + name
+ "Unable to include block [" + path
+ "] into the containmment model ["
+ getQualifiedName()
+ "] because of a url related error.";
@@ -545,7 +557,7 @@
catch( IOException e )
{
final String error =
- "Unable to include block [" + name
+ "Unable to include block [" + path
+ "] into the containmment model ["
+ getQualifiedName()
+ "] because of a io related error.";
@@ -554,7 +566,7 @@
catch( Throwable e )
{
final String error =
- "Unable to include block [" + name
+ "Unable to include block [" + path
+ "] into the containmment model ["
+ getQualifiedName()
+ "] because of an unexpected error.";
1.2 +3 -2 avalon-sandbox/merlin/kernel/bootstrap/src/etc/merlin.properties
Index: merlin.properties
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/kernel/bootstrap/src/etc/merlin.properties,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- merlin.properties 17 Aug 2003 00:51:57 -0000 1.1
+++ merlin.properties 17 Aug 2003 15:06:41 -0000 1.2
@@ -7,7 +7,7 @@
#
# the bootstrap classpath
#
-merlin.bootstrap.classpath.length=22
+merlin.bootstrap.classpath.length=23
merlin.bootstrap.classpath.0=xerces:xerces;2.2.1
merlin.bootstrap.classpath.1=xml-apis:xml-apis;1.0.b2
merlin.bootstrap.classpath.2=avalon-framework:avalon-framework-api;SNAPSHOT
@@ -29,4 +29,5 @@
merlin.bootstrap.classpath.18=merlin:merlin-kernel-impl;SNAPSHOT
merlin.bootstrap.classpath.19=logkit:logkit;1.2
merlin.bootstrap.classpath.20=excalibur-event:excalibur-event;1.0.3
-merlin.bootstrap.classpath.21=excalibur:excalibur-configuration;1.0
+merlin.bootstrap.classpath.21=excalibur-configuration:excalibur-configuration;1.1-dev
+merlin.bootstrap.classpath.22=excalibur-lifecycle:excalibur-lifecycle;1.0
1.4 +8 -5 avalon-sandbox/merlin/kernel/bootstrap/src/java/Merlin.java
Index: Merlin.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/kernel/bootstrap/src/java/Merlin.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Merlin.java 17 Aug 2003 00:51:57 -0000 1.3
+++ Merlin.java 17 Aug 2003 15:06:41 -0000 1.4
@@ -54,6 +54,7 @@
import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
@@ -114,8 +115,8 @@
String fallback = System.getProperty( "user.home" ) + "/merlin";
String system = System.getProperty( MERLIN_HOME_KEY, fallback );
- String home = System.getProperty( MERLIN_LOCAL_KEY, system );
- File base = new File( home, "repository" );
+ String local = System.getProperty( MERLIN_LOCAL_KEY, system );
+ File base = new File( local, "repository" );
if( !base.exists() )
{
@@ -161,9 +162,7 @@
URL[] bootstrap = null;
try
{
- bootstrap = getURLs(
- repository,
- properties );
+ bootstrap = getURLs( repository, properties );
}
catch( Throwable e )
{
@@ -217,6 +216,10 @@
Object kernel =
constructor.newInstance(
new Object[]{ repository, args } );
+ }
+ catch( InvocationTargetException e )
+ {
+ return;
}
catch( Throwable e )
{
1.4 +61 -11
avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/CLIKernelLoader.java
Index: CLIKernelLoader.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/CLIKernelLoader.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CLIKernelLoader.java 17 Aug 2003 00:51:57 -0000 1.3
+++ CLIKernelLoader.java 17 Aug 2003 15:06:41 -0000 1.4
@@ -48,13 +48,14 @@
private static final File HOME = new File( System.getProperty( "user.dir" ) );
- private static final File SYSTEM = new File( System.getProperty( "merlin.home"
) );
+ private static final File SYSTEM = getSystemDefaultDirectory();
private static Resources REZ =
ResourceManager.getPackageResources( CLIKernelLoader.class );
private static Options CL_OPTIONS = buildCommandLineOptions();
+
//--------------------------------------------------------------------------
// constructor
//--------------------------------------------------------------------------
@@ -98,7 +99,7 @@
{
line = parser.parse( CL_OPTIONS, args );
- boolean server = line.hasOption( "server" );
+ boolean server = !line.hasOption( "execute" );
if( line.hasOption( "lang" ) )
{
@@ -180,6 +181,12 @@
File system = getSystemPath( line );
//
+ // get the library path
+ //
+
+ File library = getLibraryPath( line, system );
+
+ //
// get the working home directory
//
@@ -192,7 +199,7 @@
URL config = getConfigPath( base.getParentFile(), line );
return new DefaultKernelContext(
- repository, system, home, kernel, blocks, config, server, debug );
+ repository, system, library, home, kernel, blocks, config, server,
debug );
}
catch( Throwable e )
{
@@ -356,6 +363,29 @@
}
}
+ private File getLibraryPath( CommandLine command, File system ) throws
IOException
+ {
+ final String key = "library";
+ if( command.hasOption( key ) )
+ {
+ String path = command.getOptionValue( key );
+ try
+ {
+ return getFile( system, path );
+ }
+ catch( FileNotFoundException fnfe )
+ {
+ final String error =
+ "Supplied library path does not exist: " + path;
+ throw new FileNotFoundException( error );
+ }
+ }
+ else
+ {
+ return system;
+ }
+ }
+
private File getSystemPath( CommandLine command ) throws IOException
{
File file = getSysPath( command );
@@ -383,7 +413,7 @@
path = command.getOptionValue( key );
try
{
- return getFile( HOME, path );
+ return getFile( SYSTEM, path );
}
catch( FileNotFoundException fnfe )
{
@@ -394,7 +424,7 @@
}
else
{
- return HOME;
+ return SYSTEM;
}
}
@@ -433,13 +463,13 @@
REZ.getString( "cli-version-description" ) );
Option execute = new Option(
- "server",
- REZ.getString( "cli-server-description" ) );
-
- Option server = new Option(
"execute",
REZ.getString( "cli-execute-description" ) );
+ Option server = new Option(
+ "server",
+ REZ.getString( "cli-server-description" ) );
+
Option debug = new Option(
"debug",
REZ.getString( "cli-debug-description" ) );
@@ -456,12 +486,18 @@
.withDescription( REZ.getString( "cli-home-description" ) )
.create( "home" );
- Option system = OptionBuilder
+ Option sys = OptionBuilder
.hasArg()
.withArgName( REZ.getString( "directory" ) )
.withDescription( REZ.getString( "cli-system-description" ) )
.create( "system" );
+ Option library = OptionBuilder
+ .hasArg()
+ .withArgName( REZ.getString( "directory" ) )
+ .withDescription( REZ.getString( "cli-library-description" ) )
+ .create( "library" );
+
Option config = OptionBuilder
.hasArg()
.withArgName( REZ.getString( "file" ) )
@@ -480,10 +516,24 @@
options.addOption( version );
options.addOption( debug );
options.addOption( home );
- options.addOption( system );
+ options.addOption( sys );
+ options.addOption( library );
options.addOption( config );
options.addOption( kernel );
options.addOption( locale );
return options;
+ }
+
+ private static File getSystemDefaultDirectory()
+ {
+ final String system = System.getProperty( "merlin.home" );
+ if( system == null )
+ {
+ return new File( System.getProperty( "user.home" ), "merlin" );
+ }
+ else
+ {
+ return new File( system );
+ }
}
}
1.4 +113 -91
avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernel.java
Index: DefaultKernel.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernel.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DefaultKernel.java 17 Aug 2003 00:51:57 -0000 1.3
+++ DefaultKernel.java 17 Aug 2003 15:06:41 -0000 1.4
@@ -81,6 +81,7 @@
import org.apache.avalon.composition.model.impl.DefaultSystemContext;
import org.apache.avalon.composition.model.impl.DefaultModelFactory;
import org.apache.avalon.composition.model.ContainmentModel;
+import org.apache.avalon.composition.util.ExceptionHelper;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.configuration.Configuration;
@@ -111,27 +112,19 @@
private final Block m_block;
+ private final DefaultState m_self = new DefaultState();
+
//--------------------------------------------------------------
// constructor
//--------------------------------------------------------------
- public DefaultKernel( final KernelContext context ) throws KernelException
+ public DefaultKernel( final KernelContext context ) throws Exception
{
if( context == null ) throw new NullPointerException( "context" );
m_context = context;
-
- try
- {
- LoggingManager logging = context.getLoggingManager();
- enableLogging( logging.getSystemLoggerForCategory( "" ) );
- }
- catch( Throwable e )
- {
- final String error =
- "Kernel logging subsystem creation failure.";
- throw new KernelException( error, e );
- }
+ LoggingManager logging = context.getLoggingManager();
+ enableLogging( logging.getSystemLoggerForCategory( "" ) );
//
// create the root block into which we install application blocks
@@ -152,7 +145,11 @@
{
final String error =
"Internal error while build default containment context.";
- throw new KernelException( error, e );
+ String msg =
+ ExceptionHelper.packException( error, e, context.getDebugFlag() );
+ getLogger().error( msg );
+ shutdown();
+ throw new RuntimeException( msg );
}
getLogger().info( "construction phase" );
@@ -165,15 +162,20 @@
{
final String error =
"Internal error while build default containment model.";
- throw new KernelException( error, e );
+ String msg =
+ ExceptionHelper.packException( error, e, context.getDebugFlag() );
+ getLogger().error( msg );
+ shutdown();
+ throw new RuntimeException( msg );
}
- getLogger().info( "install phase" );
+ m_self.setEnabled( true );
//
// install any block declared within the kernel context
//
+ getLogger().info( "install phase" );
URL[] urls = context.getInstallSequence();
for( int i=0; i<urls.length; i++ )
{
@@ -187,7 +189,11 @@
{
final String error =
"Block install failure: " + url;
- throw new KernelException( error, e );
+ String msg =
+ ExceptionHelper.packException( error, e, context.getDebugFlag() );
+ getLogger().error( msg );
+ shutdown();
+ throw new RuntimeException( msg );
}
}
@@ -233,7 +239,11 @@
{
final String error =
"Root block composition failure.";
- throw new KernelException( error, e );
+ String msg =
+ ExceptionHelper.packException( error, e, context.getDebugFlag() );
+ getLogger().error( msg );
+ shutdown();
+ throw new RuntimeException( msg );
}
try
@@ -248,7 +258,11 @@
{
final String error =
"Root block assembly failure.";
- throw new KernelException( error, e );
+ String msg =
+ ExceptionHelper.packException( error, e, context.getDebugFlag() );
+ getLogger().error( msg );
+ shutdown();
+ throw new RuntimeException( msg );
}
try
@@ -260,7 +274,11 @@
{
final String error =
"Root block deployment failure.";
- throw new KernelException( error, e );
+ String msg =
+ ExceptionHelper.packException( error, e, context.getDebugFlag() );
+ getLogger().error( msg );
+ shutdown();
+ throw new RuntimeException( msg );
}
if( !context.getServerFlag() )
@@ -279,101 +297,105 @@
*/
public void shutdown()
{
- if( getLogger() != null )
+ synchronized( m_self )
{
- if( getLogger().isInfoEnabled() )
- {
- getLogger().info( "decommissioning phase" );
- }
- }
+ if( !m_self.isEnabled() ) return;
- if( m_block != null )
- {
- try
- {
- m_block.decommission();
- }
- catch( Throwable e )
+ if( getLogger() != null )
{
- if( getLogger().isWarnEnabled() )
+ if( getLogger().isInfoEnabled() )
{
- final String error =
- "Ignoring block decommissioning error.";
- getLogger().warn( error, e );
+ getLogger().info( "decommissioning phase" );
}
}
- try
+ if( m_block != null )
{
- if( m_block instanceof Composite )
+ try
{
- getLogger().info( "dissassembly phase" );
- ((Composite)m_block).disassemble();
+ m_block.decommission();
}
- }
- catch( Throwable e )
- {
- if( getLogger().isWarnEnabled() )
+ catch( Throwable e )
{
- final String error =
- "Ignoring block dissassembly error.";
- getLogger().warn( error, e );
+ if( getLogger().isWarnEnabled() )
+ {
+ final String error =
+ "Ignoring block decommissioning error.";
+ getLogger().warn( error, e );
+ }
}
- }
- try
- {
- if( m_block instanceof Disposable )
+ try
{
- getLogger().info( "disposal phase" );
- ((Disposable)m_block).dispose();
+ if( m_block instanceof Composite )
+ {
+ getLogger().info( "dissassembly phase" );
+ ((Composite)m_block).disassemble();
+ }
}
- }
- catch( Throwable e )
- {
- if( getLogger().isWarnEnabled() )
+ catch( Throwable e )
+ {
+ if( getLogger().isWarnEnabled() )
+ {
+ final String error =
+ "Ignoring block dissassembly error.";
+ getLogger().warn( error, e );
+ }
+ }
+
+ try
{
- final String error =
- "Ignoring block disposal error.";
- getLogger().warn( error, e );
+ if( m_block instanceof Disposable )
+ {
+ getLogger().info( "disposal phase" );
+ ((Disposable)m_block).dispose();
+ }
+ }
+ catch( Throwable e )
+ {
+ if( getLogger().isWarnEnabled() )
+ {
+ final String error =
+ "Ignoring block disposal error.";
+ getLogger().warn( error, e );
+ }
}
}
- }
- if( getLogger().isDebugEnabled() )
- {
- int n = Thread.activeCount();
- getLogger().info( "bye (" + n + ")" );
- }
- else if( getLogger().isInfoEnabled() )
- {
- getLogger().info( "bye" );
+ if( getLogger().isDebugEnabled() )
+ {
+ int n = Thread.activeCount();
+ getLogger().info( "bye (" + n + ")" );
+ }
+ else if( getLogger().isInfoEnabled() )
+ {
+ getLogger().info( "bye" );
+ }
+
+ m_self.setEnabled( false );
}
}
- //==============================================================
- // internals
- //==============================================================
-
- /**
- * Return a string representation of the kernel.
- * @return the string representation
- */
- /*
- public String toString()
+ private class DefaultState
{
- StringBuffer buffer =
- new StringBuffer(
- "DefaultKernel: "
- + System.identityHashCode( this )
- + " block: " );
+ private boolean m_enabled = false;
- if( m_block != null )
+ /**
+ * Return the enabled state of the state.
+ * @return TRUE if the state has been enabled else FALSE
+ */
+ public boolean isEnabled()
{
- buffer.append( "\nBlock: " + m_block );
+ return m_enabled;
}
- return buffer.toString();
- }
- */
+ /**
+ * Set the enabled state of the state.
+ * @param enabled the enabled state to assign
+ */
+ public void setEnabled( boolean enabled )
+ {
+ m_enabled = enabled;
+ }
+ }
}
1.6 +30 -19
avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernelContext.java
Index: DefaultKernelContext.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernelContext.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- DefaultKernelContext.java 17 Aug 2003 06:35:52 -0000 1.5
+++ DefaultKernelContext.java 17 Aug 2003 15:06:41 -0000 1.6
@@ -121,6 +121,11 @@
private final File m_system;
/**
+ * The library path
+ */
+ private final File m_library;
+
+ /**
* The home path
*/
private final File m_home;
@@ -182,7 +187,9 @@
/**
* Creation of a new default kernel context.
* @param repository the bootstrap repository
- * @param system directory against which extension jar
+ * @param install the merlin install directory
+ * @param system the parent directory of the runtime repository
+ * @param library directory against which extension jar
* directives are resolved
* @param home local working directory
* @param kernel the kernel configuration URL - if null, the
@@ -194,17 +201,18 @@
* @param debug debug flag
*/
public DefaultKernelContext(
- Repository repository, File system, File home,
+ Repository repository, File system, File library, File home,
URL kernel, URL[] blocks, URL config, boolean server, boolean debug )
throws NullPointerException, KernelException
{
if( repository == null ) throw new NullPointerException( "repository" );
- m_system = system;
m_home = home;
- m_kernelURL = kernel;
+ m_system = system;
+ m_library = library;
+ m_kernelURL = kernel;
if( kernel != null )
{
m_kernel = getKernelConfiguration( kernel );
@@ -244,17 +252,8 @@
// bootstrap repository declared under the constructor
//
- Configuration repositoryConfig = m_kernel.getChild( "repository", false );
- if( repositoryConfig == null )
- {
- m_repository = repository;
- getLogger().debug( "using botstrap repository" );
- }
- else
- {
- m_repository = createRepository( system, repositoryConfig );
- getLogger().debug( "using custom repository" );
- }
+ Configuration repositoryConfig = m_kernel.getChild( "repository" );
+ m_repository = createRepository( system, repositoryConfig );
//
// setup the pool manager
@@ -272,7 +271,7 @@
m_factory = new DefaultModelFactory(
new DefaultSystemContext(
getLoggingManager(),
- getSystemPath(),
+ getLibraryPath(),
getHomePath(),
getRepository() ) );
}
@@ -286,12 +285,12 @@
private Repository createRepository( File root, Configuration config ) throws
KernelException
{
- File base = root;
+ File base = null;
String cache = config.getChild( "cache" ).getValue( null );
if( cache != null )
{
base = new File( cache );
- getLogger().debug( "setting repository declared cache: " + base );
+ getLogger().debug( "setting repository cache: " + base );
}
else
{
@@ -299,6 +298,8 @@
getLogger().debug( "setting repository to: " + base );
}
+ //File base = new File( getSystemPath(), "repository" );
+
if( !base.exists() ) base.mkdirs();
//
@@ -417,6 +418,15 @@
}
/**
+ * Return the library path
+ * @return the path (possibly null)
+ */
+ public File getLibraryPath()
+ {
+ return m_library;
+ }
+
+ /**
* Return the home path
* @return the path (possibly null)
*/
@@ -507,6 +517,7 @@
buffer.append( getVersionString() );
buffer.append( "\nhome: " + getHomePath() );
buffer.append( "\nsystem: " + getSystemPath() );
+ buffer.append( "\nlibrary: " + getLibraryPath() );
buffer.append( "\nkernel: " + m_kernelURL );
buffer.append( "\nblock: " + getInstallSequenceString() );
buffer.append( "\noverride: " + getOverrideDirective() );
1.3 +4 -2
avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/Resources.properties
Index: Resources.properties
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/Resources.properties,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Resources.properties 12 Aug 2003 05:30:44 -0000 1.2
+++ Resources.properties 17 Aug 2003 15:06:41 -0000 1.3
@@ -11,7 +11,7 @@
cli-server-description=Overrides the default execute flag.
-cli-version-description=Prints Merlin version information.
+cli-version-description=Lists Merlin version information.
cli-debug-description=Enable debug messages during the bootstrap phase.
@@ -23,7 +23,9 @@
cli-config-description=The filename of the block configuration. If not specified
the value defaults to a file name config.xml in the same directory as the block.
-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-system-description=An absolute or relative path to a repository parent
directory.
+
+cli-library-description=A directory that serves as the anchor for relative library
directory references.
cli-description=\nDescription: The merlin command executes the deployment of a
component block. The [block] argument may be either an block descriptor file or a jar
file containing a block descriptor. If no value if declared, Merlin will attempt to
execute a file named 'block.xml' in the current directory.
1.5 +1 -1 avalon-sandbox/merlin/merlin-platform/src/bin/merlin.bat
Index: merlin.bat
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/merlin-platform/src/bin/merlin.bat,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- merlin.bat 17 Aug 2003 08:48:54 -0000 1.4
+++ merlin.bat 17 Aug 2003 15:06:41 -0000 1.5
@@ -1,6 +1,6 @@
@echo off
if "%MERLIN_HOME%" == "" goto MissingHomeDefinition
-java -Dmerlin.home=%MERLIN_HOME% -jar %MERLIN_HOME%\bin\merlin-bootstrap-1.0.jar
-system %MERLIN_HOME% -execute %1 %2 %3 %4 %5 %6
+java -Dmerlin.home=%MERLIN_HOME% -jar %MERLIN_HOME%\bin\merlin-bootstrap-1.0.jar %1
%2 %3 %4 %5 %6
goto :end
:MissingHomeDefinition
echo.
1.5 +1 -1 avalon-sandbox/merlin/merlin-platform/src/bin/merlin.sh
Index: merlin.sh
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/merlin-platform/src/bin/merlin.sh,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- merlin.sh 11 Aug 2003 22:58:51 -0000 1.4
+++ merlin.sh 17 Aug 2003 15:06:41 -0000 1.5
@@ -102,9 +102,9 @@
#
# Get the run cmd
RUN_CMD="$JAVA_HOME/bin/java $JVM_OPTS \
+ -Dmerlin.home="$MERLIN_HOME" \
$DEBUG \
-jar "$MERLIN_HOME/bin/merlin-bootstrap-1.0.jar" \
- -system "$MERLIN_HOME" \
$*"
echo "Using MERLIN_HOME: $MERLIN_HOME"
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]