You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2003/03/29 04:25:58 UTC
cvs commit: avalon-sandbox/merlin/meta-spi/src/java/org/apache/avalon/meta/info ContextDescriptor.java DependencyDescriptor.java ExtensionDescriptor.java ReferenceDescriptor.java Type.java
mcconnell 2003/03/28 19:25:58
Modified: merlin maven.xml project.xml
merlin/assembly/src/java/org/apache/avalon/assembly/appliance
DefaultAppliance.java
merlin/assembly/src/java/org/apache/avalon/assembly/engine
EngineClassLoader.java Resources.properties
merlin/assembly/src/java/org/apache/avalon/assembly/engine/model
EngineConfigurationHelper.java
merlin/assembly/src/java/org/apache/avalon/assembly/lifecycle
UnresolvedProviderException.java
merlin/assembly/src/test/org/apache/avalon/playground/basic
BasicComponent.xinfo
merlin/assembly-spi/src/java/org/apache/avalon/assembly/appliance
DependencyGraph.java
merlin/assembly-spi/src/java/org/apache/avalon/assembly/engine/model
Classpath.java ClasspathDescriptor.java
merlin/merlin-core/src/java/org/apache/avalon/merlin/block/impl
DefaultBlockLoader.java
merlin/merlin-core/src/java/org/apache/avalon/merlin/kernel/impl
DefaultKernel.java DefaultKernel.xinfo
merlin/merlin-smp/src/repository/demo block.xml
merlin/merlin-smp/src/repository/james block.xml config.xml
merlin/meta/src/java/org/apache/avalon/meta/info/builder
TypeBuilder.java XMLLegacyCreator.java
XMLTypeCreator.java
merlin/meta-spi/src/java/org/apache/avalon/meta/info
ContextDescriptor.java DependencyDescriptor.java
ExtensionDescriptor.java ReferenceDescriptor.java
Type.java
Added: merlin/assembly/src/java/org/apache/avalon/assembly/engine/model
DefaultClasspath.java
merlin/assembly-spi/src/java/org/apache/avalon/assembly/engine/model
ResourceDescriptor.java
Log:
Updates to support repository based loading of jar files.
Revision Changes Path
1.3 +16 -4 avalon-sandbox/merlin/maven.xml
Index: maven.xml
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/maven.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- maven.xml 13 Mar 2003 03:58:15 -0000 1.2
+++ maven.xml 29 Mar 2003 03:25:56 -0000 1.3
@@ -35,7 +35,7 @@
<maven:reactor
basedir="${basedir}"
includes="*/project.xml"
- excludes="merlin-smp/*"
+ excludes="merlin-smp/*,merlin-plugin/*"
goals="merlin-propergate"
banner="Installing:"
ignoreFailures="false" />
@@ -81,8 +81,8 @@
<!--
TODO - build the demonstrations to include the the repository
directory (which is also linked to completing the documentation
- ongetting started and tyhe finalization of the bloc service access
- and the finalization of repositrory semanitcs).
+ on getting started and the finalization of the block service access
+ and the finalization of repository semantics).
-->
</goal>
@@ -144,7 +144,7 @@
variable already defined. No checking or validation is currently in
place. It is useful if you want to update an existing installation.
-->
- <goal name="merlin-install" prereqs="merlin-dist">
+ <goal name="merlin-install" prereqs="merlin-install-plugin,merlin-dist">
<property environment="env"/>
<mkdir dir="${env.MERLIN_HOME}"/>
<echo>Installing Merlin into home directory: ${env.MERLIN_HOME}</echo>
@@ -153,6 +153,18 @@
<include name="**/*"/>
</fileset>
</copy>
+ </goal>
+
+ <!--
+ Install the merlin plugin into the Maven plugin suite.
+ -->
+ <goal name="merlin-install-plugin" prereqs="merlin-dist" description="Install Merlin Maven plugin.">
+ <maven:reactor
+ basedir="${basedir}"
+ includes="merlin-plugin/project.xml"
+ goals="plugin:install"
+ banner="Resolving dependencies:"
+ ignoreFailures="false"/>
</goal>
<!--
1.3 +8 -4 avalon-sandbox/merlin/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/project.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- project.xml 13 Mar 2003 03:56:58 -0000 1.2
+++ project.xml 29 Mar 2003 03:25:56 -0000 1.3
@@ -100,8 +100,8 @@
<build>
<nagEmailAddress>dev@avalon.apache.org</nagEmailAddress>
- <sourceDirectory>src/java</sourceDirectory>
- <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
+ <sourceDirectory>${basedir}/src/java</sourceDirectory>
+ <unitTestSourceDirectory>${basedir}/src/test</unitTestSourceDirectory>
<integrationUnitTestSourceDirectory/>
<aspectSourceDirectory/>
@@ -115,13 +115,15 @@
<resource>
<directory>${basedir}/src/test</directory>
<includes>
+ <include>**/*.dtd</include>
<include>**/*.properties</include>
<include>**/*.xinfo</include>
- <include>**/*.xconfig</include>
+ <include>**/*.xtype</include>
<include>**/*.xprofile</include>
+ <include>**/*.xconfig</include>
<include>**/*.xml</include>
<include>**/*.xservice</include>
- </includes>
+ </includes>
</resource>
</resources>
</unitTest>
@@ -135,6 +137,8 @@
<include>**/*.dtd</include>
<include>**/*.properties</include>
<include>**/*.xinfo</include>
+ <include>**/*.xtype</include>
+ <include>**/*.xprofile</include>
<include>**/*.xconfig</include>
<include>**/*.xml</include>
<include>**/*.xservice</include>
1.3 +3 -3 avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/appliance/DefaultAppliance.java
Index: DefaultAppliance.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/appliance/DefaultAppliance.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DefaultAppliance.java 17 Mar 2003 02:46:27 -0000 1.2
+++ DefaultAppliance.java 29 Mar 2003 03:25:56 -0000 1.3
@@ -903,7 +903,7 @@
for( int i = 0; i < dependencies.length; i++ )
{
DependencyDescriptor dependency = dependencies[ i ];
- String role = dependency.getRole();
+ String role = dependency.getKey();
if( getServiceProvider( role ) == null )
{
@@ -935,7 +935,7 @@
final String message =
"Unresolved supplied for the dependency: "
+ dependency.getReference()
- + ", for the role: " + dependency.getRole();
+ + ", for the role: " + dependency.getKey();
setEnabled( false );
throw new ApplianceException( message );
1.2 +55 -30 avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/engine/EngineClassLoader.java
Index: EngineClassLoader.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/engine/EngineClassLoader.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- EngineClassLoader.java 13 Mar 2003 01:03:56 -0000 1.1
+++ EngineClassLoader.java 29 Mar 2003 03:25:56 -0000 1.2
@@ -82,6 +82,7 @@
import org.apache.avalon.assembly.engine.model.FilesetDescriptor;
import org.apache.avalon.assembly.engine.model.IncludeDescriptor;
import org.apache.avalon.assembly.engine.model.Classpath;
+import org.apache.avalon.assembly.engine.model.DefaultClasspath;
import org.apache.avalon.assembly.engine.type.TypeManager;
import org.apache.avalon.assembly.locator.Contextualizable;
import org.apache.avalon.assembly.logging.LoggingDescriptor;
@@ -337,7 +338,8 @@
if( context.hasEntry( "urn:assembly:engine.extensions" ) )
{
String scope = "home";
- m_descriptor = (LibraryDescriptor)context.get( "urn:assembly:engine.extensions" );
+ m_descriptor = (LibraryDescriptor)context.get(
+ "urn:assembly:engine.extensions" );
if( m_descriptor.isSystem() )
{
scope = "system";
@@ -351,11 +353,13 @@
if( context.hasEntry( "urn:assembly:engine.classpath" ) )
{
- m_classpath = (Classpath)context.get( "urn:assembly:engine.classpath" );
+ m_classpath = (Classpath)context.get(
+ "urn:assembly:engine.classpath" );
}
else
{
- m_classpath = new Classpath( m_home, new ClasspathDescriptor() );
+ m_classpath =
+ new DefaultClasspath( m_root, m_home, new ClasspathDescriptor() );
}
if( context.hasEntry( "urn:assembly:home" ) )
@@ -374,7 +378,8 @@
if( context.hasEntry( "urn:assembly:engine.bootstrap" ) )
{
- m_bootstrap = "true".equals( context.get( "urn:assembly:engine.bootstrap" ) );
+ m_bootstrap = "true".equals(
+ context.get( "urn:assembly:engine.bootstrap" ) );
}
if( context.hasEntry( "urn:assembly:logging.manager" ) )
@@ -385,7 +390,8 @@
if( context.hasEntry( "urn:assembly:appliance.repository" ) )
{
- m_manager = (ApplianceRepository) context.get( "urn:assembly:appliance.repository" );
+ m_manager = (ApplianceRepository)
+ context.get( "urn:assembly:appliance.repository" );
}
else
{
@@ -394,7 +400,8 @@
if( context.hasEntry( "urn:assembly:threads.manager" ) )
{
- m_pool = (PoolManager) context.get( "urn:assembly:threads.manager" );
+ m_pool = (PoolManager)
+ context.get( "urn:assembly:threads.manager" );
}
else
{
@@ -456,7 +463,9 @@
{
if( m_root != null )
{
- anchor = new File( m_root, m_descriptor.getBaseDirectory() ).getCanonicalFile();
+ anchor = new File(
+ m_root, m_descriptor.getBaseDirectory()
+ ).getCanonicalFile();
}
else
{
@@ -470,7 +479,8 @@
{
if( m_home != null )
{
- anchor = new File( m_home, m_descriptor.getBaseDirectory() ).getCanonicalFile();
+ final String base = m_descriptor.getBaseDirectory();
+ anchor = new File( m_home, base ).getCanonicalFile();
}
else
{
@@ -485,15 +495,19 @@
IncludeDescriptor[] includes = m_descriptor.getIncludeDescriptors();
for( int j = 0; j < includes.length; j++ )
{
- File include = new File( anchor, includes[ j ].getFile() ).getCanonicalFile();
+ File include =
+ new File( anchor,
+ includes[ j ].getFile() ).getCanonicalFile();
if( include.isDirectory() )
{
list.add( include );
- getLogger().debug( REZ.getString( "kernel.extension", include ) );
+ getLogger().debug(
+ REZ.getString( "kernel.extension", include ) );
}
else
{
- final String error = REZ.getString( "error.include", include );
+ final String error =
+ REZ.getString( "error.include", include );
throw new IllegalArgumentException( error );
}
}
@@ -514,7 +528,8 @@
list.add( test );
if( getLogger().isDebugEnabled() )
{
- final String msg = REZ.getString( "system.extension", token );
+ final String msg =
+ REZ.getString( "system.extension", token );
getLogger().debug( msg );
}
}
@@ -526,14 +541,16 @@
list.add( file );
if( getLogger().isDebugEnabled() )
{
- getLogger().debug( REZ.getString( "relative.extension", file ) );
+ getLogger().debug(
+ REZ.getString( "relative.extension", file ) );
}
}
else
{
if( getLogger().isWarnEnabled() )
{
- getLogger().warn( REZ.getString( "extension.warning", token ) );
+ getLogger().warn(
+ REZ.getString( "extension.warning", token ) );
}
}
}
@@ -728,12 +745,19 @@
engine.enableLogging( getLogger() );
DefaultLocator context = new DefaultLocator();
+ DefaultApplianceRepository manager =
+ new DefaultApplianceRepository( this, m_manager, name );
+
+ context.put( "urn:assembly:appliance.repository", manager );
context.put( "urn:assembly:home", m_home );
- context.put( "urn:assembly:system", m_root );
context.put( "urn:assembly:engine.bootstrap", "false" );
context.put( "urn:assembly:logging.manager", m_logging );
context.put( "urn:assembly:threads.manager", m_pool );
+ if( m_root != null )
+ {
+ context.put( "urn:assembly:system", m_root );
+ }
if( extensions != null )
{
context.put( "urn:assembly:engine.extensions", extensions );
@@ -743,10 +767,6 @@
context.put( "urn:assembly:engine.classpath", classpath );
}
- DefaultApplianceRepository manager =
- new DefaultApplianceRepository( this, m_manager, name );
- context.put( "urn:assembly:appliance.repository", manager );
-
context.makeReadOnly();
engine.contextualize( context );
engine.initialize();
@@ -770,11 +790,11 @@
protected void addURL( URL url )
{
addExtensions( url );
- super.addURL( url );
if( getLogger().isDebugEnabled() )
{
getLogger().debug( REZ.getString( "add.url", url ) );
}
+ super.addURL( url );
m_repository.install( url );
}
@@ -801,7 +821,7 @@
}
//
- // expand the classpath relative to the home directory
+ // expand the classpath
//
try
@@ -824,8 +844,7 @@
}
catch( Throwable e )
{
- final String error =
- "Unexpected exception while attampting to expand the supplied classpath.";
+ final String error = REZ.getString( "classpath.expand.error" );
throw new EngineRuntimeException( error, e );
}
}
@@ -856,7 +875,7 @@
}
catch( Throwable e )
{
- final String error = REZ.getString("add.ext.error", ext );
+ final String error = REZ.getString( "add.ext.error", ext );
throw new EngineRuntimeException( error, e );
}
}
@@ -916,7 +935,8 @@
* @param dependency a service depedency descriptor
* @return the appliance
*/
- public Appliance resolve( DependencyGraph graph, DependencyDescriptor dependency )
+ public Appliance resolve(
+ DependencyGraph graph, DependencyDescriptor dependency )
throws Exception
{
return resolve( graph, dependency, "" );
@@ -955,7 +975,8 @@
Appliance appliance = m_manager.getAppliance( dependency );
if( appliance == null )
{
- Profile profile = getRepository().getProfileManager().getProfile( dependency );
+ Profile profile =
+ getRepository().getProfileManager().getProfile( dependency );
if( profile == null )
{
final String error = REZ.getString( "resolve.fail", dependency );
@@ -963,7 +984,8 @@
}
else
{
- DefaultApplianceContext context = new DefaultApplianceContext( profile );
+ DefaultApplianceContext context =
+ new DefaultApplianceContext( profile );
context.setPartitionName( partition );
context.makeReadOnly();
appliance = createAppliance( context, true );
@@ -989,7 +1011,8 @@
* @param stage a lifecycle stage descriptor
* @return the appliance
*/
- public Appliance resolve( DependencyGraph graph, StageDescriptor stage ) throws Exception
+ public Appliance resolve( DependencyGraph graph, StageDescriptor stage )
+ throws Exception
{
return resolve( graph, stage, "" );
}
@@ -997,11 +1020,13 @@
/**
* Resolve an appliance capable of supporting a referenced extension.
*
+ * @param graph the dependency graph
* @param stage a lifecycle stage descriptor
* @param partition the partition to assign to a new appliance if creation is necessary
* @return the appliance
*/
- public Appliance resolve( DependencyGraph graph, StageDescriptor stage, String partition )
+ public Appliance resolve(
+ DependencyGraph graph, StageDescriptor stage, String partition )
throws Exception
{
if( stage == null )
1.2 +1 -0 avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/engine/Resources.properties
Index: Resources.properties
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/engine/Resources.properties,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Resources.properties 13 Mar 2003 01:03:56 -0000 1.1
+++ Resources.properties 29 Mar 2003 03:25:56 -0000 1.2
@@ -18,6 +18,7 @@
classpath.include=fileset contains {0} include entries
classpath.include.error=Error processing a classpath include: {0}
classpath.ok=classpath ok
+classpath.expend.error=Unexpected exception while attampting to expand the supplied classpath
add.ext.error=Internal error while attempting to add optional package: {0}
add.extension.error=Internal error while attempting to add extension url: {0}
register.path=register: {0}
1.2 +21 -2 avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/engine/model/EngineConfigurationHelper.java
Index: EngineConfigurationHelper.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/engine/model/EngineConfigurationHelper.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- EngineConfigurationHelper.java 13 Mar 2003 01:03:57 -0000 1.1
+++ EngineConfigurationHelper.java 29 Mar 2003 03:25:56 -0000 1.2
@@ -66,6 +66,7 @@
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.configuration.DefaultConfiguration;
import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.Version;
import org.apache.avalon.meta.ConfigurationBuilder;
import org.apache.avalon.meta.info.Type;
import org.apache.avalon.meta.model.LoggingDirective;
@@ -108,7 +109,25 @@
}
FilesetDescriptor[] filesets =
(FilesetDescriptor[])list.toArray( new FilesetDescriptor[ 0 ] );
- return new ClasspathDescriptor( filesets );
+
+ //
+ // the the repository resource descriptors
+ //
+
+ ArrayList res = new ArrayList();
+ Configuration repository = config.getChild( "repository" );
+ Configuration[] resources = repository.getChildren( "resource" );
+ for( int i = 0; i < resources.length; i++ )
+ {
+ Configuration resource = resources[ i ];
+ String id = resource.getAttribute( "id" );
+ String version = resource.getAttribute( "version" );
+ res.add( new ResourceDescriptor( id, version ) );
+ }
+ ResourceDescriptor[] descriptors =
+ (ResourceDescriptor[])res.toArray( new ResourceDescriptor[ 0 ] );
+
+ return new ClasspathDescriptor( filesets, descriptors );
}
/**
1.1 avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/engine/model/DefaultClasspath.java
Index: DefaultClasspath.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, 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", "Avalon", 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 apache@apache.org.
*
* 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 (INCLUDING, 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.assembly.engine.model;
import java.io.File;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.net.URL;
import java.net.MalformedURLException;
/**
* <p>A classpath directive that describes a scoped set of jar files and
* a relative base directory.
*
* @see ClasspathDescriptor
* @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
* @version $Revision: 1.1 $ $Date: 2003/03/29 03:25:56 $
*/
public class DefaultClasspath implements Classpath
{
/**
* The classpath descriptor.
*/
private final ClasspathDescriptor m_classpath;
/**
* The directory from which classpath entries will be resolved.
*/
private final File m_base;
/**
* The directory from which respository references will be resolved.
*/
private final File m_system;
/**
* Create a new Classpath instance.
* @param system the the base directory from wehich the system repository
* resoure references will be resolved
* @param base the base directory from which classpath fileset directories
* shall be resolved.
* @param classpath the classpath descriptor
*/
public DefaultClasspath( File system, File base, ClasspathDescriptor classpath )
{
m_base = base;
m_classpath = classpath;
m_system = system;
}
/**
* Create a new Classpath instance.
* @param a url from which the base directory will be resolved
* @param classpath the classpath descriptor
* @exception IllegalArgumentException if the base directory cannot
* be resolved from the supplied URL
*/
public DefaultClasspath( File system, URL url, ClasspathDescriptor classpath )
throws IllegalArgumentException
{
m_system = system;
m_base = getBaseDirectory( url );
m_classpath = classpath;
}
/**
* Expand a classpath to an array of URLS.
* @param home the base directory from which relative classpath entries
* will be resolved.
*/
public URL[] expand( )
{
List list = new ArrayList();
FilesetDescriptor[] dirs = m_classpath.getFilesetDescriptors();
for( int i = 0; i < dirs.length; i++ )
{
FilesetDescriptor descriptor = dirs[ i ];
File anchor = new File( m_base, descriptor.getBaseDirectory() );
if( !anchor.exists() )
{
final String error =
"Fileset base directory does not exist: "
+ anchor;
throw new ClasspathRuntimeException( error );
}
IncludeDescriptor[] includes = descriptor.getIncludeDescriptors();
for( int j = 0; j < includes.length; j++ )
{
String inc = includes[ j ].getFile();
try
{
URL url = new File( anchor, inc ).getCanonicalFile().toURL();
list.add( url );
}
catch( Throwable e )
{
final String error =
"Error processing a classpath include: "
+ inc;
throw new ClasspathRuntimeException( error, e );
}
}
}
if( m_system != null )
{
expandResources( list );
}
return (URL[]) list.toArray( new URL[0] );
}
/**
* Return the classpath descriptor.
*
* @return the classpath descriptor
*/
public ClasspathDescriptor getClasspathDescriptor()
{
return m_classpath;
}
/**
* Expand any resource declarations and add them to the supplied list.
*/
private void expandResources( List list )
{
ResourceDescriptor[] resources = m_classpath.getResourceDescriptors();
for( int i=0; i<resources.length; i++ )
{
final ResourceDescriptor resource = resources[i];
final String group = resource.getGroupID();
final String name = resource.getName();
final String version = resource.getVersion();
File repository = new File( m_system, "repository" );
File jars = new File( new File( repository, group ), "jars" );
File target = new File( jars, name + "-" + version + ".jar" );
if( target.exists() )
{
try
{
final URL url = target.toURL();
list.add( url );
}
catch( Throwable e )
{
final String error =
"Malformed URL error while attempting add resource: " + resource;
throw new RuntimeException( error );
}
}
else
{
final String error =
"Supplied resource declaration unresolvable: " + resource;
throw new IllegalArgumentException( error );
}
}
}
/**
* Resolves a supplied URL to a directory.
* @param url the url to resolve
* @return the base directory file
* @exception IllegalArgumentException if the supplied URL
* cannot be resolved to a directory
*/
private static File getBaseDirectory( final URL url )
{
File base = null;
if( url.getProtocol().equals( "file" ) )
{
File file = new File( url.toString().substring( 5 ) );
if( file.isFile() )
{
base = file.getParentFile();
}
else
{
base = file;
}
}
if( base.isDirectory() )
{
return base;
}
else
{
final String error =
"Cannot resolve base directory from supplied URL: " + url;
throw new IllegalArgumentException( error );
}
}
}
1.2 +2 -2 avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/lifecycle/UnresolvedProviderException.java
Index: UnresolvedProviderException.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/assembly/src/java/org/apache/avalon/assembly/lifecycle/UnresolvedProviderException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- UnresolvedProviderException.java 13 Mar 2003 01:04:05 -0000 1.1
+++ UnresolvedProviderException.java 29 Mar 2003 03:25:56 -0000 1.2
@@ -103,7 +103,7 @@
private static String getStandardMessage( DependencyDescriptor dependency )
{
return "Unable to resolve a provider for the dependency '"
- + dependency.getReference() + "' for the role: " + dependency.getRole();
+ + dependency.getReference() + "' for the role: " + dependency.getKey();
}
}
1.2 +1 -1 avalon-sandbox/merlin/assembly/src/test/org/apache/avalon/playground/basic/BasicComponent.xinfo
Index: BasicComponent.xinfo
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/assembly/src/test/org/apache/avalon/playground/basic/BasicComponent.xinfo,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BasicComponent.xinfo 13 Mar 2003 01:04:28 -0000 1.1
+++ BasicComponent.xinfo 29 Mar 2003 03:25:57 -0000 1.2
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!DOCTYPE type
- PUBLIC "-//AVALON/Component Type DTD Version 1.0//EN"
+ PUBLIC "-//AVALON/Type DTD Version 1.0//EN"
"http://avalon.apache.org/dtds/meta/type_1_1.dtd" >
<!--
1.3 +3 -3 avalon-sandbox/merlin/assembly-spi/src/java/org/apache/avalon/assembly/appliance/DependencyGraph.java
Index: DependencyGraph.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/assembly-spi/src/java/org/apache/avalon/assembly/appliance/DependencyGraph.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- DependencyGraph.java 17 Mar 2003 02:52:52 -0000 1.2
+++ DependencyGraph.java 29 Mar 2003 03:25:57 -0000 1.3
@@ -391,7 +391,7 @@
for( int i = 0; i < descriptors.length; i++ )
{
DependencyDescriptor dependency = descriptors[ i ];
- Appliance provider = appliance.getServiceProvider( dependency.getRole() );
+ Appliance provider = appliance.getServiceProvider( dependency.getKey() );
if( provider != null )
{
@@ -402,7 +402,7 @@
if( dependency.isRequired() )
{
throw new IllegalStateException(
- "unresolved service dependency for role: " + dependency.getRole()
+ "unresolved service dependency for role: " + dependency.getKey()
+ " in appliance: " + appliance );
}
}
1.2 +8 -123 avalon-sandbox/merlin/assembly-spi/src/java/org/apache/avalon/assembly/engine/model/Classpath.java
Index: Classpath.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/assembly-spi/src/java/org/apache/avalon/assembly/engine/model/Classpath.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Classpath.java 13 Mar 2003 01:04:40 -0000 1.1
+++ Classpath.java 29 Mar 2003 03:25:57 -0000 1.2
@@ -63,135 +63,20 @@
import java.net.MalformedURLException;
/**
- * <p>A classpath directive that describes a scoped set of jar files and
- * a relative base directory.
+ * <p>A classpath directive that defines the contract for multiple
+ * implementations capable of providing jar file URLs to a classloader.</p>
*
- * @see ClasspathDescriptor
* @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
* @version $Revision$ $Date$
*/
-public class Classpath implements Serializable
+public interface Classpath
{
- /**
- * The classpath descriptor.
- */
- private final ClasspathDescriptor m_classpath;
-
- /**
- * The directory from which classpath entries will be resolved.
- */
- private final File m_base;
-
- /**
- * Create a new Classpath instance.
- * @param base the base directory from which classpath fileset directories
- * shall be resolved.
- * @param classpath the classpath descriptor
- */
- public Classpath( File base, ClasspathDescriptor classpath )
- {
- m_base = base;
- m_classpath = classpath;
- }
-
- /**
- * Create a new Classpath instance.
- * @param a url from which the base directory will be resolved
- * @param classpath the classpath descriptor
- * @exception IllegalArgumentException if the base directory cannot
- * be resolved from the supplied URL
- */
- public Classpath( URL url, ClasspathDescriptor classpath )
- throws IllegalArgumentException
- {
- m_base = getBaseDirectory( url );
- m_classpath = classpath;
- }
-
- /**
- * Return the classpath descriptor.
- *
- * @return the classpath descriptor
- */
- public ClasspathDescriptor getClasspathDescriptor()
- {
- return m_classpath;
- }
-
- /**
- * Expand a classpath to an array of URLS.
- * @param home the base directory from which relative classpath entries
- * will be resolved.
- */
- public URL[] expand( )
- {
- List list = new ArrayList();
- FilesetDescriptor[] dirs = m_classpath.getFilesetDescriptors();
- for( int i = 0; i < dirs.length; i++ )
- {
- FilesetDescriptor descriptor = dirs[ i ];
- File anchor = new File( m_base, descriptor.getBaseDirectory() );
- if( !anchor.exists() )
- {
- final String error =
- "Fileset base directory does not exist: "
- + anchor;
- throw new ClasspathRuntimeException( error );
- }
-
- IncludeDescriptor[] includes = descriptor.getIncludeDescriptors();
- for( int j = 0; j < includes.length; j++ )
- {
- String inc = includes[ j ].getFile();
- try
- {
- URL url = new File( anchor, inc ).getCanonicalFile().toURL();
- list.add( url );
- }
- catch( Throwable e )
- {
- final String error =
- "Error processing a classpath include: "
- + inc;
- throw new ClasspathRuntimeException( error, e );
- }
- }
- }
- return (URL[]) list.toArray( new URL[0] );
- }
/**
- * Resolves a supplied URL to a directory.
- * @param url the url to resolve
- * @return the base directory file
- * @exception IllegalArgumentException if the supplied URL
- * cannot be resolved to a directory
+ * Expand a classpath to an array of URLS.
+ * @param home the base directory from which relative classpath entries
+ * will be resolved.
*/
- private static File getBaseDirectory( final URL url )
- {
- File base = null;
- if( url.getProtocol().equals( "file" ) )
- {
- File file = new File( url.toString().substring( 5 ) );
- if( file.isFile() )
- {
- base = file.getParentFile();
- }
- else
- {
- base = file;
- }
- }
- if( base.isDirectory() )
- {
- return base;
- }
- else
- {
- final String error =
- "Cannot resolve base directory from supplied URL: " + url;
- throw new IllegalArgumentException( error );
- }
- }
+ URL[] expand();
}
1.2 +36 -94 avalon-sandbox/merlin/assembly-spi/src/java/org/apache/avalon/assembly/engine/model/ClasspathDescriptor.java
Index: ClasspathDescriptor.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/assembly-spi/src/java/org/apache/avalon/assembly/engine/model/ClasspathDescriptor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ClasspathDescriptor.java 13 Mar 2003 01:04:41 -0000 1.1
+++ ClasspathDescriptor.java 29 Mar 2003 03:25:57 -0000 1.2
@@ -102,6 +102,11 @@
private final FilesetDescriptor[] m_filesets;
/**
+ * The collection of resources.
+ */
+ private final ResourceDescriptor[] m_resources;
+
+ /**
* Create an empty ClasspathDescriptor instance.
*
*/
@@ -117,7 +122,30 @@
*/
public ClasspathDescriptor( final FilesetDescriptor[] filesets )
{
+ this( new FilesetDescriptor[ 0 ], new ResourceDescriptor[ 0 ] );
+ }
+
+ /**
+ * Create a ClasspathDescriptor instance.
+ *
+ * @param filesets the set of filesets to include in the classpath
+ * @param resources the set of resources to include in the classpath
+ */
+ public ClasspathDescriptor( ResourceDescriptor[] resources )
+ {
+ this( new FilesetDescriptor[ 0 ], resources );
+ }
+
+ /**
+ * Create a ClasspathDescriptor instance.
+ *
+ * @param filesets the set of filesets to include in the classpath
+ * @param resources the set of resources to include in the classpath
+ */
+ public ClasspathDescriptor( final FilesetDescriptor[] filesets, ResourceDescriptor[] resources )
+ {
m_filesets = filesets;
+ m_resources = resources;
}
/**
@@ -131,98 +159,12 @@
}
/**
- * Expand a classpath to an array of URLS.
- * @param home the base directory from which relative classpath entries
- * will be resolved.
- */
- public static URL[] expand( File home, ClasspathDescriptor classpath )
- {
- if( home == null )
- {
- throw new NullPointerException( "home" );
- }
-
- if( classpath == null )
- {
- throw new NullPointerException( "classpath" );
- }
-
- List list = new ArrayList();
- FilesetDescriptor[] dirs = classpath.getFilesetDescriptors();
- for( int i = 0; i < dirs.length; i++ )
- {
- FilesetDescriptor descriptor = dirs[ i ];
- File anchor = new File( home, descriptor.getBaseDirectory() );
- if( !anchor.exists() )
- {
- final String error =
- "Classpath base directory does not exist: "
- + anchor;
- throw new ClasspathRuntimeException( error );
- }
-
- IncludeDescriptor[] includes = descriptor.getIncludeDescriptors();
- for( int j = 0; j < includes.length; j++ )
- {
- String inc = includes[ j ].getFile();
- try
- {
- URL url = new File( anchor, inc ).getCanonicalFile().toURL();
- list.add( url );
- }
- catch( Throwable e )
- {
- final String error =
- "Error processing a classpath include: "
- + inc;
- throw new ClasspathRuntimeException( error, e );
- }
- }
- }
- return (URL[]) list.toArray( new URL[0] );
- }
-
- /**
- * Expand a classpath to an array of URLS.
- * @param home the base directory from which relative classpath entries
- * will be resolved.
- */
- public static URL[] expand( URL home, ClasspathDescriptor classpath ) throws MalformedURLException
- {
- if( home == null )
- {
- throw new NullPointerException( "home" );
- }
-
- if( classpath == null )
- {
- throw new NullPointerException( "classpath" );
- }
-
- List list = new ArrayList();
- FilesetDescriptor[] dirs = classpath.getFilesetDescriptors();
- for( int i = 0; i < dirs.length; i++ )
- {
- FilesetDescriptor descriptor = dirs[ i ];
- URL anchor = new URL( home, descriptor.getBaseDirectory() );
- IncludeDescriptor[] includes = descriptor.getIncludeDescriptors();
- for( int j = 0; j < includes.length; j++ )
- {
- String inc = includes[ j ].getFile();
- try
- {
- URL url = new URL( anchor, anchor.getPath() + "/" + inc );
- list.add( url );
- }
- catch( Throwable e )
- {
- final String error =
- "Error processing a classpath include: "
- + inc;
- throw new ClasspathRuntimeException( error, e );
- }
- }
- }
- return (URL[]) list.toArray( new URL[0] );
+ * Return the filesets held within the classpath descriptor.
+ *
+ * @return the filesets
+ */
+ public ResourceDescriptor[] getResourceDescriptors()
+ {
+ return m_resources;
}
}
1.1 avalon-sandbox/merlin/assembly-spi/src/java/org/apache/avalon/assembly/engine/model/ResourceDescriptor.java
Index: ResourceDescriptor.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, 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", "Avalon", 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 apache@apache.org.
*
* 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 (INCLUDING, 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.assembly.engine.model;
import java.io.Serializable;
import org.apache.avalon.framework.Version;
/**
* <p>An resource include directive.</p>
* <p><b>XML</b></p>
* <p>An resource element is normally contained within a scoping structure such as a
* repository descriptor. The resource element contains an id and version attribute which
* collectively identify a resource wiuthin a repository.
* </p>
* <pre>
* <font color="gray"><repository></font>
* <resource id="<font color="darkred">avalon:avalon-framework.jar</font>" version="<font color="darkred">4.1.4</font>"/>
* <font color="gray"></repository></font>
* </pre>
*
* @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
* @version $Revision: 1.1 $ $Date: 2003/03/29 03:25:57 $
*/
public class ResourceDescriptor implements Serializable
{
private String m_version;
private String m_id;
/**
* Create a ResourceDescriptor instance.
*
* @param id the resource identifier
* @param version the resource version
*/
public ResourceDescriptor( final String id, final String version )
{
m_id = id;
m_version = version;
}
/**
* Return the included resource identifier.
*
* @return the identifier
*/
public String getID()
{
return m_id;
}
/**
* Return the group identifier.
*
* @return the group identifier
*/
public String getGroupID()
{
return m_id.substring( 0, m_id.indexOf(":") );
}
/**
* Return the resource name.
*
* @return the resource name
*/
public String getName()
{
return m_id.substring( m_id.indexOf(":") +1, m_id.length() );
}
/**
* Return the resource version.
*
* @return the version
*/
public String getVersion()
{
return m_version;
}
/**
* Return a string representation of the resource descriptor.
* @return the string representation
*/
public String toString()
{
return "urn:" + m_id + "-" + m_version;
}
}
1.4 +9 -2 avalon-sandbox/merlin/merlin-core/src/java/org/apache/avalon/merlin/block/impl/DefaultBlockLoader.java
Index: DefaultBlockLoader.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/merlin-core/src/java/org/apache/avalon/merlin/block/impl/DefaultBlockLoader.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DefaultBlockLoader.java 18 Mar 2003 05:05:48 -0000 1.3
+++ DefaultBlockLoader.java 29 Mar 2003 03:25:57 -0000 1.4
@@ -76,6 +76,7 @@
import org.apache.avalon.assembly.engine.Engine;
import org.apache.avalon.assembly.engine.model.LibraryDescriptor;
import org.apache.avalon.assembly.engine.model.Classpath;
+import org.apache.avalon.assembly.engine.model.DefaultClasspath;
import org.apache.avalon.assembly.engine.model.ClasspathDescriptor;
import org.apache.avalon.assembly.util.ExceptionHelper;
import org.apache.avalon.assembly.appliance.Appliance;
@@ -174,6 +175,11 @@
*/
private File m_home;
+ /**
+ * The application home directory.
+ */
+ private File m_root;
+
/**
* The assembly engine.
*/
@@ -199,6 +205,7 @@
*/
public void contextualize( Locator context ) throws ContextException
{
+ m_root = (File) context.get( "urn:assembly:system" );
m_engine = (EngineClassLoader) context.get( "urn:assembly:engine" );
m_system = (Locator) context.get( "urn:assembly:system-context" );
m_home = (File) m_system.get( "urn:assembly:home" );
@@ -936,7 +943,7 @@
ClasspathDescriptor descriptor = createClasspathDescriptor( classpathConfig );
try
{
- classpath = new Classpath( base, descriptor );
+ classpath = new DefaultClasspath( m_root, base, descriptor );
}
catch( IllegalArgumentException iae )
{
1.2 +4 -2 avalon-sandbox/merlin/merlin-core/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernel.java
Index: DefaultKernel.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/merlin-core/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 13 Mar 2003 01:05:12 -0000 1.1
+++ DefaultKernel.java 29 Mar 2003 03:25:57 -0000 1.2
@@ -76,6 +76,7 @@
import org.apache.avalon.assembly.engine.model.LibraryDescriptor;
import org.apache.avalon.assembly.engine.model.ClasspathDescriptor;
import org.apache.avalon.assembly.engine.model.Classpath;
+import org.apache.avalon.assembly.engine.model.DefaultClasspath;
import org.apache.avalon.assembly.util.ExceptionHelper;
import org.apache.avalon.assembly.appliance.Appliance;
import org.apache.avalon.assembly.appliance.ApplianceContext;
@@ -472,6 +473,7 @@
DefaultLocator context = new DefaultLocator();
context.put( "urn:assembly:engine", m_engine );
context.put( "urn:assembly:system-context", getSystemContext() );
+ context.put( "urn:assembly:system", m_root );
context.makeReadOnly();
m_installer.contextualize( context );
m_installer.initialize();
@@ -763,7 +765,7 @@
CREATOR.createClasspathDescriptor( classpathConfig );
try
{
- classpath = new Classpath( m_url, descriptor );
+ classpath = new DefaultClasspath( m_root, m_url, descriptor );
}
catch( IllegalArgumentException iae )
{
1.2 +1 -3 avalon-sandbox/merlin/merlin-core/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernel.xinfo
Index: DefaultKernel.xinfo
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/merlin-core/src/java/org/apache/avalon/merlin/kernel/impl/DefaultKernel.xinfo,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DefaultKernel.xinfo 13 Mar 2003 01:05:12 -0000 1.1
+++ DefaultKernel.xinfo 29 Mar 2003 03:25:57 -0000 1.2
@@ -31,9 +31,7 @@
</context>
<services>
- <service>
- <reference type="org.apache.avalon.merlin.kernel.Kernel" version="1.0"/>
- </service>
+ <service type="org.apache.avalon.merlin.kernel.Kernel" version="1.0"/>
</services>
</type>
1.2 +5 -0 avalon-sandbox/merlin/merlin-smp/src/repository/demo/block.xml
Index: block.xml
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/merlin-smp/src/repository/demo/block.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- block.xml 13 Mar 2003 01:05:37 -0000 1.1
+++ block.xml 29 Mar 2003 03:25:57 -0000 1.2
@@ -13,9 +13,14 @@
<engine>
<classpath>
+ <repository>
+ <resource id="demo:merlin-demo" version="1.0"/>
+ </repository>
+ <!--
<fileset dir=".">
<include name="merlin-demo-1.0.jar"/>
</fileset>
+ -->
</classpath>
</engine>
1.2 +26 -31 avalon-sandbox/merlin/merlin-smp/src/repository/james/block.xml
Index: block.xml
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/merlin-smp/src/repository/james/block.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- block.xml 13 Mar 2003 01:05:37 -0000 1.1
+++ block.xml 29 Mar 2003 03:25:57 -0000 1.2
@@ -16,7 +16,7 @@
<!--
Block implementation. The implementation element may contain component
and container entities. The block implementation statement is equivalent
- to a root container who's name is implied by the name of the block.
+ to a root container who's name corresponds to the name of the block.
-->
<implementation>
@@ -24,47 +24,42 @@
<engine>
<classpath>
- <fileset dir="../../../../../jakarta-james/phoenix-bin/lib">
- <include name="excalibur-io-1.1.jar"/>
- </fileset>
- <fileset dir="../../../../../jakarta-james/lib/candidates">
- <include name="excalibur-pool-1.2.jar"/>
- <include name="excalibur-thread-1.1.jar"/>
- <include name="commons-collections-2.1.jar"/>
- <include name="cornerstone-threads-1.0.jar"/>
- <include name="cornerstone-connection-1.0.jar"/>
- <include name="cornerstone-datasources-1.0.jar"/>
- <include name="cornerstone-scheduler-1.0.jar"/>
- <include name="cornerstone-sockets-1.0.jar"/>
- <include name="cornerstone-store-1.0.jar"/>
- </fileset>
- <fileset dir="../../../../../jakarta-james/lib">
- <include name="dnsjava-1.3.2.jar"/>
- <include name="mail_1_3.jar"/>
- <include name="jakarta-oro-2.0.1.jar"/>
- <include name="activation.jar"/>
- </fileset>
- <fileset dir="../../../../../jakarta-james/build/lib">
- <include name="mailet.jar"/>
- <include name="james.jar"/>
- </fileset>
+ <repository>
+ <resource id="excalibur:excalibur-io" version="1.1"/>
+ <resource id="excalibur:excalibur-pool" version="1.2"/>
+ <resource id="excalibur:excalibur-thread" version="1.1"/>
+ <resource id="excalibur:excalibur-threadcontext" version="1.0"/>
+ <resource id="excalibur:excalibur-collections" version="1.0"/>
+ <resource id="commons:commons-collections" version="2.1"/>
+ <resource id="cornerstone:cornerstone-threads" version="1.0"/>
+ <resource id="cornerstone:cornerstone-connection" version="1.0"/>
+ <resource id="cornerstone:cornerstone-datasources" version="1.0"/>
+ <resource id="cornerstone:cornerstone-scheduler" version="1.0"/>
+ <resource id="cornerstone:cornerstone-sockets" version="1.0"/>
+ <resource id="cornerstone:cornerstone-store" version="1.0"/>
+ <resource id="james:dnsjava" version="1.3.2"/>
+ <resource id="james:mail" version="1.3"/>
+ <resource id="james:activation" version="1.0"/>
+ <resource id="james:mailet" version="1.0"/>
+ <resource id="james:james" version="1.3"/>
+ </repository>
</classpath>
</engine>
<appliance name="james" class="org.apache.james.James"
activation="true">
- <!-- see blocks.xml for configuration -->
+ <!-- see config.xml for configuration -->
</appliance>
<appliance name="dns" class="org.apache.james.dnsserver.DNSServer"
activation="true">
- <!-- see blocks.xml for configuration -->
+ <!-- see config.xml for configuration -->
</appliance>
<appliance name="remote"
class="org.apache.james.remotemanager.RemoteManager"
activation="true">
- <!-- see blocks.xml for port and handler configuration -->
+ <!-- see config.xml for port and handler configuration -->
</appliance>
<appliance name="pop3"
@@ -73,7 +68,7 @@
<configuration enabled="true">
<port>110</port>
<handler>
- <helloName autodetect="true">myMailServer</helloName>
+ <helloName autodetect="true"/>
<connectiontimeout>120000</connectiontimeout>
</handler>
</configuration>
@@ -85,7 +80,7 @@
<configuration enabled="true">
<port>25</port>
<handler>
- <helloName autodetect="true">myMailServer</helloName>
+ <helloName autodetect="true"/>
<connectiontimeout>360000</connectiontimeout>
<maxmessagesize>0</maxmessagesize>
</handler>
@@ -378,7 +373,7 @@
<configuration enabled="false">
<port>119</port>
<handler>
- <helloName autodetect="true">myMailServer</helloName>
+ <helloName autodetect="true"/>
<connectiontimeout>120000</connectiontimeout>
<authRequired>false</authRequired>
</handler>
1.2 +1 -8 avalon-sandbox/merlin/merlin-smp/src/repository/james/config.xml
Index: config.xml
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/merlin-smp/src/repository/james/config.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- config.xml 13 Mar 2003 01:05:37 -0000 1.1
+++ config.xml 29 Mar 2003 03:25:57 -0000 1.2
@@ -5,8 +5,6 @@
<configuration>
<postmaster>postmaster@localhost</postmaster>
<servernames autodetect="true" autodetectIP="true">
- <servername>localhost</servername>
- <servername>home.osm.net</servername>
</servernames>
<usernames ignoreCase="true" enableAliases="true" enableForwarding="true"/>
<inboxRepository>
@@ -17,11 +15,6 @@
<target name="dns">
<configuration>
- <servers>
- <server>212.198.0.66</server>
- <server>212.198.0.67</server>
- <server>192.112.36.4</server>
- </servers>
<autodiscover>true</autodiscover>
<authoritative>false</authoritative>
</configuration>
@@ -31,7 +24,7 @@
<configuration>
<port>4555</port>
<handler>
- <helloName autodetect="TRUE">myMailServer</helloName>
+ <helloName autodetect="TRUE"/>
<administrator_accounts>
<account login="root" password="root"/>
</administrator_accounts>
1.2 +3 -3 avalon-sandbox/merlin/meta/src/java/org/apache/avalon/meta/info/builder/TypeBuilder.java
Index: TypeBuilder.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/meta/src/java/org/apache/avalon/meta/info/builder/TypeBuilder.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TypeBuilder.java 13 Mar 2003 01:06:01 -0000 1.1
+++ TypeBuilder.java 29 Mar 2003 03:25:58 -0000 1.2
@@ -129,7 +129,7 @@
throws Exception
{
final String xinfo =
- classname.replace( '.', '/' ) + ".sinfo";
+ classname.replace( '.', '/' ) + ".stype";
final InputStream inputStream =
classLoader.getResourceAsStream( xinfo );
if( null == inputStream )
@@ -156,7 +156,7 @@
final TypeFactory xmlTypeFactory = getXMLTypeFactory( classname );
//
- // get the input stream for the .xinfo resource
+ // get the input stream for the .xtype resource
//
final String path =
1.3 +38 -21 avalon-sandbox/merlin/meta/src/java/org/apache/avalon/meta/info/builder/XMLLegacyCreator.java
Index: XMLLegacyCreator.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/meta/src/java/org/apache/avalon/meta/info/builder/XMLLegacyCreator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XMLLegacyCreator.java 18 Mar 2003 08:02:53 -0000 1.2
+++ XMLLegacyCreator.java 29 Mar 2003 03:25:58 -0000 1.3
@@ -73,7 +73,7 @@
import org.xml.sax.InputSource;
/**
- * Handles internalization of a legacy Poenix XML based description of a {@link Type}
+ * Handles internalization of a legacy Phoenix XML based description of a {@link Type}
* from a Configuration object.
*
* @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
@@ -137,16 +137,13 @@
throws Exception
{
final String topLevelName = info.getName();
- if( !topLevelName.equals( "type" ) )
+ if( !topLevelName.equals( "blockinfo" ) )
{
- if( !topLevelName.equals( "blockinfo" ) )
- {
- final String message =
- REZ.getString( "builder.bad-toplevel-block-element.error",
- classname,
- topLevelName );
- throw new ConfigurationException( message );
- }
+ final String message =
+ REZ.getString( "builder.bad-toplevel-block-element.error",
+ classname,
+ topLevelName );
+ throw new ConfigurationException( message );
}
Configuration configuration = null;
@@ -156,15 +153,14 @@
buildInfoDescriptor( classname, configuration );
configuration = info.getChild( "loggers" );
- final LoggerDescriptor[] loggers = buildLoggers( configuration );
-
+ final LoggerDescriptor[] loggers = new LoggerDescriptor[0];
final ContextDescriptor context = buildPhoenixContext( );
configuration = info.getChild( "services" );
final ServiceDescriptor[] services = buildBlockServices( configuration );
configuration = info.getChild( "dependencies" );
- final DependencyDescriptor[] dependencies = buildDependencies( configuration );
+ final DependencyDescriptor[] dependencies = buildBlockDependencies( configuration );
configuration = info.getChild( "stages" );
final StageDescriptor[] phases = buildPhases( configuration );
@@ -180,8 +176,10 @@
{
ReferenceDescriptor reference =
createReference( "org.apache.avalon.framework.context.Context" );
- EntryDescriptor name = new EntryDescriptor( "urn:avalon:name", "block.name", "java.lang.String", false );
- EntryDescriptor home = new EntryDescriptor( "urn:avalon:home", "app.home", "java.io.File", false );
+ EntryDescriptor name =
+ new EntryDescriptor( "urn:avalon:name", "block.name", "java.lang.String", false );
+ EntryDescriptor home =
+ new EntryDescriptor( "urn:avalon:home", "app.home", "java.io.File", false );
return new ContextDescriptor( reference, new EntryDescriptor[]{ name, home }, null );
}
@@ -193,6 +191,28 @@
* @return the created ServiceDescriptor
* @throws ConfigurationException if an error occurs
*/
+ protected DependencyDescriptor[] buildBlockDependencies( final Configuration depSet )
+ throws ConfigurationException
+ {
+ final Configuration[] deps = depSet.getChildren( "dependency" );
+ final ArrayList dependencies = new ArrayList();
+ for( int i = 0; i < deps.length; i++ )
+ {
+ final DependencyDescriptor dependency = buildBlockDependency( deps[ i ] );
+ dependencies.add( dependency );
+ }
+ return (DependencyDescriptor[])dependencies.toArray( new DependencyDescriptor[ 0 ] );
+ }
+
+
+ /**
+ * A utility method to build an array of {@link ServiceDescriptor}
+ * objects from specified configuraiton.
+ *
+ * @param servicesSet the services configuration
+ * @return the created ServiceDescriptor
+ * @throws ConfigurationException if an error occurs
+ */
protected ServiceDescriptor[] buildBlockServices( final Configuration servicesSet )
throws ConfigurationException
{
@@ -246,7 +266,7 @@
catch( Throwable e )
{
final String error =
- "Error occured while attempting to build reference descriptor from configuration: "
+ "Error occured while attempting to build reference descriptor from legacy blockinfo configuration: "
+ ConfigurationUtil.list( service );
throw new ConfigurationException( error, e );
}
@@ -256,16 +276,13 @@
* A utility method to build a {@link DependencyDescriptor}
* object from specified configuraiton.
*
- * @param classname The classname of Component (used for logging purposes)
* @param dependency the dependency configuration
* @return the created DependencyDescriptor
* @throws ConfigurationException if an error occurs
*/
- protected DependencyDescriptor buildDependency( final String classname,
- final Configuration dependency )
+ protected DependencyDescriptor buildBlockDependency( final Configuration dependency )
throws ConfigurationException
{
-
Configuration serviceRef = dependency.getChild( "service" );
final ReferenceDescriptor service =
buildReferenceDescriptor( serviceRef );
1.3 +24 -70 avalon-sandbox/merlin/meta/src/java/org/apache/avalon/meta/info/builder/XMLTypeCreator.java
Index: XMLTypeCreator.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/meta/src/java/org/apache/avalon/meta/info/builder/XMLTypeCreator.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XMLTypeCreator.java 17 Mar 2003 04:10:24 -0000 1.2
+++ XMLTypeCreator.java 29 Mar 2003 03:25:58 -0000 1.3
@@ -131,14 +131,14 @@
return new XMLLegacyCreator().createType( classname, info );
}
- //if( !topLevelName.equals( "type" ) )
- //{
- // final String message =
- // REZ.getString( "builder.bad-toplevel-element.error",
- // classname,
- // topLevelName );
- // throw new ConfigurationException( message );
- //}
+ if( !topLevelName.equals( "type" ) )
+ {
+ final String message =
+ REZ.getString( "builder.bad-toplevel-element.error",
+ classname,
+ topLevelName );
+ throw new ConfigurationException( message );
+ }
Configuration configuration = null;
@@ -177,7 +177,8 @@
final ExtensionDescriptor[] extensions = buildExtensions( configuration );
return new Type(
- descriptor, loggers, context, services, dependencies, phases, extensions, defaults );
+ descriptor, loggers, context, services, dependencies, phases,
+ extensions, defaults );
}
/**
@@ -206,21 +207,7 @@
*/
protected StageDescriptor buildPhase( Configuration config ) throws Exception
{
- ReferenceDescriptor reference;
- if( config.getAttribute( "type", null ) != null )
- {
- reference = createReference( config.getAttribute( "type" ) );
- }
- else
- {
- //
- // use the old method
- //
-
- Configuration ref = config.getChild( "reference" );
- reference = buildReferenceDescriptor( ref );
- }
-
+ ReferenceDescriptor reference = createReference( config.getAttribute( "type" ) );
final Properties attributes =
buildAttributes( config.getChild( "attributes" ) );
return new StageDescriptor( reference, attributes );
@@ -319,23 +306,9 @@
protected DependencyDescriptor buildDependency( final Configuration dependency )
throws ConfigurationException
{
- String role;
- ReferenceDescriptor reference;
- if( dependency.getAttribute( "type", null ) != null )
- {
- reference = createReference( dependency.getAttribute( "type" ) );
- role = dependency.getAttribute( "role", null );
- }
- else
- {
- //
- // use the old method
- //
-
- Configuration serviceRef = dependency.getChild( "reference" );
- reference = buildReferenceDescriptor( serviceRef );
- role = dependency.getChild( "role" ).getValue( null );
- }
+ String role = dependency.getAttribute( "role", null );
+ ReferenceDescriptor reference =
+ createReference( dependency.getAttribute( "type" ) );
final boolean optional =
dependency.getAttributeAsBoolean( "optional", false );
@@ -412,17 +385,7 @@
protected ServiceDescriptor buildService( final Configuration service )
throws ConfigurationException
{
- ReferenceDescriptor reference;
- if( service.getAttribute( "type", null ) != null )
- {
- reference = createReference( service.getAttribute( "type" ) );
- }
- else
- {
- Configuration serviceRef = service.getChild( "reference" );
- reference = buildReferenceDescriptor( serviceRef );
- }
-
+ ReferenceDescriptor reference = createReference( service.getAttribute( "type" ) );
final Properties attributes =
buildAttributes( service.getChild( "attributes" ) );
return new ServiceDescriptor( reference, attributes );
@@ -441,11 +404,12 @@
final Configuration component )
throws ConfigurationException
{
- final String name = component.getChild( "name" ).getValue( null );
- final Version version = buildVersion( component.getChild( "version" ).getValue( "1.0" ) );
+ final String name =
+ component.getChild( "name" ).getValue( null );
+ final Version version =
+ buildVersion( component.getChild( "version" ).getValue( "1.0" ) );
final Properties attributes =
buildAttributes( component.getChild( "attributes" ) );
-
return new InfoDescriptor( name, classname, version, attributes );
}
@@ -474,21 +438,11 @@
*/
protected ExtensionDescriptor buildExtension( Configuration config ) throws Exception
{
- ReferenceDescriptor reference;
- if( config.getAttribute( "type", null ) != null )
- {
- reference = createReference( config.getAttribute( "type" ) );
- }
- else
- {
- reference =
- buildReferenceDescriptor( config.getChild( "reference" ) );
- }
-
- ContextDescriptor context = buildContext( config.getChild( "context" ) );
+ ReferenceDescriptor reference =
+ createReference( config.getAttribute( "type" ) );
final Properties attributes =
- buildAttributes( config.getChild( "attributes" ) );
- return new ExtensionDescriptor( reference, context, attributes );
+ buildAttributes( config.getChild( "attributes" ) );
+ return new ExtensionDescriptor( reference, attributes );
}
/**
1.2 +8 -2 avalon-sandbox/merlin/meta-spi/src/java/org/apache/avalon/meta/info/ContextDescriptor.java
Index: ContextDescriptor.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/meta-spi/src/java/org/apache/avalon/meta/info/ContextDescriptor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ContextDescriptor.java 13 Mar 2003 01:06:12 -0000 1.1
+++ ContextDescriptor.java 29 Mar 2003 03:25:58 -0000 1.2
@@ -147,10 +147,15 @@
*/
public EntryDescriptor getEntry( final String key )
{
+ if( null == key )
+ {
+ throw new NullPointerException( "key" );
+ }
+
for( int i = 0; i < m_entries.length; i++ )
{
final EntryDescriptor entry = m_entries[ i ];
- if( entry.getAlias().equals( key ) )
+ if( ( entry.getAlias() != null ) && entry.getAlias().equals( key ) )
{
return entry;
}
@@ -159,6 +164,7 @@
return entry;
}
}
+
return null;
}
1.2 +9 -9 avalon-sandbox/merlin/meta-spi/src/java/org/apache/avalon/meta/info/DependencyDescriptor.java
Index: DependencyDescriptor.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/meta-spi/src/java/org/apache/avalon/meta/info/DependencyDescriptor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DependencyDescriptor.java 13 Mar 2003 01:06:12 -0000 1.1
+++ DependencyDescriptor.java 29 Mar 2003 03:25:58 -0000 1.2
@@ -87,7 +87,7 @@
/**
* The name the component uses to lookup dependency.
*/
- private final String m_role;
+ private final String m_key;
/**
* The service class/interface that the dependency must provide.
@@ -154,24 +154,24 @@
throw new NullPointerException( "service" );
}
- m_role = role;
+ m_key = role;
m_service = service;
m_optional = optional;
}
/**
- * Return the name the component uses to lookup dependency.
+ * Return the name the component uses to lookup the dependency.
*
- * @return the name the component uses to lookup dependency.
+ * @return the name the component uses to lookup the dependency.
*/
- public String getRole()
+ public String getKey()
{
- return m_role;
+ return m_key;
}
/**
* Return the service class/interface descriptor that describes the
- * dependency must fulfilled by a provider.
+ * dependency that the provider provides.
*
* @return a reference to service reference that describes the fulfillment
* obligations that must be met by a service provider.
@@ -216,7 +216,7 @@
public String toString()
{
- return "[" + getRole() + "] " + getReference();
+ return "[" + getKey() + "] " + getReference();
}
/**
1.2 +16 -29 avalon-sandbox/merlin/meta-spi/src/java/org/apache/avalon/meta/info/ExtensionDescriptor.java
Index: ExtensionDescriptor.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/meta-spi/src/java/org/apache/avalon/meta/info/ExtensionDescriptor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ExtensionDescriptor.java 13 Mar 2003 01:06:13 -0000 1.1
+++ ExtensionDescriptor.java 29 Mar 2003 03:25:58 -0000 1.2
@@ -66,32 +66,34 @@
private final ReferenceDescriptor m_reference;
/**
- * Context dependecies declared by the extension.
+ * Creation of an extension descriptor without attributes.
+ * @param classname an interface classname
+ * @exception NullPointerException if the classname is null
*/
- private final ContextDescriptor m_context;
+ public ExtensionDescriptor( final String classname )
+ throws NullPointerException
+ {
+ this( new ReferenceDescriptor( classname ), null );
+ }
/**
* Creation of an extension descriptor without attributes.
- * @param reference a version interface reference
- * @param context the context criteria associated with the extension
- * @exception NullPointerException if the name, reference or context parameters are null
+ * @param reference an interface reference
+ * @exception NullPointerException if the reference is null
*/
- public ExtensionDescriptor( final ContextDescriptor context,
- final ReferenceDescriptor reference )
+ public ExtensionDescriptor( final ReferenceDescriptor reference )
throws NullPointerException
{
- this( reference, context, null );
+ this( reference, null );
}
/**
- * Creation of a phase descriptor with attributes.
+ * Creation of a extension descriptor with attributes.
* @param reference a version interface reference
- * @param context the context criteria associated with the extension
* @param attributes a set of attributes to associate with the extension
- * @exception NullPointerException if the name, reference or context parameters are null
+ * @exception NullPointerException if the supplied reference is null
*/
public ExtensionDescriptor( final ReferenceDescriptor reference,
- final ContextDescriptor context,
final Properties attributes )
throws NullPointerException
{
@@ -101,32 +103,17 @@
{
throw new NullPointerException( "reference" );
}
- if( null == context )
- {
- throw new NullPointerException( "context" );
- }
m_reference = reference;
- m_context = context;
}
/**
- * Return the versioned interface reference.
+ * Return the interface reference
*
* @return the reference.
*/
public ReferenceDescriptor getReference()
{
return m_reference;
- }
-
- /**
- * Return the context constraints.
- *
- * @return the context descriptor
- */
- public ContextDescriptor getContext()
- {
- return m_context;
}
}
1.2 +8 -5 avalon-sandbox/merlin/meta-spi/src/java/org/apache/avalon/meta/info/ReferenceDescriptor.java
Index: ReferenceDescriptor.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/meta-spi/src/java/org/apache/avalon/meta/info/ReferenceDescriptor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ReferenceDescriptor.java 13 Mar 2003 01:06:19 -0000 1.1
+++ ReferenceDescriptor.java 29 Mar 2003 03:25:58 -0000 1.2
@@ -102,13 +102,16 @@
throw new NullPointerException( "classname" );
}
+ m_classname = classname;
+
if( null == version )
{
- throw new NullPointerException( "version" );
+ m_version = Version.getVersion( "1.0" );
+ }
+ else
+ {
+ m_version = version;
}
-
- m_classname = classname;
- m_version = version;
}
/**
1.2 +4 -4 avalon-sandbox/merlin/meta-spi/src/java/org/apache/avalon/meta/info/Type.java
Index: Type.java
===================================================================
RCS file: /home/cvs/avalon-sandbox/merlin/meta-spi/src/java/org/apache/avalon/meta/info/Type.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Type.java 13 Mar 2003 01:06:20 -0000 1.1
+++ Type.java 29 Mar 2003 03:25:58 -0000 1.2
@@ -303,14 +303,14 @@
/**
* Retrieve a dependency with a particular role.
*
- * @param role the role
+ * @param key the service key
* @return the dependency or null if it does not exist
*/
- public DependencyDescriptor getDependency( final String role )
+ public DependencyDescriptor getDependency( final String key )
{
for( int i = 0; i < m_dependencies.length; i++ )
{
- if( m_dependencies[ i ].getRole().equals( role ) )
+ if( m_dependencies[ i ].getKey().equals( key ) )
{
return m_dependencies[ i ];
}
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org