Skip to content

Commit

Permalink
Revert "Moved API classes to their own module. (smallrye#295)"
Browse files Browse the repository at this point in the history
This reverts commit 8581174
  • Loading branch information
radcortez committed May 6, 2020
1 parent c0828e9 commit 03e9d8a
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 161 deletions.
100 changes: 0 additions & 100 deletions api/pom.xml

This file was deleted.

4 changes: 0 additions & 4 deletions implementation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@
<artifactId>jakarta.annotation-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.smallrye.config</groupId>
<artifactId>smallrye-config-api</artifactId>
</dependency>
<dependency>
<groupId>io.smallrye.config</groupId>
<artifactId>smallrye-config-common</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import java.util.Collections;
import java.util.Iterator;

import io.smallrye.common.annotation.Experimental;

/**
* The ConfigSourceInterceptor allows to intercept the resolution of a configuration name before the
* configuration value is resolved by the Config and before any conversion taking place. It can also intercept
Expand All @@ -28,7 +26,6 @@
* of {@code io.smallrye.config.Priorities#APPLICATION} is assumed. If multiple interceptors are registered with the
* same priority, then their execution order may be non deterministic.
*/
@Experimental("Interceptor API to intercept resolution of a configuration name")
public interface ConfigSourceInterceptor extends Serializable {
/**
* Intercept the resolution of a configuration name and either return the corresponding {@link ConfigValue} or a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,10 @@
import java.io.Serializable;
import java.util.Iterator;

import io.smallrye.common.annotation.Experimental;

/**
* Exposes contextual information about the intercepted invocation of {@link ConfigSourceInterceptor}. This allows
* implementers to control the behavior of the invocation chain.
*/
@Experimental("Interceptor API to intercept resolution of a configuration name")
public interface ConfigSourceInterceptorContext extends Serializable {
/**
* Proceeds to the next interceptor in the chain.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import java.util.OptionalInt;

import io.smallrye.common.annotation.Experimental;

/**
* This ConfigSourceInterceptorFactory allows to initialize a {@link ConfigSourceInterceptor}, with access to the
* current {@link ConfigSourceInterceptorContext}.
Expand All @@ -14,13 +12,12 @@
* initialized.
* <p>
*
* Instances of this interface will be discovered by {@code SmallRyeConfigBuilder#addDiscoveredInterceptors()} via the
* Instances of this interface will be {@link SmallRyeConfigBuilder#addDiscoveredInterceptors()} via the
* {@link java.util.ServiceLoader} mechanism and can be registered by providing a
* {@code META-INF/services/io.smallrye.config.ConfigSourceInterceptorFactory}
* {@linkplain ClassLoader#getResource(String) resource} which contains the fully qualified class name of the
* custom {@code ConfigSourceProvider} implementation.
*/
@Experimental("Interceptor API to intercept resolution of a configuration name")
public interface ConfigSourceInterceptorFactory {
/**
* The default priority value, {@link Priorities#APPLICATION}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import java.util.Objects;

import io.smallrye.common.annotation.Experimental;

/**
* The ConfigValue is a metadata object that holds additional information after the lookup of a configuration.
* <p>
Expand All @@ -16,7 +14,6 @@
* This is used together with {@link ConfigValueConfigSource} and {@link ConfigSourceInterceptor} to expose the
* Configuration lookup metadata.
*/
@Experimental("Extension to the original ConfigSource to allow retrieval of additional metadata on config lookup")
public class ConfigValue {
private final String name;
private final String value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

import org.eclipse.microprofile.config.spi.ConfigSource;

import io.smallrye.common.annotation.Experimental;

/**
* Extends the original {@link ConfigSource} to expose methods that return a {@link ConfigValue}. The
* {@link ConfigValue} allows to retrieve additional metadata associated with the configuration resolution.
Expand All @@ -19,7 +17,6 @@
*
* Ideally, this should move the the MicroProfile Config API, once the concept is well-proven.
*/
@Experimental("Extension to the original ConfigSource to allow retrieval of additional metadata on config lookup")
public interface ConfigValueConfigSource extends ConfigSource {
/**
* Return the {@link ConfigValue} for the specified property in this configuration source.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@
import java.util.Map;
import java.util.Set;

import io.smallrye.common.annotation.Experimental;

/**
* The ConfigValueMapView is view over a Map of String configs names and ConfigValue value.
* <p>
*
* Use this to wrap the ConfigValue map and expose it where a Map of String name and String value is required.
*/
@Experimental("Extension to the original ConfigSource to allow retrieval of additional metadata on config lookup")
public final class ConfigValueMapView extends AbstractMap<String, String> {
private final Map<String, ConfigValue> delegate;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package io.smallrye.config;

import io.smallrye.common.annotation.Experimental;

/**
* A collection of built-in priority constants for {@link ConfigSourceInterceptor} that are supposed to be
* ordered based on their {@code javax.annotation.Priority} class-level annotation.
*/
@Experimental("Interceptor API to intercept resolution of a configuration name")
public final class Priorities {
/**
* Range for early interceptors defined by Platform specifications.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,7 @@ private static class ConfigSources implements Serializable {
ConfigSources(final List<ConfigSource> sources, final ConfigSources configSources) {
sources.sort(CONFIG_SOURCE_COMPARATOR);

SmallRyeConfigSourceInterceptorContext current = new SmallRyeConfigSourceInterceptorContext(
EMPTY, null);
SmallRyeConfigSourceInterceptorContext current = new SmallRyeConfigSourceInterceptorContext(EMPTY, null);

for (int i = sources.size() - 1; i >= 0; i--) {
current = new SmallRyeConfigSourceInterceptorContext(configSourceInterceptor(sources.get(i)), current);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void size() {

@Test
public void isEmpty() {
assertTrue(new ConfigValueMapStringView(new HashMap<>(), "test", 1).isEmpty());
assertTrue(new ConfigValueMapView(new HashMap<>()).isEmpty());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;

import java.io.IOException;
import java.util.AbstractMap;
import java.util.Collection;
import java.util.HashMap;
Expand Down Expand Up @@ -98,6 +99,20 @@ public void values() {
assertThrows(UnsupportedOperationException.class, () -> values.remove("1234"));
}

@Test
public void configSourceMap() throws IOException {
final ConfigValuePropertiesConfigSource configSource = new ConfigValuePropertiesConfigSource(
ConfigValueMapViewTest.class.getResource("/config-values.properties"));
final Map<String, String> properties = configSource.getProperties();

assertEquals("abc", properties.get("my.prop"));
assertEquals("abc", properties.get("my.prop"));
assertThrows(UnsupportedOperationException.class, () -> properties.remove("x"));
assertThrows(UnsupportedOperationException.class, () -> properties.put("x", "x"));
assertThrows(UnsupportedOperationException.class, () -> properties.putAll(new HashMap<>()));
assertThrows(UnsupportedOperationException.class, properties::clear);
}

private ConfigValueMapView sampleMap() {
final Map<String, ConfigValue> configValueMap = new HashMap<>();
configValueMap.put("my.prop", ConfigValue.builder().withName("my.prop").withValue("1234").build());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
package io.smallrye.config;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import org.eclipse.microprofile.config.Config;
import org.junit.Assert;
import org.junit.Test;
Expand All @@ -20,20 +13,6 @@ public void interceptor() throws Exception {
Assert.assertEquals("20", config.getValue("my.prop.20", String.class));
}

@Test
public void configSourceMap() throws IOException {
final ConfigValuePropertiesConfigSource configSource = new ConfigValuePropertiesConfigSource(
ConfigValuePropertiesConfigSourceTest.class.getResource("/config-values.properties"));
final Map<String, String> properties = configSource.getProperties();

assertEquals("abc", properties.get("my.prop"));
assertEquals("abc", properties.get("my.prop"));
assertThrows(UnsupportedOperationException.class, () -> properties.remove("x"));
assertThrows(UnsupportedOperationException.class, () -> properties.put("x", "x"));
assertThrows(UnsupportedOperationException.class, () -> properties.putAll(new HashMap<>()));
assertThrows(UnsupportedOperationException.class, properties::clear);
}

private static Config buildConfig() throws Exception {
return new SmallRyeConfigBuilder()
.addDefaultSources()
Expand Down
11 changes: 0 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@

<modules>
<module>common</module>
<module>api</module>
<module>implementation</module>
<module>sources/hocon</module>
<module>sources/file-system</module>
Expand Down Expand Up @@ -116,11 +115,6 @@
</dependency>

<!-- External SmallRye Dependencies -->
<dependency>
<groupId>io.smallrye.common</groupId>
<artifactId>smallrye-common-annotation</artifactId>
<version>${version.smallrye.common}</version>
</dependency>
<dependency>
<groupId>io.smallrye.common</groupId>
<artifactId>smallrye-common-expression</artifactId>
Expand All @@ -133,11 +127,6 @@
</dependency>

<!-- Dependencies provided by the project -->
<dependency>
<groupId>io.smallrye.config</groupId>
<artifactId>smallrye-config-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.smallrye.config</groupId>
<artifactId>smallrye-config-common</artifactId>
Expand Down

0 comments on commit 03e9d8a

Please sign in to comment.