/** * Enables the proxy server for a given URL. * * @deprecated This method has side-effects and is only used in the "old" resolver. */ public void enableProxy(URL url) { final String protocol = url.getProtocol(); Map<String, String> proxyDetails = getProxySettings(url.getProtocol()).get(protocol); if (proxyDetails != null) { LOGGER.trace("Enabling proxy [" + proxyDetails + "]"); final String user = proxyDetails.get("user"); final String pass = proxyDetails.get("pass"); Authenticator.setDefault(new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(user, pass.toCharArray()); } }); System.setProperty(protocol + ".proxyHost", proxyDetails.get("host")); System.setProperty(protocol + ".proxyPort", proxyDetails.get("port")); System.setProperty(protocol + ".nonProxyHosts", proxyDetails.get("nonProxyHosts")); set(m_pid + ServiceConstants.PROPERTY_PROXY_SUPPORT, protocol); } }
public String getSecuritySettings() { String key = m_pid + ServiceConstants.PROPERTY_SECURITY; if (!contains(key)) { String spec = m_propertyResolver.get(key); if (spec == null) { spec = new File(System.getProperty("user.home"), ".m2/settings-security.xml") .getPath(); } return set(key, spec); } return get(key); } }
/** * @see MavenConfiguration#isOffline() */ public boolean isOffline() { if (!contains(m_pid + ServiceConstants.PROPERTY_OFFLINE)) { return set( m_pid + ServiceConstants.PROPERTY_OFFLINE, Boolean.valueOf(m_propertyResolver.get(m_pid + ServiceConstants.PROPERTY_OFFLINE))); } return get(m_pid + ServiceConstants.PROPERTY_OFFLINE); }
/** * @see MavenConfiguration#getCertificateCheck() */ public boolean getCertificateCheck() { if (!contains(m_pid + ServiceConstants.PROPERTY_CERTIFICATE_CHECK)) { return set( m_pid + ServiceConstants.PROPERTY_CERTIFICATE_CHECK, Boolean.valueOf(m_propertyResolver.get(m_pid + ServiceConstants.PROPERTY_CERTIFICATE_CHECK))); } return get(m_pid + ServiceConstants.PROPERTY_CERTIFICATE_CHECK); }
/** * {@inheritDoc} */ public Boolean useFallbackRepositories() { if (!contains(m_pid + ServiceConstants.PROPERTY_USE_FALLBACK_REPOSITORIES)) { String useFallbackRepoProp = m_propertyResolver.get(m_pid + ServiceConstants.PROPERTY_USE_FALLBACK_REPOSITORIES); return set(m_pid + ServiceConstants.PROPERTY_USE_FALLBACK_REPOSITORIES, Boolean.valueOf(useFallbackRepoProp == null ? "true" : useFallbackRepoProp)); } return get(m_pid + ServiceConstants.PROPERTY_USE_FALLBACK_REPOSITORIES); }
public List<MavenRepositoryURL> getDefaultRepositories() throws MalformedURLException { if (!contains(m_pid + ServiceConstants.PROPERTY_DEFAULT_REPOSITORIES)) { // look for repositories property String defaultRepositoriesProp = m_propertyResolver.get(m_pid + ServiceConstants.PROPERTY_DEFAULT_REPOSITORIES); // build repositories list final List<MavenRepositoryURL> defaultRepositoriesProperty = new ArrayList<MavenRepositoryURL>(); if (defaultRepositoriesProp != null && defaultRepositoriesProp.trim().length() > 0) { String[] repositories = defaultRepositoriesProp.split(REPOSITORIES_SEPARATOR); for (String repositoryURL : repositories) { defaultRepositoriesProperty.add(new MavenRepositoryURL(repositoryURL.trim())); } } LOGGER.trace("Using repositories [" + defaultRepositoriesProperty + "]"); return set(m_pid + ServiceConstants.PROPERTY_DEFAULT_REPOSITORIES, defaultRepositoriesProperty); } return get(m_pid + ServiceConstants.PROPERTY_DEFAULT_REPOSITORIES); }
public Integer getTimeout() { if (!contains(m_pid + ServiceConstants.PROPERTY_TIMEOUT)) { String timeout = m_propertyResolver.get(m_pid + ServiceConstants.PROPERTY_TIMEOUT); return set(m_pid + ServiceConstants.PROPERTY_TIMEOUT, Integer.valueOf(timeout == null ? DEFAULT_TIMEOUT : timeout)); } return get(m_pid + ServiceConstants.PROPERTY_TIMEOUT); }
return set(m_pid + ServiceConstants.PROPERTY_SETTINGS_FILE, new URL(spec)); if (file.exists()) { try { return set(m_pid + ServiceConstants.PROPERTY_SETTINGS_FILE, file.toURI() .toURL()); + spec + "] cannot be used and will be skipped (malformed url or file does not exist)"); set(m_pid + ServiceConstants.PROPERTY_SETTINGS_FILE, null);
return set(m_pid + ServiceConstants.PROPERTY_LOCAL_REPOSITORY, new MavenRepositoryURL(spec)); return set(m_pid + ServiceConstants.PROPERTY_LOCAL_REPOSITORY, new MavenRepositoryURL(new File(spec).toURI().toASCIIString())); LOGGER.warn("Local repository [" + spec + "] cannot be used and will be skipped"); return set(m_pid + ServiceConstants.PROPERTY_LOCAL_REPOSITORY, null);
public String getGlobalUpdatePolicy() { final String propertyName = m_pid + ServiceConstants.PROPERTY_GLOBAL_UPDATE_POLICY; if (contains(propertyName)) { return get(propertyName); } final String propertyValue = m_propertyResolver.get(propertyName); if (propertyValue != null) { set(propertyName, propertyValue); return propertyValue; } return null; }
public String getGlobalChecksumPolicy() { final String propertyName = m_pid + ServiceConstants.PROPERTY_GLOBAL_CHECKSUM_POLICY; if (contains(propertyName)) { return get(propertyName); } final String propertyValue = m_propertyResolver.get(propertyName); if (propertyValue != null) { set(propertyName, propertyValue); return propertyValue; } return null; }
return set(m_pid + ServiceConstants.PROPERTY_REPOSITORIES, repositoriesProperty);