http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/converter/ProviderConverter.java ---------------------------------------------------------------------- diff --git a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/converter/ProviderConverter.java b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/converter/ProviderConverter.java index 97aeebd..043d9b9 100644 --- a/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/converter/ProviderConverter.java +++ b/modules/microprofile/src/main/java/org/apache/tamaya/microprofile/converter/ProviderConverter.java @@ -53,7 +53,7 @@ public class ProviderConverter implements PropertyConverter<Provider> { ConvertQuery converter = new ConvertQuery(value, TypeLiteral.of(targetType)); return context.getConfiguration().adapt(converter); }catch(Exception e){ - throw new ConfigException("Error evaluating configuration value.", e); + throw new ConfigException("Error evaluating configuration createValue.", e); } }; }
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/BuildableConfigSource.java ---------------------------------------------------------------------- diff --git a/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/BuildableConfigSource.java b/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/BuildableConfigSource.java index abca900..66abe23 100644 --- a/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/BuildableConfigSource.java +++ b/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/BuildableConfigSource.java @@ -138,7 +138,7 @@ public class BuildableConfigSource implements ConfigSource{ * With simple property builder. * * @param key the key - * @param value the value + * @param value the createValue * @return the builder */ public Builder withProperty(String key, String value) { http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/MicroprofileAdapterTest.java ---------------------------------------------------------------------- diff --git a/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/MicroprofileAdapterTest.java b/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/MicroprofileAdapterTest.java index 5f30991..7a94d6e 100644 --- a/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/MicroprofileAdapterTest.java +++ b/modules/microprofile/src/test/java/org/apache/tamaya/microprofile/MicroprofileAdapterTest.java @@ -161,7 +161,7 @@ public class MicroprofileAdapterTest { @Test public void toStringMap() throws Exception { Map<String,PropertyValue> props = new HashMap<>(); - props.put("a", PropertyValue.create("a","b").setMeta("source", "toStringMap")); + props.put("a", PropertyValue.createValue("a","b").setMeta("source", "toStringMap")); Map<String, String> mpProps = MicroprofileAdapter.toStringMap(props); assertNotNull(mpProps); assertEquals(props.keySet(), mpProps.keySet()); http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ChangePropagationPolicy.java ---------------------------------------------------------------------- diff --git a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ChangePropagationPolicy.java b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ChangePropagationPolicy.java index 0cfd8b8..e183898 100644 --- a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ChangePropagationPolicy.java +++ b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ChangePropagationPolicy.java @@ -31,10 +31,10 @@ import java.util.Collection; * is writable/removable.</li> * <li><b>SIGNIFICANT_ONLY: </b>A change (creation, update) is only applied, if * <ol> - * <li>the value is not provided by a more significant read-only property source.</li> + * <li>the createValue is not provided by a more significant read-only property source.</li> * <li>there is no more significant writable property source, which supports writing a g iven key.</li> * </ol> - * In other words a added or updated value is written exactly once to the most significant + * In other words a added or updated createValue is written exactly once to the most significant * writable property source, which accepts a given key. Otherwise the change is discarded.</li> * <li><b>NONE: </b>Do not apply any changes.</li> * </ul> @@ -43,7 +43,7 @@ import java.util.Collection; public interface ChangePropagationPolicy { /** - * Method being called when a multiple key/value pairs are added or updated. + * Method being called when a multiple key/createValue pairs are added or updated. * @param propertySources the property sources, including readable property sources of the current configuration, * never null. * @param configChange the configuration change, not null. http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ConfigChangeRequest.java ---------------------------------------------------------------------- diff --git a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ConfigChangeRequest.java b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ConfigChangeRequest.java index 5f83e2b..475799f 100644 --- a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ConfigChangeRequest.java +++ b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/ConfigChangeRequest.java @@ -57,7 +57,7 @@ public final class ConfigChangeRequest { } /** - * Sets the started at value. By default {@link #startedAt} is already setCurrent on instance creation to + * Sets the started at createValue. By default {@link #startedAt} is already setCurrent on instance creation to * {@code System.currentTimeMillis()}. * @param startedAt the new UTC POSIX timestamp in millis. */ @@ -82,8 +82,8 @@ public final class ConfigChangeRequest { } /** - * Get an unmodifiable key/value map of properties added or updated. - * @return an unmodifiable key/value map of properties added or updated, never null. + * Get an unmodifiable key/createValue map of properties added or updated. + * @return an unmodifiable key/createValue map of properties added or updated, never null. */ public Map<String,String> getAddedProperties(){ return Collections.unmodifiableMap(addedProperties); @@ -98,9 +98,9 @@ public final class ConfigChangeRequest { } /** - * Adds/updates a new key/value pair. + * Adds/updates a new key/createValue pair. * @param key the key, not null. - * @param value the value, not null. + * @param value the createValue, not null. */ public void put(String key, String value) { this.addedProperties.put(key, value); http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/MutableConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/MutableConfiguration.java b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/MutableConfiguration.java index 7aa5f3a..8d10de6 100644 --- a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/MutableConfiguration.java +++ b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/MutableConfiguration.java @@ -19,6 +19,9 @@ package org.apache.tamaya.mutableconfig; import org.apache.tamaya.Configuration; +import org.apache.tamaya.mutableconfig.spi.MutableConfigurationProviderSpi; +import org.apache.tamaya.mutableconfig.spi.MutablePropertySource; +import org.apache.tamaya.spi.ServiceContextManager; import java.util.Collection; import java.util.Map; @@ -36,7 +39,7 @@ import java.util.Map; * * This class should only used in a single threaded context, though all methods inherited from {@link Configuration} * must be thread-safe. Methods handling configuration changes are expected to be used in a single threaded environment - * only. For multi-threaded us create a new instance of {@link MutableConfiguration} for each thread. + * only. For multi-threaded us createObject a new instance of {@link MutableConfiguration} for each thread. */ public interface MutableConfiguration extends Configuration { @@ -70,9 +73,9 @@ public interface MutableConfiguration extends Configuration { * Sets a property. * * @param key the property's key, not null. - * @param value the property's value, not null. - * @return the former property value, or null. - * @throws org.apache.tamaya.ConfigException if the key/value cannot be added, or the request is read-only. + * @param value the property's createValue, not null. + * @return the former property createValue, or null. + * @throws org.apache.tamaya.ConfigException if the key/createValue cannot be added, or the request is read-only. */ MutableConfiguration put(String key, String value); @@ -122,4 +125,84 @@ public interface MutableConfiguration extends Configuration { */ MutableConfiguration remove(String... keys); + /** + * Creates a new {@link MutableConfiguration} for the given default configuration + * (based on the current classloader), using all + * {@link MutablePropertySource} instances found in its context and {@code autoCommit = false}. + * + * @return a new MutableConfiguration instance + * @see ServiceContextManager#getDefaultClassLoader() + */ + static MutableConfiguration create(){ + return create(ServiceContextManager.getDefaultClassLoader()); + } + + /** + * Creates a new {@link MutableConfiguration} for the given default configuration for + * the given target classloader, using all + * {@link MutablePropertySource} instances found in its context and {@code autoCommit = false}. + * + * @param classLoader the target classloader, not null. + * @return a new MutableConfiguration instance + */ + static MutableConfiguration create(ClassLoader classLoader){ + return MutableConfigurationProvider.getInstance(classLoader).createMutableConfiguration(); + } + + /** + * Creates a new {@link MutableConfiguration} for the given default configuration for the current + * default classloader, using all + * {@link MutablePropertySource} instances found in its context and {@code autoCommit = false}. + * @param changePropgationPolicy policy that defines how a change is written back and which property + * sources are finally eligible for a write operation. + * @return a new MutableConfiguration instance, with the given change policy active. + * @see ServiceContextManager#getDefaultClassLoader() + */ + static MutableConfiguration create(ChangePropagationPolicy changePropgationPolicy){ + return create(changePropgationPolicy, + ServiceContextManager.getDefaultClassLoader()); + } + + /** + * Creates a new {@link MutableConfiguration} for the configuration based on the given classloader, using all + * {@link MutablePropertySource} instances found in its context and {@code autoCommit = false}. + * @param changePropgationPolicy policy that defines how a change is written back and which property + * sources are finally eligible for a write operation. + * @param classLoader the target classloader, not null. + * @return a new MutableConfiguration instance, with the given change policy active. + */ + static MutableConfiguration create(ChangePropagationPolicy changePropgationPolicy, ClassLoader classLoader){ + return MutableConfigurationProvider.getInstance(classLoader).createMutableConfiguration(changePropgationPolicy); + } + + + /** + * Creates a new {@link MutableConfiguration} for the given configuration, using all + * {@link MutablePropertySource} instances found in its context and {@code MOST_SIGNIFICANT_ONLY_POLICY} + * configuration writing policy. + * + * @param configuration the configuration to use to write the changes/config. + * @return a new MutableConfiguration instance + */ + static MutableConfiguration create(Configuration configuration){ + return MutableConfigurationProvider.getInstance( + configuration.getContext().getServiceContext().getClassLoader()) + .createMutableConfiguration(configuration); + } + + /** + * Creates a new {@link MutableConfiguration} for the given configuration, using all + * {@link MutablePropertySource} instances found in its context and {@code ALL_POLICY} + * configuration writing policy. + * + * @param configuration the configuration to use to write the changes/config. + * @param changePropagationPolicy the configuration writing policy. + * @return a new MutableConfiguration instance + */ + static MutableConfiguration create(Configuration configuration, ChangePropagationPolicy changePropagationPolicy){ + return MutableConfigurationProvider.getInstance( + configuration.getContext().getServiceContext().getClassLoader()) + .createMutableConfiguration(configuration, changePropagationPolicy); + } + } http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/MutableConfigurationProvider.java ---------------------------------------------------------------------- diff --git a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/MutableConfigurationProvider.java b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/MutableConfigurationProvider.java index 950da06..e0b9bf4 100644 --- a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/MutableConfigurationProvider.java +++ b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/MutableConfigurationProvider.java @@ -20,30 +20,30 @@ package org.apache.tamaya.mutableconfig; import org.apache.tamaya.ConfigException; import org.apache.tamaya.Configuration; -import org.apache.tamaya.ConfigurationProvider; import org.apache.tamaya.mutableconfig.spi.MutableConfigurationProviderSpi; import org.apache.tamaya.mutableconfig.spi.MutablePropertySource; import org.apache.tamaya.spi.PropertySource; import org.apache.tamaya.spi.ServiceContextManager; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; +import java.util.*; import java.util.logging.Logger; /** * Accessor for creating {@link MutableConfiguration} instances to change configuration and commit changes. + * @deprecated Use static methods on {@link MutableConfiguration}. */ +@Deprecated public final class MutableConfigurationProvider { private static final Logger LOG = Logger.getLogger(MutableConfigurationProvider.class.getName()); + private ClassLoader classLoader; + /** * URIs used by this query instance to identify the backends to use for write operations. */ - private static MutableConfigurationProviderSpi spi(){ - MutableConfigurationProviderSpi spi = ServiceContextManager.getServiceContext().getService( + private static MutableConfigurationProviderSpi spi(ClassLoader classLoader){ + MutableConfigurationProviderSpi spi = ServiceContextManager.getServiceContext(classLoader).getService( MutableConfigurationProviderSpi.class) ; if(spi==null){ throw new ConfigException("Failed to initialize MutableConfigurationProviderSpi - " + @@ -52,9 +52,29 @@ public final class MutableConfigurationProvider { return spi; } + /** + * Get the current mutable config provider for the default classloader. + * @return the corresponding provider, not null. + * @see ServiceContextManager#getDefaultClassLoader() + */ + public static MutableConfigurationProvider getInstance(){ + return getInstance(ServiceContextManager.getDefaultClassLoader()); + } + + /** + * Get the current mutable config provider for the given classloader. + * @param classLoader the target classloader, not null. + * @return the corresponding provider, not null. + */ + public static MutableConfigurationProvider getInstance(ClassLoader classLoader){ + return ServiceContextManager.getServiceContext().getService(MutableConfigurationProvider.class, + () -> new MutableConfigurationProvider(classLoader)); + } /** Singleton constructor. */ - private MutableConfigurationProvider(){} + private MutableConfigurationProvider(ClassLoader classLoader){ + this.classLoader = Objects.requireNonNull(classLoader); + } /** * Creates a new {@link MutableConfiguration} for the given default configuration, using all @@ -62,9 +82,9 @@ public final class MutableConfigurationProvider { * * @return a new MutableConfiguration instance */ - public static MutableConfiguration createMutableConfiguration(){ - return spi().createMutableConfiguration( - Configuration.current(), getApplyMostSignificantOnlyChangePolicy()); + public MutableConfiguration createMutableConfiguration(){ + return spi(classLoader).createMutableConfiguration( + Configuration.current(classLoader), getApplyMostSignificantOnlyChangePolicy()); } /** @@ -74,9 +94,9 @@ public final class MutableConfigurationProvider { * sources are finally eligible for a write operation. * @return a new MutableConfiguration instance, with the given change policy active. */ - public static MutableConfiguration createMutableConfiguration(ChangePropagationPolicy changePropgationPolicy){ - return spi().createMutableConfiguration( - Configuration.current(), changePropgationPolicy); + public MutableConfiguration createMutableConfiguration(ChangePropagationPolicy changePropgationPolicy){ + return spi(classLoader).createMutableConfiguration( + Configuration.current(classLoader), changePropgationPolicy); } @@ -88,7 +108,7 @@ public final class MutableConfigurationProvider { * @param configuration the configuration to use to write the changes/config. * @return a new MutableConfiguration instance */ - public static MutableConfiguration createMutableConfiguration(Configuration configuration){ + public MutableConfiguration createMutableConfiguration(Configuration configuration){ return createMutableConfiguration(configuration, MOST_SIGNIFICANT_ONLY_POLICY); } @@ -101,8 +121,9 @@ public final class MutableConfigurationProvider { * @param changePropagationPolicy the configuration writing policy. * @return a new MutableConfiguration instance */ - public static MutableConfiguration createMutableConfiguration(Configuration configuration, ChangePropagationPolicy changePropagationPolicy){ - return spi().createMutableConfiguration(configuration, changePropagationPolicy); + public MutableConfiguration createMutableConfiguration(Configuration configuration, ChangePropagationPolicy changePropagationPolicy){ + return spi(configuration.getContext().getServiceContext().getClassLoader()) + .createMutableConfiguration(configuration, changePropagationPolicy); } /** @@ -198,6 +219,14 @@ public final class MutableConfigurationProvider { }; /** + * Get the provider's classloader. + * @return the classloader, not null. + */ + public ClassLoader getClassLoader() { + return classLoader; + } + + /** * This propagation policy writes through all changes to all mutable property sources, where applicable. */ private static final class SelectiveChangeApplyPolicy implements ChangePropagationPolicy { http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/propertysources/MutablePropertiesPropertySource.java ---------------------------------------------------------------------- diff --git a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/propertysources/MutablePropertiesPropertySource.java b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/propertysources/MutablePropertiesPropertySource.java index 659dab2..3a0e06b 100644 --- a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/propertysources/MutablePropertiesPropertySource.java +++ b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/propertysources/MutablePropertiesPropertySource.java @@ -125,10 +125,10 @@ implements MutablePropertySource{ if(!file.exists()){ try { if(!file.createNewFile()){ - throw new ConfigException("Failed to create config file " + file); + throw new ConfigException("Failed to createObject config file " + file); } } catch (IOException e) { - throw new ConfigException("Failed to create config file " + file, e); + throw new ConfigException("Failed to createObject config file " + file, e); } } for(Map.Entry<String,String> en:change.getAddedProperties().entrySet()){ http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/propertysources/MutableXmlPropertiesPropertySource.java ---------------------------------------------------------------------- diff --git a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/propertysources/MutableXmlPropertiesPropertySource.java b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/propertysources/MutableXmlPropertiesPropertySource.java index bcba53a..053f88d 100644 --- a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/propertysources/MutableXmlPropertiesPropertySource.java +++ b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/propertysources/MutableXmlPropertiesPropertySource.java @@ -131,10 +131,10 @@ implements MutablePropertySource{ if(!file.exists()){ try { if(!file.createNewFile()){ - throw new ConfigException("Failed to create config file " + file); + throw new ConfigException("Failed to createObject config file " + file); } } catch (IOException e) { - throw new ConfigException("Failed to create config file " + file, e); + throw new ConfigException("Failed to createObject config file " + file, e); } } for(Map.Entry<String,String> en:configChange.getAddedProperties().entrySet()){ http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/MutableConfigurationProviderSpi.java ---------------------------------------------------------------------- diff --git a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/MutableConfigurationProviderSpi.java b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/MutableConfigurationProviderSpi.java index 4412085..fb205d0 100644 --- a/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/MutableConfigurationProviderSpi.java +++ b/modules/mutable-config/src/main/java/org/apache/tamaya/mutableconfig/spi/MutableConfigurationProviderSpi.java @@ -25,7 +25,7 @@ import org.apache.tamaya.mutableconfig.MutableConfiguration; /** * Provider SPI used by {@link org.apache.tamaya.mutableconfig.MutableConfigurationProvider}. Providers may override - * other providers registering with a higher {@link javax.annotation.Priority} value annotated. + * other providers registering with a higher {@link javax.annotation.Priority} createValue annotated. */ public interface MutableConfigurationProviderSpi { http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/MutableConfigurationProviderTest.java ---------------------------------------------------------------------- diff --git a/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/MutableConfigurationProviderTest.java b/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/MutableConfigurationProviderTest.java index f6c6bf3..61be1fc 100644 --- a/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/MutableConfigurationProviderTest.java +++ b/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/MutableConfigurationProviderTest.java @@ -31,12 +31,12 @@ import static org.junit.Assert.*; public class MutableConfigurationProviderTest { @Test public void createMutableConfiguration() throws Exception { - assertNotNull(MutableConfigurationProvider.createMutableConfiguration()); + assertNotNull(MutableConfigurationProvider.getInstance().createMutableConfiguration()); } @Test public void createMutableConfiguration1() throws Exception { - MutableConfiguration cfg = MutableConfigurationProvider + MutableConfiguration cfg = MutableConfigurationProvider.getInstance() .createMutableConfiguration(Configuration.current()); assertNotNull(cfg); assertEquals(cfg.getChangePropagationPolicy(), @@ -46,7 +46,7 @@ public class MutableConfigurationProviderTest { @Test public void createMutableConfiguration2() throws Exception { ChangePropagationPolicy policy = MutableConfigurationProvider.getApplySelectiveChangePolicy("blabla"); - MutableConfiguration cfg = MutableConfigurationProvider + MutableConfiguration cfg = MutableConfigurationProvider.getInstance() .createMutableConfiguration(Configuration.current(), policy); assertNotNull(cfg); @@ -56,7 +56,7 @@ public class MutableConfigurationProviderTest { @Test public void createMutableConfiguration3() throws Exception { ChangePropagationPolicy policy = MutableConfigurationProvider.getApplySelectiveChangePolicy("gugus"); - MutableConfiguration cfg = MutableConfigurationProvider + MutableConfiguration cfg = MutableConfigurationProvider.getInstance() .createMutableConfiguration(policy); assertNotNull(cfg); assertEquals(cfg.getChangePropagationPolicy(), policy); http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/MutableConfigurationTest.java ---------------------------------------------------------------------- diff --git a/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/MutableConfigurationTest.java b/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/MutableConfigurationTest.java index 664b1c7..eb1d354 100644 --- a/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/MutableConfigurationTest.java +++ b/modules/mutable-config/src/test/java/org/apache/tamaya/mutableconfig/MutableConfigurationTest.java @@ -37,20 +37,52 @@ import static org.junit.Assert.*; */ public class MutableConfigurationTest { + @Test + public void createMutableConfiguration() throws Exception { + assertNotNull(MutableConfiguration.create()); + } + + @Test + public void createMutableConfiguration1() throws Exception { + MutableConfiguration cfg = MutableConfiguration.create(Configuration.current()); + assertNotNull(cfg); + assertEquals(cfg.getChangePropagationPolicy(), + MutableConfigurationProvider.getApplyMostSignificantOnlyChangePolicy()); + } + + @Test + public void createMutableConfiguration2() throws Exception { + ChangePropagationPolicy policy = MutableConfigurationProvider.getApplySelectiveChangePolicy("blabla"); + MutableConfiguration cfg = MutableConfiguration + .create(Configuration.current(), + policy); + assertNotNull(cfg); + assertEquals(cfg.getChangePropagationPolicy(), policy); + } + + @Test + public void createMutableConfiguration3() throws Exception { + ChangePropagationPolicy policy = MutableConfigurationProvider.getApplySelectiveChangePolicy("gugus"); + MutableConfiguration cfg = MutableConfiguration + .create(policy); + assertNotNull(cfg); + assertEquals(cfg.getChangePropagationPolicy(), policy); + } + /** - * Test create change request. + * Test createObject change request. * * @throws Exception the exception */ @Test public void testCreateMutableConfiguration() throws Exception { File f = File.createTempFile("ConfigChangeRequest",".properties"); - MutableConfiguration cfg1 = MutableConfigurationProvider.createMutableConfiguration( + MutableConfiguration cfg1 = MutableConfiguration.create( Configuration.current(), MutableConfigurationProvider.getApplyAllChangePolicy()); assertNotNull(cfg1); assertNotNull(cfg1.getConfigChangeRequest()); - MutableConfiguration cfg2 = MutableConfigurationProvider.createMutableConfiguration( + MutableConfiguration cfg2 = MutableConfiguration.create( Configuration.current()); assertNotNull(cfg2); assertNotNull(cfg2.getConfigChangeRequest()); @@ -59,24 +91,24 @@ public class MutableConfigurationTest { } /** - * Test null create change request. + * Test null createObject change request. * * @throws Exception the exception */ @Test(expected=NullPointerException.class) public void testNullCreateMutableConfiguration1() throws Exception { - MutableConfigurationProvider.createMutableConfiguration( + MutableConfiguration.create( (Configuration) null); } /** - * Test null create change request. + * Test null createObject change request. * * @throws Exception the exception */ @Test(expected=NullPointerException.class) public void testNullCreateMutableConfiguration2() throws Exception { - MutableConfigurationProvider.createMutableConfiguration( + MutableConfiguration.create( (ChangePropagationPolicy) null); } @@ -88,7 +120,7 @@ public class MutableConfigurationTest { @Test public void testReadWriteProperties_WithCancel() throws IOException { WritablePropertiesSource.target.delete(); - MutableConfiguration mutConfig = MutableConfigurationProvider.createMutableConfiguration( + MutableConfiguration mutConfig = MutableConfiguration.create( Configuration.current() ); mutConfig.put("key1", "value1"); @@ -105,7 +137,7 @@ public class MutableConfigurationTest { @Test public void testReadWriteProperties_WithCommit() throws IOException { WritablePropertiesSource.target.delete(); - MutableConfiguration mutConfig = MutableConfigurationProvider.createMutableConfiguration( + MutableConfiguration mutConfig = MutableConfiguration.create( Configuration.current() ); mutConfig.put("key1", "value1"); @@ -115,7 +147,7 @@ public class MutableConfigurationTest { mutConfig.putAll(cm); mutConfig.store(); assertTrue(WritablePropertiesSource.target.exists()); - MutableConfiguration mmutConfig2 = MutableConfigurationProvider.createMutableConfiguration( + MutableConfiguration mmutConfig2 = MutableConfiguration.create( Configuration.current() ); mmutConfig2.remove("foo"); @@ -139,7 +171,7 @@ public class MutableConfigurationTest { @Test public void testReadWriteXmlProperties_WithCommit() throws IOException { WritableXmlPropertiesSource.target.delete(); - MutableConfiguration cfg = MutableConfigurationProvider.createMutableConfiguration( + MutableConfiguration cfg = MutableConfiguration.create( Configuration.current(), MutableConfigurationProvider.getApplyAllChangePolicy()); cfg.put("key1", "value1"); Map<String,String> cm = new HashMap<>(); @@ -148,7 +180,7 @@ public class MutableConfigurationTest { cfg.putAll(cm); cfg.store(); assertTrue(WritableXmlPropertiesSource.target.exists()); - MutableConfiguration cfg2 = MutableConfigurationProvider.createMutableConfiguration( + MutableConfiguration cfg2 = MutableConfiguration.create( Configuration.current()); assertTrue(cfg != cfg2); cfg2.remove("foo"); @@ -171,7 +203,7 @@ public class MutableConfigurationTest { @Test public void testWriteWithNoChangePolicy() throws IOException { WritableXmlPropertiesSource.target.delete(); - MutableConfiguration cfg = MutableConfigurationProvider.createMutableConfiguration( + MutableConfiguration cfg = MutableConfiguration.create( Configuration.current(), MutableConfigurationProvider.getApplyNonePolicy()); cfg.put("key1", "value1"); http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/optional/pom.xml ---------------------------------------------------------------------- diff --git a/modules/optional/pom.xml b/modules/optional/pom.xml index 341f547..e5fa76b 100644 --- a/modules/optional/pom.xml +++ b/modules/optional/pom.xml @@ -28,7 +28,7 @@ under the License. </parent> <artifactId>tamaya-optional</artifactId> - <name>Apache Tamaya Optional Configuration Backend</name> + <name>Apache Tamaya Modules - Optional Backend</name> <description>This module provides a simple class that can be used as a single dependency for evaluating configuration. It runs basically without Tamaya being on the classpath, but if available it considers/uses Tamaya functionality.</description> http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/optional/src/main/java/org/apache/tamaya/optional/EvaluationPolicy.java ---------------------------------------------------------------------- diff --git a/modules/optional/src/main/java/org/apache/tamaya/optional/EvaluationPolicy.java b/modules/optional/src/main/java/org/apache/tamaya/optional/EvaluationPolicy.java index 86df274..3cc8fee 100644 --- a/modules/optional/src/main/java/org/apache/tamaya/optional/EvaluationPolicy.java +++ b/modules/optional/src/main/java/org/apache/tamaya/optional/EvaluationPolicy.java @@ -24,9 +24,9 @@ package org.apache.tamaya.optional; public enum EvaluationPolicy { /** Values from Tamaya (if available) always override values from the default provider. */ TAMAYA_OVERRIDES_OTHER, - /** Values from value provider always override values from Tamaya (if available). */ + /** Values from createValue provider always override values from Tamaya (if available). */ OTHER_OVERRIDES_TAMAYA, - /** No overrides are allowed. If both the value provider and Tamaya return values not equal a RuntimeException + /** No overrides are allowed. If both the createValue provider and Tamaya return values not equal a RuntimeException * is thrown. */ THROWS_EXCEPTION http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/optional/src/main/java/org/apache/tamaya/optional/OptionalConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/optional/src/main/java/org/apache/tamaya/optional/OptionalConfiguration.java b/modules/optional/src/main/java/org/apache/tamaya/optional/OptionalConfiguration.java index 9f19463..77b5a5f 100644 --- a/modules/optional/src/main/java/org/apache/tamaya/optional/OptionalConfiguration.java +++ b/modules/optional/src/main/java/org/apache/tamaya/optional/OptionalConfiguration.java @@ -62,7 +62,7 @@ public final class OptionalConfiguration { } /** - * Default value provider returning Strings from system properties and the system environment. + * Default createValue provider returning Strings from system properties and the system environment. * In all other cases {@code null} is returned. */ public static final ValueProvider DEFAULT_PROVIDER = new ValueProvider() { @@ -81,7 +81,7 @@ public final class OptionalConfiguration { }; /** - * Default value provider that always returns {@code null}. + * Default createValue provider that always returns {@code null}. */ public static final ValueProvider NULLPROVIDER = new ValueProvider() { @Override @@ -91,7 +91,7 @@ public final class OptionalConfiguration { }; /** - * Delegating value getter used to evaluate values, depending on the fallback policy. + * Delegating createValue getter used to evaluate values, depending on the fallback policy. */ private final ValueProvider provider; @@ -103,7 +103,7 @@ public final class OptionalConfiguration { /** * Creates a new instance. * - * @param policy the policy how a value should be evaluated depending if Tamaya is available or not. + * @param policy the policy how a createValue should be evaluated depending if Tamaya is available or not. * @param provider the non Tamaya-based provider to be used to evaluate values. */ private OptionalConfiguration(EvaluationPolicy policy, ValueProvider provider) { @@ -114,7 +114,7 @@ public final class OptionalConfiguration { /** * Returns an instance of OptionalConfiguration, which uses the given provider and policy for evaluating the values. * - * @param policy the policy how a value should be evaluated depending if Tamaya is available or not. + * @param policy the policy how a createValue should be evaluated depending if Tamaya is available or not. * @param provider the non Tamaya-based provider to be used to evaluate values. * @return a default OptionalConfiguration instance, never null. */ @@ -126,7 +126,7 @@ public final class OptionalConfiguration { * Returns a default instance, which uses a default provider returning values from system properties and environment * only. * - * @param policy the policy how a value should be evaluated depending if Tamaya is available or not. + * @param policy the policy how a createValue should be evaluated depending if Tamaya is available or not. * @return a default OptionalConfiguration instance, never null. */ public static OptionalConfiguration of(EvaluationPolicy policy) { @@ -134,21 +134,21 @@ public final class OptionalConfiguration { } /** - * Access a String value. + * Access a String createValue. * * @param key the key, not null. - * @return the value found, or null. + * @return the createValue found, or null. */ public String get(String key) { return get(key, String.class); } /** - * Access a String value. + * Access a String createValue. * * @param key the key, not null. - * @param defaultValue the default value, returned if no such key is found in the configuration. - * @return the value found, or null. + * @param defaultValue the default createValue, returned if no such key is found in the configuration. + * @return the createValue found, or null. */ public String getOrDefault(String key, String defaultValue) { final String value = get(key, String.class); @@ -159,13 +159,13 @@ public final class OptionalConfiguration { } /** - * Method that returns the corresponding value, depending on the availability of Tamaya, the + * Method that returns the corresponding createValue, depending on the availability of Tamaya, the * registered provider and evaluation policy. * * @param key the key, not null. * @param type the target type, not null. * @param <T> the type param. - * @return the value, or null. + * @return the createValue, or null. */ public <T> T get(String key, Class<T> type) { final T value = provider.get(key, type); @@ -190,13 +190,13 @@ public final class OptionalConfiguration { } /** - * Access a String value. + * Access a String createValue. * * @param key the key, not null. * @param type the target type, not null. * @param <T> the type param. - * @param defaultValue the default value, returned if no such key is found in the configuration. - * @return the value found, or null. + * @param defaultValue the default createValue, returned if no such key is found in the configuration. + * @return the createValue found, or null. */ public <T> T getOrDefault(String key, Class<T> type, T defaultValue) { final T value = get(key, type); @@ -207,12 +207,12 @@ public final class OptionalConfiguration { } /** - * Internal method that evaluates a value from Tamaya, when Tamaya is loaded. + * Internal method that evaluates a createValue from Tamaya, when Tamaya is loaded. * * @param key the key, not null. * @param type the target type, not null. * @param <T> The type param - * @return the corresponding value from Tamaya, or null. + * @return the corresponding createValue from Tamaya, or null. * @throws IllegalStateException if Tamaya is not loaded. * @see #isTamayaLoaded() */ http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/optional/src/main/java/org/apache/tamaya/optional/ValueProvider.java ---------------------------------------------------------------------- diff --git a/modules/optional/src/main/java/org/apache/tamaya/optional/ValueProvider.java b/modules/optional/src/main/java/org/apache/tamaya/optional/ValueProvider.java index 1423341..f0dc3fe 100644 --- a/modules/optional/src/main/java/org/apache/tamaya/optional/ValueProvider.java +++ b/modules/optional/src/main/java/org/apache/tamaya/optional/ValueProvider.java @@ -23,18 +23,18 @@ package org.apache.tamaya.optional; * It is the {@link EvaluationPolicy} that also must be passed, when creating an {@link OptionalConfiguration}, * which is defining if values from this provider are overriding values from Tamaya (if available) or vice * versa. This provider interface must be implemented by the client that wants to optionally enhance its - * code with optional Tamaya configuration support to create a bridge between his code and the values optionally + * code with optional Tamaya configuration support to createObject a bridge between his code and the values optionally * returned by Tamaya. */ @FunctionalInterface public interface ValueProvider { /** - * Access a typed value given a (non empty) key. + * Access a typed createValue given a (non empty) key. * @param key the key, not null. * @param type the type, not null. * @param <T> the type - * @return the value found, or null. + * @return the createValue found, or null. */ <T> T get(String key, Class<T> type); http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/ConfigHistory.java ---------------------------------------------------------------------- diff --git a/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/ConfigHistory.java b/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/ConfigHistory.java index 94747c7..6a672af 100644 --- a/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/ConfigHistory.java +++ b/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/ConfigHistory.java @@ -48,9 +48,9 @@ public final class ConfigHistory implements Serializable{ private long timestamp = System.currentTimeMillis(); /** The entry type. */ private TaskType type; - /** The previous value. */ + /** The previous createValue. */ private Object previousValue; - /** The current value. */ + /** The current createValue. */ private Object value; /** The key. */ private String key; @@ -98,8 +98,8 @@ public final class ConfigHistory implements Serializable{ * Creates and registers an entry when a property has been changed. * @param pid the PID * @param key the key, not null. - * @param previousValue the previous value. - * @param value the new value. + * @param previousValue the previous createValue. + * @param value the new createValue. * @return the entry, never null. */ public static ConfigHistory propertySet(String pid, String key, Object value, Object previousValue){ @@ -219,7 +219,7 @@ public final class ConfigHistory implements Serializable{ return "ConfigHistory{" + "timestamp=" + timestamp + ", previousValue=" + previousValue + - ", value=" + value + + ", createValue=" + value + ", key='" + key + '\'' + '}'; } http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/TamayaConfigPlugin.java ---------------------------------------------------------------------- diff --git a/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/TamayaConfigPlugin.java b/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/TamayaConfigPlugin.java index 6c9c685..452919b 100644 --- a/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/TamayaConfigPlugin.java +++ b/modules/osgi/common/src/main/java/org/apache/tamaya/osgi/TamayaConfigPlugin.java @@ -303,10 +303,10 @@ public class TamayaConfigPlugin implements TamayaConfigService,BundleListener, S if(props!=null) { props.put(key, value); setPluginConfig(props); - LOG.finest("Updated Tamaya Plugin value: " + key + "=" + value); + LOG.finest("Updated Tamaya Plugin createValue: " + key + "=" + value); } } catch (Exception e) { - LOG.log(Level.WARNING, "Error writing Tamaya config value: " + key, e); + LOG.log(Level.WARNING, "Error writing Tamaya config createValue: " + key, e); } } @@ -317,7 +317,7 @@ public class TamayaConfigPlugin implements TamayaConfigService,BundleListener, S return props.get(key); } } catch (Exception e) { - LOG.log(Level.WARNING, "Error reading Tamaya config value.", e); + LOG.log(Level.WARNING, "Error reading Tamaya config createValue.", e); } return null; } http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/ConfigCommands.java ---------------------------------------------------------------------- diff --git a/modules/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/ConfigCommands.java b/modules/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/ConfigCommands.java index cd99f1f..5a8ae7b 100644 --- a/modules/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/ConfigCommands.java +++ b/modules/osgi/gogo-shell/src/main/java/org/apache/tamaya/gogo/shell/ConfigCommands.java @@ -78,7 +78,7 @@ public class ConfigCommands { @Descriptor("Get details of a property source.") public void tm_propertysource(@Parameter(absentValue = "", names={"-ps", "--propertysource"}) - @Descriptor("The property source name, empty returns a list of possible values")String propertysource) throws IOException { + @Descriptor("The property source name, empty returns a createList of possible values")String propertysource) throws IOException { System.out.println(org.apache.tamaya.osgi.commands.ConfigCommands.getPropertySource(propertysource)); } http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/TamayaOSGIInjector.java ---------------------------------------------------------------------- diff --git a/modules/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/TamayaOSGIInjector.java b/modules/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/TamayaOSGIInjector.java index fe0fe78..8f3cfc5 100644 --- a/modules/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/TamayaOSGIInjector.java +++ b/modules/osgi/injection/src/main/java/org/apache/tamaya/osgi/injection/TamayaOSGIInjector.java @@ -108,7 +108,7 @@ public class TamayaOSGIInjector{ } /** - * Get or create an injector for injecting OSGI configuration using Tamaya's injection API. + * Get or createObject an injector for injecting OSGI configuration using Tamaya's injection API. * @param pid the PID, not nbull. * @param location the optional location. * @return a injector, never null. http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/DefaultEnableCommand.java ---------------------------------------------------------------------- diff --git a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/DefaultEnableCommand.java b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/DefaultEnableCommand.java index 1a7ebcf..a667224 100644 --- a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/DefaultEnableCommand.java +++ b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/DefaultEnableCommand.java @@ -42,7 +42,7 @@ public class DefaultEnableCommand implements Action{ @Reference private TamayaConfigService configPlugin; - @Argument(index = 0, name = "enabled", description = "The boolean value to enabled/disable Tamaya by default.", + @Argument(index = 0, name = "enabled", description = "The boolean createValue to enabled/disable Tamaya by default.", required = true, multiValued = false) boolean enabled; http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertyGetCommand.java ---------------------------------------------------------------------- diff --git a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertyGetCommand.java b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertyGetCommand.java index 72f5b4a..b4e62f0 100644 --- a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertyGetCommand.java +++ b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertyGetCommand.java @@ -35,7 +35,7 @@ public class PropertyGetCommand implements Action{ required = false, multiValued = false) String key = null; - @Option(name="extended", aliases = "e", description = "Also print extended property value attributes.") + @Option(name="extended", aliases = "e", description = "Also print extended property createValue attributes.") boolean extended; @Option(name = "propertysource", aliases = "ps", description = "The target property source id.", http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourcesCommand.java ---------------------------------------------------------------------- diff --git a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourcesCommand.java b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourcesCommand.java index 7aa660d..e7d725d 100644 --- a/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourcesCommand.java +++ b/modules/osgi/karaf-shell/src/main/java/org/apache/tamaya/karaf/shell/PropertySourcesCommand.java @@ -28,7 +28,7 @@ import org.apache.tamaya.spi.PropertySource; import java.io.IOException; -@Command(scope = "tamaya", name = "tm_propertysources", description="Get a list of currently registered propertysources.") +@Command(scope = "tamaya", name = "tm_propertysources", description="Get a createList of currently registered propertysources.") @Service public class PropertySourcesCommand implements Action{ http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/osgi/updater/src/main/java/org/apache/tamaya/osgi/updater/Activator.java ---------------------------------------------------------------------- diff --git a/modules/osgi/updater/src/main/java/org/apache/tamaya/osgi/updater/Activator.java b/modules/osgi/updater/src/main/java/org/apache/tamaya/osgi/updater/Activator.java index a83f18f..a97e8f3 100644 --- a/modules/osgi/updater/src/main/java/org/apache/tamaya/osgi/updater/Activator.java +++ b/modules/osgi/updater/src/main/java/org/apache/tamaya/osgi/updater/Activator.java @@ -51,14 +51,14 @@ public class Activator implements BundleActivator { @Override public void start(BundleContext context) throws Exception { listener = new EventListener(context); - ConfigEventManager.addListener(listener, ConfigurationChange.class); + ConfigEventManager.getInstance().addListener(listener, ConfigurationChange.class); LOG.info("Registered Tamaya getConfig trigger for OSGI."); ServiceReference<TamayaConfigService> pluginRef = context.getServiceReference(TamayaConfigService.class); TamayaConfigService tamayaPlugin = context.getService(pluginRef); updateTimer.schedule(new TimerTask() { @Override public void run() { - ConfigEventManager.enableChangeMonitoring(tamayaPlugin.isAutoUpdateEnabled()); + ConfigEventManager.getInstance().enableChangeMonitoring(tamayaPlugin.isAutoUpdateEnabled()); } }, DELAY, PERIOD); } @@ -67,9 +67,9 @@ public class Activator implements BundleActivator { public void stop(BundleContext context) throws Exception { updateTimer.cancel(); if (listener != null) { - ConfigEventManager.removeListener(this.listener, ConfigurationChange.class); + ConfigEventManager.getInstance().removeListener(this.listener, ConfigurationChange.class); LOG.info("Unregistered Tamaya getConfig trigger for OSGI."); - ConfigEventManager.enableChangeMonitoring(false); + ConfigEventManager.getInstance().enableChangeMonitoring(false); } } http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/osgi/updater/src/test/java/org/apache/tamaya/osgi/updater/ActivatorTest.java ---------------------------------------------------------------------- diff --git a/modules/osgi/updater/src/test/java/org/apache/tamaya/osgi/updater/ActivatorTest.java b/modules/osgi/updater/src/test/java/org/apache/tamaya/osgi/updater/ActivatorTest.java index 5e1f614..a27bfbb 100644 --- a/modules/osgi/updater/src/test/java/org/apache/tamaya/osgi/updater/ActivatorTest.java +++ b/modules/osgi/updater/src/test/java/org/apache/tamaya/osgi/updater/ActivatorTest.java @@ -33,12 +33,12 @@ public class ActivatorTest extends AbstractOSGITest{ @Test public void startStop() throws Exception { - int size = ConfigEventManager.getListeners().size(); + int size = ConfigEventManager.getInstance().getListeners().size(); Activator activator = new Activator(); activator.start(super.bundleContext); - assertEquals(ConfigEventManager.getListeners().size(), size+1); + assertEquals(ConfigEventManager.getInstance().getListeners().size(), size+1); activator.stop(super.bundleContext); - assertEquals(ConfigEventManager.getListeners().size(), size); + assertEquals(ConfigEventManager.getInstance().getListeners().size(), size); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/resolver/pom.xml ---------------------------------------------------------------------- diff --git a/modules/resolver/pom.xml b/modules/resolver/pom.xml index 7691c23..76661e4 100644 --- a/modules/resolver/pom.xml +++ b/modules/resolver/pom.xml @@ -28,7 +28,7 @@ under the License. </parent> <artifactId>tamaya-resolver</artifactId> - <name>Apache Tamaya Resolver Services</name> + <name>Apache Tamaya Modules - Placeholder Resolver</name> <packaging>jar</packaging> <dependencies> http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/resolver/src/main/java/org/apache/tamaya/resolver/Resolver.java ---------------------------------------------------------------------- diff --git a/modules/resolver/src/main/java/org/apache/tamaya/resolver/Resolver.java b/modules/resolver/src/main/java/org/apache/tamaya/resolver/Resolver.java index 7450c27..f573d0a 100644 --- a/modules/resolver/src/main/java/org/apache/tamaya/resolver/Resolver.java +++ b/modules/resolver/src/main/java/org/apache/tamaya/resolver/Resolver.java @@ -25,45 +25,69 @@ import org.apache.tamaya.spi.ServiceContext; import org.apache.tamaya.spi.ServiceContextManager; import java.util.Collection; +import java.util.Objects; /** * Resolver singleton. */ public final class Resolver { + private final ClassLoader classLoader; + + + /** + * Get the current mutable config provider for the default classloader. + * @return the corresponding provider, not null. + * @see ServiceContextManager#getDefaultClassLoader() + */ + public static Resolver getInstance(){ + return getInstance(ServiceContextManager.getDefaultClassLoader()); + } + + /** + * Get the current mutable config provider for the given classloader. + * @param classLoader the target classloader, not null. + * @return the corresponding provider, not null. + */ + public static Resolver getInstance(ClassLoader classLoader){ + return ServiceContextManager.getServiceContext().getService(Resolver.class, + () -> new Resolver(classLoader)); + } + /** * Singleton constructor. */ - private Resolver(){} + private Resolver(ClassLoader classLoader){ + this.classLoader = Objects.requireNonNull(classLoader); + } /** * Evaluates the current expression using the current thread's context classloader. * @param key the key, not null. - * @param value the value to be filtered/evaluated. - * @return the filtered/evaluated value, including null. + * @param value the createValue to be filtered/evaluated. + * @return the filtered/evaluated createValue, including null. */ - public static String evaluateExpression(String key, String value){ - return evaluator(Thread.currentThread().getContextClassLoader()).evaluateExpression(key, value, true); + public String evaluateExpression(String key, String value){ + return evaluator().evaluateExpression(key, value, true); } /** * Evaluates the current expression. * @param key the key, not null. - * @param value the value to be filtered/evaluated. + * @param value the createValue to be filtered/evaluated. * @param classLoader the classloader to be used, not null. - * @return the filtered/evaluated value, including null. + * @return the filtered/evaluated createValue, including null. */ - public static String evaluateExpression(String key, String value, ClassLoader classLoader){ - return evaluator(classLoader).evaluateExpression(key, value, true); + public String evaluateExpression(String key, String value, ClassLoader classLoader){ + return evaluator().evaluateExpression(key, value, true); } /** * Get the evaluator. - * @param classLoader the classloader to be used, not null. * @return the evaluator, never null. * @throws ConfigException if the evaluator cannot be evaluated. */ - private static ExpressionEvaluator evaluator(ClassLoader classLoader) { + private ExpressionEvaluator evaluator() { ExpressionEvaluator evaluator = ServiceContextManager.getServiceContext(classLoader) .getService(ExpressionEvaluator.class); if(evaluator==null){ @@ -74,45 +98,22 @@ public final class Resolver { /** * Evaluates the current expression using the current thread's context classloader. - * @param value the value to be filtered/evaluated. - * @return the filtered/evaluated value, including null. - */ - public static String evaluateExpression(String value){ - - return evaluateExpression(value, true, Thread.currentThread().getContextClassLoader()); - } - - /** - * Evaluates the current expression. - * @param value the value to be filtered/evaluated. - * @param classLoader the classloader to be used, not null. - * @return the filtered/evaluated value, including null. + * @param value the createValue to be filtered/evaluated. + * @return the filtered/evaluated createValue, including null. */ - public static String evaluateExpression(String value, ClassLoader classLoader){ - return evaluateExpression(value, true, classLoader); + public String evaluateExpression(String value){ + return evaluateExpression(value, true); } /** * Evaluates the current expression using the current thread's context classloader. - * @param value the value to be filtered/evaluated. - * @param maskNotFound if true, not found expression parts will be replaced vy surrounding with []. - * Setting to false will replace the value with an empty String. - * @return the filtered/evaluated value, including null. - */ - public static String evaluateExpression(String value, boolean maskNotFound){ - return evaluateExpression(value, maskNotFound, Thread.currentThread().getContextClassLoader()); - } - - /** - * Evaluates the current expression. - * @param value the value to be filtered/evaluated. + * @param value the createValue to be filtered/evaluated. * @param maskNotFound if true, not found expression parts will be replaced vy surrounding with []. - * Setting to false will replace the value with an empty String. - * @param classLoader the classloader to be used, not null. - * @return the filtered/evaluated value, including null. + * Setting to false will replace the createValue with an empty String. + * @return the filtered/evaluated createValue, including null. */ - public static String evaluateExpression(String value, boolean maskNotFound, ClassLoader classLoader){ - return evaluator(classLoader).evaluateExpression(null, value, maskNotFound); + public String evaluateExpression(String value, boolean maskNotFound){ + return evaluator().evaluateExpression(null, value, maskNotFound); } /** @@ -121,7 +122,14 @@ public final class Resolver { * @deprecated will be removed. */ @Deprecated - public static Collection<ExpressionResolver> getResolvers(){ - return evaluator(Thread.currentThread().getContextClassLoader()).getResolvers(); + public Collection<ExpressionResolver> getResolvers(){ + return evaluator().getResolvers(); + } + + @Override + public String toString() { + return "Resolver{" + + "classLoader=" + classLoader + + '}'; } } http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ConfigResolver.java ---------------------------------------------------------------------- diff --git a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ConfigResolver.java b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ConfigResolver.java index a7794ed..edebd39 100644 --- a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ConfigResolver.java +++ b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ConfigResolver.java @@ -27,7 +27,7 @@ import java.util.Objects; /** * Property resolver implementation that interprets the resolver expression as a reference to another configuration - * entry. It can be explicitly addressed by prefixing {@code conf:}, e.g. {@code ${conf:my.other.config.value}}. + * entry. It can be explicitly addressed by prefixing {@code conf:}, e.g. {@code ${conf:my.other.config.createValue}}. */ @Priority(200) public final class ConfigResolver implements ExpressionResolver, ClassloaderAware { http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/DefaultExpressionEvaluator.java ---------------------------------------------------------------------- diff --git a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/DefaultExpressionEvaluator.java b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/DefaultExpressionEvaluator.java index 41d39e7..637c943 100644 --- a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/DefaultExpressionEvaluator.java +++ b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/DefaultExpressionEvaluator.java @@ -104,10 +104,10 @@ public class DefaultExpressionEvaluator implements ExpressionEvaluator { * </ul> * * @param key the key to be filtered - * @param value value to be analyzed for expressions + * @param value createValue to be analyzed for expressions * @param maskUnresolved if true, not found expression parts will be replaced by surrounding with []. - * Setting to false will replace the value with an empty String. - * @return the resolved value, or the input in case where no expression was detected. + * Setting to false will replace the createValue with an empty String. + * @return the resolved createValue, or the input in case where no expression was detected. */ @Override public String evaluateExpression(String key, String value, boolean maskUnresolved){ @@ -217,7 +217,7 @@ public class DefaultExpressionEvaluator implements ExpressionEvaluator { * based on priority. * @param unresolvedExpression the parsed, but unresolved expression * @param maskUnresolved if true, not found expression parts will be replaced by surrounding with []. - * Setting to false will replace the value with an empty String. + * Setting to false will replace the createValue with an empty String. * @return the resolved expression, or null. */ private String evaluateInternal(String unresolvedExpression, boolean maskUnresolved) { http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ExpressionResolutionFilter.java ---------------------------------------------------------------------- diff --git a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ExpressionResolutionFilter.java b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ExpressionResolutionFilter.java index 72fd71c..3b8db24 100644 --- a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ExpressionResolutionFilter.java +++ b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ExpressionResolutionFilter.java @@ -91,8 +91,8 @@ public class ExpressionResolutionFilter implements PropertyFilter, ClassloaderAw * <li><code>\${resolverId:expression}foo${resolverId2:expression2}bar</code> (first expression is escaped).</li> * </ul> * - * @param valueToBeFiltered value to be analyzed for expressions - * @return the resolved value, or the input in case where no expression was detected. + * @param valueToBeFiltered createValue to be analyzed for expressions + * @return the resolved createValue, or the input in case where no expression was detected. */ @Override public PropertyValue filterProperty(PropertyValue valueToBeFiltered){ http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ResourceResolver.java ---------------------------------------------------------------------- diff --git a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ResourceResolver.java b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ResourceResolver.java index 291fc49..0922c23 100644 --- a/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ResourceResolver.java +++ b/modules/resolver/src/main/java/org/apache/tamaya/resolver/internal/ResourceResolver.java @@ -107,10 +107,11 @@ public final class ResourceResolver implements ExpressionResolver, ClassloaderAw private URL getUrl(String expression, ClassLoader... classLoaders) { if (IS_RESOURCE_MODULE_AVAILABLE) { - org.apache.tamaya.resource.ResourceResolver resolver = ServiceContextManager.getServiceContext() - .getService(org.apache.tamaya.resource.ResourceResolver.class); for (ClassLoader cl : classLoaders) { - Collection<URL> resources = resolver.getResources(cl, expression); + org.apache.tamaya.resource.ResourceResolver resolver = ServiceContextManager.getServiceContext(cl) + .getService(org.apache.tamaya.resource.ResourceResolver.class); + + Collection<URL> resources = resolver.getResources(expression); if (!resources.isEmpty()) { if (resources.size() != 1) { LOG.log(Level.WARNING, "Unresolvable expression (ambiguous resource): " + expression); http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/resolver/src/main/java/org/apache/tamaya/resolver/spi/ExpressionEvaluator.java ---------------------------------------------------------------------- diff --git a/modules/resolver/src/main/java/org/apache/tamaya/resolver/spi/ExpressionEvaluator.java b/modules/resolver/src/main/java/org/apache/tamaya/resolver/spi/ExpressionEvaluator.java index 96dbb66..276a928 100644 --- a/modules/resolver/src/main/java/org/apache/tamaya/resolver/spi/ExpressionEvaluator.java +++ b/modules/resolver/src/main/java/org/apache/tamaya/resolver/spi/ExpressionEvaluator.java @@ -50,10 +50,10 @@ public interface ExpressionEvaluator { /** * Evaluates the current expression. * @param key the key, not null. - * @param value the value to be filtered/evaluated. + * @param value the createValue to be filtered/evaluated. * @param maskNotFound if true, not found expression parts will be replaced vy surrounding with []. - * Setting to false will replace the value with an empty String. - * @return the filtered/evaluated value, including null. + * Setting to false will replace the createValue with an empty String. + * @return the filtered/evaluated createValue, including null. */ String evaluateExpression(String key, String value, boolean maskNotFound); http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/resolver/src/test/java/org/apache/tamaya/resolver/ConfigResolutionTest.java ---------------------------------------------------------------------- diff --git a/modules/resolver/src/test/java/org/apache/tamaya/resolver/ConfigResolutionTest.java b/modules/resolver/src/test/java/org/apache/tamaya/resolver/ConfigResolutionTest.java index aac6244..3186c4e 100644 --- a/modules/resolver/src/test/java/org/apache/tamaya/resolver/ConfigResolutionTest.java +++ b/modules/resolver/src/test/java/org/apache/tamaya/resolver/ConfigResolutionTest.java @@ -19,7 +19,6 @@ package org.apache.tamaya.resolver; import org.apache.tamaya.Configuration; -import org.apache.tamaya.ConfigurationProvider; import org.junit.Test; import static org.junit.Assert.assertEquals; http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/resolver/src/test/java/org/apache/tamaya/resolver/MyTestPropertySource.java ---------------------------------------------------------------------- diff --git a/modules/resolver/src/test/java/org/apache/tamaya/resolver/MyTestPropertySource.java b/modules/resolver/src/test/java/org/apache/tamaya/resolver/MyTestPropertySource.java index 8a67159..00aaa76 100644 --- a/modules/resolver/src/test/java/org/apache/tamaya/resolver/MyTestPropertySource.java +++ b/modules/resolver/src/test/java/org/apache/tamaya/resolver/MyTestPropertySource.java @@ -88,7 +88,7 @@ public class MyTestPropertySource implements PropertySource{ @Override public PropertyValue get(String key) { - return PropertyValue.of(key, properties.get(key), getName()); + return PropertyValue.createValue(key, properties.get(key)).setMeta("source", getName()); } @Override @@ -100,8 +100,4 @@ public class MyTestPropertySource implements PropertySource{ return res; } - @Override - public boolean isScannable() { - return true; - } } http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/resolver/src/test/java/org/apache/tamaya/resolver/ResolverTest.java ---------------------------------------------------------------------- diff --git a/modules/resolver/src/test/java/org/apache/tamaya/resolver/ResolverTest.java b/modules/resolver/src/test/java/org/apache/tamaya/resolver/ResolverTest.java index 183183a..8321195 100644 --- a/modules/resolver/src/test/java/org/apache/tamaya/resolver/ResolverTest.java +++ b/modules/resolver/src/test/java/org/apache/tamaya/resolver/ResolverTest.java @@ -29,41 +29,40 @@ public class ResolverTest { @Test public void testEvaluateExpression_withMask_NoKey() throws Exception { - assertEquals(Resolver.evaluateExpression("Version ${java.foo}", true), + assertEquals(Resolver.getInstance().evaluateExpression("Version ${java.foo}", true), "Version ?{java.foo}"); } @Test public void testEvaluateExpression_withMask_Classloader() throws Exception { - assertEquals(Resolver.evaluateExpression("Version ${java.foo}", true, - Thread.currentThread().getContextClassLoader()), + assertEquals(Resolver.getInstance(Thread.currentThread().getContextClassLoader()) + .evaluateExpression("Version ${java.foo}", true), "Version ?{java.foo}"); } @Test public void testEvaluateExpression() throws Exception { - assertEquals(Resolver.evaluateExpression("myKey", "Version ${java.version}"), + assertEquals(Resolver.getInstance().evaluateExpression("myKey", "Version ${java.version}"), "Version " + System.getProperty("java.version")); } @Test public void testEvaluateExpression_NoKey() throws Exception { - assertEquals(Resolver.evaluateExpression("Version ${java.version}"), + assertEquals(Resolver.getInstance().evaluateExpression("Version ${java.version}"), "Version " + System.getProperty("java.version")); } @Test public void testEvaluateExpression_ClassLoader() throws Exception { - assertEquals(Resolver.evaluateExpression("myKey", "Version ${java.version}", + assertEquals(Resolver.getInstance().evaluateExpression("myKey", "Version ${java.version}", Thread.currentThread().getContextClassLoader()), "Version " + System.getProperty("java.version")); } @Test public void testEvaluateExpression1_NoKey_ClassLoader() throws Exception { - assertEquals(Resolver.evaluateExpression("Version ${java.version}", - Thread.currentThread().getContextClassLoader()), + assertEquals(Resolver.getInstance().evaluateExpression("Version ${java.version}"), "Version " + System.getProperty("java.version")); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/resources/pom.xml ---------------------------------------------------------------------- diff --git a/modules/resources/pom.xml b/modules/resources/pom.xml index e482618..4d6ddb1 100644 --- a/modules/resources/pom.xml +++ b/modules/resources/pom.xml @@ -28,7 +28,7 @@ under the License. </parent> <artifactId>tamaya-resources</artifactId> - <name>Apache Tamaya Resource Services</name> + <name>Apache Tamaya Modules - Resource Locator</name> <packaging>jar</packaging> <dependencies> http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/resources/src/main/java/org/apache/tamaya/resource/AbstractPathPropertySourceProvider.java ---------------------------------------------------------------------- diff --git a/modules/resources/src/main/java/org/apache/tamaya/resource/AbstractPathPropertySourceProvider.java b/modules/resources/src/main/java/org/apache/tamaya/resource/AbstractPathPropertySourceProvider.java index d7462b9..fa8e536 100644 --- a/modules/resources/src/main/java/org/apache/tamaya/resource/AbstractPathPropertySourceProvider.java +++ b/modules/resources/src/main/java/org/apache/tamaya/resource/AbstractPathPropertySourceProvider.java @@ -76,7 +76,7 @@ public abstract class AbstractPathPropertySourceProvider implements PropertySour List<PropertySource> propertySources = new ArrayList<>(); for (String resource : getResourcePaths()) { try { - Collection<URL> resources = ConfigResources.getResourceResolver().getResources(classLoader, resource); + Collection<URL> resources = ConfigResources.getResourceResolver(classLoader).getResources(resource); for (URL url : resources) { try { Collection<PropertySource> propertySourcesToInclude = getPropertySources(url); @@ -107,7 +107,7 @@ public abstract class AbstractPathPropertySourceProvider implements PropertySour * the resource locator. * @param url the URL, not null. * @return the {@link org.apache.tamaya.spi.PropertySource}s to be included into the current provider's sources - * list. It is safe to return {@code null} here, in case the content of the URL has shown to be not relevant + * createList. It is safe to return {@code null} here, in case the content of the URL has shown to be not relevant * as configuration input. In case the input is not valid or accessible an exception can be thrown or logged. */ protected abstract Collection<PropertySource> getPropertySources(URL url); @@ -180,7 +180,7 @@ public abstract class AbstractPathPropertySourceProvider implements PropertySour } /** - * Returns the default ordinal used, when no ordinal is setCurrent, or the ordinal was not parseable to an int value. + * Returns the default ordinal used, when no ordinal is setCurrent, or the ordinal was not parseable to an int createValue. * * @return the default ordinal used, by default 0. */ http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/resources/src/main/java/org/apache/tamaya/resource/BaseResourceResolver.java ---------------------------------------------------------------------- diff --git a/modules/resources/src/main/java/org/apache/tamaya/resource/BaseResourceResolver.java b/modules/resources/src/main/java/org/apache/tamaya/resource/BaseResourceResolver.java index a407d81..17a59bf 100644 --- a/modules/resources/src/main/java/org/apache/tamaya/resource/BaseResourceResolver.java +++ b/modules/resources/src/main/java/org/apache/tamaya/resource/BaseResourceResolver.java @@ -47,7 +47,7 @@ import java.util.Collection; public abstract class BaseResourceResolver implements ResourceResolver { /** - * Resolves resource expressions to a list of {@link URL}s, considerubg + * Resolves resource expressions to a createList of {@link URL}s, considerubg * the given classloader for classloader dependent format. Hereby * the ordering of format matches the input of the resolved expressions. Nevertheless be aware that * there is no determined ordering of format located within a classloader. @@ -58,6 +58,22 @@ public abstract class BaseResourceResolver implements ResourceResolver { * . */ @Override - public abstract Collection<URL> getResources(ClassLoader classLoader, Collection<String> expressions); + public abstract Collection<URL> getResources(Collection<String> expressions); + + /** + * Resolves resource expressions to a createList of {@link URL}s, considerubg + * the given classloader for classloader dependent format. Hereby + * the ordering of format matches the input of the resolved expressions. Nevertheless be aware that + * there is no determined ordering of format located within a classloader. + * + * @param expressions the expressions to be resolved, not empty. + * @return the corresponding collection of current {@link URL}s found, never + * null. + * . + */ + @Override + public Collection<URL> getResources(String... expressions){ + return getResources(Arrays.asList(expressions)); + } } http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/resources/src/main/java/org/apache/tamaya/resource/ConfigResources.java ---------------------------------------------------------------------- diff --git a/modules/resources/src/main/java/org/apache/tamaya/resource/ConfigResources.java b/modules/resources/src/main/java/org/apache/tamaya/resource/ConfigResources.java index a0a2f20..c35e1ff 100644 --- a/modules/resources/src/main/java/org/apache/tamaya/resource/ConfigResources.java +++ b/modules/resources/src/main/java/org/apache/tamaya/resource/ConfigResources.java @@ -24,7 +24,9 @@ import org.apache.tamaya.spi.ServiceContextManager; /** * Singleton Accessor for accessing the current {@link org.apache.tamaya.resource.ResourceResolver} instance. + * @deprecated Use static methods on {@link ResourceResolver} */ +@Deprecated public final class ConfigResources { /** @@ -33,16 +35,15 @@ public final class ConfigResources { private ConfigResources(){} /** - * <p>Access the current ResourceResolver.</p> + * <p>Access the current ResourceResolver using the default classloader.</p> * * @throws ConfigException if no ResourceResolver is available (should not happen). * * @return the current ResourceResolver instance, never null. - * @deprecated Use {@link #getResourceResolver(ClassLoader)} + * @see ServiceContextManager#getDefaultClassLoader() */ - @Deprecated public static ResourceResolver getResourceResolver() throws ConfigException { - return getResourceResolver(Thread.currentThread().getContextClassLoader()); + return getResourceResolver(ServiceContextManager.getDefaultClassLoader()); } /** http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/36c32fcf/modules/resources/src/main/java/org/apache/tamaya/resource/ResourceLocator.java ---------------------------------------------------------------------- diff --git a/modules/resources/src/main/java/org/apache/tamaya/resource/ResourceLocator.java b/modules/resources/src/main/java/org/apache/tamaya/resource/ResourceLocator.java index d094487..ab5b4e0 100644 --- a/modules/resources/src/main/java/org/apache/tamaya/resource/ResourceLocator.java +++ b/modules/resources/src/main/java/org/apache/tamaya/resource/ResourceLocator.java @@ -28,7 +28,7 @@ import java.util.Collection; public interface ResourceLocator { /** - * Method to lookup a given list of URLs, identified by the given expression. + * Method to lookup a given createList of URLs, identified by the given expression. * @param classLoader the classloader to be used, if necessary. * @param expression the expression. * @return a collection of URL found.
