Skip to Content.
Sympa Menu

notify-dpml - svn commit: r2098 - in development/main: . metro metro/composition/api/src/main/net/dpml/composition/data metro/composition/api/src/main/net/dpml/composition/model metro/composition/impl/src/main/net/dpml/composition/data/builder metro/composition/impl/src/main/net/dpml/composition/data/writer metro/composition/impl/src/main/net/dpml/composition/model/impl metro/composition/spi/src/main/net/dpml/composition/provider metro/extension

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell AT dpml.net
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: svn commit: r2098 - in development/main: . metro metro/composition/api/src/main/net/dpml/composition/data metro/composition/api/src/main/net/dpml/composition/model metro/composition/impl/src/main/net/dpml/composition/data/builder metro/composition/impl/src/main/net/dpml/composition/data/writer metro/composition/impl/src/main/net/dpml/composition/model/impl metro/composition/spi/src/main/net/dpml/composition/provider metro/extension
  • Date: Mon, 21 Mar 2005 11:12:58 -0500

Author: mcconnell AT dpml.net
Date: Mon Mar 21 11:12:58 2005
New Revision: 2098

Removed:

development/main/metro/composition/api/src/main/net/dpml/composition/data/ClassLoaderDirective.java
development/main/metro/extension/
Modified:
development/main/ (props changed)

development/main/metro/composition/api/src/main/net/dpml/composition/data/ContainmentProfile.java

development/main/metro/composition/api/src/main/net/dpml/composition/model/ClassLoaderModel.java

development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLContainmentProfileCreator.java

development/main/metro/composition/impl/src/main/net/dpml/composition/data/writer/XMLContainmentProfileWriter.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderContext.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderModel.java

development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelFactory.java

development/main/metro/composition/spi/src/main/net/dpml/composition/provider/ClassLoaderContext.java
development/main/metro/index.xml
Log:
Remove logic dealing with java extension library handling (transit is
sufficiently evolved that this is now largely redundant).

Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/data/ContainmentProfile.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/data/ContainmentProfile.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/data/ContainmentProfile.java
Mon Mar 21 11:12:58 2005
@@ -49,19 +49,17 @@
private static final DeploymentProfile[] EMPTY_PROFILES =
new DeploymentProfile[0];

- private static final ClassLoaderDirective EMPTY_CLASSLOADER =
- new ClassLoaderDirective(
- new LibraryDirective(),
- new ClasspathDirective());
+ private static final ClasspathDirective EMPTY_CLASSPATH =
+ new ClasspathDirective();


//========================================================================
// state

//========================================================================

/**
- * The classloader directive.
+ * The classpath directive.
*/
- private ClassLoaderDirective m_classloader;
+ private ClasspathDirective m_classpath;

/**
* The published service directives.
@@ -89,24 +87,47 @@
* Creation of a new containment profile.
*
* @param name the profile name
- * @param classloader the description of the classloader to be
- * created for this containment profile
+ * @param classpath the description of the classpath
* @param exports the set of servides that this component is
* dependent on for normal execution
* @param profiles the set of profiles contained within this
* containment profile
*/
public ContainmentProfile(
- final String name, final ClassLoaderDirective classloader,
+ final String name,
+ final ClasspathDirective classpath,
final ServiceDirective[] exports,
final CategoriesDirective categories,
DeploymentProfile[] profiles )
{
super( name, DeploymentProfile.ENABLED, Mode.EXPLICIT, categories );

- m_classloader = classloader;
- m_profiles = profiles;
- m_export = exports;
+ if( classpath == null )
+ {
+ m_classpath = EMPTY_CLASSPATH;
+ }
+ else
+ {
+ m_classpath = classpath;
+ }
+
+ if( exports == null )
+ {
+ m_export = EMPTY_SERVICES;
+ }
+ else
+ {
+ m_export = exports;
+ }
+
+ if( profiles == null )
+ {
+ m_profiles = EMPTY_PROFILES;
+ }
+ else
+ {
+ m_profiles = profiles;
+ }
}


//--------------------------------------------------------------------------
@@ -119,10 +140,9 @@
*
* @return the classloader directive
*/
- public ClassLoaderDirective getClassLoaderDirective()
+ public ClasspathDirective getClasspathDirective()
{
- if( m_classloader == null ) return EMPTY_CLASSLOADER;
- return m_classloader;
+ return m_classpath;
}

/**
@@ -134,7 +154,6 @@
*/
public ServiceDirective[] getExportDirectives()
{
- if( m_export == null ) return EMPTY_SERVICES;
return m_export;
}

@@ -166,7 +185,6 @@
*/
public DeploymentProfile[] getProfiles()
{
- if( m_profiles == null ) return EMPTY_PROFILES;
return m_profiles;
}


Modified:
development/main/metro/composition/api/src/main/net/dpml/composition/model/ClassLoaderModel.java
==============================================================================
---
development/main/metro/composition/api/src/main/net/dpml/composition/model/ClassLoaderModel.java
(original)
+++
development/main/metro/composition/api/src/main/net/dpml/composition/model/ClassLoaderModel.java
Mon Mar 21 11:12:58 2005
@@ -22,8 +22,7 @@
import java.security.CodeSource;

import net.dpml.composition.data.ContainmentProfile;
-import net.dpml.extension.manager.ExtensionManager;
-import net.dpml.extension.manager.OptionalPackage;
+
import net.dpml.logging.Logger;

/**
@@ -51,29 +50,6 @@
ServiceRepository getServiceRepository();

/**
- * Return the optional extensions manager.
- * @return the extension manager
- */
- ExtensionManager getExtensionManager();
-
- /**
- * Return the set of local established optional packages.
- *
- * @return the local set of optional packages
- */
- OptionalPackage[] getOptionalPackages();
-
- /**
- * Return the set of optional packages already established including
- * the optional packages established by any parent classloader model.
- *
- * @param policy if TRUE, return the local and all ancestor optional
- * package - if FALSE only return the local packages
- * @return the OptionalPackage instances
- */
- OptionalPackage[] getOptionalPackages( boolean policy );
-
- /**
* Return the fully qualified classpath including extension jar files
* resolved relative to a classpath directives.
*

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLContainmentProfileCreator.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLContainmentProfileCreator.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/data/builder/XMLContainmentProfileCreator.java
Mon Mar 21 11:12:58 2005
@@ -20,7 +20,6 @@
import java.util.ArrayList;

import net.dpml.composition.data.BlockCompositionDirective;
-import net.dpml.composition.data.ClassLoaderDirective;
import net.dpml.composition.data.ClasspathDirective;
import net.dpml.composition.data.ContainmentProfile;
import net.dpml.composition.data.DeploymentProfile;
@@ -94,9 +93,9 @@
// then run with it, otherwise continue with the container defintion
//

- ClassLoaderDirective classloader =
- createClassLoaderDirective(
- config.getChild( "classloader", false ) );
+ Configuration classloader = config.getChild( "classloader", true );
+ ClasspathDirective classpath =
+ createClasspathDirective( classloader.getChild( "classpath", false
) );

//
// build any logging category directives
@@ -115,7 +114,7 @@
// return the containment profile
//

- return new ContainmentProfile( name, classloader, exports,
categories, profiles );
+ return new ContainmentProfile( name, classpath, exports, categories,
profiles );
}

private boolean isaValidProfileRootName( String name )
@@ -138,21 +137,6 @@
}
}

- private ClassLoaderDirective createClassLoaderDirective( Configuration
config )
- throws ConfigurationException
- {
- if( config == null )
- {
- return null;
- }
-
- LibraryDirective library =
- createLibraryDirective( config.getChild( "library", false ) );
- ClasspathDirective classpath =
- createClasspathDirective( config.getChild( "classpath", false ) );
- return new ClassLoaderDirective( library, classpath );
- }
-
private ClasspathDirective createClasspathDirective( Configuration
config )
throws ConfigurationException
{
@@ -166,31 +150,6 @@
return new ClasspathDirective( filesets, artifacts );
}

- private LibraryDirective createLibraryDirective( Configuration config )
- throws ConfigurationException
- {
- if( config == null )
- {
- return null;
- }
-
- Configuration[] includes = config.getChildren( "include" );
- String[] inc = new String[ includes.length ];
- for( int i = 0; i < includes.length; i++ )
- {
- inc[i] = getIncludeValue( includes[i] );
- }
-
- Configuration[] groups = config.getChildren( "group" );
- String[] grp = new String[ groups.length ];
- for( int i = 0; i < groups.length; i++ )
- {
- grp[i] = groups[i].getValue();
- }
-
- return new LibraryDirective( inc, grp );
- }
-
private Artifact[] createArtifactDirectives( Configuration config )
throws ConfigurationException
{
@@ -477,7 +436,7 @@
}

/**
- * Create a containment defintion for an include statement. Two variant
+ * Create a containment definition for an include statement. Two variant
* of include are supported - include by resource reference, and include
* of a source container defintion.
*
@@ -538,28 +497,4 @@
throw new MetaDataException( error, e );
}
}
-/* Never used
- private String getBlockIncludePath( Configuration config ) throws
MetaDataException
- {
- try
- {
- Configuration source = config.getChild( "source", false );
- if( null == source )
- {
- final String error =
- "Missing 'source' element in the block include
statement:\n"
- + ConfigurationUtil.list( config );
- throw new MetaDataException( error );
- }
- return source.getValue();
- }
- catch( ConfigurationException e )
- {
- final String error =
- "Missing source value in the block include statement:\n"
- + ConfigurationUtil.list( config );
- throw new MetaDataException( error, e );
- }
- }
-*/
}

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/data/writer/XMLContainmentProfileWriter.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/data/writer/XMLContainmentProfileWriter.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/data/writer/XMLContainmentProfileWriter.java
Mon Mar 21 11:12:58 2005
@@ -27,7 +27,6 @@
import net.dpml.composition.data.DeploymentProfile;
import net.dpml.composition.data.ContainmentProfile;
import net.dpml.composition.data.ComponentProfile;
-import net.dpml.composition.data.ClassLoaderDirective;
import net.dpml.composition.data.ClasspathDirective;
import net.dpml.composition.data.LibraryDirective;
import net.dpml.composition.data.ServiceDirective;
@@ -94,7 +93,7 @@
writer.write( pad + "<container name=\"" + profile.getName() +
"\">");
final String padding = pad + INDENT;
writeServiceDirectives( writer, profile.getExportDirectives(),
padding );
- writeClassLoader( writer, profile.getClassLoaderDirective(), padding
);
+ writeClassLoader( writer, profile.getClasspathDirective(), padding );
writeCategories( writer, profile.getCategories(), padding );
writeProfiles( writer, profile.getProfiles(), padding );
writer.write( "\n" + pad + "</container>" );
@@ -159,57 +158,17 @@
* @throws IOException if unable to write xml
*/
private void writeClassLoader(
- final Writer writer, final ClassLoaderDirective classloader, String
pad )
+ final Writer writer, final ClasspathDirective classpath, String pad )
throws IOException
{
- if( classloader.isEmpty() ) return;
-
+ if( classpath.isEmpty() ) return;
writer.write( "\n" + pad + "<classloader>" );
final String padding = pad + INDENT;
-
- LibraryDirective library = classloader.getLibrary();
- writeLibrary( writer, library, padding );
-
- ClasspathDirective classpath = classloader.getClasspathDirective();
writeClasspathDirective( writer, classpath, padding );
-
writer.write( "\n" + pad + "</classloader>" );
}

/**
- * Write out xml representation of a set of includes.
- *
- * @param writer the writer
- * @param library the library directives
- * @param pad character offset
- * @throws IOException if unable to write xml
- */
- private void writeLibrary(
- final Writer writer, final LibraryDirective library, String pad )
- throws IOException
- {
- if( library.isEmpty() ) return;
-
- final String padding = pad + INDENT;
- writer.write( "\n" + pad + "<library>" );
- String[] includes = library.getIncludes();
- for( int i=0; i<includes.length; i++ )
- {
- writer.write( "\n" + padding
- + "<include>" + includes[i] + "</include>" );
- }
-
- String[] groups = library.getGroups();
- for( int i=0; i<groups.length; i++ )
- {
- writer.write( "\n" + padding
- + "<group>" + groups[i] + "</group>" );
- }
-
- writer.write( "\n" + pad + "</library>" );
- }
-
- /**
* Write out xml representation of a classpath.
*
* @param writer the writer

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderContext.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderContext.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderContext.java
Mon Mar 21 11:12:58 2005
@@ -22,7 +22,7 @@

import java.net.URL;

-import net.dpml.composition.data.ClassLoaderDirective;
+import net.dpml.composition.data.ClasspathDirective;

import net.dpml.composition.model.ServiceRepository;
import net.dpml.composition.model.TypeRepository;
@@ -31,9 +31,6 @@

import net.dpml.context.impl.DefaultContext;

-import net.dpml.extension.manager.ExtensionManager;
-import net.dpml.extension.manager.OptionalPackage;
-
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;

@@ -77,14 +74,7 @@
private final ClassLoader m_parent;

/**
- * Option packages established through the chain of parent
- * models.
- */
- private final OptionalPackage[] m_packages;
-
- /**
- * The base directory for resolution of extension directories and
- * fileset directories.
+ * The base directory for resolution of extension fileset directories.
*/
private final File m_base;

@@ -94,11 +84,6 @@
private final Repository m_repository;

/**
- * The optional extensions package manager.
- */
- private final ExtensionManager m_manager;
-
- /**
* The parent type manager.
*/
private final TypeRepository m_types;
@@ -109,9 +94,9 @@
private final ServiceRepository m_services;

/**
- * The classloader directive.
+ * The classpath directive.
*/
- private final ClassLoaderDirective m_directive;
+ private final ClasspathDirective m_directive;

/**
* Implied url to include in the classpath.
@@ -137,10 +122,9 @@
*/
public DefaultClassLoaderContext(
Logger logger, SystemContext system,
- ClassLoader parent, ClassLoaderDirective directive )
+ ClassLoader parent, ClasspathDirective directive )
{
- this( logger, system, parent,
- new OptionalPackage[0], null, null, null, directive, null );
+ this( logger, system, parent, null, null, directive, null );
}

/**
@@ -149,23 +133,18 @@
* @param logger the logging channel to assign to the classloader model
* @param system the system context
* @param parent the parent classloader
- * @param packages the set of optional packages established under
- * current classloader chain
- * @param manager the optional extions package manager established
- * by the parent classloader
* @param types the parent type manager
* @param services the parent service manager
- * @param directive the classloader directive
+ * @param directive the classpath directive
* @param implied url array added though implication
* @exception NullArgumentException if any one of the logger, parent,
packages,
* directive or system arguments is null.
*/
public DefaultClassLoaderContext(
Logger logger, SystemContext system,
- ClassLoader parent, OptionalPackage[] packages,
- ExtensionManager manager, TypeRepository types,
+ ClassLoader parent, TypeRepository types,
ServiceRepository services,
- ClassLoaderDirective directive,
+ ClasspathDirective directive,
URL[] implied )
throws NullArgumentException
{
@@ -178,10 +157,6 @@
{
throw new NullArgumentException( "parent" );
}
- if( packages == null )
- {
- throw new NullArgumentException( "packages" );
- }
if( directive == null )
{
throw new NullArgumentException( "directive" );
@@ -195,8 +170,6 @@
m_repository = system.getRepository();
m_base = system.getAnchorDirectory();
m_parent = parent;
- m_packages = packages;
- m_manager = manager;
m_types = types;
m_services = services;
m_directive = directive;
@@ -212,14 +185,9 @@
}
}

- //==============================================================
- // Context
- //==============================================================
-
-
- //==============================================================
+ //--------------------------------------------------------------
// ClassLoaderContext
- //==============================================================
+ //--------------------------------------------------------------

/**
* Return the system logging channel.
@@ -263,27 +231,6 @@
}

/**
- * Return the containment classloader.
- *
- * @return the classloader
- */
- public OptionalPackage[] getOptionalPackages()
- {
- return m_packages;
- }
-
- /**
- * Return the extension manager established by the parent
- * classloader model.
- *
- * @return the extension manager
- */
- public ExtensionManager getExtensionManager()
- {
- return m_manager;
- }
-
- /**
* Return the type repository established by the parent classloader.
*
* @return the type repository
@@ -304,12 +251,12 @@
}

/**
- * Return the classloader directive to be applied to the
+ * Return the classpath directive to be applied to the
* classloader model.
*
* @return the classloader directive
*/
- public ClassLoaderDirective getClassLoaderDirective()
+ public ClasspathDirective getClasspathDirective()
{
return m_directive;
}

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderModel.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderModel.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultClassLoaderModel.java
Mon Mar 21 11:12:58 2005
@@ -35,7 +35,7 @@

import java.util.jar.Manifest;

-import net.dpml.composition.data.ClassLoaderDirective;
+import net.dpml.composition.data.ClasspathDirective;
import net.dpml.composition.data.ContainmentProfile;
import net.dpml.composition.data.ExcludeDirective;
import net.dpml.composition.data.FilesetDirective;
@@ -48,15 +48,6 @@

import net.dpml.composition.provider.ClassLoaderContext;

-import net.dpml.extension.Extension;
-
-import net.dpml.extension.manager.ExtensionManager;
-import net.dpml.extension.manager.OptionalPackage;
-import net.dpml.extension.manager.PackageManager;
-
-import net.dpml.extension.manager.impl.DefaultExtensionManager;
-import net.dpml.extension.manager.impl.DelegatingExtensionManager;
-
import net.dpml.i18n.ResourceManager;
import net.dpml.i18n.Resources;

@@ -77,26 +68,6 @@
* are associated together enabling the creation of a fully
* qualified classpath.</p>
*
- * <p>The classpath established by this model implementation
- * applies the following logic:</p>
- * <ul>
- * <li>establish an extensions manager relative to the
- * &lt;library/&gt> directives</li>
- * <li>build an uqualifed classpath relative to the
- * &lt;classpath/&gt> directives</li>
- * <li>resolve any optional jar file extension jar file
- * entries based on the manifest declarations of
- * the unqualified classpath, together with recursive
- * resolution of resolved optional extensions</li>
- * <li>consolidate the generated classpath relative to
- * the optional extensions established by any parent
- * classloader models</li>
- * </ul>
- * <p>
- * Class dependencies include the util i18n, the assembly
- * repository package, the avalon framework and meta packages,
- * and the extensions package.
- * </p>
* @author <a href="mailto:dev-dpml AT lists.ibiblio.org";>The Digital Product
Meta Library</a>
* @version $Id$
*/
@@ -116,14 +87,8 @@

private final ClassLoaderContext m_context;

- private final ExtensionManager m_extension;
-
- private final PackageManager m_manager;
-
private final String[] m_classpath;

- private final OptionalPackage[] m_packages;
-
private final URL[] m_urls;

private final URLClassLoader m_classLoader;
@@ -169,29 +134,12 @@
File base =
context.getBaseDirectory();

- ClassLoaderDirective directive = context.getClassLoaderDirective();
+ ClasspathDirective directive = context.getClasspathDirective();

- ExtensionManager manager =
- context.getExtensionManager();
URL[] implicit = context.getImplicitURLs();

try
{
- if( manager != null )
- {
- DefaultExtensionManager local =
- new DefaultExtensionManager(
- directive.getLibrary().getOptionalExtensionDirectories(
base ) );
- m_extension = new DelegatingExtensionManager(
- new ExtensionManager[]{ manager, local } );
- }
- else
- {
- m_extension = new DefaultExtensionManager(
- directive.getLibrary().getOptionalExtensionDirectories(
base ) );
- }
-
- m_manager = new PackageManager( m_extension );
m_classpath = createClassPath( base, directive, implicit );

if( getLocalLogger().isDebugEnabled() )
@@ -201,19 +149,19 @@
getLocalLogger().debug( str );
}

- m_packages = buildOptionalPackages(
- m_classpath, context.getOptionalPackages() );
m_urls = buildQualifiedClassPath();
+
+ m_classLoader =
+ new URLClassLoader(
+ m_urls, context.getClassLoader(),
+ new ArtifactURLStreamHandlerFactory() );
+
//m_classLoader =
// new StandardClassLoader(
// m_urls, context.getClassLoader(),
// new ArtifactURLStreamHandlerFactory( repository ),
// "container" );

- m_classLoader =
- new URLClassLoader(
- m_urls, context.getClassLoader(),
- new ArtifactURLStreamHandlerFactory() );

//
// scan the classpath for component type and service
@@ -224,9 +172,7 @@
ArrayList services = new ArrayList();
Logger scannerLogger = getLocalLogger().getChildLogger(
"scanner" );
SystemContext system = context.getSystemContext();
-
Scanner scanner = new Scanner( scannerLogger, system,
m_classLoader );
-
scanner.scan( m_urls, types, services );

//
@@ -240,7 +186,6 @@
Logger serviceLogger = getLocalLogger().getChildLogger(
"services" );
m_services = new DefaultServiceRepository(
serviceLogger, context.getServiceRepository(), services );
-
}
catch( Throwable e )
{
@@ -294,65 +239,9 @@
}

/**
- * Return the optional extensions manager.
- * @return the extension manager
- */
- public ExtensionManager getExtensionManager()
- {
- return m_extension;
- }
-
- /**
- * Return the set of local established optional packages.
- *
- * @return the local set of optional packages
- */
- public OptionalPackage[] getOptionalPackages()
- {
- return getOptionalPackages( false );
- }
-
- /**
- * Return the set of optional packages already established including
- * the optional packages established by any parent classloader model.
- *
- * @param policy if TRUE, return the local and all ancestor optional
- * package - if FALSE only return the local packages
- * @return the OptionalPackage instances
- */
- public OptionalPackage[] getOptionalPackages( boolean policy )
- {
- if( !policy )
- {
- return m_packages;
- }
-
- final ArrayList list = new ArrayList();
- OptionalPackage[] available = m_context.getOptionalPackages();
- for( int i=0; i<available.length; i++ )
- {
- list.add( available[i] );
- }
- for( int i=0; i<m_packages.length; i++ )
- {
- list.add( m_packages[i] );
- }
-
- return (OptionalPackage[]) list.toArray( new OptionalPackage[0] );
- }
-
- /**
- * Return the fully qualified classpath including extension jar files
- * resolved relative to the classpath directives in the meta-data
- * and any parent classloader models.
- *
- * WARNING: lots of updates needed to properly populate the returned
- * code source with certificates used to verify repository content which
- * means updating the extension utilities and the repository package.
- * Currently the code sources returned contain an empty certificates
- * array.
+ * Return the fully qualified classpath.
*
- * @return an array of URL representing the complete classpath
+ * @return an CodeSource array
*/
public CodeSource[] getQualifiedClassPath()
{
@@ -391,13 +280,11 @@
Logger logger, ContainmentProfile profile, URL[] implied )
{
SystemContext system = m_context.getSystemContext();
- OptionalPackage[] packages = getOptionalPackages();
- ClassLoaderDirective directive =
- profile.getClassLoaderDirective();
+ ClasspathDirective directive =
+ profile.getClasspathDirective();

return new DefaultClassLoaderContext(
- logger, system, m_classLoader, packages,
- m_extension, m_types, m_services, directive, implied );
+ logger, system, m_classLoader, m_types, m_services, directive,
implied );
}

private String[] getClassPath()
@@ -406,8 +293,7 @@
}

/**
- * Build the fully qulalified classpath including extension jar files
- * resolved relative to the classpath directives in the meta-data.
+ * Build the fully qulalified classpath.
*
* @return an array of URL representing the complete classpath
*/
@@ -425,11 +311,6 @@
list.add( url );
}
}
- File[] extensions = OptionalPackage.toFiles( getOptionalPackages() );
- for( int i=0; i<extensions.length; i++ )
- {
- list.add( extensions[i].toURL() );
- }
return (URL[]) list.toArray( new URL[0] );
}

@@ -476,7 +357,7 @@
}

private String[] createClassPath(
- File base, ClassLoaderDirective directive, URL[] implicit )
+ File base, ClasspathDirective directive, URL[] implicit )
throws Exception
{
ArrayList classpath = new ArrayList();
@@ -496,7 +377,7 @@

File[] files =
expandFileSetDirectives(
- base, directive.getClasspathDirective().getFilesets() );
+ base, directive.getFilesets() );
addToClassPath( classpath, files );

if( files.length > 0 )
@@ -508,7 +389,7 @@
}

Artifact[] artifacts =
- directive.getClasspathDirective().getArtifacts();
+ directive.getArtifacts();

for( int i=0; i<artifacts.length; i++ )
{
@@ -519,102 +400,6 @@
return (String[]) classpath.toArray( new String[0] );
}

- /**
- * Retrieve the files for the optional packages required by
- * the jars in ClassPath.
- *
- * @param classPath the Classpath array
- * @return the files that need to be added to ClassLoader
- * @exception Exception if a extension error occurs
- */
-// private OptionalPackage[] buildOptionalPackages( final String[]
classPath )
-// throws Exception
-// {
-// return buildOptionalPackages( classPath, new OptionalPackage[0] );
-// }
-
- /**
- * Retrieve the files for the optional packages required by
- * the jars in the ClassPath.
- *
- * @param classPath the Classpath array
- * @return the files that need to be added to ClassLoader
- * @exception Exception if a extension error occurs
- */
- private OptionalPackage[] buildOptionalPackages(
- final String[] classPath, final OptionalPackage[] established )
- throws Exception
- {
- final ArrayList unsatisfied = new ArrayList();
- final ArrayList dependencies = new ArrayList();
- for( int i=0; i<established.length; i++ )
- {
- dependencies.add( established[i] );
- }
-
- final Manifest[] manifests = getManifests( classPath );
- final Extension[] available = Extension.getAvailable( manifests );
- final Extension[] required = Extension.getRequired( manifests );
-
- m_manager.scanDependencies(
- required, available, dependencies, unsatisfied );
- if( 0 != unsatisfied.size() )
- {
- final int size = unsatisfied.size();
- final String message =
- REZ.getString(
- "classloader.unsatisfied-extensions.error",
- new Integer( size ) );
- StringBuffer buffer = new StringBuffer( message );
- for( int i = 0; i < size; i++ )
- {
- final Extension extension = (Extension) unsatisfied.get( i );
- final Object[] params = new Object[]
- {
- extension.getExtensionName(),
- extension.getSpecificationVendor(),
- extension.getSpecificationVersion(),
- extension.getImplementationVendor(),
- extension.getImplementationVendorID(),
- extension.getImplementationVersion(),
- extension.getImplementationURL()
- };
- final String entry = REZ.format(
- "classloader.missing.extension.error", params );
- buffer.append( "\n" + entry );
- }
- throw new ModelException( buffer.toString() );
- }
-
- final OptionalPackage[] packages =
- (OptionalPackage[]) dependencies.toArray( new
OptionalPackage[0] );
- return consolidate( packages, established );
- }
-
- private OptionalPackage[] consolidate(
- OptionalPackage[] includes, OptionalPackage[] excludes )
- {
- ArrayList list = new ArrayList();
- for( int i=0; i<includes.length; i++ )
- {
- boolean skip = false;
- OptionalPackage inc = includes[i];
- File file = inc.getFile();
- for( int j=0; j<excludes.length; j++ )
- {
- if( file.equals( excludes[j].getFile() ) );
- skip = true;
- break;
- }
- if( !skip )
- {
- list.add( inc );
- }
- }
- return (OptionalPackage[]) list.toArray(
- new OptionalPackage[0] );
- }
-
private void addToClassPath( List list, File[] files )
throws IOException
{
@@ -632,48 +417,6 @@
list.add( uri );
}

- private Manifest[] getManifests( final String[] classPath )
- throws ModelException
- {
- final ArrayList manifests = new ArrayList();
- for( int i = 0; i < classPath.length; i++ )
- {
- final String element = classPath[i];
-
- if( element.endsWith( ".jar" ) || element.startsWith( "jar:" ) )
- {
- try
- {
- URL url;
- if( element.startsWith( "jar:" ) )
- {
- url = new URL( element );
- }
- else
- {
- url = new URL( "jar:" + element + "!/" );
- }
-
- final JarURLConnection connection =
- (JarURLConnection) url.openConnection();
- final Manifest manifest = connection.getManifest();
- if( null != manifest )
- {
- manifests.add( manifest );
- }
- }
- catch( final IOException ioe )
- {
- final String message =
- REZ.getString(
"classloader.bad-classpath-entry.error", element );
- throw new ModelException( message, ioe );
- }
- }
- }
- return (Manifest[]) manifests.toArray( new Manifest[0] );
- }
-
-
/**
* Return an array of files corresponding to the expansion
* of the filesets declared within the directive.

Modified:
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelFactory.java
==============================================================================
---
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelFactory.java
(original)
+++
development/main/metro/composition/impl/src/main/net/dpml/composition/model/impl/DefaultModelFactory.java
Mon Mar 21 11:12:58 2005
@@ -30,7 +30,7 @@
import java.util.Map;
import java.util.Set;

-import net.dpml.composition.data.ClassLoaderDirective;
+import net.dpml.composition.data.ClasspathDirective;
import net.dpml.composition.data.ContainmentProfile;
import net.dpml.composition.data.SecurityProfile;

@@ -475,13 +475,13 @@

try
{
- ClassLoaderDirective classLoaderDirective =
- profile.getClassLoaderDirective();
+ ClasspathDirective classpathDirective =
+ profile.getClasspathDirective();

ClassLoaderContext classLoaderContext =
new DefaultClassLoaderContext(
logger, m_context.getSystemContext(), root,
- classLoaderDirective );
+ classpathDirective );

long now = System.currentTimeMillis();


Modified:
development/main/metro/composition/spi/src/main/net/dpml/composition/provider/ClassLoaderContext.java
==============================================================================
---
development/main/metro/composition/spi/src/main/net/dpml/composition/provider/ClassLoaderContext.java
(original)
+++
development/main/metro/composition/spi/src/main/net/dpml/composition/provider/ClassLoaderContext.java
Mon Mar 21 11:12:58 2005
@@ -22,13 +22,12 @@
import java.net.URL;

import net.dpml.system.SystemContext;
-import net.dpml.composition.data.ClassLoaderDirective;
+
+import net.dpml.composition.data.ClasspathDirective;
+
import net.dpml.composition.model.TypeRepository;
import net.dpml.composition.model.ServiceRepository;

-import net.dpml.extension.manager.OptionalPackage;
-import net.dpml.extension.manager.ExtensionManager;
-
import net.dpml.context.Context;
import net.dpml.logging.Logger;

@@ -74,28 +73,12 @@
ClassLoader getClassLoader();

/**
- * Return the optional packages already establised relative to
- * the parent classloader.
- *
- * @return the array of established optional packages
- */
- OptionalPackage[] getOptionalPackages();
-
- /**
- * Return the extension manager established by the parent
- * classloader model.
- *
- * @return the extension manager
- */
- ExtensionManager getExtensionManager();
-
- /**
- * Return the classloader directive to be applied to the
+ * Return the path directive to be applied to the
* classloader model.
*
* @return the classloader directive
*/
- ClassLoaderDirective getClassLoaderDirective();
+ ClasspathDirective getClasspathDirective();

/**
* Return the type repository established by the parent classloader.

Modified: development/main/metro/index.xml
==============================================================================
--- development/main/metro/index.xml (original)
+++ development/main/metro/index.xml Mon Mar 21 11:12:58 2005
@@ -290,38 +290,6 @@

<!-- FROM PROTECTED INDEX -->

- <!-- Extension -->
-
- <project basedir="extension/api">
- <info>
- <group>dpml/metro/protected</group>
- <name>dpml-extension-api</name>
- <version>1.0.0</version>
- <status>SNAPSHOT</status>
- <types>
- <type>jar</type>
- </types>
- </info>
- <dependencies>
- <include key="dpml-transit-main"/>
- </dependencies>
- </project>
-
- <project basedir="extension/impl">
- <info>
- <group>dpml/metro/private</group>
- <name>dpml-extension-impl</name>
- <version>1.0.0</version>
- <status>SNAPSHOT</status>
- <types>
- <type>jar</type>
- </types>
- </info>
- <dependencies>
- <include key="dpml-extension-api"/>
- </dependencies>
- </project>
-
<!-- Composition -->

<project basedir="composition/api">
@@ -344,7 +312,6 @@
<include key="dpml-parameters-api"/>
<include key="dpml-logging-api"/>
<include key="dpml-logging-data"/>
- <include key="dpml-extension-api"/>
<include key="dpml-configuration-impl" build="false" test="true"
runtime="false"/>
<include key="dpml-parameters-impl" build="false" test="true"
runtime="false"/>
</dependencies>
@@ -389,13 +356,10 @@
<include key="dpml-configuration-api" tag="api"/>
<include key="dpml-service-api" tag="api"/>
<include key="dpml-meta-api" tag="api"/>
- <include key="dpml-extension-api" tag="api"/>
<include key="dpml-composition-spi" tag="spi"/>
<include key="dpml-meta-spi" tag="spi"/>
<include key="dpml-configuration-impl"/>
<include key="dpml-meta-impl"/>
- <include key="dpml-extension-api" tag="spi"/>
- <include key="dpml-extension-impl"/>
<include key="dpml-util-exception"/>
<include key="dpml-context-impl"/>
<include key="dpml-util-criteria"/>
@@ -450,8 +414,6 @@
</dependencies>
</project>

- <!-- Extension -->
-
<!-- System -->

<project basedir="system/api">



  • svn commit: r2098 - in development/main: . metro metro/composition/api/src/main/net/dpml/composition/data metro/composition/api/src/main/net/dpml/composition/model metro/composition/impl/src/main/net/dpml/composition/data/builder metro/composition/impl/src/main/net/dpml/composition/data/writer metro/composition/impl/src/main/net/dpml/composition/model/impl metro/composition/spi/src/main/net/dpml/composition/provider metro/extension, mcconnell, 03/20/2005

Archive powered by MHonArc 2.6.24.

Top of Page