mcconnell 2003/11/22 16:47:06
Modified: kernel/impl project.xml
kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl
DefaultKernel.java DefaultKernelContext.java
Resources.properties
Added: kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl
DefaultCriteria.java DefaultFactory.java
Removed: kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl
CLIKernelLoader.java DefaultKernelMBean.java
DefaultLoader.java JRMPKernelAdaptor.java
Log:
Updated impl to 3.2.2.
Revision Changes Path
1.4 +47 -4 avalon-sandbox/kernel/impl/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/avalon-sandbox/kernel/impl/project.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- project.xml 13 Nov 2003 14:24:41 -0000 1.3
+++ project.xml 23 Nov 2003 00:47:06 -0000 1.4
@@ -9,7 +9,7 @@
<name>Merlin Kernel Implementation</name>
<package>org.apache.avalon.merlin</package>
- <currentVersion>3.3-dev</currentVersion>
+ <currentVersion>3.2.2-dev</currentVersion>
<inceptionYear>2002</inceptionYear>
<shortDescription>Merlin Kernel Implementation</shortDescription>
@@ -37,7 +37,10 @@
<dependency>
<groupId>merlin</groupId>
<artifactId>merlin-kernel-spi</artifactId>
- <version>3.3-dev</version>
+ <version>3.2-dev</version>
+ <properties>
+ <avalon.classloader>api</avalon.classloader>
+ </properties>
</dependency>
<!-- avalon dependecies -->
@@ -46,11 +49,17 @@
<groupId>avalon-activation</groupId>
<artifactId>avalon-activation-api</artifactId>
<version>1.2-dev</version>
+ <properties>
+ <avalon.classloader>api</avalon.classloader>
+ </properties>
</dependency>
<dependency>
<groupId>avalon-activation</groupId>
<artifactId>avalon-activation-spi</artifactId>
<version>1.2.1-dev</version>
+ <properties>
+ <avalon.classloader>spi</avalon.classloader>
+ </properties>
</dependency>
<dependency>
<groupId>avalon-activation</groupId>
@@ -62,11 +71,17 @@
<groupId>avalon-repository</groupId>
<artifactId>avalon-repository-api</artifactId>
<version>1.2-dev</version>
+ <properties>
+ <avalon.classloader>api</avalon.classloader>
+ </properties>
</dependency>
<dependency>
<groupId>avalon-repository</groupId>
<artifactId>avalon-repository-spi</artifactId>
<version>1.2-dev</version>
+ <properties>
+ <avalon.classloader>spi</avalon.classloader>
+ </properties>
</dependency>
<dependency>
<groupId>avalon-repository</groupId>
@@ -78,27 +93,39 @@
<groupId>avalon-composition</groupId>
<artifactId>avalon-composition-api</artifactId>
<version>1.2-dev</version>
+ <properties>
+ <avalon.classloader>api</avalon.classloader>
+ </properties>
</dependency>
<dependency>
<groupId>avalon-composition</groupId>
<artifactId>avalon-composition-spi</artifactId>
<version>1.2-dev</version>
+ <properties>
+ <avalon.classloader>spi</avalon.classloader>
+ </properties>
</dependency>
<dependency>
<groupId>avalon-composition</groupId>
<artifactId>avalon-composition-impl</artifactId>
- <version>1.2-dev</version>
+ <version>1.2.1-dev</version>
</dependency>
<dependency>
<groupId>avalon-meta</groupId>
<artifactId>avalon-meta-api</artifactId>
<version>1.2.1-dev</version>
+ <properties>
+ <avalon.classloader>api</avalon.classloader>
+ </properties>
</dependency>
<dependency>
<groupId>avalon-meta</groupId>
<artifactId>avalon-meta-spi</artifactId>
<version>1.2.1-dev</version>
+ <properties>
+ <avalon.classloader>spi</avalon.classloader>
+ </properties>
</dependency>
<dependency>
<groupId>avalon-meta</groupId>
@@ -110,6 +137,9 @@
<groupId>avalon-extension</groupId>
<artifactId>avalon-extension-spi</artifactId>
<version>1.0</version>
+ <properties>
+ <avalon.classloader>api</avalon.classloader>
+ </properties>
</dependency>
<dependency>
<groupId>avalon-extension</groupId>
@@ -121,6 +151,9 @@
<groupId>avalon-framework</groupId>
<artifactId>avalon-framework-api</artifactId>
<version>4.1.5</version>
+ <properties>
+ <avalon.classloader>api</avalon.classloader>
+ </properties>
</dependency>
<dependency>
<groupId>avalon-framework</groupId>
@@ -128,7 +161,6 @@
<version>4.1.5</version>
</dependency>
-
<!-- logkit dependecies -->
<dependency>
@@ -148,6 +180,9 @@
<groupId>excalibur-lifecycle</groupId>
<artifactId>excalibur-lifecycle-api</artifactId>
<version>1.0</version>
+ <properties>
+ <avalon.classloader>api</avalon.classloader>
+ </properties>
</dependency>
<dependency>
<id>excalibur-i18n</id>
@@ -171,6 +206,8 @@
<!-- commons dependencies -->
+ <!--
+ -->
<dependency>
<id>commons-cli</id>
<version>1.0</version>
@@ -186,11 +223,17 @@
<dependency>
<id>xml-apis</id>
<version>2.0.2</version>
+ <properties>
+ <avalon.classloader>api</avalon.classloader>
+ </properties>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xmlParserAPIs</artifactId>
<version>2.0.2</version>
+ <properties>
+ <avalon.classloader>api</avalon.classloader>
+ </properties>
</dependency>
<dependency>
<id>xerces</id>
1.2 +0 -0
avalon-sandbox/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernel.java
Index: DefaultKernel.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/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
1.2 +13 -43
avalon-sandbox/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernelContext.java
Index: DefaultKernelContext.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/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 12 Nov 2003 07:43:25 -0000 1.1
+++ DefaultKernelContext.java 23 Nov 2003 00:47:06 -0000 1.2
@@ -82,12 +82,10 @@
import org.apache.avalon.merlin.kernel.KernelContext;
import org.apache.avalon.merlin.kernel.KernelException;
import org.apache.avalon.merlin.kernel.KernelRuntimeException;
-import org.apache.avalon.repository.DefaultAuthenticator;
-import org.apache.avalon.repository.InitialRepositoryFactory;
import org.apache.avalon.repository.Repository;
import org.apache.avalon.repository.ProxyContext;
-import org.apache.avalon.repository.RepositoryContext;
-import org.apache.avalon.repository.RepositoryException;
+import org.apache.avalon.repository.impl.DefaultAuthenticator;
+import org.apache.avalon.repository.impl.DefaultFileRepository;
import org.apache.excalibur.configuration.ConfigurationUtil;
import org.apache.excalibur.mpool.PoolManager;
@@ -437,26 +435,11 @@
private Repository createRepository( File root, Configuration config )
throws KernelException
{
- InitialRepositoryFactory l_factory = null ;
- RepositoryContext l_repoCtx = null ;
-
- try
- {
- l_factory = new InitialRepositoryFactory() ;
- l_repoCtx = l_factory.getDefaultContext() ;
- }
- catch ( RepositoryException e )
- {
- throw new KernelException( "Could not initialize system repository",
- e ) ;
- }
-
File base = null;
String cache = config.getChild( "cache" ).getValue( null );
-
if( cache != null )
{
- base = new File( cache );
+ base = new File( cache );
getLogger().debug( "setting runtime repository cache: " + base );
}
else
@@ -465,19 +448,13 @@
getLogger().debug( "setting runtime repository to: " + base );
}
- if( !base.exists() )
- {
- base.mkdirs();
- }
+ if( !base.exists() ) base.mkdirs();
- l_repoCtx.setCacheDir( base.getAbsolutePath() ) ;
-
//
// set the remote repository urls
//
- final Configuration[] hosts = config.getChild( "hosts" )
- .getChildren( "host" );
+ final Configuration[] hosts = config.getChild( "hosts" ).getChildren(
"host" );
final URL[] list = new URL[ hosts.length ];
for( int i=0; i<hosts.length; i++ )
{
@@ -493,11 +470,13 @@
final String warning =
"\n#"
+ "\n# WARNING:" + path
- + "\n# The kernel file is using a depricated <host> "
- + "format.\n# Please replace all <host>...</host> "
- + "references\n# with <host path=\"...\"/>."
- + "\n#\n# Source kernel defintion: " + m_kernelURL
- + "\n#" + ConfigurationUtil.list( host );
+ + "\n# The kernel file is using a depricated <host>
format. "
+ + "\n# Please replace all <host>...</host> references "
+ + "\n# with <host path=\"...\"/>."
+ + "\n#"
+ + "\n# Source kernel defintion: " + m_kernelURL
+ + "\n#"
+ + ConfigurationUtil.list( host );
getLogger().warn( warning );
}
else
@@ -577,18 +556,9 @@
}
getLogger().debug( "repository proxy: " + host + ":" + port );
proxy = new ProxyContext( host, port, authenticator );
- l_repoCtx.setProxyContext( proxy ) ;
}
- try
- {
- return l_factory.create( l_repoCtx ) ;
- }
- catch ( RepositoryException e )
- {
- throw new KernelException( "Could not initialize system repository",
- e ) ;
- }
+ return new DefaultFileRepository( base, proxy, list );
}
//--------------------------------------------------------------
1.2 +21 -4
avalon-sandbox/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/Resources.properties
Index: Resources.properties
===================================================================
RCS file:
/home/cvs/avalon-sandbox/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 12 Nov 2003 07:43:25 -0000 1.1
+++ Resources.properties 23 Nov 2003 00:47:06 -0000 1.2
@@ -1,3 +1,24 @@
+
+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-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.
+
+template-home-dir=The directory used as the current directory. Logging files will
be directed to the home directory by default (unless an alternative target is declared
within the kernel). The default value is the current working directory ${user.dir}.
+
+template-base-dir=The directory used as the working base directory. Working and
temporary directories are created relative to this directory in combination with the
component partition name. The default value is the current working directory
${user.dir}.
+
+template-kernel-url=A optional url to a kernel configuration.
+
+template-info-policy=The info generation policy option. If TRUE a summary listing
of the Merlin environment will be generated on system establishment. This information
is generally useful when validating current version information and configuration
paths.
+
+template-debug-policy=The debug generation policy. If TRUE debug level logging is
automatically enabled on all channels (typically only used when debugging an
application).
+
+template-server-policy=The server mode execution policy. If TRUE the kernel will
execute in server mode otherwise components will be decommissioned following
deployment.
+
+
+
url=url
directory=directory
@@ -33,7 +54,3 @@
cli-library-description=A directory that serves as the anchor for relative library
references.
cli-description=\nDescription: The merlin command executes the deployment of one or
more component blocks. 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.1
avalon-sandbox/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultCriteria.java
Index: DefaultCriteria.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
"Apache Software Foundation" must not be used to endorse or promote
products derived from this software without prior written
permission. For written permission, please contact [EMAIL PROTECTED]
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.avalon.merlin.kernel.impl;
import org.apache.avalon.repository.criteria.Criteria;
import org.apache.avalon.repository.criteria.Template;
import org.apache.avalon.repository.criteria.ValidationException;
import org.apache.avalon.repository.criteria.Parameter;
import java.util.Hashtable;
import java.util.Map;
/**
* A Criteria is a class holding the values supplied by a user
* for application to a factory.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Stephen McConnell</a>
* @version $Revision: 1.1 $
*/
public class DefaultCriteria implements Criteria
{
//--------------------------------------------------------------
// state
//--------------------------------------------------------------
private final Template m_template;
private final Hashtable m_bindings = new Hashtable();
//--------------------------------------------------------------
// constructor
//--------------------------------------------------------------
/**
* Creation of a new criteria.
* @param template the template containing the validation parameters
*/
public DefaultCriteria( Template template )
{
if( null == template )
throw new NullPointerException( "template" );
m_template = template;
}
//--------------------------------------------------------------
// Criteria
//--------------------------------------------------------------
/**
* Return the template backing the criteria.
* @return the template
*/
public Template getTemplate()
{
return m_template;
}
/**
* Set a named parameter of the criteria to a value.
* @param key the parameter key
* @param value the value to assign to the key
* @exception ValidationException if the supplied value fails
* the validation test for its associated parameter
*/
public void setValue( final String key, final Object value )
throws ValidationException
{
Parameter p = m_template.getParameter( key );
p.verify( value );
m_bindings.put( key, value );
}
/**
* Return the currently assigned value for a key.
* @return the assigned value
*/
public Object getValue( final String key )
{
m_template.getParameter( key ); // verify key
return m_bindings.get( key );
}
/**
* Return the current state of the criteria as a map.
* @return the criteria as a map
*/
public Map getMap()
{
Hashtable map = new Hashtable();
String[] keys = getTemplate().getKeys();
for( int i=0; i<keys.length; i++ )
{
final String key = keys[i];
Object value = getValue( key );
if( value != null )
{
map.put( key, value );
}
}
return map;
}
public String toString()
{
return "[merlin: " + getMap() + "]";
}
}
1.1
avalon-sandbox/kernel/impl/src/java/org/apache/avalon/merlin/kernel/impl/DefaultFactory.java
Index: DefaultFactory.java
===================================================================
package org.apache.avalon.merlin.kernel.impl;
import java.io.File;
import java.net.URL;
import org.apache.avalon.excalibur.i18n.ResourceManager;
import org.apache.avalon.excalibur.i18n.Resources;
import org.apache.avalon.repository.criteria.Parameter;
import org.apache.avalon.repository.criteria.Criteria;
import org.apache.avalon.repository.criteria.Template;
import org.apache.avalon.repository.criteria.ValidationException;
import org.apache.avalon.repository.criteria.Factory;
/**
* The DefaultFactory provides support for the establishment of a
* new merlin kernel.
*/
public class DefaultFactory implements Factory
{
//--------------------------------------------------------------------------
// static
//--------------------------------------------------------------------------
private static Resources REZ =
ResourceManager.getPackageResources( DefaultFactory.class );
/**
* Repository parameter descriptor.
*/
public static final Parameter MERLIN_REPOSITORY_DIR =
new Parameter(
"urn:merlin:repository.dir",
File.class.getName(),
false,
REZ.getString( "template-repository-dir" ) );
/**
* Library path parameter descriptor.
*/
public static final Parameter MERLIN_LIBRARY_DIR =
new Parameter(
"urn:merlin:library.dir",
File.class.getName(),
false,
REZ.getString( "template-library-dir" ) );
/**
* Home directory parameter descriptor.
*/
public static final Parameter MERLIN_HOME_DIR =
new Parameter(
"urn:merlin:home.dir",
File.class.getName(),
false,
REZ.getString( "template-home-dir" ) );
/**
* Base directory parameter descriptor.
*/
public static final Parameter MERLIN_BASE_DIR =
new Parameter(
"urn:merlin:base.dir",
File.class.getName(),
false,
REZ.getString( "template-base-dir" ) );
/**
* Kernel url parameter descriptor.
*/
public static final Parameter MERLIN_KERNEL_URL =
new Parameter(
"urn:merlin:kernel.url",
URL.class.getName(),
false,
REZ.getString( "template-kernel-url" ) );
/**
* Info policy parameter descriptor.
*/
public static final Parameter MERLIN_POLICY_INFO =
new Parameter(
"urn:merlin:policy.info",
Boolean.class.getName(),
false,
REZ.getString( "template-info-policy" ) );
/**
* Debug policy parameter descriptor.
*/
public static final Parameter MERLIN_POLICY_DEBUG =
new Parameter(
"urn:merlin:policy.debug",
Boolean.class.getName(),
false,
REZ.getString( "template-debug-policy" ) );
/**
* Server model parameter descriptor.
*/
public static final Parameter MERLIN_POLICY_SERVER =
new Parameter(
"urn:merlin:policy.server",
Boolean.class.getName(),
false,
REZ.getString( "template-server-policy" ) );
/**
* The factory parameters template.
*/
public static final Template TEMPLATE =
new Template(
REZ.getString( "template-description" ),
new Parameter[]
{
MERLIN_REPOSITORY_DIR,
MERLIN_LIBRARY_DIR,
MERLIN_HOME_DIR,
MERLIN_BASE_DIR,
MERLIN_KERNEL_URL,
MERLIN_POLICY_INFO,
MERLIN_POLICY_DEBUG,
MERLIN_POLICY_SERVER
} );
//--------------------------------------------------------------------------
// Factory
//--------------------------------------------------------------------------
public Criteria createDefaultCriteria()
{
return new DefaultCriteria( TEMPLATE );
}
public Object create( Criteria criteria )
{
System.out.println( "CRITERIA: " + criteria );
return null;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]