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 DefaultRepositoryManager.java
Date Thu, 27 Feb 2003 23:07:37 GMT
mcconnell    2003/02/27 15:07:37

  Modified:    assembly/src/java/org/apache/avalon/assembly/engine
                        DefaultRepositoryManager.java
  Log:
  Initial work on directory based scanning.
  
  Revision  Changes    Path
  1.13      +46 -10    avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/engine/DefaultRepositoryManager.java
  
  Index: DefaultRepositoryManager.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/assembly/src/java/org/apache/avalon/assembly/engine/DefaultRepositoryManager.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- DefaultRepositoryManager.java	23 Feb 2003 14:08:43 -0000	1.12
  +++ DefaultRepositoryManager.java	27 Feb 2003 23:07:37 -0000	1.13
  @@ -150,13 +150,18 @@
        */
       private List m_scanned = new ArrayList();
   
  +    /**
  +     * The home directory from which classpath includes will be resolved.
  +     */
  +    private File m_home;
  +
       //===================================================================
       // constructor
       //===================================================================
   
  -    DefaultRepositoryManager( ClassLoader classloader )
  +    DefaultRepositoryManager( ClassLoader classloader, File home )
       {
  -        this( classloader, null );
  +        this( classloader, null, home );
       }
   
      /**
  @@ -167,15 +172,21 @@
       *        profile managers created by this repository
       * @param parent the parent repository
       */
  -    DefaultRepositoryManager( ClassLoader classloader, RepositoryManager parent )
  +    DefaultRepositoryManager( ClassLoader classloader, RepositoryManager parent, File home
)
       {
           if( classloader == null )
           {
               throw new NullPointerException( "classloader" );
           }
   
  +        if( home == null )
  +        {
  +            throw new NullPointerException( "home" );
  +        }
  +
           m_classloader = classloader;
           m_parent = parent;
  +        m_home = home;
       }
   
       //===================================================================
  @@ -273,21 +284,46 @@
               //
   
               URL resource = getJarURL( url );
  -            final JarURLConnection jar = (JarURLConnection)resource.openConnection();
  -            final JarFile base = jar.getJarFile();
  -            m_scanned.add( url );
  -            load( base );
  +            if( resource.toString().endsWith( "!/" ) )
  +            {
  +
  +                final JarURLConnection jar = (JarURLConnection)resource.openConnection();
  +                final JarFile base = jar.getJarFile();
  +                m_scanned.add( url );
  +                load( base );
  +            }
  +            else if( url.toString().indexOf( "!/" ) > 0 )
  +            {
  +                //
  +                // this is a jar file reference container in a jar URL therefor
  +                // we need to fall back toi the filesystem home and check for the 
  +                // existance of the file in question
  +                //
  +   
  +                String path = url.toString();
  +                String filename = path.substring( path.indexOf( "!/" ) + 2 );
  +                getLogger().debug( "### " + filename );
  +                final String error =
  +                  "Not ready yet with URL: " + url;
  +                throw new EngineRuntimeException( error );
  +            }
  +            else
  +            {
  +                final String error =
  +                  "Cannot resolve the supplied URL: " + url;
  +                throw new EngineRuntimeException( error );
  +            }
           }
           catch( IOException e )
           {
               final String error =
  -                "IO exception while attempt to read manifest. from the url: "
  +                "IO exception while attempt to read url: "
                   + url;
               throw new EngineRuntimeException( error, e );
           }
           catch( Throwable e )
           {
  -            final String error = "Unexpected exception while inspecting manifest on file:
";
  +            final String error = "Unexpected exception while resolving URL: ";
               throw new EngineRuntimeException( error + url, e );
           }
       }
  
  
  

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


Mime
View raw message