avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl AbstractURLConnection.java ArtifactHandler.java ArtifactURLConnection.java BlockHandler.java
Date Fri, 16 Jan 2004 03:17:43 GMT
mcconnell    2004/01/15 19:17:43

  Modified:    merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl
                        AbstractURLConnection.java ArtifactHandler.java
                        ArtifactURLConnection.java BlockHandler.java
  Log:
  Cleaningup the external form the block and artifact urls.
  
  Revision  Changes    Path
  1.2       +30 -13    avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl/AbstractURLConnection.java
  
  Index: AbstractURLConnection.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl/AbstractURLConnection.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractURLConnection.java	16 Jan 2004 01:29:54 -0000	1.1
  +++ AbstractURLConnection.java	16 Jan 2004 03:17:43 -0000	1.2
  @@ -61,18 +61,17 @@
   import org.apache.avalon.activation.appliance.CascadingIOException;
   
   /**
  - * Repository URL protocol handler.  
  + * Abstract artifact URL protocol handler.  
  + * @since 3.3
    */
   public abstract class AbstractURLConnection extends URLConnection
   {
       /**
        * Creation of a new handler. 
        * @param url the url to establish a connection with
  -     * @param type the default type if no type specified
  -     * @exception NullPointerException if the supplied repository argument is null
        */
        AbstractURLConnection( URL url ) 
  -       throws NullPointerException, IOException
  +       throws IOException
        {
            super( url );
    
  @@ -86,6 +85,20 @@
            }
        }
   
  +    /**
  +     * Return the Artifact specified by this URL.
  +     * @param classes a set of classes (ignored)
  +     * @return the artifact instance
  +     * @see org.apache.avalon.repository.Artifact
  +     */
  +     public Object getContent( Class[] classes ) throws IOException
  +     {
  +         return getContent();
  +     }
  +
  +    /**
  +     * Null implementation of the conect protocol.
  +     */
        public void connect()
        {
            // nothing to do
  @@ -93,8 +106,9 @@
   
       /**
        * Return the Artifact specified by this URL.
  -     * @param type the artifact type
  +     * @param type the artifact type (e.g. "jar", "block", "xml", etc.)
        * @return the artifact instance
  +     * @see org.apache.avalon.repository.Artifact
        */
        protected Object getContent( String type ) throws IOException
        {
  @@ -116,22 +130,25 @@
        }
   
       /**
  -     * Return the Artifact specified by this URL.
  -     * @param classes a set of classes (ignored)
  -     * @return the artifact instance
  +     * Utility method to return the version field with the url query.
  +     * @param url the url containing the query
  +     * @return the version value if declared else null
        */
  -     public Object getContent( Class[] classes ) throws IOException
  -     {
  -         return getContent();
  -     }
  -
        protected String getVersion( URL url )
        {
            return getQueryField( url, "version", null );
        } 
   
  +     /**
  +     * Utility method to return the value of a field within the url query.
  +     * @param url the url containing the query
  +     * @param field the query field name
  +     * @param fallback the default value if not query parameter available
  +     * @return the value of the query field
  +     */
        protected String getQueryField( URL url, String field, String fallback )
        {
  +System.out.println( "url: " + url + ", field: " + field + ", fallback: " + fallback );
            String query = url.getQuery();
            if( null != query ) 
            {
  
  
  
  1.3       +1 -5      avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl/ArtifactHandler.java
  
  Index: ArtifactHandler.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl/ArtifactHandler.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ArtifactHandler.java	16 Jan 2004 01:29:54 -0000	1.2
  +++ ArtifactHandler.java	16 Jan 2004 03:17:43 -0000	1.3
  @@ -87,11 +87,6 @@
           {
               result.append(url.getFile());
           }
  -	  if (url.getQuery() != null ) 
  -        {
  -	      result.append("?");
  -            result.append(url.getQuery());
  -	  }
   	  if (url.getRef() != null ) 
           {
   	      result.append("#");
  @@ -99,4 +94,5 @@
   	  }
   	  return result.toString();
       }
  +
   }
  
  
  
  1.3       +1 -1      avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl/ArtifactURLConnection.java
  
  Index: ArtifactURLConnection.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl/ArtifactURLConnection.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ArtifactURLConnection.java	16 Jan 2004 01:29:54 -0000	1.2
  +++ ArtifactURLConnection.java	16 Jan 2004 03:17:43 -0000	1.3
  @@ -83,7 +83,7 @@
        */
        public Object getContent() throws IOException
        {
  -         return super.getContent( "jar" );
  +         return getContent( "jar" );
        }
   
       /**
  
  
  
  1.2       +0 -5      avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl/BlockHandler.java
  
  Index: BlockHandler.java
  ===================================================================
  RCS file: /home/cvs/avalon/merlin/kernel/impl/src/java/org/apache/avalon/merlin/impl/BlockHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BlockHandler.java	16 Jan 2004 01:29:54 -0000	1.1
  +++ BlockHandler.java	16 Jan 2004 03:17:43 -0000	1.2
  @@ -86,11 +86,6 @@
           {
               result.append(url.getFile());
           }
  -	  if (url.getQuery() != null ) 
  -        {
  -	      result.append("?");
  -            result.append(url.getQuery());
  -	  }
   	  if (url.getRef() != null ) 
           {
   	      result.append("#");
  
  
  

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


Mime
View raw message