org.ops4j.pax.url.mvn.internal
Class Connection

java.lang.Object
  extended by java.net.URLConnection
      extended by org.ops4j.pax.url.mvn.internal.Connection

public class Connection
extends java.net.URLConnection

An URLConnextion that supports mvn: protocol.
Syntax:
mvn:[repository_url!]groupId/artifactId[/version[/type]]
where:
- repository_url = an url that points to a maven 2 repository; optional, if not sepecified the repositories are resolved based on the repository/localRepository.
- groupId = group id of maven artifact; mandatory
- artifactId = artifact id of maven artifact; mandatory
- version = version of maven artifact; optional, if not specified uses LATEST and will try to resolve the version from available maven metadata. If version is a SNAPSHOT version, SNAPSHOT will be resolved from available maven metadata
- type = type of maven artifact; optional, if not specified uses JAR
Examples:
mvn:http://repository.ops4j.org/mvn-releases!org.ops4j.pax.runner/runner/0.4.0 - an artifact from an http repository
mvn:http://user:password@repository.ops4j.org/mvn-releases!org.ops4j.pax.runner/runner/0.4.0 - an artifact from an http repository with authentication
mvn:file://c:/localRepo!org.ops4j.pax.runner/runner/0.4.0 - an artifact from a directory
mvn:jar:file://c:/repo.zip!/repository!org.ops4j.pax.runner/runner/0.4.0 - an artifact from a zip file
mvn:org.ops4j.pax.runner/runner/0.4.0 - an artifact that will be resolved based on the configured repositories

The service can be configured in two ways: via configuration admin if available and via framework/system properties where the configuration via config admin has priority.
Service configuration:
- org.ops4j.pax.url.mvn.settings = the path to settings.xml;
- org.ops4j.pax.url.mvn.localRepository = the path to local repository directory;
- org.ops4j.pax.url.mvn.repository = a comma separated list for repositories urls;
- org.ops4j.pax.url.mvn.certicateCheck = true/false if the SSL certificate check should be done. Default false.

Since:
August 10, 2007
Author:
Alin Dreghiciu

Field Summary
 
Fields inherited from class java.net.URLConnection
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches
 
Constructor Summary
Connection(java.net.URL url, MavenConfiguration configuration)
          Creates a new connection.
 
Method Summary
 void connect()
          Does nothing.
 java.io.InputStream getInputStream()
          Returns the input stream denoted by the url.
If the url does not contain a repository the resource is searched in every repository if available, in the order provided by the repository setting.
 
Methods inherited from class java.net.URLConnection
addRequestProperty, getAllowUserInteraction, getConnectTimeout, getContent, getContent, getContentEncoding, getContentLength, getContentType, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getHeaderFields, getIfModifiedSince, getLastModified, getOutputStream, getPermission, getReadTimeout, getRequestProperties, getRequestProperty, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setConnectTimeout, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setReadTimeout, setRequestProperty, setUseCaches, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Connection

public Connection(java.net.URL url,
                  MavenConfiguration configuration)
           throws java.net.MalformedURLException
Creates a new connection.

Parameters:
url - the url; cannot be null.
configuration - service configuration; cannot be null
Throws:
java.net.MalformedURLException - in case of a malformed url
Method Detail

connect

public void connect()
Does nothing.

Specified by:
connect in class java.net.URLConnection
See Also:
URLConnection.connect()

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Returns the input stream denoted by the url.
If the url does not contain a repository the resource is searched in every repository if available, in the order provided by the repository setting.

Overrides:
getInputStream in class java.net.URLConnection
Returns:
the input stream for the resource denoted by url
Throws:
java.io.IOException - in case of an exception during accessing the resource
See Also:
URLConnection.getInputStream()


Copyright © 2006-2011 OPS4J - Open Participation Software for Java. All Rights Reserved.