avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject cvs commit: jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/source SourceResolver.java SourceResolverImpl.java
Date Tue, 05 Feb 2002 13:06:36 GMT
cziegeler    02/02/05 05:06:36

  Modified:    src/scratchpad/org/apache/avalon/excalibur/source
                        SourceResolver.java SourceResolverImpl.java
  Log:
  Removed obsolete methods taking a URL as a base - for custom protocols you don't have a
URL!
  
  Revision  Changes    Path
  1.9       +1 -16     jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/source/SourceResolver.java
  
  Index: SourceResolver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/source/SourceResolver.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SourceResolver.java	25 Jan 2002 21:12:56 -0000	1.8
  +++ SourceResolver.java	5 Feb 2002 13:06:35 -0000	1.9
  @@ -11,7 +11,6 @@
   import org.apache.avalon.framework.component.ComponentException;
   import java.io.IOException;
   import java.net.MalformedURLException;
  -import java.net.URL;
   
   /**
    * Base interface for resolving a source by system identifiers.
  @@ -30,7 +29,7 @@
    * like Composable, Initializable, Disposable etc.
    *
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  - * @version CVS $Revision: 1.8 $ $Date: 2002/01/25 21:12:56 $
  + * @version CVS $Revision: 1.9 $ $Date: 2002/02/05 13:06:35 $
    */
   
   public interface SourceResolver
  @@ -47,21 +46,7 @@
       /**
        * Get a <code>Source</code> object.
        */
  -    Source resolve(URL base, String location)
  -    throws MalformedURLException, IOException, ComponentException;
  -
  -    /**
  -     * Get a <code>Source</code> object.
  -     */
       Source resolve(String location,
  -                   SourceParameters parameters)
  -    throws MalformedURLException, IOException, ComponentException;
  -
  -    /**
  -     * Get a <code>Source</code> object.
  -     */
  -    Source resolve(URL base,
  -                   String location,
                      SourceParameters parameters)
       throws MalformedURLException, IOException, ComponentException;
   
  
  
  
  1.14      +9 -31     jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/source/SourceResolverImpl.java
  
  Index: SourceResolverImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/source/SourceResolverImpl.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- SourceResolverImpl.java	25 Jan 2002 21:12:56 -0000	1.13
  +++ SourceResolverImpl.java	5 Feb 2002 13:06:35 -0000	1.14
  @@ -51,7 +51,7 @@
    *
    * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version $Id: SourceResolverImpl.java,v 1.13 2002/01/25 21:12:56 bloritsch Exp $
  + * @version $Id: SourceResolverImpl.java,v 1.14 2002/02/05 13:06:35 cziegeler Exp $
    */
   public class SourceResolverImpl
   extends AbstractLogEnabled
  @@ -139,7 +139,7 @@
       public Source resolve(String location)
       throws MalformedURLException, IOException, ComponentException
       {
  -        return this.resolve(m_baseURL, location, null);
  +        return this.resolve(location, null);
       }
   
       /**
  @@ -149,58 +149,36 @@
                             SourceParameters parameters)
       throws MalformedURLException, IOException, ComponentException
       {
  -        return this.resolve( m_baseURL, location, parameters );
  -    }
  -
  -    /**
  -     * Get a <code>Source</code> object.
  -     */
  -    public Source resolve(URL base, String location)
  -    throws MalformedURLException, IOException, ComponentException
  -    {
  -        return this.resolve(base, location, null);
  -    }
  -
  -
  -    /**
  -     * Get a <code>Source</code> object.
  -     */
  -    public Source resolve(URL base,
  -                          String location,
  -                          SourceParameters parameters)
  -    throws MalformedURLException, IOException, ComponentException
  -    {
           if ( this.getLogger().isDebugEnabled() ) {
  -            this.getLogger().debug("Resolving '"+location+"' in context '" + base + "'");
  +            this.getLogger().debug("Resolving '"+location+"' in context '" + m_baseURL
+ "'");
           }
           if (location == null) throw new MalformedURLException("Invalid System ID");
   
           // first step: create systemID
           String systemID;
  -        if (base == null) base = m_baseURL;
   
           if (location.length() == 0) {
  -            systemID = base.toExternalForm();
  +            systemID = m_baseURL.toExternalForm();
           } else if (location.indexOf(":") > 1)
           {
               systemID = location;
           }
           else if (location.charAt(0) == '/')
           {
  -            systemID = new StringBuffer(base.getProtocol())
  +            systemID = new StringBuffer(m_baseURL.getProtocol())
                              .append(":").append(location).toString();
           // windows: absolute paths can start with drive letter
           }
           else if (location.length() > 1 && location.charAt(1) == ':')
           {
  -            systemID = new StringBuffer(base.getProtocol())
  +            systemID = new StringBuffer(m_baseURL.getProtocol())
                              .append(":/").append(location).toString();
           }
           else
           {
  -            if (base.getProtocol().equals("file") == true)
  +            if (m_baseURL.getProtocol().equals("file") == true)
               {
  -                File temp = new File(base.toExternalForm().substring("file:".length()),
location);
  +                File temp = new File(m_baseURL.toExternalForm().substring("file:".length()),
location);
                   String path = temp.getAbsolutePath();
                   // windows paths starts with drive letter
                   if (path.charAt(0) != File.separator.charAt(0))
  @@ -214,7 +192,7 @@
               }
               else
               {
  -                systemID = new URL(base, location).toExternalForm();
  +                systemID = new URL(m_baseURL, location).toExternalForm();
               }
           }
           if ( this.getLogger().isDebugEnabled() )
  
  
  

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


Mime
View raw message