Skip to content

Commit

Permalink
Revert state of the project just after 1.3
Browse files Browse the repository at this point in the history
(Reverted from 884c1d3)

Signed-off-by: Jeff Mesnil <jmesnil@redhat.com>
  • Loading branch information
jmesnil committed Sep 6, 2019
1 parent 04a092f commit 89fa224
Show file tree
Hide file tree
Showing 16 changed files with 95 additions and 222 deletions.
35 changes: 0 additions & 35 deletions CONTRIBUTING.adoc

This file was deleted.

8 changes: 1 addition & 7 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
// limitations under the License.
//
image:https://badges.gitter.im/eclipse/microprofile-config.svg[link="https://gitter.im/eclipse/microprofile-config"]
image:https://img.shields.io/maven-central/v/org.eclipse.microprofile.config/microprofile-config-api.svg[link="http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.eclipse.microprofile.config%22%20AND%20a%3A%22microprofile-config-api%22"]
image:https://javadoc.io/badge/org.eclipse.microprofile.config/microprofile-config-api.svg[ link="https://javadoc.io/doc/org.eclipse.microprofile.config/microprofile-config-api"]

# Configuration for MicroProfile

Expand Down Expand Up @@ -57,8 +55,7 @@ The following Implementations are available
* Apache Geronimo Config (https://svn.apache.org/repos/asf/geronimo/components/config/trunk)
* WebSphere Liberty 2017 March-June Beta so far (https://developer.ibm.com/wasdev/)
* Payara Server 173 and Payara Micro 173 (https://docs.payara.fish/documentation/microprofile/config.html)
* WildFly & Thorntail (https://github.com/smallrye/smallrye-config)
* https://microbean.github.io/microbean-microprofile-config/[microBean(TM) MicroProfile Config]
* WildFly / WildFly Swarm (https://github.com/wildfly-extras/wildfly-microprofile-config/)

== Design

Expand Down Expand Up @@ -88,6 +85,3 @@ The whole MicroProfile config project can be built via Apache Maven

`$> mvn clean install`

== Contributing

Do you want to contribute to this project? link:CONTRIBUTING.adoc[Find out how you can help here].
1 change: 0 additions & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
<groupId>org.osgi</groupId>
<artifactId>org.osgi.annotation.versioning</artifactId>
<version>1.0.0</version>
<scope>provided</scope>

</dependency>
</dependencies>
Expand Down
17 changes: 8 additions & 9 deletions api/src/main/java/org/eclipse/microprofile/config/Config.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (c) 2011-2019 Contributors to the Eclipse Foundation
* Copyright (c) 2011-2017 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
Expand All @@ -26,9 +26,6 @@
* Extracted the Config part out of Apache DeltaSpike and proposed as Microprofile-Config
* 2016-11-14 - Emily Jiang / IBM Corp
* Experiments with separate methods per type, JavaDoc, method renaming
* 2018-04-04 - Mark Struberg, Manfred Huber, Alex Falb, Gerhard Petracek
* ConfigSnapshot added. Initially authored in Apache DeltaSpike fdd1e3dcd9a12ceed831dd
* Additional reviews and feedback by Tomas Langer.
*
*******************************************************************************/

Expand All @@ -47,11 +44,13 @@
* <p>If multiple {@link ConfigSource ConfigSources} are specified with
* the same ordinal, the {@link ConfigSource#getName()} will be used for sorting.
* <p>
* The config objects produced via the injection model {@code @Inject Config} are guaranteed to be serializable, while
* The config objects produced via the injection model <pre>@Inject Config</pre> are guaranteed to be serializable, while
* the programmatically created ones are not required to be serializable.
* <p>
* If one or more converters are registered for a class of a requested value then the registered {@link org.eclipse.microprofile.config.spi.Converter}
* which has the highest {@code @javax.annotation.Priority} is used to convert the string value retrieved from the config sources.
* If one or more converters are registered for a class of a requested value then one of the registered converters
* which has the highest priority is used to convert the string value retrieved from config sources.
* The highest priority means the highest priority number.
* For more information about converters, see {@link org.eclipse.microprofile.config.spi.Converter}
*
* <h3>Usage</h3>
*
Expand Down Expand Up @@ -91,7 +90,7 @@ public interface Config {
/**
* Return the resolved property value with the specified type for the
* specified property name from the underlying {@link ConfigSource ConfigSources}.
*
*
* If this method gets used very often then consider to locally store the configured value.
*
* @param <T>
Expand All @@ -109,7 +108,7 @@ public interface Config {
/**
* Return the resolved property value with the specified type for the
* specified property name from the underlying {@link ConfigSource ConfigSources}.
*
*
* If this method is used very often then consider to locally store the configured value.
*
* @param <T>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2019 Contributors to the Eclipse Foundation
* Copyright (c) 2016-2017 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
Expand Down Expand Up @@ -102,19 +102,9 @@
@Target({METHOD, FIELD, PARAMETER, TYPE})
public @interface ConfigProperty {
String UNCONFIGURED_VALUE="org.eclipse.microprofile.config.configproperty.unconfigureddvalue";
/**
* Provide a way to specify {@code null} value for a property.
* e.g. The following example is to set the default value of {@code my.port} to null if the property is not specified in any config sources.
* <pre>
* &#064;Inject
* &#064;ConfigProperty(name="my.port" defaultValue=ConfigProperty.NULL_VALUE)
* String value;
* </pre>
*/
String NULL_VALUE="org.eclipse.microprofile.config.configproperty.nullvalue";
/**
* The key of the config property used to look up the configuration value.
* If it is not specified, it will be derived automatically as {@code <class_name>.<injection_point_name>},
* If it is not specified, it will be derived automatically as {@code <class_name>.<injetion_point_name>},
* where {@code injection_point_name} is the field name or parameter name,
* {@code class_name} is the fully qualified name of the class being injected to.
* If one of the {@code class_name} or {@code injection_point_name} cannot be determined, the value has to be provided.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@
* @author <a href="mailto:emijiang@uk.ibm.com">Emily Jiang</a>
*
*/
@org.osgi.annotation.versioning.Version("1.1.0")
@org.osgi.annotation.versioning.Version("1.0")
package org.eclipse.microprofile.config.inject;

4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<groupId>org.eclipse.microprofile.config</groupId>
<artifactId>microprofile-config-parent</artifactId>
<version>1.3</version>
<version>1.4-SNAPSHOT</version>
<packaging>pom</packaging>
<name>MicroProfile Config</name>
<description>Eclipse MicroProfile Config Feature :: Parent POM</description>
Expand Down Expand Up @@ -77,7 +77,7 @@
<connection>scm:git:https://github.com/eclipse/microprofile-config.git</connection>
<developerConnection>scm:git:git@github.com:eclipse/microprofile-config.git</developerConnection>
<url>https://github.com/eclipse/microprofile-config</url>
<tag>1.3</tag>
<tag>HEAD</tag>
</scm>

<distributionManagement>
Expand Down
2 changes: 1 addition & 1 deletion spec/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<!-- This is just for now and will not work if the API has a separate release cycle than the rest. -->
<groupId>org.eclipse.microprofile.config</groupId>
<artifactId>microprofile-config-parent</artifactId>
<version>1.3</version>
<version>1.4-SNAPSHOT</version>
</parent>

<groupId>org.eclipse.microprofile.config</groupId>
Expand Down
29 changes: 12 additions & 17 deletions spec/src/main/asciidoc/configexamples.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ If you need to access a different server then you can e.g. change the configurat

[source, text]
----
$> java -Dacme.myprj.some.url=http://other.server/other/endpoint -jar some.jar
$> java -jar some.jar -Dacme.myprj.some.url=http://other.server/other/endpoint
----

Note that this is only one example how to possibly configure your application.
Another example is to register <<custom_configsources, Custom ConfigSources>> to e.g. pick up values from a database table, etc.

If a config value is a comma(`,`) separated string, this value can be automatically converted to a multiple element array with `\` as the escape character.
If a config value is a `,` separated string, this value can be automatically converted to a multiple element array with `\` as the escape character.
When specifying the property `myPets=dog,cat,dog\\,cat` in a config source, the following code snippet can be used to obtain an array.
----
String[] myPets = config.getValue("myPets", String[].class);
String[] myPets = config.getValue("myPets", String[].class);
//myPets = {"dog", "cat", "dog,cat"}
----

Expand All @@ -77,29 +77,24 @@ public class InjectedConfigUsageSample {
@Inject
@ConfigProperty(name="myprj.some.url")
private String someUrl;
//The following code injects an Optional value of myprj.some.port property.
//Contrary to natively injecting the configured value this will not lead to a
//DeploymentException if the configured value is missing.
//The following code injects an Optional value of myprj.some.port property.
//Contrary to natively injecting the configured value this will not lead to a
//DeploymentException if the configured value is missing.
@Inject
@ConfigProperty(name="myprj.some.port")
private Optional<Integer> somePort;
//Injects a Provider for the value of myprj.some.dynamic.timeout property to
//resolve the property dynamically. Each invocation to Provider#get() will
//Injects a Provider for the value of myprj.some.dynamic.timeout property to
//resolve the property dynamically. Each invocation to Provider#get() will
//resolve the latest value from underlying Config.
//The existence of configured values will get checked during startup.
//Instances of Provider<T> are guaranteed to be Serializable.
//The existence of configured values will get checked during startup.
//Instances of Provider<T> are guaranteed to be Serializable.
@Inject
@ConfigProperty(name="myprj.some.dynamic.timeout", defaultValue="100")
private javax.inject.Provider<Long> timeout;
//Injects the value of the property myprj.name if specified in any of the configures, otherwise null will be injected.
@Inject
@ConfigProperty(name="myprj.name" defaultValue=ConfigProperty.NULL_VALUE)
String name;
//The following code injects an Array, List or Set for the `myPets` property,
//The following code injects an Array, List or Set for the `myPets` property,
//where its value is a comma separated value ( myPets=dog,cat,dog\\,cat)
@Inject @ConfigProperty(name="myPets") private String[] myArrayPets;
@Inject @ConfigProperty(name="myPets") private List<String> myListPets;
@Inject @ConfigProperty(name="myPets") private List<String> myListPets;
@Inject @ConfigProperty(name="myPets") private Set<String> mySetPets;
}
----
Expand Down
1 change: 1 addition & 0 deletions spec/src/main/asciidoc/configsources.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ A Microprofile-Config implementation must provide <<ConfigSource,ConfigSources>>

Some operating systems allow only alphabetic characters or an underscore, `_`, in environment variables. Other characters such as `., /`, etc may be disallowed. In order to set a value for a config property that has a name containing such disallowed characters from an environment variable, the following rules are used.

This `ConfigSource` searches 3 environment variables for a given property name (e.g. `com.ACME.size`):
This `ConfigSource` searches 3 environment variables for a given property name (e.g. `com.ACME.size`):

1. Exact match (i.e. `com.ACME.size`)
Expand Down
28 changes: 13 additions & 15 deletions spec/src/main/asciidoc/converters.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,26 @@
// Mark Struberg
// Emily Jiang
// John D. Ament
// Gunnar Morling

[[converter]]
== Converter

For providing type-safe configuration we need to convert from the configured Strings into target types.
This happens by providing ``Converter``s in the `Config`.
For providing typeseafe configuration we need to convert from the configured Strings into target types.
This happens by providing `Converter` s in the `Config`.

=== Built-in Converters

The following ``Converter``s are provided by MicroProfile-Config by default:
The following `Converter` s are provided by Microprofile-Config by default:

* `boolean` and `java.lang.Boolean` , values for `true` (case insensitive) "true", "1", "YES", "Y" "ON".
* `boolean` and `Boolean` , values for `true` (case insensitive) "true", "1", "YES", "Y" "ON".
Any other value will be interpreted as `false`
* `byte` and `java.lang.Byte`
* `short` and `java.lang.Short`
* `int` and `java.lang.Integer`
* `long` and `java.lang.Long`
* `float` and `java.lang.Float` , a dot '.' is used to separate the fractional digits
* `double` and `java.lang.Double` , a dot '.' is used to separate the fractional digits
* `char` and `java.lang.Character`
* `java.lang.Class` based on the result of `Class.forName`
* `int` and `Integer`
* `long` and `Long`
* `float` and `Float` , a dot '.' is used to separate the fractional digits
* `double` and `Double` , a dot '.' is used to separate the fractional digits
* `Class` based on the result of `Class.forName`

All built-in ``Converter``s have the `@Priority` of `1`.
All built-in `Converter` have the `@Priority` of `1`.


=== Adding custom Converters
Expand Down Expand Up @@ -88,9 +84,11 @@ e.g. With this config `myPets=dog,cat,dog\\,cat`, the values as an array will be
myPets will be "dog", "cat", "dog,cat" as an array, List or Set.

=== Automatic Converters
If no built-in nor custom `Converter` exists for a requested Type `T`, an implicit `Converter` is automatically provided if the following conditions are met:

If no built-in nor custom `Converter` for a requested Type `T`, an implicit Converter is automatically provided if the following conditions are met:

* The target type {@code T} has a {@code public static T of(String)} method, or
* The target type {@code T} has a {@code public static T valueOf(String)} method, or
* The target type {@code T} has a public Constructor with a String parameter, or
* The target type {@code T} has a {@code public static T parse(CharSequence)} method

49 changes: 49 additions & 0 deletions spec/src/main/asciidoc/microprofile-config-spec.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//
// Copyright (c) 2016-2017 Eclipse Microprofile Contributors:
// Mark Struberg
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

= Configuration for Microprofile
:authors: Mark Struberg, Emily Jiang, John D. Ament
:email: struberg@apache.org, emijiang@uk.ibm.com, john.d.ament@gmail.com
:version-label!:
:sectanchors:
:doctype: book
:license: Apache License v2.0
:source-highlighter: coderay
:toc: left
:toclevels: 4
:sectnumlevels: 4
ifdef::backend-pdf[]
:pagenums:
endif::[]


include::license-alv2.asciidoc[]

== Microprofile Config


include::architecture.asciidoc[]

include::configexamples.asciidoc[]

include::configprovider.asciidoc[]

include::configsources.asciidoc[]

include::converters.asciidoc[]

include::release_notes.asciidoc[]
2 changes: 1 addition & 1 deletion tck/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<!-- This is just for now and will not work if the API has a separate release cycle than the rest. -->
<groupId>org.eclipse.microprofile.config</groupId>
<artifactId>microprofile-config-parent</artifactId>
<version>1.3</version>
<version>1.4-SNAPSHOT</version>
</parent>

<groupId>org.eclipse.microprofile.config</groupId>
Expand Down
Loading

0 comments on commit 89fa224

Please sign in to comment.