avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject cvs commit: avalon-sandbox/repository/impl/src/java/org/apache/avalon/repository/impl DefaultFileRepository.java
Date Tue, 11 Nov 2003 06:55:01 GMT
akarasulu    2003/11/10 22:55:01

  Modified:    repository/impl/src/java/org/apache/avalon/repository/impl
                        DefaultFileRepository.java
  Log:
  Untested but complete.
  
  Revision  Changes    Path
  1.5       +43 -5     avalon-sandbox/repository/impl/src/java/org/apache/avalon/repository/impl/DefaultFileRepository.java
  
  Index: DefaultFileRepository.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/repository/impl/src/java/org/apache/avalon/repository/impl/DefaultFileRepository.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DefaultFileRepository.java	11 Nov 2003 06:08:19 -0000	1.4
  +++ DefaultFileRepository.java	11 Nov 2003 06:55:01 -0000	1.5
  @@ -54,12 +54,14 @@
   import java.io.File ;
   import java.net.URL ;
   import java.net.Authenticator ;
  +import java.net.URLClassLoader;
  +import java.util.ArrayList;
   
   import javax.naming.directory.Attributes ;
   
  -import org.apache.avalon.repository.JarDescriptor;
   import org.apache.avalon.repository.Repository ;
   import org.apache.avalon.repository.ProxyContext ;
  +import org.apache.avalon.repository.JarDescriptor ;
   import org.apache.avalon.repository.ArtifactDatabase ;
   import org.apache.avalon.repository.ArtifactDescriptor ;
   import org.apache.avalon.repository.RepositoryException ;
  @@ -303,11 +305,47 @@
       public ClassLoader getClassLoader( JarDescriptor a_descriptor )
           throws RepositoryException
       {
  -        ClassLoader l_loader = null ;
  +        ArrayList l_apiJars = new ArrayList() ;
  +        ArrayList l_spiJars = new ArrayList() ;
  +        ArrayList l_implJars = new ArrayList() ;
  +        ArrayList l_others = new ArrayList() ;
  +        ArtifactDescriptor [] l_descriptors = getDependencies( a_descriptor ) ;
           
  -        throw new RepositoryException( "Not implemented yet!" ) ; 
  +        for ( int ii = 0; ii < l_descriptors.length; ii++ )
  +        {
  +            if ( "jars" != l_descriptors[ii].getType() )
  +            {
  +                continue ;
  +            }
  +            
  +            if ( l_descriptors[ii].getName().endsWith("api") )
  +            {
  +                l_apiJars.add( getArtifact( l_descriptors[ii] ) ) ;
  +            }
  +            else if ( l_descriptors[ii].getName().endsWith("spi") )
  +            {
  +                l_spiJars.add( getArtifact( l_descriptors[ii] ) ) ;
  +            }
  +            else if ( l_descriptors[ii].getName().endsWith("impl") )
  +            {
  +                l_implJars.add( getArtifact( l_descriptors[ii] ) ) ;
  +            }
  +            else
  +            {
  +                l_others.add( getArtifact( l_descriptors[ii] ) ) ;
  +            }
  +        }
           
  -        // return l_loader ;
  +        ClassLoader l_topCL = ClassLoader.getSystemClassLoader() ;
  +        ClassLoader l_othersCL = new URLClassLoader( (URL []) 
  +                l_others.toArray( new URL[0] ), l_topCL ) ;
  +        ClassLoader l_apiCL = new URLClassLoader( (URL[]) 
  +                l_apiJars.toArray( new URL[0] ), l_othersCL ) ;
  +        ClassLoader l_spiCL = new URLClassLoader( (URL[]) 
  +                l_spiJars.toArray( new URL[0] ), l_apiCL ) ;
  +        ClassLoader l_implCL = new URLClassLoader( (URL[]) 
  +                l_implJars.toArray( new URL[0] ), l_spiCL ) ;
  +        return l_implCL ;
       }
       
   
  
  
  

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


Mime
View raw message