org.ops4j.pax.url.maven.commons
Class MavenConfigurationImpl

java.lang.Object
  extended by org.ops4j.util.property.PropertyStore
      extended by org.ops4j.pax.url.maven.commons.MavenConfigurationImpl
All Implemented Interfaces:
MavenConfiguration

public class MavenConfigurationImpl
extends org.ops4j.util.property.PropertyStore
implements MavenConfiguration

Service Configuration implementation.

Since:
August 11, 2007
Author:
Alin Dreghiciu
See Also:
MavenConfiguration

Constructor Summary
MavenConfigurationImpl(org.ops4j.util.property.PropertyResolver propertyResolver, String pid)
          Creates a new service configuration.
 
Method Summary
 void enableProxy(URL url)
          Deprecated. This method has side-effects and is only used in the "old" resolver.
 Boolean getCertificateCheck()
          Returns true if the certificate should be checked on SSL connection, false otherwise.
 List<MavenRepositoryURL> getDefaultRepositories()
          Repository is a comma separated list of repositories to be used.
 MavenRepositoryURL getLocalRepository()
          Resolves local repository directory by using the following resolution:
1.
 Map<String,Map<String,String>> getMirrors()
          Returns the mirror settings from settings.xml.
 Map<String,Map<String,String>> getProxySettings(String... protocols)
          Returns the active proxy settings from settings.xml The fields are user, pass, host, port, nonProxyHosts, protocol.
 List<MavenRepositoryURL> getRepositories()
          Repository is a comma separated list of repositories to be used.
 URL getSettingsFileUrl()
          Returns the URL of settings file.
 void setSettings(MavenSettings settings)
          Sets maven settings abstraction.
 Boolean useFallbackRepositories()
          Returns true if the fallback repositories should be used instead of default ones.
 
Methods inherited from class org.ops4j.util.property.PropertyStore
contains, get, set
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MavenConfigurationImpl

public MavenConfigurationImpl(org.ops4j.util.property.PropertyResolver propertyResolver,
                              String pid)
Creates a new service configuration.

Parameters:
propertyResolver - propertyResolver used to resolve properties; mandatory
pid - configuration PID; mandatory
Method Detail

setSettings

public void setSettings(MavenSettings settings)
Sets maven settings abstraction.

Parameters:
settings - maven settings abstraction

getCertificateCheck

public Boolean getCertificateCheck()
Description copied from interface: MavenConfiguration
Returns true if the certificate should be checked on SSL connection, false otherwise.

Specified by:
getCertificateCheck in interface MavenConfiguration
Returns:
true if the certificate should be checked
See Also:
MavenConfiguration.getCertificateCheck()

getSettingsFileUrl

public URL getSettingsFileUrl()
Returns the URL of settings file. Will try first to use the url as is. If a malformed url encountered then will try to use the url as a file path. If still not valid will throw the original Malformed URL exception.

Specified by:
getSettingsFileUrl in interface MavenConfiguration
Returns:
the url to settings file
See Also:
MavenConfiguration.getSettingsFileUrl()

getDefaultRepositories

public List<MavenRepositoryURL> getDefaultRepositories()
                                                throws MalformedURLException
Repository is a comma separated list of repositories to be used. If repository acces requests authentication the user name and password must be specified in the repository url as for example http://user:password@repository.ops4j.org/maven2.
If the repository from 1/2 bellow starts with a plus (+) the option 3 is also used and the repositories from settings.xml will be cummulated.
Repository resolution:
1. looks for a configuration property named repository;
2. looks for a framework property/system setting repository;
3. looks in settings.xml (see settings.xml resolution). in this case all configured repositories will be used including configured user/password. In this case the central repository is also added. Note that the local repository is added as the first repository if exists.

Specified by:
getDefaultRepositories in interface MavenConfiguration
Returns:
a list of default repositories. List can be null or empty if there are not default repositories to be searched.
Throws:
MalformedURLException
See Also:
MavenConfiguration.getRepositories(), MavenConfiguration.getLocalRepository()

getRepositories

public List<MavenRepositoryURL> getRepositories()
                                         throws MalformedURLException
Repository is a comma separated list of repositories to be used. If repository acces requests authentication the user name and password must be specified in the repository url as for example http://user:password@repository.ops4j.org/maven2.
If the repository from 1/2 bellow starts with a plus (+) the option 3 is also used and the repositories from settings.xml will be cummulated.
Repository resolution:
1. looks for a configuration property named repository;
2. looks for a framework property/system setting repository;
3. looks in settings.xml (see settings.xml resolution). in this case all configured repositories will be used including configured user/password. In this case the central repository is also added. Note that the local repository is added as the first repository if exists.

Specified by:
getRepositories in interface MavenConfiguration
Returns:
a list of repositories. List can be null or empty if there are no repositories to be searched.
Throws:
MalformedURLException
See Also:
MavenConfiguration.getRepositories(), MavenConfiguration.getLocalRepository()

getLocalRepository

public MavenRepositoryURL getLocalRepository()
Resolves local repository directory by using the following resolution:
1. looks for a configuration property named localRepository; 2. looks for a framework property/system setting localRepository;
3. looks in settings.xml (see settings.xml resolution);
4. falls back to ${user.home}/.m2/repository.

Specified by:
getLocalRepository in interface MavenConfiguration
Returns:
url of local repository. Can be null if there is no local repository.
See Also:
MavenConfiguration.getLocalRepository()

useFallbackRepositories

public Boolean useFallbackRepositories()
Returns true if the fallback repositories should be used instead of default ones. Default value is false.

Specified by:
useFallbackRepositories in interface MavenConfiguration
Returns:
true if the fallback repositories should

enableProxy

public void enableProxy(URL url)
Deprecated. This method has side-effects and is only used in the "old" resolver.

Enables the proxy server for a given URL.

Specified by:
enableProxy in interface MavenConfiguration
Parameters:
url - Enables the proxy server for a given URL.

getProxySettings

public Map<String,Map<String,String>> getProxySettings(String... protocols)
Description copied from interface: MavenConfiguration
Returns the active proxy settings from settings.xml The fields are user, pass, host, port, nonProxyHosts, protocol.

Specified by:
getProxySettings in interface MavenConfiguration
Parameters:
protocols - protocols to be recognized.
Returns:
the active proxy settings

getMirrors

public Map<String,Map<String,String>> getMirrors()
Description copied from interface: MavenConfiguration
Returns the mirror settings from settings.xml. The fields are id, url, mirrorOf, layout, mirrorOfLayouts.

Specified by:
getMirrors in interface MavenConfiguration
Returns:
the mirror settings


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