avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/engine EngineClassLoader.java
Date Thu, 06 Mar 2003 12:01:54 GMT
mcconnell    2003/03/06 04:01:54

  Modified:    assembly/src/java/org/apache/avalon/assembly/engine
                        EngineClassLoader.java
  Log:
  Updated the engine with the introduction of a classpath instance that seperates meta data
usage from meta info usage and enables seperation of the classpath base from the working directory.
  
  Revision  Changes    Path
  1.40      +25 -34    avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/engine/EngineClassLoader.java
  
  Index: EngineClassLoader.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/engine/EngineClassLoader.java,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- EngineClassLoader.java	28 Feb 2003 06:09:16 -0000	1.39
  +++ EngineClassLoader.java	6 Mar 2003 12:01:54 -0000	1.40
  @@ -81,7 +81,7 @@
   import org.apache.avalon.assembly.engine.model.ClasspathDescriptor;
   import org.apache.avalon.assembly.engine.model.FilesetDescriptor;
   import org.apache.avalon.assembly.engine.model.IncludeDescriptor;
  -import org.apache.avalon.assembly.engine.model.ClasspathDescriptor;
  +import org.apache.avalon.assembly.engine.model.Classpath;
   import org.apache.avalon.assembly.locator.Contextualizable;
   import org.apache.avalon.assembly.logging.LoggingDescriptor;
   import org.apache.avalon.assembly.logging.DefaultLoggingManager;
  @@ -145,11 +145,6 @@
      /**
       * Constructor supplied urls.
       */
  -    private URL m_base;
  -
  -   /**
  -    * Constructor supplied urls.
  -    */
       private URL[] m_urls = new URL[0];
   
      /**
  @@ -164,7 +159,7 @@
   
      /**
       * The system wide context where system refers to the context that
  -    * will be propergated by this engine to compoents under it 
  +    * will be propergated by this engine to components under it's 
       * supervision.
       */
       private Locator m_context;
  @@ -218,9 +213,9 @@
       private LibraryDescriptor m_descriptor;
   
       /**
  -     * Classpath descriptor.
  +     * Classpath directive.
        */
  -    private ClasspathDescriptor m_classpath;
  +    private Classpath m_classpath;
   
       /**
        * The set of facilities.
  @@ -340,11 +335,6 @@
               m_map = (Map) context.get( "urn:assembly:system-map" );
           }
   
  -        if( context.hasEntry( "urn:assembly:engine.base"  ) )
  -        {
  -            m_base = (URL) context.get( "urn:assembly:engine.base" );
  -        }
  -
           if( context.hasEntry( "urn:assembly:engine.extensions" ) )
           {
               String scope = "home";
  @@ -362,11 +352,11 @@
   
           if( context.hasEntry( "urn:assembly:engine.classpath" ) )
           {
  -            m_classpath = (ClasspathDescriptor)context.get( "urn:assembly:engine.classpath"
);
  +            m_classpath = (Classpath)context.get( "urn:assembly:engine.classpath" );
           }
           else
           {
  -            m_classpath = new ClasspathDescriptor();
  +            m_classpath = new Classpath( m_home, new ClasspathDescriptor() );
           }
   
           if( context.hasEntry( "urn:assembly:home" ) )
  @@ -710,53 +700,54 @@
      /**
       * Creation of a subsidiary engine.
       * @param name the name to assign to the manager
  -    * @param base the URL from which classpath declarations 
  -    *    shall be resolved
       * @param extensions the declaration of supplimentary extension directories
  -    * @param classpath a classpath descriptor
  +    * @param classpath a classpath directive
       * @return the new engine
       */
       public EngineClassLoader newInstance( 
  -      String name, URL base, LibraryDescriptor extensions, ClasspathDescriptor classpath
)
  +      String name, LibraryDescriptor extensions, Classpath classpath )
         throws EngineException
       {
  -        return newInstance( name, base, extensions, classpath, new URL[0] );
  +        return newInstance( name, extensions, classpath, new URL[0] );
       }
   
      /**
       * Creation of a subsidiary engine.
       * @param name the name to assign to the manager
  -    * @param base the URL from which classpath declarations 
  -    *    shall be resolved
       * @param extensions the declaration of supplimentary extension directories
  -    * @param classpath a classpath descriptor
  +    * @param classpath a classpath directive
       * @param urls a set of URLs to be added to the engine
       * @return the new engine
       */
       public EngineClassLoader newInstance( 
  -      String name, URL base, LibraryDescriptor extensions, ClasspathDescriptor classpath,
URL[] urls )
  +      String name, LibraryDescriptor extensions, Classpath classpath, URL[] urls )
         throws EngineException
       {
           try
           {
               EngineClassLoader engine = new EngineClassLoader( urls, this );
  -            DefaultApplianceRepository manager = 
  -              new DefaultApplianceRepository( this, m_manager, name );
   
               engine.enableLogging( getLogger() );
               DefaultLocator context = new DefaultLocator();
               context.put( "urn:assembly:home", m_home );
               context.put( "urn:assembly:system", m_root );
  -            context.put( "urn:assembly:engine.base", base );
               context.put( "urn:assembly:engine.bootstrap", "false" );
  +            context.put( "urn:assembly:logging.manager", m_logging );
  +            context.put( "urn:assembly:threads.manager", m_pool );
  +
               if( extensions != null )
               {
                   context.put( "urn:assembly:engine.extensions", extensions );
               }
  -            context.put( "urn:assembly:engine.classpath", classpath );
  -            context.put( "urn:assembly:logging.manager", m_logging );
  -            context.put( "urn:assembly:threads.manager", m_pool );
  +            if( classpath != null )
  +            {
  +                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();
  @@ -793,7 +784,7 @@
        * @param base the base directory from which relative classpath entries
        * will be resolved.
        */
  -    public void addClasspath( ClasspathDescriptor classpath ) throws MalformedURLException
  +    private void addClasspath( Classpath classpath ) throws MalformedURLException
       {
           if( classpath == null )
           {
  @@ -816,7 +807,7 @@
   
           try
           {
  -            URL[] urls = ClasspathDescriptor.expand( m_home, classpath );
  +            URL[] urls = classpath.expand();
               for( int j = 0; j < urls.length; j++ )
               {
                   URL inc = urls[ j ];
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message