You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tamaya.apache.org by an...@apache.org on 2016/07/15 12:04:41 UTC
[15/21] incubator-tamaya git commit: - Minimalized current API for
further discussions.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/code/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertySourceProvider.java
----------------------------------------------------------------------
diff --git a/code/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertySourceProvider.java b/code/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertySourceProvider.java
deleted file mode 100644
index 5706478..0000000
--- a/code/core/src/test/java/org/apache/tamaya/core/testdata/TestPropertySourceProvider.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-package org.apache.tamaya.core.testdata;
-
-import org.apache.tamaya.core.propertysource.BasePropertySource;
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertySourceProvider;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Test provider reading properties from classpath:cfg/final/**.properties.
- */
-public class TestPropertySourceProvider implements PropertySourceProvider {
-
- private List<PropertySource> list = new ArrayList<>();
-
- public TestPropertySourceProvider(){
- list.add(new MyPropertySource());
- list = Collections.unmodifiableList(list);
- }
-
- @Override
- public Collection<PropertySource> getPropertySources() {
- return list;
- }
-
- private static class MyPropertySource extends BasePropertySource {
-
- private Map<String, String> properties = new HashMap<>();
-
- public MyPropertySource() {
- super(200);
- properties.put("name", "Robin");
- properties.put("name3", "Lukas");
- properties.put("name4", "Sereina");
- properties.put("name5", "Benjamin");
- properties = Collections.unmodifiableMap(properties);
- }
-
- @Override
- public String getName() {
- return "final-testdata-properties";
- }
-
- @Override
- public Map<String, String> getProperties() {
- return properties;
- }
-
- @Override
- public boolean isScannable() {
- return true;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/code/core/src/test/java/org/apache/tamaya/core/testdata/TestRemovingPropertyFilter.java
----------------------------------------------------------------------
diff --git a/code/core/src/test/java/org/apache/tamaya/core/testdata/TestRemovingPropertyFilter.java b/code/core/src/test/java/org/apache/tamaya/core/testdata/TestRemovingPropertyFilter.java
deleted file mode 100644
index 7a5b7a8..0000000
--- a/code/core/src/test/java/org/apache/tamaya/core/testdata/TestRemovingPropertyFilter.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you 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.
- */
-package org.apache.tamaya.core.testdata;
-
-import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.spi.FilterContext;
-import org.apache.tamaya.spi.PropertyFilter;
-
-import javax.annotation.Priority;
-
-/**
- * Simple PropertyFilter that filters exact one value, registered using ServiceLoader.
- */
-@Priority(200)
-public class TestRemovingPropertyFilter implements PropertyFilter{
- @Override
- public String filterProperty(String valueToBeFiltered, FilterContext context) {
- if("name5".equals(context.getKey())){
- return null;
- }
- else if("name3".equals(context.getKey())){
- return "Mapped to name: " + ConfigurationProvider.getConfiguration().get("name");
- }
- return valueToBeFiltered;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/code/core/src/test/resources/META-INF/javaconfiguration.properties
----------------------------------------------------------------------
diff --git a/code/core/src/test/resources/META-INF/javaconfiguration.properties b/code/core/src/test/resources/META-INF/javaconfiguration.properties
deleted file mode 100644
index 33beabb..0000000
--- a/code/core/src/test/resources/META-INF/javaconfiguration.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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.
-
-confkey1=javaconf-value1
-confkey2=javaconf-value2
-confkey3=javaconf-value3
-confkey4=javaconf-value4
-confkey5=javaconf-value5
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/code/core/src/test/resources/META-INF/services/org.apache.tamaya.builder.spi.PropertyConverter
----------------------------------------------------------------------
diff --git a/code/core/src/test/resources/META-INF/services/org.apache.tamaya.builder.spi.PropertyConverter b/code/core/src/test/resources/META-INF/services/org.apache.tamaya.builder.spi.PropertyConverter
new file mode 100644
index 0000000..d039696
--- /dev/null
+++ b/code/core/src/test/resources/META-INF/services/org.apache.tamaya.builder.spi.PropertyConverter
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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 current 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.
+#
+org.apache.tamaya.core.internal.CTestConverter
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/code/core/src/test/resources/META-INF/services/org.apache.tamaya.core.internal.DefaultServiceContextTest$InvalidPriorityInterface
----------------------------------------------------------------------
diff --git a/code/core/src/test/resources/META-INF/services/org.apache.tamaya.core.internal.DefaultServiceContextTest$InvalidPriorityInterface b/code/core/src/test/resources/META-INF/services/org.apache.tamaya.core.internal.DefaultServiceContextTest$InvalidPriorityInterface
deleted file mode 100644
index f203fa6..0000000
--- a/code/core/src/test/resources/META-INF/services/org.apache.tamaya.core.internal.DefaultServiceContextTest$InvalidPriorityInterface
+++ /dev/null
@@ -1,18 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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.
-org.apache.tamaya.core.internal.DefaultServiceContextTest$InvalidPriorityImpl1
-org.apache.tamaya.core.internal.DefaultServiceContextTest$InvalidPriorityImpl2
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/code/core/src/test/resources/META-INF/services/org.apache.tamaya.core.internal.DefaultServiceContextTest$MultiImplsInterface
----------------------------------------------------------------------
diff --git a/code/core/src/test/resources/META-INF/services/org.apache.tamaya.core.internal.DefaultServiceContextTest$MultiImplsInterface b/code/core/src/test/resources/META-INF/services/org.apache.tamaya.core.internal.DefaultServiceContextTest$MultiImplsInterface
deleted file mode 100644
index b144790..0000000
--- a/code/core/src/test/resources/META-INF/services/org.apache.tamaya.core.internal.DefaultServiceContextTest$MultiImplsInterface
+++ /dev/null
@@ -1,20 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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.
-
-org.apache.tamaya.core.internal.DefaultServiceContextTest$MultiImpl1
-org.apache.tamaya.core.internal.DefaultServiceContextTest$MultiImpl2
-org.apache.tamaya.core.internal.DefaultServiceContextTest$MultiImpl3
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/code/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
----------------------------------------------------------------------
diff --git a/code/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter b/code/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
deleted file mode 100644
index d039696..0000000
--- a/code/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyConverter
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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 current 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.
-#
-org.apache.tamaya.core.internal.CTestConverter
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/code/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyFilter
----------------------------------------------------------------------
diff --git a/code/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyFilter b/code/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyFilter
deleted file mode 100644
index 18e61cb..0000000
--- a/code/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertyFilter
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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 current 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.
-#
-org.apache.tamaya.core.testdata.TestPropertyFilter
-org.apache.tamaya.core.testdata.TestRemovingPropertyFilter
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/code/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
----------------------------------------------------------------------
diff --git a/code/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource b/code/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
deleted file mode 100644
index 409c9cb..0000000
--- a/code/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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 current 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.
-#
-org.apache.tamaya.core.testdata.TestPropertyDefaultSource
-org.apache.tamaya.core.propertysource.SystemPropertySource
-org.apache.tamaya.core.propertysource.EnvironmentPropertySource
-org.apache.tamaya.core.internal.converters.ConverterTestsPropertySource
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/code/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
----------------------------------------------------------------------
diff --git a/code/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider b/code/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
deleted file mode 100644
index 9c352f4..0000000
--- a/code/core/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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 current 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.
-#
-org.apache.tamaya.core.testdata.TestPropertySourceProvider
-org.apache.tamaya.core.provider.JavaConfigurationProvider
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/code/core/src/test/resources/overrideOrdinal.properties
----------------------------------------------------------------------
diff --git a/code/core/src/test/resources/overrideOrdinal.properties b/code/core/src/test/resources/overrideOrdinal.properties
deleted file mode 100644
index 96935a8..0000000
--- a/code/core/src/test/resources/overrideOrdinal.properties
+++ /dev/null
@@ -1,25 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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.
-
-#override ordinal
-tamaya.ordinal=16784
-
-mykey1=myval1
-mykey2=myval2
-mykey3=myval3
-mykey4=myval4
-mykey5=myval5
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/code/core/src/test/resources/testfile.properties
----------------------------------------------------------------------
diff --git a/code/core/src/test/resources/testfile.properties b/code/core/src/test/resources/testfile.properties
deleted file mode 100644
index abd7ee8..0000000
--- a/code/core/src/test/resources/testfile.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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.
-
-key1=val1
-key2=val2
-key3=val3
-key4=val4
-key5=val5
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/code/core/src/test/resources/x34.properties
----------------------------------------------------------------------
diff --git a/code/core/src/test/resources/x34.properties b/code/core/src/test/resources/x34.properties
deleted file mode 100644
index f2c4a0a..0000000
--- a/code/core/src/test/resources/x34.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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.
-
-x34=x34
-x34.a.b.c=C
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/examples/2-simple-propertysource-example/src/main/resources/META-INF/services/org.apache.tamaya.builder.spi.PropertySource
----------------------------------------------------------------------
diff --git a/examples/2-simple-propertysource-example/src/main/resources/META-INF/services/org.apache.tamaya.builder.spi.PropertySource b/examples/2-simple-propertysource-example/src/main/resources/META-INF/services/org.apache.tamaya.builder.spi.PropertySource
new file mode 100644
index 0000000..cce39fc
--- /dev/null
+++ b/examples/2-simple-propertysource-example/src/main/resources/META-INF/services/org.apache.tamaya.builder.spi.PropertySource
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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 current 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.
+#
+org.apache.tamaya.examples.simple.SimplePropertySource
+org.apache.tamaya.builder.propertysource.EnvironmentPropertySource
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/examples/2-simple-propertysource-example/src/main/resources/META-INF/services/org.apache.tamaya.builder.spi.PropertySourceProvider
----------------------------------------------------------------------
diff --git a/examples/2-simple-propertysource-example/src/main/resources/META-INF/services/org.apache.tamaya.builder.spi.PropertySourceProvider b/examples/2-simple-propertysource-example/src/main/resources/META-INF/services/org.apache.tamaya.builder.spi.PropertySourceProvider
new file mode 100644
index 0000000..f9ed0ab
--- /dev/null
+++ b/examples/2-simple-propertysource-example/src/main/resources/META-INF/services/org.apache.tamaya.builder.spi.PropertySourceProvider
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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 current 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.
+#
+org.apache.tamaya.examples.simple.SimplePropertySourceProvider
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/examples/2-simple-propertysource-example/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
----------------------------------------------------------------------
diff --git a/examples/2-simple-propertysource-example/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource b/examples/2-simple-propertysource-example/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
deleted file mode 100644
index 33988a7..0000000
--- a/examples/2-simple-propertysource-example/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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 current 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.
-#
-org.apache.tamaya.examples.simple.SimplePropertySource
-org.apache.tamaya.core.propertysource.EnvironmentPropertySource
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/examples/2-simple-propertysource-example/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
----------------------------------------------------------------------
diff --git a/examples/2-simple-propertysource-example/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider b/examples/2-simple-propertysource-example/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
deleted file mode 100644
index f9ed0ab..0000000
--- a/examples/2-simple-propertysource-example/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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 current 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.
-#
-org.apache.tamaya.examples.simple.SimplePropertySourceProvider
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/examples/3-resources-example/src/main/resources/META-INF/services/org.apache.tamaya.builder.spi.PropertySourceProvider
----------------------------------------------------------------------
diff --git a/examples/3-resources-example/src/main/resources/META-INF/services/org.apache.tamaya.builder.spi.PropertySourceProvider b/examples/3-resources-example/src/main/resources/META-INF/services/org.apache.tamaya.builder.spi.PropertySourceProvider
new file mode 100644
index 0000000..499756d
--- /dev/null
+++ b/examples/3-resources-example/src/main/resources/META-INF/services/org.apache.tamaya.builder.spi.PropertySourceProvider
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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 current 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.
+#
+org.apache.tamaya.examples.items.MyPathPropertySourceProvider
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/examples/3-resources-example/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
----------------------------------------------------------------------
diff --git a/examples/3-resources-example/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider b/examples/3-resources-example/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
deleted file mode 100644
index 499756d..0000000
--- a/examples/3-resources-example/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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 current 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.
-#
-org.apache.tamaya.examples.items.MyPathPropertySourceProvider
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/examples/6-fileobserver-example/src/test/resources/META-INF/services/org.apache.tamaya.builder.spi.PropertySourceProvider
----------------------------------------------------------------------
diff --git a/examples/6-fileobserver-example/src/test/resources/META-INF/services/org.apache.tamaya.builder.spi.PropertySourceProvider b/examples/6-fileobserver-example/src/test/resources/META-INF/services/org.apache.tamaya.builder.spi.PropertySourceProvider
new file mode 100644
index 0000000..7484bcd
--- /dev/null
+++ b/examples/6-fileobserver-example/src/test/resources/META-INF/services/org.apache.tamaya.builder.spi.PropertySourceProvider
@@ -0,0 +1,20 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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 current 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.
+#
+org.aspache.tamaya.examples.fileobserver.TestObservingProvider
+
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/examples/6-fileobserver-example/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
----------------------------------------------------------------------
diff --git a/examples/6-fileobserver-example/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider b/examples/6-fileobserver-example/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
deleted file mode 100644
index 7484bcd..0000000
--- a/examples/6-fileobserver-example/src/test/resources/META-INF/services/org.apache.tamaya.spi.PropertySourceProvider
+++ /dev/null
@@ -1,20 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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 current 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.
-#
-org.aspache.tamaya.examples.fileobserver.TestObservingProvider
-
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/examples/8-remote-example/client/src/main/resources/META-INF/services/org.apache.tamaya.builder.spi.PropertySource
----------------------------------------------------------------------
diff --git a/examples/8-remote-example/client/src/main/resources/META-INF/services/org.apache.tamaya.builder.spi.PropertySource b/examples/8-remote-example/client/src/main/resources/META-INF/services/org.apache.tamaya.builder.spi.PropertySource
new file mode 100644
index 0000000..a2a4042
--- /dev/null
+++ b/examples/8-remote-example/client/src/main/resources/META-INF/services/org.apache.tamaya.builder.spi.PropertySource
@@ -0,0 +1,19 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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 current 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.
+#
+#org.apache.tamaya.examples.remote.client.RemotePropertySource
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/examples/8-remote-example/client/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
----------------------------------------------------------------------
diff --git a/examples/8-remote-example/client/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource b/examples/8-remote-example/client/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
deleted file mode 100644
index a2a4042..0000000
--- a/examples/8-remote-example/client/src/main/resources/META-INF/services/org.apache.tamaya.spi.PropertySource
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you 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 current 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.
-#
-#org.apache.tamaya.examples.remote.client.RemotePropertySource
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/jqassistant/default.xml
----------------------------------------------------------------------
diff --git a/jqassistant/default.xml b/jqassistant/default.xml
index c35ec68..eba0d68 100644
--- a/jqassistant/default.xml
+++ b/jqassistant/default.xml
@@ -26,7 +26,7 @@ under the License.
(t:Type)-[:IMPLEMENTS*]->(i:Type)
WHERE
- i.fqn='org.apache.tamaya.spi.PropertyConverter'
+ i.fqn='PropertyConverter'
AND NOT t:Anonymous:Inner
AND NOT t.name =~ '.*Converter'
@@ -43,7 +43,7 @@ under the License.
(t:Type)-[:IMPLEMENTS*]->(i:Type)
WHERE
- i.fqn='org.apache.tamaya.spi.PropertyFilter'
+ i.fqn='PropertyFilter'
AND NOT t:Anonymous:Inner
AND NOT t.name =~ '.*Filter'
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/jqassistant/serviceloader-rules.xml
----------------------------------------------------------------------
diff --git a/jqassistant/serviceloader-rules.xml b/jqassistant/serviceloader-rules.xml
index 6c69b11..f3f1656 100644
--- a/jqassistant/serviceloader-rules.xml
+++ b/jqassistant/serviceloader-rules.xml
@@ -76,7 +76,7 @@ under the License.
AND NOT impl.fqn IN [// All classes of the builder MUST not use the SPI mechanism
'org.apache.tamaya.builder.ProgrammaticConfigurationContext'
// See TAMAYA-77 and TAMAYA-78, Oliver B. Fischer, 2015-04-25
- // 'org.apache.tamaya.core.internal.DefaultConfigurationContextBuilder'
+ // 'DefaultConfigurationContextBuilder'
]
RETURN
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/modules/builder/src/main/java/org/apache/tamaya/builder/ConfigurationBuilder.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/ConfigurationBuilder.java b/modules/builder/src/main/java/org/apache/tamaya/builder/ConfigurationBuilder.java
index afdc121..6188f83 100644
--- a/modules/builder/src/main/java/org/apache/tamaya/builder/ConfigurationBuilder.java
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/ConfigurationBuilder.java
@@ -20,16 +20,16 @@ package org.apache.tamaya.builder;
import org.apache.tamaya.ConfigException;
import org.apache.tamaya.Configuration;
-import org.apache.tamaya.spi.PropertyConverter;
+import org.apache.tamaya.builder.spi.PropertyConverter;
import org.apache.tamaya.TypeLiteral;
import org.apache.tamaya.format.ConfigurationData;
import org.apache.tamaya.format.ConfigurationFormats;
import org.apache.tamaya.format.FlattenedDefaultPropertySource;
-import org.apache.tamaya.spi.ConfigurationContext;
-import org.apache.tamaya.spi.PropertyFilter;
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertySourceProvider;
-import org.apache.tamaya.spi.PropertyValueCombinationPolicy;
+import org.apache.tamaya.builder.spi.ConfigurationContext;
+import org.apache.tamaya.builder.spi.PropertyFilter;
+import org.apache.tamaya.builder.spi.PropertySource;
+import org.apache.tamaya.builder.spi.PropertySourceProvider;
+import org.apache.tamaya.builder.spi.PropertyValueCombinationPolicy;
import org.apache.tamaya.spisupport.DefaultConfiguration;
import java.io.IOException;
@@ -69,8 +69,8 @@ import static java.lang.String.format;
*
* The configuration builder allows you to put property resources
* via a URL, as shown in the code example above, without implementing
- * a {@link org.apache.tamaya.spi.PropertySource PropertySource} or providing an
- * instance of a {@link org.apache.tamaya.spi.PropertySource PropertySource}.
+ * a {@link PropertySource PropertySource} or providing an
+ * instance of a {@link PropertySource PropertySource}.
* If a property resource in
* a specific format can be added to configuration builder or not depends
* on the available implementations of
@@ -269,7 +269,7 @@ public class ConfigurationBuilder {
*
* @return the builder instance currently used
*
- * @see org.apache.tamaya.spi.PropertySource
+ * @see PropertySource
*/
public ConfigurationBuilder addPropertySources(PropertySource... sources){
checkBuilderState();
@@ -297,7 +297,7 @@ public class ConfigurationBuilder {
*
* @return the builder instance currently used
*
- * @see org.apache.tamaya.spi.PropertySourceProvider
+ * @see PropertySourceProvider
*/
public ConfigurationBuilder addPropertySourceProviders(PropertySourceProvider... providers){
contextBuilder.addPropertySourceProviders(providers);
@@ -318,7 +318,7 @@ public class ConfigurationBuilder {
*
* @return the builder instance currently used
*
- * @see org.apache.tamaya.spi.PropertyFilter
+ * @see PropertyFilter
* @see #disableProvidedPropertyFilters()
* @see #enabledProvidedPropertyFilters()
*/
@@ -355,7 +355,7 @@ public class ConfigurationBuilder {
*
* @return the builder instance currently used
*
- * @see org.apache.tamaya.spi.PropertyConverter
+ * @see PropertyConverter
* @see #enableProvidedPropertyConverters()
* @see #disableProvidedPropertyConverters()
*/
@@ -381,7 +381,7 @@ public class ConfigurationBuilder {
}
/**
- * Checks if the automatic loading of all {@link org.apache.tamaya.spi.PropertyConverter
+ * Checks if the automatic loading of all {@link PropertyConverter
* PropertyConverter} service providers is enabled or disabled.
*
* @return {@code true} if the automatic loading is enabled,
@@ -389,20 +389,20 @@ public class ConfigurationBuilder {
*
* @see #enableProvidedPropertyConverters()
* @see #disableProvidedPropertyConverters()
- * @see #addPropertyConverter(Class, org.apache.tamaya.spi.PropertyConverter)
- * @see #addPropertyConverter(org.apache.tamaya.TypeLiteral, org.apache.tamaya.spi.PropertyConverter)
+ * @see #addPropertyConverter(Class, PropertyConverter)
+ * @see #addPropertyConverter(org.apache.tamaya.TypeLiteral, PropertyConverter)
*/
public boolean isPropertyConverterLoadingEnabled() {
return loadProvidedPropertyConverters;
}
/**
- * Enables the loading of all {@link org.apache.tamaya.spi.PropertyConverter}
+ * Enables the loading of all {@link PropertyConverter}
* service providers.
*
* @return the builder instance currently used
*
- * @see org.apache.tamaya.spi.PropertyConverter
+ * @see PropertyConverter
* @see #disableProvidedPropertyConverters()
* @see #enableProvidedPropertyConverters()
*/
@@ -415,14 +415,14 @@ public class ConfigurationBuilder {
}
/**
- * Disables the automatic loading of all {@link org.apache.tamaya.spi.PropertyConverter}
+ * Disables the automatic loading of all {@link PropertyConverter}
* service providers.
*
* @return the builder instance currently used
*
- * @see org.apache.tamaya.spi.PropertyConverter
+ * @see PropertyConverter
* @see #enableProvidedPropertyConverters()
- * @see #addPropertyConverter(Class, org.apache.tamaya.spi.PropertyConverter)
+ * @see #addPropertyConverter(Class, PropertyConverter)
*/
public ConfigurationBuilder disableProvidedPropertyConverters() {
checkBuilderState();
@@ -434,12 +434,12 @@ public class ConfigurationBuilder {
/**
- * Enables the automatic loading of all {@link org.apache.tamaya.spi.PropertySource}
+ * Enables the automatic loading of all {@link PropertySource}
* service providers.
*
* @return the builder instance currently used
*
- * @see org.apache.tamaya.spi.PropertySource
+ * @see PropertySource
* @see #disableProvidedPropertySources()
*/
public ConfigurationBuilder enableProvidedPropertySources() {
@@ -451,7 +451,7 @@ public class ConfigurationBuilder {
}
/**
- * Checks if the automatic loading of all {@link org.apache.tamaya.spi.PropertySource
+ * Checks if the automatic loading of all {@link PropertySource
* PropertySource} service providers is enabled or disabled.
*
* @return {@code true} if the automatic loading is enabled,
@@ -463,7 +463,7 @@ public class ConfigurationBuilder {
/**
- * Checks if the automatic loading of all {@link org.apache.tamaya.spi.PropertyFilter
+ * Checks if the automatic loading of all {@link PropertyFilter
* PropertyFilter} service providers is enabled or disabled.
*
* @return {@code true} if the automatic loading is enabled,
@@ -474,14 +474,14 @@ public class ConfigurationBuilder {
}
/**
- * Enables the automatic loading of all {@link org.apache.tamaya.spi.PropertyFilter}
+ * Enables the automatic loading of all {@link PropertyFilter}
* service providers.
*
* @return the builder instance currently used
*
- * @see org.apache.tamaya.spi.PropertyFilter
+ * @see PropertyFilter
* @see #disableProvidedPropertyFilters()
- * @see #addPropertyFilters(org.apache.tamaya.spi.PropertyFilter...)
+ * @see #addPropertyFilters(PropertyFilter...)
*/
public ConfigurationBuilder enabledProvidedPropertyFilters() {
checkBuilderState();
@@ -492,12 +492,12 @@ public class ConfigurationBuilder {
}
/**
- * Disables the automatic loading of all {@link org.apache.tamaya.spi.PropertyFilter}
+ * Disables the automatic loading of all {@link PropertyFilter}
* service providers.
*
- * @see org.apache.tamaya.spi.PropertyFilter
+ * @see PropertyFilter
* @see #enabledProvidedPropertyFilters()
- * @see #addPropertyFilters(org.apache.tamaya.spi.PropertyFilter...)
+ * @see #addPropertyFilters(PropertyFilter...)
*
* @return the builder instance currently used
*/
@@ -510,12 +510,12 @@ public class ConfigurationBuilder {
}
/**
- * Disables the automatic loading of all {@link org.apache.tamaya.spi.PropertySource}
+ * Disables the automatic loading of all {@link PropertySource}
* service providers.
*
* @return the builder instance currently used
*
- * @see org.apache.tamaya.spi.PropertySource
+ * @see PropertySource
* @see #enableProvidedPropertySources()
*/
public ConfigurationBuilder disableProvidedPropertySources() {
@@ -527,12 +527,12 @@ public class ConfigurationBuilder {
}
/**
- * Enables the automatic loading of {@link org.apache.tamaya.spi.PropertySourceProvider
+ * Enables the automatic loading of {@link PropertySourceProvider
* property source providers} provided via the SPI API.
*
* @return the builder instance currently used
*
- * @see org.apache.tamaya.spi.PropertySourceProvider
+ * @see PropertySourceProvider
*/
public ConfigurationBuilder enableProvidedPropertySourceProviders() {
checkBuilderState();
@@ -543,7 +543,7 @@ public class ConfigurationBuilder {
}
/**
- * Disables the automatic loading of {@link org.apache.tamaya.spi.PropertySourceProvider
+ * Disables the automatic loading of {@link PropertySourceProvider
* property source providers} provided via the SPI API.
*
* @return the builder instance currently used
@@ -557,7 +557,7 @@ public class ConfigurationBuilder {
}
/**
- * Checks if the automatic loading of {@link org.apache.tamaya.spi.PropertySourceProvider
+ * Checks if the automatic loading of {@link PropertySourceProvider
* PropertySourceProviders} is enabled or disabled.
*
* @return {@code true} if the automatic loading is enabled,
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/modules/builder/src/main/java/org/apache/tamaya/builder/ProgrammaticConfigurationContext.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/ProgrammaticConfigurationContext.java b/modules/builder/src/main/java/org/apache/tamaya/builder/ProgrammaticConfigurationContext.java
index 68e770d..05acdc3 100644
--- a/modules/builder/src/main/java/org/apache/tamaya/builder/ProgrammaticConfigurationContext.java
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/ProgrammaticConfigurationContext.java
@@ -19,15 +19,15 @@
package org.apache.tamaya.builder;
-import org.apache.tamaya.spi.PropertyConverter;
+import org.apache.tamaya.builder.spi.PropertyConverter;
import org.apache.tamaya.TypeLiteral;
-import org.apache.tamaya.spi.ConfigurationContext;
-import org.apache.tamaya.spi.ConfigurationContextBuilder;
-import org.apache.tamaya.spi.PropertyFilter;
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertySourceProvider;
-import org.apache.tamaya.spi.PropertyValueCombinationPolicy;
-import org.apache.tamaya.spi.ServiceContextManager;
+import org.apache.tamaya.builder.spi.ConfigurationContext;
+import org.apache.tamaya.builder.spi.ConfigurationContextBuilder;
+import org.apache.tamaya.builder.spi.PropertyFilter;
+import org.apache.tamaya.builder.spi.PropertySource;
+import org.apache.tamaya.builder.spi.PropertySourceProvider;
+import org.apache.tamaya.builder.spi.PropertyValueCombinationPolicy;
+import org.apache.tamaya.builder.spi.ServiceContextManager;
import org.apache.tamaya.spisupport.PriorityServiceComparator;
import org.apache.tamaya.spisupport.PropertyConverterManager;
import org.apache.tamaya.spisupport.PropertySourceComparator;
@@ -40,7 +40,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.logging.Logger;
/**
- * Implementation of the {@link org.apache.tamaya.spi.ConfigurationContext}
+ * Implementation of the {@link ConfigurationContext}
* used by the {@link org.apache.tamaya.builder.ConfigurationBuilder}
* internally.
*/
@@ -53,17 +53,17 @@ class ProgrammaticConfigurationContext implements ConfigurationContext {
*/
private final static Logger LOG = Logger.getLogger(ProgrammaticConfigurationContext.class.getName());
/**
- * Cubcomponent handling {@link org.apache.tamaya.spi.PropertyConverter} instances.
+ * Cubcomponent handling {@link PropertyConverter} instances.
*/
private PropertyConverterManager propertyConverterManager = new PropertyConverterManager();
/**
- * The current unmodifiable list of loaded {@link org.apache.tamaya.spi.PropertySource} instances.
+ * The current unmodifiable list of loaded {@link PropertySource} instances.
*/
private List<PropertySource> immutablePropertySources = new ArrayList<>();
/**
- * The current unmodifiable list of loaded {@link org.apache.tamaya.spi.PropertyFilter} instances.
+ * The current unmodifiable list of loaded {@link PropertyFilter} instances.
*/
private List<PropertyFilter> immutablePropertyFilters = new ArrayList<>();
@@ -81,8 +81,8 @@ class ProgrammaticConfigurationContext implements ConfigurationContext {
/**
* The first time the Configuration system gets invoked we do initialize
- * all our {@link org.apache.tamaya.spi.PropertySource}s and
- * {@link org.apache.tamaya.spi.PropertyFilter}s which are known at startup.
+ * all our {@link PropertySource}s and
+ * {@link PropertyFilter}s which are known at startup.
*/
@SuppressWarnings("unchecked")
public ProgrammaticConfigurationContext(Builder builder) {
@@ -174,7 +174,7 @@ class ProgrammaticConfigurationContext implements ConfigurationContext {
*/
private int comparePropertySources(PropertySource source1, PropertySource source2) {
- //X TODO this method duplicates org.apache.tamaya.core.internal.DefaultConfigurationContext.PropertySourceComparator.comparePropertySources()
+ //X TODO this method duplicates DefaultConfigurationContext.PropertySourceComparator.comparePropertySources()
//X maybe we should extract the Comperator in an own class for real code-reuse (copy paste == bad code reuse)
if (source1.getOrdinal() < source2.getOrdinal()) {
@@ -195,7 +195,7 @@ class ProgrammaticConfigurationContext implements ConfigurationContext {
*/
private int comparePropertyFilters(PropertyFilter filter1, PropertyFilter filter2) {
- //X TODO this method duplicates org.apache.tamaya.core.internal.DefaultConfigurationContext.PropertySourceComparator.comparePropertyFilters()
+ //X TODO this method duplicates DefaultConfigurationContext.PropertySourceComparator.comparePropertyFilters()
//X maybe we should extract the Comperator in an own class for real code-reuse (copy paste == bad code reuse)
Priority prio1 = filter1.getClass().getAnnotation(Priority.class);
@@ -254,12 +254,12 @@ class ProgrammaticConfigurationContext implements ConfigurationContext {
*/
public final static class Builder {
/**
- * The current unmodifiable list of loaded {@link org.apache.tamaya.spi.PropertySource} instances.
+ * The current unmodifiable list of loaded {@link PropertySource} instances.
*/
private final List<PropertySource> propertySources = new ArrayList<>();
/**
- * The current unmodifiable list of loaded {@link org.apache.tamaya.spi.PropertyFilter} instances.
+ * The current unmodifiable list of loaded {@link PropertyFilter} instances.
*/
private final List<PropertyFilter> propertyFilters = new ArrayList<>();
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/modules/builder/src/main/java/org/apache/tamaya/builder/PropertySourceBuilder.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/PropertySourceBuilder.java b/modules/builder/src/main/java/org/apache/tamaya/builder/PropertySourceBuilder.java
index 481a80c..e880fb4 100644
--- a/modules/builder/src/main/java/org/apache/tamaya/builder/PropertySourceBuilder.java
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/PropertySourceBuilder.java
@@ -18,14 +18,14 @@
*/
package org.apache.tamaya.builder;
-import org.apache.tamaya.spi.PropertySource;
+import org.apache.tamaya.builder.spi.PropertySource;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
- * Simple builder for building a {@link org.apache.tamaya.spi.PropertySource}.
+ * Simple builder for building a {@link PropertySource}.
*/
public final class PropertySourceBuilder {
/** The ordinal to be used. */
@@ -100,8 +100,8 @@ public final class PropertySourceBuilder {
}
/**
- * Creates a new immutable {@link org.apache.tamaya.spi.PropertySource} instance.
- * @return a new immutable {@link org.apache.tamaya.spi.PropertySource} instance, never null.
+ * Creates a new immutable {@link PropertySource} instance.
+ * @return a new immutable {@link PropertySource} instance, never null.
*/
public PropertySource build(){
return new SimplePropertySource(name, properties);
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/modules/builder/src/main/java/org/apache/tamaya/builder/SimplePropertySource.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/SimplePropertySource.java b/modules/builder/src/main/java/org/apache/tamaya/builder/SimplePropertySource.java
index 085bd9a..8218bc8 100644
--- a/modules/builder/src/main/java/org/apache/tamaya/builder/SimplePropertySource.java
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/SimplePropertySource.java
@@ -18,8 +18,8 @@
*/
package org.apache.tamaya.builder;
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertyValue;
+import org.apache.tamaya.builder.spi.PropertySource;
+import org.apache.tamaya.builder.spi.PropertyValue;
import java.util.HashMap;
import java.util.Map;
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/modules/builder/src/main/java/org/apache/tamaya/builder/internal/DefaultConfigurationContext.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/internal/DefaultConfigurationContext.java b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/DefaultConfigurationContext.java
new file mode 100644
index 0000000..cab4a49
--- /dev/null
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/DefaultConfigurationContext.java
@@ -0,0 +1,278 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tamaya.builder.internal;
+
+import org.apache.tamaya.ConfigurationProvider;
+import org.apache.tamaya.TypeLiteral;
+import org.apache.tamaya.builder.spi.ConfigurationContext;
+import org.apache.tamaya.builder.spi.ConfigurationContextBuilder;
+import org.apache.tamaya.builder.spi.PropertyConverter;
+import org.apache.tamaya.builder.spi.PropertyFilter;
+import org.apache.tamaya.builder.spi.PropertySource;
+import org.apache.tamaya.builder.spi.PropertySourceProvider;
+import org.apache.tamaya.builder.spi.PropertyValueCombinationPolicy;
+import org.apache.tamaya.builder.spi.ServiceContextManager;
+
+import javax.annotation.Priority;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import java.util.logging.Logger;
+
+/**
+ * Default Implementation of a simple ConfigurationContext.
+ */
+public class DefaultConfigurationContext implements ConfigurationContext {
+ /** The logger used. */
+ private final static Logger LOG = Logger.getLogger(DefaultConfigurationContext.class.getName());
+ /**
+ * Cubcomponent handling {@link PropertyConverter} instances.
+ */
+ private final PropertyConverterManager propertyConverterManager = new PropertyConverterManager();
+
+ /**
+ * The current unmodifiable list of loaded {@link PropertySource} instances.
+ */
+ private List<PropertySource> immutablePropertySources;
+
+ /**
+ * The current unmodifiable list of loaded {@link PropertyFilter} instances.
+ */
+ private List<PropertyFilter> immutablePropertyFilters;
+
+ /**
+ * The overriding policy used when combining PropertySources registered to evalute the final configuration
+ * values.
+ */
+ private PropertyValueCombinationPolicy propertyValueCombinationPolicy;
+
+ /**
+ * Lock for internal synchronization.
+ */
+ private final ReentrantReadWriteLock propertySourceLock = new ReentrantReadWriteLock();
+
+ /** Comparator used for ordering property sources. */
+ private final PropertySourceComparator propertySourceComparator = new PropertySourceComparator();
+
+ /** Comparator used for ordering property filters. */
+ private final PropertyFilterComparator propertyFilterComparator = new PropertyFilterComparator();
+
+
+ /**
+ * The first time the Configuration system gets invoked we do initialize
+ * all our {@link PropertySource}s and
+ * {@link PropertyFilter}s which are known at startup.
+ */
+ public DefaultConfigurationContext() {
+ List<PropertySource> propertySources = new ArrayList<>();
+
+ // first we load all PropertySources which got registered via java.util.ServiceLoader
+ propertySources.addAll(ServiceContextManager.getServiceContext().getServices(PropertySource.class));
+
+ // after that we add all PropertySources which get dynamically registered via their PropertySourceProviders
+ propertySources.addAll(evaluatePropertySourcesFromProviders());
+
+ // now sort them according to their ordinal values
+ Collections.sort(propertySources, new PropertySourceComparator());
+
+ immutablePropertySources = Collections.unmodifiableList(propertySources);
+ LOG.info("Registered " + immutablePropertySources.size() + " property sources: " +
+ immutablePropertySources);
+
+ // as next step we pick up the PropertyFilters pretty much the same way
+ List<PropertyFilter> propertyFilters = new ArrayList<>();
+ propertyFilters.addAll(ServiceContextManager.getServiceContext().getServices(PropertyFilter.class));
+ Collections.sort(propertyFilters, new PropertyFilterComparator());
+ immutablePropertyFilters = Collections.unmodifiableList(propertyFilters);
+ LOG.info("Registered " + immutablePropertyFilters.size() + " property filters: " +
+ immutablePropertyFilters);
+
+ immutablePropertyFilters = Collections.unmodifiableList(propertyFilters);
+ LOG.info("Registered " + immutablePropertyFilters.size() + " property filters: " +
+ immutablePropertyFilters);
+ propertyValueCombinationPolicy = ServiceContextManager.getServiceContext().getService(PropertyValueCombinationPolicy.class);
+ if(propertyValueCombinationPolicy==null) {
+ propertyValueCombinationPolicy = PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_COLLECTOR;
+ }
+ LOG.info("Using PropertyValueCombinationPolicy: " + propertyValueCombinationPolicy);
+ }
+
+ DefaultConfigurationContext(DefaultConfigurationContextBuilder builder) {
+ List<PropertySource> propertySources = new ArrayList<>();
+ // first we load all PropertySources which got registered via java.util.ServiceLoader
+ propertySources.addAll(builder.propertySources.values());
+ // now sort them according to their ordinal values
+ Collections.sort(propertySources, propertySourceComparator);
+ immutablePropertySources = Collections.unmodifiableList(propertySources);
+ LOG.info("Registered " + immutablePropertySources.size() + " property sources: " +
+ immutablePropertySources);
+
+ // as next step we pick up the PropertyFilters pretty much the same way
+ List<PropertyFilter> propertyFilters = new ArrayList<>();
+ propertyFilters.addAll(ServiceContextManager.getServiceContext().getServices(PropertyFilter.class));
+ Collections.sort(propertyFilters, propertyFilterComparator);
+ immutablePropertyFilters = Collections.unmodifiableList(propertyFilters);
+ LOG.info("Registered " + immutablePropertyFilters.size() + " property filters: " +
+ immutablePropertyFilters);
+
+ propertyValueCombinationPolicy = builder.combinationPolicy;
+ if(propertyValueCombinationPolicy==null){
+ propertyValueCombinationPolicy = ServiceContextManager.getServiceContext().getService(PropertyValueCombinationPolicy.class);
+ }
+ if(propertyValueCombinationPolicy==null){
+ propertyValueCombinationPolicy = PropertyValueCombinationPolicy.DEFAULT_OVERRIDING_COLLECTOR;
+ }
+ LOG.info("Using PropertyValueCombinationPolicy: " + propertyValueCombinationPolicy);
+ }
+
+ /**
+ * Pick up all {@link PropertySourceProvider}s and return all the
+ * {@link PropertySource}s they like to register.
+ */
+ private Collection<? extends PropertySource> evaluatePropertySourcesFromProviders() {
+ List<PropertySource> propertySources = new ArrayList<>();
+ Collection<PropertySourceProvider> propertySourceProviders = ServiceContextManager.getServiceContext().getServices(PropertySourceProvider.class);
+ for (PropertySourceProvider propertySourceProvider : propertySourceProviders) {
+ Collection<PropertySource> sources = propertySourceProvider.getPropertySources();
+ LOG.finer("PropertySourceProvider " + propertySourceProvider.getClass().getName() +
+ " provided the following property sources: " + sources);
+ propertySources.addAll(sources);
+ }
+
+ return propertySources;
+ }
+
+ @Override
+ public void addPropertySources(PropertySource... propertySourcesToAdd) {
+ Lock writeLock = propertySourceLock.writeLock();
+ try {
+ writeLock.lock();
+ List<PropertySource> newPropertySources = new ArrayList<>(this.immutablePropertySources);
+ newPropertySources.addAll(Arrays.asList(propertySourcesToAdd));
+ Collections.sort(newPropertySources, new PropertySourceComparator());
+
+ this.immutablePropertySources = Collections.unmodifiableList(newPropertySources);
+ } finally {
+ writeLock.unlock();
+ }
+ }
+
+ private static class PropertySourceComparator implements Comparator<PropertySource>, Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Order property source reversely, the most important come first.
+ *
+ * @param source1 the first PropertySource
+ * @param source2 the second PropertySource
+ * @return the comparison result.
+ */
+ private int comparePropertySources(PropertySource source1, PropertySource source2) {
+ if (source1.getOrdinal() < source2.getOrdinal()) {
+ return -1;
+ } else if (source1.getOrdinal() > source2.getOrdinal()) {
+ return 1;
+ } else {
+ return source1.getClass().getName().compareTo(source2.getClass().getName());
+ }
+ }
+
+ @Override
+ public int compare(PropertySource source1, PropertySource source2) {
+ return comparePropertySources(source1, source2);
+ }
+ }
+
+ private static class PropertyFilterComparator implements Comparator<PropertyFilter>, Serializable{
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Compare 2 filters for ordering the filter chain.
+ *
+ * @param filter1 the first filter
+ * @param filter2 the second filter
+ * @return the comparison result
+ */
+ private int comparePropertyFilters(PropertyFilter filter1, PropertyFilter filter2) {
+ Priority prio1 = filter1.getClass().getAnnotation(Priority.class);
+ Priority prio2 = filter2.getClass().getAnnotation(Priority.class);
+ int ord1 = prio1 != null ? prio1.value() : 0;
+ int ord2 = prio2 != null ? prio2.value() : 0;
+
+ if (ord1 < ord2) {
+ return -1;
+ } else if (ord1 > ord2) {
+ return 1;
+ } else {
+ return filter1.getClass().getName().compareTo(filter2.getClass().getName());
+ }
+ }
+
+ @Override
+ public int compare(PropertyFilter filter1, PropertyFilter filter2) {
+ return comparePropertyFilters(filter1, filter2);
+ }
+ }
+
+ @Override
+ public List<PropertySource> getPropertySources() {
+ return immutablePropertySources;
+ }
+
+ @Override
+ public <T> void addPropertyConverter(TypeLiteral<T> typeToConvert, PropertyConverter<T> propertyConverter) {
+ propertyConverterManager.register(typeToConvert, propertyConverter);
+ LOG.info("Added PropertyConverter: " + propertyConverter.getClass().getName());
+ }
+
+ @Override
+ public Map<TypeLiteral<?>, List<PropertyConverter<?>>> getPropertyConverters() {
+ return propertyConverterManager.getPropertyConverters();
+ }
+
+ @Override
+ public <T> List<PropertyConverter<T>> getPropertyConverters(TypeLiteral<T> targetType) {
+ return propertyConverterManager.getPropertyConverters(targetType);
+ }
+
+ @Override
+ public List<PropertyFilter> getPropertyFilters() {
+ return immutablePropertyFilters;
+ }
+
+ @Override
+ public PropertyValueCombinationPolicy getPropertyValueCombinationPolicy(){
+ return propertyValueCombinationPolicy;
+ }
+
+ @Override
+ public ConfigurationContextBuilder toBuilder() {
+ return ConfigurationProvider.getConfigurationContextBuilder().setContext(this);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/modules/builder/src/main/java/org/apache/tamaya/builder/internal/DefaultConfigurationContextBuilder.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/internal/DefaultConfigurationContextBuilder.java b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/DefaultConfigurationContextBuilder.java
new file mode 100644
index 0000000..56a3379
--- /dev/null
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/DefaultConfigurationContextBuilder.java
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tamaya.builder.internal;
+
+import org.apache.tamaya.ConfigException;
+import org.apache.tamaya.builder.spi.PropertyConverter;
+import org.apache.tamaya.TypeLiteral;
+import org.apache.tamaya.builder.spi.ConfigurationContext;
+import org.apache.tamaya.builder.spi.ConfigurationContextBuilder;
+import org.apache.tamaya.builder.spi.PropertyFilter;
+import org.apache.tamaya.builder.spi.PropertySource;
+import org.apache.tamaya.builder.spi.PropertyValueCombinationPolicy;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * Default implementation of {@link ConfigurationContextBuilder}.
+ */
+public class DefaultConfigurationContextBuilder implements ConfigurationContextBuilder {
+
+ final Map<String, PropertySource> propertySources = new HashMap<>();
+ final List<PropertyFilter> propertyFilters = new ArrayList<>();
+ final Map<TypeLiteral<?>, List<PropertyConverter<?>>> propertyConverters = new HashMap<>();
+ PropertyValueCombinationPolicy combinationPolicy;
+
+ public DefaultConfigurationContextBuilder(){
+ }
+
+ @Override
+ public ConfigurationContextBuilder setContext(ConfigurationContext context) {
+ this.propertySources.clear();
+ for(PropertySource ps:context.getPropertySources()) {
+ this.propertySources.put(ps.getName(), ps);
+ }
+ this.propertyFilters.clear();
+ this.propertyFilters.addAll(context.getPropertyFilters());
+ this.propertyConverters.clear();
+ this.propertyConverters.putAll(context.getPropertyConverters());
+ this.combinationPolicy = context.getPropertyValueCombinationPolicy();
+ return this;
+ }
+
+ @Override
+ public ConfigurationContextBuilder addPropertySources(Collection<PropertySource> propertySourcesToAdd) {
+ for(PropertySource ps:propertySourcesToAdd){
+ if(this.propertySources.containsKey(ps.getName())){
+ throw new ConfigException("Duplicate PropertySource: " + ps.getName());
+ }
+ }
+ for(PropertySource ps:propertySourcesToAdd) {
+ this.propertySources.put(ps.getName(), ps);
+ }
+ return this;
+ }
+
+ @Override
+ public ConfigurationContextBuilder addPropertySources(PropertySource... propertySourcesToAdd) {
+ return addPropertySources(Arrays.asList(propertySourcesToAdd));
+ }
+
+ @Override
+ public ConfigurationContextBuilder removePropertySources(Collection<String> propertySourcesToRemove) {
+ for(String key: propertySourcesToRemove){
+ this.propertySources.remove(key);
+ }
+ return this;
+ }
+
+ @Override
+ public ConfigurationContextBuilder removePropertySources(String... propertySourcesToRemove) {
+ return removePropertySources(Arrays.asList(propertySourcesToRemove));
+ }
+
+ @Override
+ public ConfigurationContextBuilder addPropertyFilters(Collection<PropertyFilter> filters) {
+ this.propertyFilters.addAll(filters);
+ return this;
+ }
+
+ @Override
+ public ConfigurationContextBuilder addPropertyFilters(PropertyFilter... filters) {
+ return addPropertyFilters(Arrays.asList(filters));
+ }
+
+ @Override
+ public ConfigurationContextBuilder removePropertyFilters(Collection<PropertyFilter> filters) {
+ this.propertyFilters.removeAll(filters);
+ return this;
+ }
+
+ @Override
+ public ConfigurationContextBuilder removePropertyFilters(PropertyFilter... filters) {
+ return removePropertyFilters(Arrays.asList(filters));
+ }
+
+ @Override
+ public <T> ConfigurationContextBuilder addPropertyConverter(TypeLiteral<T> typeToConvert, PropertyConverter<T> propertyConverter) {
+ List<PropertyConverter<?>> converters = this.propertyConverters.get(typeToConvert);
+ if(converters==null){
+ converters = new ArrayList<>();
+ this.propertyConverters.put(typeToConvert, converters);
+ }
+ return this;
+ }
+
+ @Override
+ public ConfigurationContextBuilder removePropertyConverters(TypeLiteral<?> typeToConvert, PropertyConverter<?>... converters) {
+ return removePropertyConverters(typeToConvert, Arrays.asList(converters));
+ }
+
+ @Override
+ public ConfigurationContextBuilder removePropertyConverters(TypeLiteral<?> typeToConvert, Collection<PropertyConverter<?>> converters) {
+ List<PropertyConverter<?>> existing = this.propertyConverters.get(typeToConvert);
+ if(existing!=null) {
+ existing.removeAll(converters);
+ }
+ return this;
+ }
+
+ @Override
+ public ConfigurationContextBuilder setPropertyValueCombinationPolicy(PropertyValueCombinationPolicy policy) {
+ this.combinationPolicy = Objects.requireNonNull(policy);
+ return this;
+ }
+
+ @Override
+ public ConfigurationContext build() {
+ return new DefaultConfigurationContext(this);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/modules/builder/src/main/java/org/apache/tamaya/builder/internal/DefaultConfigurationProvider.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/internal/DefaultConfigurationProvider.java b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/DefaultConfigurationProvider.java
new file mode 100644
index 0000000..254edd1
--- /dev/null
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/DefaultConfigurationProvider.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tamaya.builder.internal;
+
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.builder.spi.*;
+
+/**
+ * Implementation of the Configuration API. This class uses the current {@link ConfigurationContext} to evaluate the
+ * chain of {@link PropertySource} and {@link PropertyFilter}
+ * instance to evaluate the current Configuration.
+ */
+public class DefaultConfigurationProvider implements ConfigurationProviderSpi {
+
+ private ConfigurationContext context = new DefaultConfigurationContext();
+ private Configuration config = new DefaultConfiguration(context);
+
+ @Override
+ public Configuration getConfiguration() {
+ return config;
+ }
+
+ @Override
+ public ConfigurationContext getConfigurationContext() {
+ return context;
+ }
+
+ @Override
+ public ConfigurationContextBuilder getConfigurationContextBuilder() {
+ return ServiceContextManager.getServiceContext().getService(ConfigurationContextBuilder.class);
+ }
+
+ @Override
+ public void setConfigurationContext(ConfigurationContext context){
+ // TODO think on a SPI or move event part into API...
+ this.config = new DefaultConfiguration(context);
+ this.context = context;
+ }
+
+
+ @Override
+ public boolean isConfigurationContextSettable() {
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/modules/builder/src/main/java/org/apache/tamaya/builder/internal/DefaultServiceContext.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/internal/DefaultServiceContext.java b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/DefaultServiceContext.java
new file mode 100644
index 0000000..c75f98d
--- /dev/null
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/DefaultServiceContext.java
@@ -0,0 +1,156 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tamaya.builder.internal;
+
+import org.apache.tamaya.ConfigException;
+import org.apache.tamaya.builder.spi.ServiceContext;
+
+import javax.annotation.Priority;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.ServiceLoader;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * This class implements the (default) {@link ServiceContext} interface and hereby uses the JDK
+ * {@link java.util.ServiceLoader} to load the services required.
+ */
+public final class DefaultServiceContext implements ServiceContext {
+ /**
+ * List current services loaded, per class.
+ */
+ private final ConcurrentHashMap<Class<?>, List<Object>> servicesLoaded = new ConcurrentHashMap<>();
+ /**
+ * Singletons.
+ */
+ private final Map<Class<?>, Object> singletons = new ConcurrentHashMap<>();
+
+ @Override
+ public <T> T getService(Class<T> serviceType) {
+ Object cached = singletons.get(serviceType);
+ if (cached == null) {
+ Collection<T> services = getServices(serviceType);
+ if (services.isEmpty()) {
+ cached = null;
+ } else {
+ cached = getServiceWithHighestPriority(services, serviceType);
+ }
+ if(cached!=null) {
+ singletons.put(serviceType, cached);
+ }
+ }
+ return serviceType.cast(cached);
+ }
+
+ /**
+ * Loads and registers services.
+ *
+ * @param <T> the concrete type.
+ * @param serviceType The service type.
+ * @return the items found, never {@code null}.
+ */
+ @Override
+ public <T> List<T> getServices(final Class<T> serviceType) {
+ List<T> found = (List<T>) servicesLoaded.get(serviceType);
+ if (found != null) {
+ return found;
+ }
+ List<T> services = new ArrayList<>();
+ try {
+ for (T t : ServiceLoader.load(serviceType)) {
+ services.add(t);
+ }
+ services = Collections.unmodifiableList(services);
+ } catch (Exception e) {
+ Logger.getLogger(DefaultServiceContext.class.getName()).log(Level.WARNING,
+ "Error loading services current type " + serviceType, e);
+ }
+ final List<T> previousServices = List.class.cast(servicesLoaded.putIfAbsent(serviceType, (List<Object>) services));
+ return previousServices != null ? previousServices : services;
+ }
+
+ /**
+ * Checks the given instance for a @Priority annotation. If present the annotation's value s evaluated. If no such
+ * annotation is present, a default priority is returned (1);
+ * @param o the instance, not null.
+ * @return a priority, by default 1.
+ */
+ public static int getPriority(Object o){
+ int prio = 1; //X TODO discuss default priority
+ Priority priority = o.getClass().getAnnotation(Priority.class);
+ if (priority != null) {
+ prio = priority.value();
+ }
+ return prio;
+ }
+
+ /**
+ * @param services to scan
+ * @param <T> type of the service
+ *
+ * @return the service with the highest {@link javax.annotation.Priority#value()}
+ *
+ * @throws ConfigException if there are multiple service implementations with the maximum priority
+ */
+ private <T> T getServiceWithHighestPriority(Collection<T> services, Class<T> serviceType) {
+
+ // we do not need the priority stuff if the list contains only one element
+ if (services.size() == 1) {
+ return services.iterator().next();
+ }
+
+ Integer highestPriority = null;
+ int highestPriorityServiceCount = 0;
+ T highestService = null;
+
+ for (T service : services) {
+ int prio = getPriority(service);
+ if (highestPriority == null || highestPriority < prio) {
+ highestService = service;
+ highestPriorityServiceCount = 1;
+ highestPriority = prio;
+ } else if (highestPriority == prio) {
+ highestPriorityServiceCount++;
+ }
+ }
+
+ if (highestPriorityServiceCount > 1) {
+ throw new ConfigException(MessageFormat.format("Found {0} implementations for Service {1} with Priority {2}: {3}",
+ highestPriorityServiceCount,
+ serviceType.getName(),
+ highestPriority,
+ services));
+ }
+
+ return highestService;
+ }
+
+ @Override
+ public int ordinal() {
+ return 1;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/43468987/modules/builder/src/main/java/org/apache/tamaya/builder/internal/OSGIActivator.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/internal/OSGIActivator.java b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/OSGIActivator.java
new file mode 100644
index 0000000..df20d3b
--- /dev/null
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/internal/OSGIActivator.java
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+package org.apache.tamaya.builder.internal;
+
+
+
+import org.apache.tamaya.builder.spi.ServiceContextManager;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+import java.util.logging.Logger;
+
+/**
+ * A bundle activator that registers the {@link OSGIServiceLoader}.
+ */
+public class OSGIActivator implements BundleActivator {
+
+ private static final Logger LOG = Logger.getLogger(OSGIActivator.class.getName());
+
+ private OSGIServiceLoader serviceLoader;
+
+ @Override
+ public void start(BundleContext context) {
+ // Register marker service
+ ServiceContextManager.set(new OSGIServiceContext(context));
+ LOG.info("Registered OSGI enabled ServiceContext...");
+ serviceLoader = new OSGIServiceLoader();
+ context.addBundleListener(serviceLoader);
+ }
+
+ @Override
+ public void stop(BundleContext context) {
+ if(serviceLoader!=null) {
+ context.removeBundleListener(serviceLoader);
+ }
+ }
+}