mcconnell 2003/08/11 22:30:44
Modified: merlin maven.xml
merlin/activation/src/java/org/apache/avalon/activation/appliance/impl
BlockThread.java
merlin/composition/src/java/org/apache/avalon/composition/data/builder
XMLContainmentProfileCreator.java
merlin/composition/src/java/org/apache/avalon/composition/data/writer
XMLContainmentProfileWriter.java
merlin/composition/src/java/org/apache/avalon/composition/model/impl
DefaultClassLoaderModel.java
DefaultContainmentModel.java
DefaultModelFactory.java
merlin/composition-spi/src/java/org/apache/avalon/composition/data
ResourceDirective.java
merlin/composition-spi/src/java/org/apache/avalon/composition/model
ModelFactory.java
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/kernel/spi/src/java/org/apache/avalon/merlin/kernel
KernelContext.java
merlin/merlin-platform/examples/james/conf james.xml
merlin/merlin-platform/src/bin merlin.bat
merlin/merlin-platform/src/config kernel.xml wrapper.conf
Log:
Housekeeping.
Revision Changes Path
1.35 +12 -28 avalon-sandbox/merlin/maven.xml
Index: maven.xml
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/maven.xml,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- maven.xml 11 Aug 2003 22:38:16 -0000 1.34
+++ maven.xml 12 Aug 2003 05:30:44 -0000 1.35
@@ -29,7 +29,7 @@
<maven:reactor
basedir="${basedir}"
includes="**/project.xml"
- excludes="merlin-platform/**,merlin-plugin/**,project.xml,kernel/bootstrap/*"
+
excludes="merlin-platform/**,merlin-plugin/**,project.xml,kernel/bootstrap/*,merlin-extensions/**"
goals="jar:install-snapshot"
banner="Installing:"
ignoreFailures="false" />
@@ -80,20 +80,6 @@
</goal>
<!--
- The following project is called against a subproject. It results in
- the build of the subproject, install of the jar in the user's local
- repository, and copies the jar file into the merlin installation
- directory.
- -->
- <goal name="merlin-propergate" prereqs="jar:install-snapshot">
- <ant:copy todir="${basedir}/../target/${merlin.build.inst}/lib/system">
- <fileset dir="${maven.build.dir}">
- <include name="${maven.final.name}.jar"/>
- </fileset>
- </ant:copy>
- </goal>
-
- <!--
Import the jar files declared as dependecies of the smp project. This
includes all of the external jar files needed to run merlin. Dependent
jar files are copied from the user's local repository to the merlin
@@ -193,21 +179,19 @@
without disrupting current executing NT services. I.e. just update
the jar files in the lib subdirectories.
-->
- <goal name="merlin-libs" prereqs="merlin-install-plugin,merlin-dist">
+ <goal name="merlin-libs" prereqs="merlin-dist">
<ant:property environment="env"/>
- <ant:mkdir dir="${env.MERLIN_HOME}/lib/shared"/>
+ <ant:mkdir dir="${env.MERLIN_HOME}/repository"/>
<ant:echo>Updating Merlin libraries: ${env.MERLIN_HOME}</ant:echo>
- <ant:copy toDir="${env.MERLIN_HOME}/lib/shared">
- <fileset dir="${merlin.build.inst.dir}/lib/shared">
- <include name="**/*"/>
- </fileset>
- </ant:copy>
- <ant:mkdir dir="${env.MERLIN_HOME}/lib/system"/>
- <ant:copy toDir="${env.MERLIN_HOME}/lib/system">
- <fileset dir="${merlin.build.inst.dir}/lib/system">
+ <ant:copy toDir="${env.MERLIN_HOME}/repository">
+ <fileset dir="${merlin.build.inst.dir}/repository">
<include name="**/*"/>
</fileset>
</ant:copy>
+ <ant:copy
+ file="${basedir}/kernel/bootstrap/target/merlin-bootstrap-1.0.jar"
+ toDir="${env.MERLIN_HOME}/bin"/>
+
</goal>
<goal name="xjavadoc">
@@ -225,6 +209,8 @@
<j:forEach var="packageGroup" items="${pom.packageGroups}">
<group title="${packageGroup.title}" packages="${packageGroup.packages}"/>
</j:forEach>
+ <sourcepath path="${basedir}/../repository/spi/src/java"/>
+ <sourcepath path="${basedir}/../repository/impl/src/java"/>
<sourcepath path="${basedir}/../extension-spi/src/java"/>
<sourcepath path="${basedir}/../extension/src/java"/>
<sourcepath path="${basedir}/../composition-spi/src/java"/>
@@ -233,8 +219,6 @@
<sourcepath path="${basedir}/../activation/src/java"/>
<sourcepath path="${basedir}/../kernel/spi/src/java"/>
<sourcepath path="${basedir}/../kernel/impl/src/java"/>
- <sourcepath path="${basedir}/../repository/spi/src/java"/>
- <sourcepath path="${basedir}/../repository/impl/src/java"/>
<classpath>
<path refid="maven.dependency.classpath"/>
</classpath>
@@ -278,7 +262,7 @@
<maven:reactor
basedir="${basedir}"
includes="**/project.xml"
- excludes="merlin-platform/**,project.xml"
+
excludes="merlin-platform/**,project.xml,merlin-plugin/**/*,merlin-extensions/**"
goals="clean"
banner="Cleaning subproject:"
ignoreFailures="false"/>
1.2 +3 -3
avalon-sandbox/merlin/activation/src/java/org/apache/avalon/activation/appliance/impl/BlockThread.java
Index: BlockThread.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/activation/src/java/org/apache/avalon/activation/appliance/impl/BlockThread.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BlockThread.java 8 Aug 2003 10:59:00 -0000 1.1
+++ BlockThread.java 12 Aug 2003 05:30:44 -0000 1.2
@@ -60,7 +60,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Avalon Development Team</a>
* @version $Revision$ $Date$
*/
-class BlockThread extends Thread
+public class BlockThread extends Thread
{
//-------------------------------------------------------------------
// immmutable state
@@ -90,7 +90,7 @@
* @param classloader the classloader
* @param block the block
*/
- BlockThread( Block block )
+ public BlockThread( Block block )
throws Exception
{
if( block == null ) throw new NullPointerException( "block" );
1.8 +10 -2
avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/builder/XMLContainmentProfileCreator.java
Index: XMLContainmentProfileCreator.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/builder/XMLContainmentProfileCreator.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- XMLContainmentProfileCreator.java 11 Aug 2003 22:58:49 -0000 1.7
+++ XMLContainmentProfileCreator.java 12 Aug 2003 05:30:44 -0000 1.8
@@ -262,7 +262,15 @@
{
String id = config.getAttribute( "id" );
String version = config.getAttribute( "version", null );
- return new ResourceDirective( id, version );
+ String type = config.getAttribute( "type", null );
+ if( type == null )
+ {
+ return ResourceDirective.createResourceDirective( id, version );
+ }
+ else
+ {
+ return ResourceDirective.createResourceDirective( id, version, type );
+ }
}
private FilesetDirective[] createFilesetDirectives( Configuration config )
1.8 +5 -1
avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/writer/XMLContainmentProfileWriter.java
Index: XMLContainmentProfileWriter.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/data/writer/XMLContainmentProfileWriter.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- XMLContainmentProfileWriter.java 11 Aug 2003 22:58:49 -0000 1.7
+++ XMLContainmentProfileWriter.java 12 Aug 2003 05:30:44 -0000 1.8
@@ -346,6 +346,10 @@
if( resource.getVersion() != null )
{
writer.write( " version=\"" + resource.getVersion() + "\"" );
+ if( !resource.getType().equals( "jar" ) )
+ {
+ writer.write( " type=\"" + resource.getType() + "\"" );
+ }
}
writer.write( "/>" );
}
1.17 +6 -3
avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultClassLoaderModel.java
Index: DefaultClassLoaderModel.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultClassLoaderModel.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- DefaultClassLoaderModel.java 11 Aug 2003 22:58:50 -0000 1.16
+++ DefaultClassLoaderModel.java 12 Aug 2003 05:30:44 -0000 1.17
@@ -451,8 +451,11 @@
ResourceDirective resource = resources[j];
String id = resource.getId();
String version = resource.getVersion();
- URL url = repository.getArtifact( id, version, "jar" );
- classpath.add( url.toString() );
+ if( resource.getType().equals( "jar" ) )
+ {
+ URL url = repository.getArtifact( id, version, "jar" );
+ classpath.add( url.toString() );
+ }
}
}
1.23 +3 -2
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.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- DefaultContainmentModel.java 11 Aug 2003 22:58:50 -0000 1.22
+++ DefaultContainmentModel.java 12 Aug 2003 05:30:44 -0000 1.23
@@ -435,11 +435,12 @@
final ResourceDirective resource = directive.getResource();
final String id = resource.getId();
final String version = resource.getVersion();
+ final String type = resource.getType();
try
{
Repository repository = m_context.getSystemContext().getRepository();
- final URL url = repository.getArtifact( id, version, "jar" );
+ final URL url = repository.getArtifact( id, version, type );
return createContainmentModel( name, url );
}
catch( RepositoryException e )
1.9 +25 -5
avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultModelFactory.java
Index: DefaultModelFactory.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/composition/src/java/org/apache/avalon/composition/model/impl/DefaultModelFactory.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- DefaultModelFactory.java 11 Aug 2003 22:58:50 -0000 1.8
+++ DefaultModelFactory.java 12 Aug 2003 05:30:44 -0000 1.9
@@ -199,6 +199,28 @@
public ContainmentModel createContainmentModel( ContainmentProfile profile )
throws ModelException
{
+ try
+ {
+ ContainmentContext context = createContainmentContext( profile );
+ return createContainmentModel( context );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ REZ.getString( "factory.containment.create.error", profile.getName()
);
+ throw new ModelException( error, e );
+ }
+ }
+
+ /**
+ * Creation of a new root containment context.
+ *
+ * @param profile a composition profile
+ * @return the containment model
+ */
+ public ContainmentContext createContainmentContext( ContainmentProfile profile
)
+ throws ModelException
+ {
if( profile == null )
{
throw new NullPointerException( "profile" );
@@ -223,11 +245,8 @@
ClassLoaderModel classLoaderModel =
new DefaultClassLoaderModel( classLoaderContext );
- DefaultContainmentContext context =
- new DefaultContainmentContext(
+ return new DefaultContainmentContext(
logger, m_system, classLoaderModel, profile );
-
- return createContainmentModel( context );
}
catch( Throwable e )
{
@@ -236,6 +255,7 @@
throw new ModelException( error, e );
}
}
+
/**
* Creation of a new nested containment model. This method is called
1.2 +70 -20
avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/data/ResourceDirective.java
Index: ResourceDirective.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/data/ResourceDirective.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ResourceDirective.java 17 Jul 2003 21:21:59 -0000 1.1
+++ ResourceDirective.java 12 Aug 2003 05:30:44 -0000 1.2
@@ -76,29 +76,20 @@
private final String m_version;
/**
+ * The type identifier.
+ */
+ private final String m_type;
+
+ /**
* Creation of a new resource directive.
- * @param id the artifact id
+ * @param group the artifact group
+ * @param name the artifact name
* @param version the artifact version
*/
public ResourceDirective(
- final String id, final String version )
+ final String group, final String name, final String version )
{
- if( id == null )
- {
- throw new NullPointerException( "id" );
- }
- int n = id.indexOf( ":" );
- if( id.indexOf( ":" ) > 0 )
- {
- m_group = id.substring( 0, n );
- m_name = id.substring( n+1, id.length() );
- }
- else
- {
- m_group = id;
- m_name = id;
- }
- m_version = version;
+ this( group, name, version, "jar" );
}
/**
@@ -108,7 +99,7 @@
* @param version the artifact version
*/
public ResourceDirective(
- final String group, final String name, final String version )
+ final String group, final String name, final String version, final String
type )
{
if( group == null )
{
@@ -118,10 +109,15 @@
{
throw new NullPointerException( "name" );
}
+ if( type == null )
+ {
+ throw new NullPointerException( "type" );
+ }
m_group = group;
m_name = name;
m_version = version;
+ m_type = type;
}
/**
@@ -159,4 +155,58 @@
{
return m_version;
}
+
+ /**
+ * Return the type of the artifact.
+ * @return the artifact type
+ */
+ public String getType()
+ {
+ return m_type;
+ }
+
+ /**
+ * Creation of a new resource directive.
+ * @param id the artifact id
+ * @param version the artifact version
+ */
+ public static ResourceDirective createResourceDirective(
+ final String id, final String version )
+ {
+ return createResourceDirective( id, version, "jar" );
+ }
+
+ /**
+ * Creation of a new resource directive.
+ * @param id the artifact id
+ * @param version the artifact version
+ */
+ public static ResourceDirective createResourceDirective(
+ final String id, final String version, final String type )
+ {
+ if( id == null )
+ {
+ throw new NullPointerException( "id" );
+ }
+ if( type == null )
+ {
+ throw new NullPointerException( "type" );
+ }
+
+ String group = null;
+ String name = null;
+ int n = id.indexOf( ":" );
+ if( id.indexOf( ":" ) > 0 )
+ {
+ group = id.substring( 0, n );
+ name = id.substring( n+1, id.length() );
+ }
+ else
+ {
+ group = id;
+ name = id;
+ }
+ return new ResourceDirective( group, name, version, type );
+ }
+
}
1.6 +10 -1
avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/ModelFactory.java
Index: ModelFactory.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/composition-spi/src/java/org/apache/avalon/composition/model/ModelFactory.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ModelFactory.java 11 Aug 2003 22:58:50 -0000 1.5
+++ ModelFactory.java 12 Aug 2003 05:30:44 -0000 1.6
@@ -85,6 +85,15 @@
throws ModelException;
/**
+ * Creation of a new root containment context.
+ *
+ * @param profile a composition profile
+ * @return the containment model
+ */
+ ContainmentContext createContainmentContext( ContainmentProfile profile )
+ throws ModelException;
+
+ /**
* Creation of a new nested containment model. This method is called
* by a container implementation when constructing model instances. The
* factory is identified by its implementation classname.
1.2 +9 -4 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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Merlin.java 11 Aug 2003 22:34:46 -0000 1.1
+++ Merlin.java 12 Aug 2003 05:30:44 -0000 1.2
@@ -79,7 +79,9 @@
private static final String REPOSITORY = "http://www.ibiblio.org/maven";
- private static final String MERLIN_REPOSITORY_LOCAL_KEY =
+ private static final String MERLIN_HOME_KEY =
+ "merlin.home";
+ private static final String MERLIN_LOCAL_KEY =
"merlin.repository.local";
private static final String MERLIN_REPOSITORY_REMOTE_KEY =
"merlin.repository.remote";
@@ -90,7 +92,8 @@
private static final String MERLIN_PROPERTIES_NAME =
"merlin.properties";
- private static final File HOME = new File( System.getProperty( "user.dir" ) );
+ private static final File HOME =
+ new File( System.getProperty( "user.dir" ) );
/**
* Command line entry point to the Merlin system.
@@ -107,8 +110,9 @@
// the merlin jar repository
//
- String system = System.getProperty( "user.home" ) + "/merlin";
- String home = System.getProperty( MERLIN_REPOSITORY_LOCAL_KEY, system );
+ 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" );
if( !base.exists() )
@@ -158,6 +162,7 @@
Class clazz;
String classname =
properties.getProperty( MERLIN_BOOTSTRAP_CLASSNAME_KEY );
+
try
{
clazz = loader.loadClass( classname );
1.2 +25 -7
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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CLIKernelLoader.java 11 Aug 2003 22:34:48 -0000 1.1
+++ CLIKernelLoader.java 12 Aug 2003 05:30:44 -0000 1.2
@@ -69,8 +69,11 @@
System.out.println( "\n");
System.out.println( context.toString() );
}
+ System.out.println( "## CREATING KERNEL ##");
Kernel kernel = new DefaultKernel( context );
+ System.out.println( "## SETTING SHUTDOWN HOOK ##");
setShutdownHook( kernel );
+ System.out.println( "## DONE ##");
}
//--------------------------------------------------------------------------
@@ -96,6 +99,8 @@
{
line = parser.parse( CL_OPTIONS, args );
+ boolean server = line.hasOption( "server" );
+
if( line.hasOption( "lang" ) )
{
//
@@ -123,18 +128,26 @@
}
else
{
+
String[] arguments = line.getArgs();
if( arguments.length == 0 )
{
- File target = new File( HOME, "block.xml" );
- if( target.exists() )
+ if( !server )
{
- blocks = new URL[]{ target.toURL() };
+ File target = new File( HOME, "block.xml" );
+ if( target.exists() )
+ {
+ blocks = new URL[]{ target.toURL() };
+ }
+ else
+ {
+ System.out.println( "\nFILE-NOT-FOUND: " + target );
+ return null;
+ }
}
else
{
- System.out.println( "\nFILE-NOT-FOUND: " + target );
- return null;
+ blocks = new URL[0];
}
}
else
@@ -142,7 +155,7 @@
blocks = new URL[ arguments.length ];
for( int i=0; i<arguments.length; i++ )
{
- String blockarg = arguments[1];
+ String blockarg = arguments[i];
URL url = getFile( HOME, blockarg ).toURL();
blocks[i] = url;
}
@@ -180,7 +193,7 @@
URL config = getConfigPath( base.getParentFile(), line );
return new DefaultKernelContext(
- repository, system, home, kernel, blocks, config, debug );
+ repository, system, home, kernel, blocks, config, server, debug );
}
catch( Throwable e )
{
@@ -421,6 +434,10 @@
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" ) );
@@ -460,6 +477,7 @@
options.addOption( help );
options.addOption( execute );
+ options.addOption( server );
options.addOption( version );
options.addOption( debug );
options.addOption( home );
1.2 +63 -117
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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultKernel.java 11 Aug 2003 22:34:49 -0000 1.1
+++ DefaultKernel.java 12 Aug 2003 05:30:44 -0000 1.2
@@ -75,11 +75,13 @@
import org.apache.avalon.composition.model.Model;
import org.apache.avalon.composition.model.ModelFactory;
import org.apache.avalon.composition.model.ModelException;
+import org.apache.avalon.composition.model.ContainmentContext;
import org.apache.avalon.composition.model.ContainmentModel;
import org.apache.avalon.composition.model.DeploymentModel;
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.framework.activity.Disposable;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.DefaultConfiguration;
@@ -135,13 +137,30 @@
// create the root block into which we install application blocks
//
+ getLogger().info( "context establishment" );
+
+ ContainmentContext contaiment = null;
try
{
final ContainmentProfile profile =
CREATOR.createContainmentProfile(
context.getKernelDirective().getChild( "container" ) );
- m_model =
- context.getModelFactory().createContainmentModel( profile );
+
+ contaiment = context.getModelFactory().createContainmentContext(
profile );
+ Thread.currentThread().setContextClassLoader(
contaiment.getClassLoader() );
+ }
+ catch( Throwable e )
+ {
+ final String error =
+ "Internal error while build default containment context.";
+ throw new KernelException( error, e );
+ }
+
+ getLogger().info( "construction phase" );
+
+ try
+ {
+ m_model = context.getModelFactory().createContainmentModel( contaiment
);
}
catch( Throwable e )
{
@@ -245,8 +264,10 @@
throw new KernelException( error, e );
}
- //getLogger().info( "deployment phase" );
-
+ if( !context.getServerFlag() )
+ {
+ shutdown();
+ }
}
//==============================================================
@@ -254,124 +275,16 @@
//==============================================================
/**
- * Install a block into the kernel.
- * @param base the URL of the block configuration or a jar file
- * containing a block descriptor
- * @param config a possibly null URL of a configuration file
- * containing component configuration targets
- * @return the installed block
- * @exception KernelException if an installation error if raised
- * @exception NullPointerException if the supplied base URL is null
- */
- /*
- private Block install( URL base, URL config ) throws KernelException
- {
- if( base == null )
- {
- throw new NullPointerException( "base" );
- }
-
- if( !m_initialized )
- {
- final String error =
- "Kernel has not been initialized.";
- throw new IllegalStateException( error );
- }
-
- if( getLogger().isDebugEnabled() )
- {
- getLogger().debug( "#" );
- getLogger().debug( "# installation phase" );
- getLogger().debug( "#" );
- }
-
- Block block = null;
-
- try
- {
- block = m_installer.install( base, config );
- }
- catch( Throwable e )
- {
- final String error = "Block install failure.\nURL:" + m_url;
- throw new KernelException( error, e );
- }
-
- if( getLogger().isDebugEnabled() )
- {
- getLogger().debug( "#" );
- getLogger().debug( "# assembly phase" );
- getLogger().debug( "#" );
- }
-
- try
- {
- block.assemble( m_graph );
- }
- catch( Throwable e )
- {
- final String error =
- "Unable to assemble block.\nBlock: "
- + block.getName();
- throw new KernelException( error, e );
- }
-
- Appliance[] appliances = m_graph.getStartupGraph();
- if( getLogger().isDebugEnabled() )
- {
- getLogger().debug( "#" );
- getLogger().debug( "# deployment phase" );
-
- if( appliances.length > 0 )
- {
- StringBuffer buffer = new StringBuffer( "# sequence: " );
- for( int p=0; p<appliances.length; p++ )
- {
- if( p == 0 )
- {
- buffer.append( appliances[p] );
- }
- else
- {
- buffer.append( ", " + appliances[p] );
- }
- }
- getLogger().debug( buffer.toString() );
- }
- else
- {
- getLogger().debug( "# sequence: []" );
- }
- getLogger().debug( "#" );
- }
-
- try
- {
- block.deploy();
- }
- catch( Throwable e )
- {
- final String error =
- "Root block deployment failure." ;
- throw new KernelException( error, e );
- }
-
- return block;
- }
- */
-
- /**
* Shutdown the kernel during which orderly shutdown of all
* installed blocks is undertaken.
*/
public void shutdown()
{
- /*
if( getLogger() != null )
{
if( getLogger().isInfoEnabled() )
{
- getLogger().info( "commencing decommissioning phase" );
+ getLogger().info( "decommissioning phase" );
}
}
@@ -380,8 +293,6 @@
try
{
m_block.decommission();
- m_block.terminate();
- m_block = null;
}
catch( Throwable e )
{
@@ -392,6 +303,42 @@
getLogger().warn( error, e );
}
}
+
+ try
+ {
+ if( m_block instanceof Composite )
+ {
+ getLogger().info( "dissassembly phase" );
+ ((Composite)m_block).disassemble();
+ }
+ }
+ catch( Throwable e )
+ {
+ if( getLogger().isWarnEnabled() )
+ {
+ final String error =
+ "Ignoring block dissassembly error.";
+ getLogger().warn( error, e );
+ }
+ }
+
+ try
+ {
+ 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() )
@@ -403,7 +350,6 @@
{
getLogger().info( "bye" );
}
- */
}
//==============================================================
1.2 +17 -2
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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultKernelContext.java 11 Aug 2003 22:34:50 -0000 1.1
+++ DefaultKernelContext.java 12 Aug 2003 05:30:44 -0000 1.2
@@ -146,6 +146,11 @@
*/
private final boolean m_debug;
+ /**
+ * The server flag.
+ */
+ private final boolean m_server;
+
/**
* The logging manager.
*/
@@ -183,7 +188,7 @@
*/
public DefaultKernelContext(
Repository repository, File system, File home,
- URL kernel, URL[] blocks, URL config, boolean debug )
+ URL kernel, URL[] blocks, URL config, boolean server, boolean debug )
throws NullPointerException, KernelException
{
@@ -204,6 +209,7 @@
}
m_debug = debug;
+ m_server = server;
m_blocks = blocks;
m_config = config;
@@ -329,6 +335,15 @@
public boolean getDebugFlag()
{
return m_debug;
+ }
+
+ /**
+ * Return the kernel server flag.
+ * @return the server flag
+ */
+ public boolean getServerFlag()
+ {
+ return m_server;
}
/**
1.2 +2 -0
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.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Resources.properties 11 Aug 2003 22:34:50 -0000 1.1
+++ Resources.properties 12 Aug 2003 05:30:44 -0000 1.2
@@ -9,6 +9,8 @@
cli-execute-description=If present the kernel will initiate shutdown immediately
following deployment.
+cli-server-description=Overrides the default execute flag.
+
cli-version-description=Prints Merlin version information.
cli-debug-description=Enable debug messages during the bootstrap phase.
1.2 +6 -0
avalon-sandbox/merlin/kernel/spi/src/java/org/apache/avalon/merlin/kernel/KernelContext.java
Index: KernelContext.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/kernel/spi/src/java/org/apache/avalon/merlin/kernel/KernelContext.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- KernelContext.java 11 Aug 2003 22:34:51 -0000 1.1
+++ KernelContext.java 12 Aug 2003 05:30:44 -0000 1.2
@@ -61,6 +61,12 @@
boolean getDebugFlag();
/**
+ * Return the kernel server flag.
+ * @return the server flag
+ */
+ boolean getServerFlag();
+
+ /**
* Return the logging manager for the kernel.
* @return the logging manager
*/
1.6 +20 -71
avalon-sandbox/merlin/merlin-platform/examples/james/conf/james.xml
Index: james.xml
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/merlin-platform/examples/james/conf/james.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- james.xml 18 Jul 2003 02:48:33 -0000 1.5
+++ james.xml 12 Aug 2003 05:30:44 -0000 1.6
@@ -1,9 +1,5 @@
-<block>
-
- <info>
- <name>james</name>
- </info>
+<container name="james">
<!--
Service provided by this block.
@@ -18,14 +14,11 @@
</services>
<!--
- Block implementation. The implementation element may contain component,
- container and include entities.
+ Block implementation.
-->
- <implementation>
-
- <classloader>
- <classpath>
- <repository>
+ <classloader>
+ <classpath>
+ <repository>
<!-- apis for cornerstone service imports -->
<resource id="avalon-framework:avalon-framework-impl"
version="SNAPSHOT"/>
@@ -42,71 +35,27 @@
<resource id="excalibur:excalibur-collections" version="1.0"/>
<resource id="excalibur-thread:excalibur-thread" version="1.1.1"/>
<resource id="excalibur-pool:excalibur-pool" version="1.2"/>
- <!-- <resource id="james:mail_1_3"/> -->
- <!-- <resource id="james:mailet-api" version="1.0"/> -->
- <!-- <resource id="james:activation"/> -->
<resource id="dnsjava:dnsjava" version="1.3.2"/>
- <resource id="james:mailet" version="1.0"/>
+ <resource id="james:mail_1_3"/>
+ <resource id="james:activation"/>
+
+ <!-- james core -->
+ <resource id="james:mailet-api" version="1.0"/>
<resource id="james:james" version="3.0a1"/>
+
</repository>
</classpath>
</classloader>
- <include name="threads">
- <resource id="cornerstone-threads:cornerstone-threads-impl"
version="SNAPSHOT"/>
- </include>
-
- <include name="sockets">
- <resource id="cornerstone-sockets:cornerstone-sockets-impl"
version="SNAPSHOT"/>
- </include>
-
- <include name="scheduler">
- <resource id="cornerstone-scheduler:cornerstone-scheduler-impl"
version="SNAPSHOT"/>
- </include>
-
- <include name="datasources">
- <resource id="cornerstone-datasources:cornerstone-datasources-impl"
version="SNAPSHOT"/>
- </include>
-
- <include name="store">
- <resource id="cornerstone-store:cornerstone-store-impl" version="SNAPSHOT"/>
- <targets>
- <target path="/manager">
- <configuration>
- <repositories>
- <repository
-
class="org.apache.james.mailrepository.filepair.File_Persistent_Object_Repository">
- <protocols>
- <protocol>file</protocol>
- </protocols>
- <types>
- <type>OBJECT</type>
- </types>
- <models>
- <model>SYNCHRONOUS</model>
- <model>ASYNCHRONOUS</model>
- <model>CACHE</model>
- </models>
- </repository>
- <repository
-
class="org.apache.james.mailrepository.filepair.File_Persistent_Stream_Repository">
- <protocols>
- <protocol>file</protocol>
- </protocols>
- <types>
- <type>STREAM</type>
- </types>
- <models>
- <model>SYNCHRONOUS</model>
- <model>ASYNCHRONOUS</model>
- <model>CACHE</model>
- </models>
- </repository>
- </repositories>
- </configuration>
- </target>
- </targets>
- </include>
+ <include name="threads" id="cornerstone-threads:cornerstone-threads-impl"
version="SNAPSHOT"/>
+
+ <include name="sockets" id="cornerstone-sockets:cornerstone-sockets-impl"
version="SNAPSHOT"/>
+
+ <include name="scheduler"
id="cornerstone-scheduler:cornerstone-scheduler-impl" version="SNAPSHOT"/>
+
+ <include name="datasources"
id="cornerstone-datasources:cornerstone-datasources-impl" version="SNAPSHOT"/>
+
+ <include name="store" id="cornerstone-store:cornerstone-store-impl"
version="SNAPSHOT"/>
<component name="connections"
class="org.apache.james.util.connection.SimpleConnectionManager"
1.3 +13 -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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- merlin.bat 11 Aug 2003 22:58:51 -0000 1.2
+++ merlin.bat 12 Aug 2003 05:30:44 -0000 1.3
@@ -1,3 +1,15 @@
@echo off
-java -jar %MERLIN_HOME%\bin\merlin-bootstrap-1.0.jar %1 %2 %3 %4 %5 %6
+if "%MERLIN_HOME%" == "" goto MissingHomeDefinition
+java -Dmerlin.home=%MERLIN_HOME% -jar %MERLIN_HOME%\bin\merlin-bootstrap-1.0.jar
-execute %1 %2 %3 %4 %5 %6
+goto :end
+:MissingHomeDefinition
+echo.
+echo ERROR: MERLIN_HOME is not defined.
+echo MERLIN_HOME = %MERLIN_HOME%
+echo Please set the MERLIN_HOME variable in your environment to match the
+echo location of the Merlin installation
+echo.
+goto end
+:end
+
1.6 +5 -0 avalon-sandbox/merlin/merlin-platform/src/config/kernel.xml
Index: kernel.xml
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/merlin-platform/src/config/kernel.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- kernel.xml 11 Aug 2003 22:58:51 -0000 1.5
+++ kernel.xml 12 Aug 2003 05:30:44 -0000 1.6
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
kernel.xml
@@ -17,6 +18,10 @@
<categories>
<category name="/sys" priority="WARN"/>
</categories>
+
+ <container name="root">
+ <!-- add components, container or includes here -->
+ </container>
</kernel>
1.3 +8 -8 avalon-sandbox/merlin/merlin-platform/src/config/wrapper.conf
Index: wrapper.conf
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/merlin-platform/src/config/wrapper.conf,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- wrapper.conf 11 Aug 2003 22:58:51 -0000 1.2
+++ wrapper.conf 12 Aug 2003 05:30:44 -0000 1.3
@@ -16,7 +16,7 @@
wrapper.java.library.path.1=../lib
# Java Additional Parameters
-#wrapper.java.additional.1=
+wrapper.java.additional.1=-Dmerlin.home=%MERLIN_HOME%
# Initial Java Heap Size (in MB)
wrapper.java.initmemory=3
@@ -26,13 +26,13 @@
# Application parameters. Add parameters as needed starting from 1
wrapper.app.parameter.1=Merlin
-wrapper.app.parameter.2=-kernel
-wrapper.app.parameter.3=../config/kernel.xml
-wrapper.app.parameter.4=-home
-wrapper.app.parameter.5=../
-wrapper.app.parameter.6=-config
-wrapper.app.parameter.7=../config/config.xml
-wrapper.app.parameter.8=../config/block.xml
+wrapper.app.parameter.2=-server
+wrapper.app.parameter.3=-kernel
+wrapper.app.parameter.4=../config/kernel.xml
+wrapper.app.parameter.5=-home
+wrapper.app.parameter.6=../
+wrapper.app.parameter.7=-config
+wrapper.app.parameter.8=../config/config.xml
# Port which the native wrapper code will attempt to connect to
wrapper.port=1777
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]