org.apache.avalon.repository
Class AbstractURLConnection

java.lang.Object
  extended byjava.net.URLConnection
      extended byorg.apache.avalon.repository.AbstractURLConnection
Direct Known Subclasses:
ArtifactURLConnection, BlockURLConnection

public abstract class AbstractURLConnection
extends URLConnection

Abstract artifact URL protocol handler.

Since:
3.3

Field Summary
 
Fields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches
 
Method Summary
 void connect()
          Null implementation of the conect protocol.
 Object getContent(Class[] classes)
          Return the Artifact specified by this URL.
protected  Object getContent(String type)
          Return the Artifact specified by this URL.
protected  String getQueryField(URL url, String field, String fallback)
          Utility method to return the value of a field within the url query.
protected  String getVersion(URL url)
          Utility method to return the version field with the url query.
 
Methods inherited from class java.net.URLConnection
addRequestProperty, getAllowUserInteraction, getContent, getContentEncoding, getContentLength, getContentType, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getHeaderFields, getIfModifiedSince, getInputStream, getLastModified, getOutputStream, getPermission, getRequestProperties, getRequestProperty, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setRequestProperty, setUseCaches, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getContent

public Object getContent(Class[] classes)
                  throws IOException
Return the Artifact specified by this URL.

Parameters:
classes - a set of classes (ignored)
Returns:
the artifact instance
Throws:
IOException
See Also:
Artifact

connect

public void connect()
Null implementation of the conect protocol.


getContent

protected Object getContent(String type)
                     throws IOException
Return the Artifact specified by this URL.

Parameters:
type - the artifact type (e.g. "jar", "block", "xml", etc.)
Returns:
the artifact instance
Throws:
IOException
See Also:
Artifact

getVersion

protected String getVersion(URL url)
Utility method to return the version field with the url query.

Parameters:
url - the url containing the query
Returns:
the version value if declared else null

getQueryField

protected String getQueryField(URL url,
                               String field,
                               String fallback)
Utility method to return the value of a field within the url query.

Parameters:
url - the url containing the query
field - the query field name
fallback - the default value if not query parameter available
Returns:
the value of the query field


Copyright © The Apache Software Foundation. All Rights Reserved.