public void updated(Dictionary<String, ?> config) { PropertyResolver propertyResolver; if (config == null) { propertyResolver = new PropertyResolver() { @Override public String get(String propertyName) { return m_bundleContext.getProperty(propertyName); } }; } else { propertyResolver = new DictionaryPropertyResolver(config); } MavenConfiguration mavenConfig = new MavenConfigurationImpl(propertyResolver, PID); MavenResolver resolver = new AetherBasedResolver(mavenConfig); m_resolver = resolver; ServiceRegistration registration = m_bundleContext.registerService( MavenResolver.class.getName(), resolver, null ); registration = m_resolverReg.getAndSet(registration); if (registration != null) { registration.unregister(); } }
public static MavenResolver createMavenResolver(Mirror mirror, Dictionary<String, String> properties, String pid) { PropertiesPropertyResolver syspropsResolver = new PropertiesPropertyResolver(System.getProperties()); DictionaryPropertyResolver propertyResolver = new DictionaryPropertyResolver(properties, syspropsResolver); MavenConfigurationImpl config = new MavenConfigurationImpl(propertyResolver, pid); return new AetherBasedResolver(config, mirror); }
protected MavenConfiguration retrieveMavenConfiguration() { MavenConfiguration mavenConfiguration = null; try { Configuration configuration = configurationAdmin.get().getConfiguration("org.ops4j.pax.url.mvn"); if (configuration != null) { Dictionary dictonary = configuration.getProperties(); if (dictonary != null) { DictionaryPropertyResolver resolver = new DictionaryPropertyResolver(dictonary); mavenConfiguration = new MavenConfigurationImpl(resolver, "org.ops4j.pax.url.mvn"); } } } catch (IOException e) { LOG.error("Error retrieving maven configuration", e); } return mavenConfiguration; }
combined.putAll(properties); config = new MavenConfigurationImpl(new PropertiesPropertyResolver(combined), ServiceConstants.PID);