tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anat...@apache.org
Subject [3/5] incubator-tamaya-sandbox git commit: Added tests for OSGI support, simplified OSGI support. Implemented base functionality for metamodel support, including first testing.
Date Mon, 12 Dec 2016 16:13:06 GMT
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/afc19d0e/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/ItemFactoryManager.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/ItemFactoryManager.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/ItemFactoryManager.java
new file mode 100644
index 0000000..4578640
--- /dev/null
+++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/ItemFactoryManager.java
@@ -0,0 +1,145 @@
+/*
+ * 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.metamodel.spi;
+
+import org.apache.tamaya.spi.PropertySource;
+import org.apache.tamaya.spi.ServiceContextManager;
+
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.TimeUnit;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Created by atsticks on 04.12.16.
+ */
+public final class ItemFactoryManager {
+
+    private static final Logger LOG = Logger.getLogger(ItemFactoryManager.class.getName());
+
+    private Map<Class, List<ItemFactory<?>>> factoryRegistry = new ConcurrentHashMap<>();
+
+    private static ItemFactoryManager INSTANCE = new ItemFactoryManager();
+
+    private ItemFactoryManager(){
+    }
+
+    public static ItemFactoryManager getInstance(){
+        return INSTANCE;
+    }
+
+    public <T> List<ItemFactory<T>> getFactories(Class<T> type){
+        List<ItemFactory<?>> factories = factoryRegistry.get(type);
+        if(factories==null){
+            Collection<ItemFactory> allFactories =
+                    ServiceContextManager.getServiceContext().getServices(ItemFactory.class);
+            for(ItemFactory fact:allFactories){
+                registerItemFactory(fact);
+            }
+        }
+        factories = factoryRegistry.get(type);
+        if(factories==null){
+            return Collections.emptyList();
+        }
+        return List.class.cast(factories);
+    }
+
+    public <T> ItemFactory<T> getFactory(Class<T> type, String id) {
+        List<ItemFactory<T>> factories = getFactories(type);
+        for(ItemFactory<T> f:factories){
+            if(id.equals(f.getName())){
+                return f;
+            }
+        }
+        // try creating a new factory with the given id as fully qualified class name...
+        try{
+            Class<? extends ItemFactory> instanceType = (Class<? extends ItemFactory>) Class.forName(id);
+            ItemFactory<T> factory = new SimpleItemFactory(type, instanceType);
+            registerItemFactory(factory);
+            return factory;
+        }catch(Exception e){
+            LOG.severe("Failed to create factory for configured class: " + type.getName() +
+                    " and type: " + id);
+            return null;
+        }
+    }
+
+    public <T> void registerItemFactory(ItemFactory<T> factory) {
+        List<ItemFactory<?>> factories = factoryRegistry.get(factory.getType());
+        if(factories==null){
+            factories = new ArrayList<>();
+            factoryRegistry.put(factory.getType(), factories);
+        }
+        factories.add(factory);
+    }
+
+    private static class SimpleItemFactory<I> implements ItemFactory<I> {
+
+        private Class<I> type;
+        private Class<? extends I> instanceType;
+
+        public SimpleItemFactory(Class<I> type, Class<? extends I> instanceType) {
+            this.type = Objects.requireNonNull(type);
+            this.instanceType = Objects.requireNonNull(instanceType);
+        }
+
+        @Override
+        public String getName() {
+            return getType().getName();
+        }
+
+        @Override
+        public I create(Map<String, String> parameters) {
+            try {
+                return instanceType.newInstance();
+            } catch (Exception e) {
+                LOG.log(Level.SEVERE, "Failed to create configured instance of type:" + instanceType, e);
+                return null;
+            }
+        }
+
+        @Override
+        public Class<I> getType() {
+            return type;
+        }
+
+        @Override
+        public boolean equals(Object o) {
+            if (this == o) return true;
+            if (!(o instanceof SimpleItemFactory)) return false;
+            SimpleItemFactory<?> that = (SimpleItemFactory<?>) o;
+            return Objects.equals(getType(), that.getType()) &&
+                    Objects.equals(instanceType, that.instanceType);
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(getType(), instanceType);
+        }
+
+        @Override
+        public String toString() {
+            return "SimpleItemFactory{" +
+                    "type=" + type +
+                    ", instanceType=" + instanceType +
+                    '}';
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/afc19d0e/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/MetaConfigurationReader.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/MetaConfigurationReader.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/MetaConfigurationReader.java
index c9718a9..005aa24 100644
--- a/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/MetaConfigurationReader.java
+++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/MetaConfigurationReader.java
@@ -18,14 +18,12 @@
  */
 package org.apache.tamaya.metamodel.spi;
 
-import org.apache.tamaya.metamodel.Context;
 import org.apache.tamaya.spi.ConfigurationContextBuilder;
 import org.w3c.dom.Document;
 
-import java.net.URL;
-
 /**
- * Created by atsticks on 03.11.16.
+ * Reader that reads meta configuration from the meta configuration XML source.
+ * This SPI allows to allow different aspects to be configured by different modules.
  */
 public interface MetaConfigurationReader {
 
@@ -36,6 +34,6 @@ public interface MetaConfigurationReader {
      * @param document the meta-configuration document
      * @param contextBuilder the context builder to use.
      */
-    void read(Document document, Context context, ConfigurationContextBuilder contextBuilder);
+    void read(Document document, ConfigurationContextBuilder contextBuilder);
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/afc19d0e/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/PropertySourceFactory.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/PropertySourceFactory.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/PropertySourceFactory.java
deleted file mode 100644
index 7da2e58..0000000
--- a/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/PropertySourceFactory.java
+++ /dev/null
@@ -1,48 +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.metamodel.spi;
-
-import org.apache.tamaya.metamodel.internal.SourceConfig;
-import org.apache.tamaya.spi.PropertySource;
-
-import java.util.Map;
-
-
-/**
- * {@link PropertySource} and {@link SourceConfig} instances that
- * implement configurable are configured with the according configuration
- * settings provided in the {@code tamaya-config.xml} meta-configuration.
- */
-public interface PropertySourceFactory {
-
-    /**
-     * Resolve the given expression (without the key part).
-     * @param config any further extended configuration, not null, but may be
-     *                       empty.
-     * @return the property source, or null.
-     */
-    PropertySource create(Map<String, String> config);
-
-    /**
-     * Get the property source type. The type is used to identify the correct factory instance
-     * to resolve a configured property source.
-     * @return the (unique) type key, never null and not empty.
-     */
-    String getType();
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/afc19d0e/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/PropertySourceProviderFactory.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/PropertySourceProviderFactory.java b/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/PropertySourceProviderFactory.java
deleted file mode 100644
index 41ea3a5..0000000
--- a/metamodel/src/main/java/org/apache/tamaya/metamodel/spi/PropertySourceProviderFactory.java
+++ /dev/null
@@ -1,49 +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.metamodel.spi;
-
-import org.apache.tamaya.metamodel.internal.SourceConfig;
-import org.apache.tamaya.spi.PropertySource;
-import org.apache.tamaya.spi.PropertySourceProvider;
-
-import java.util.Map;
-
-
-/**
- * {@link PropertySource} and {@link SourceConfig} instances that
- * implement configurable are configured with the according configuration
- * settings provided in the {@code tamaya-config.xml} meta-configuration.
- */
-public interface PropertySourceProviderFactory {
-
-    /**
-     * Resolve the given expression (without the key part).
-     * @param config any further extended configuration, not null, but may be
-     *                       empty.
-     * @return the property source, or null.
-     */
-    PropertySourceProvider create(Map<String, String> config);
-
-    /**
-     * Get the property source type. The type is used to identify the correct factory instance
-     * to resolve a configured property source.
-     * @return the (unique) type key, never null and not empty.
-     */
-    String getType();
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/afc19d0e/metamodel/src/main/resources/META-INF/services/org.apache.tamaya.metamodel.spi.DSLPropertySourceProvider
----------------------------------------------------------------------
diff --git a/metamodel/src/main/resources/META-INF/services/org.apache.tamaya.metamodel.spi.DSLPropertySourceProvider b/metamodel/src/main/resources/META-INF/services/org.apache.tamaya.metamodel.spi.DSLPropertySourceProvider
deleted file mode 100644
index f2b1843..0000000
--- a/metamodel/src/main/resources/META-INF/services/org.apache.tamaya.metamodel.spi.DSLPropertySourceProvider
+++ /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.metamodel.dsl.internal.NamedDSLPropertySourceProvider
-org.apache.tamaya.metamodel.dsl.internal.ResourceDSLPropertySourceProvider
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/afc19d0e/metamodel/src/main/resources/META-INF/services/org.apache.tamaya.metamodel.spi.ItemFactory
----------------------------------------------------------------------
diff --git a/metamodel/src/main/resources/META-INF/services/org.apache.tamaya.metamodel.spi.ItemFactory b/metamodel/src/main/resources/META-INF/services/org.apache.tamaya.metamodel.spi.ItemFactory
new file mode 100644
index 0000000..7b73763
--- /dev/null
+++ b/metamodel/src/main/resources/META-INF/services/org.apache.tamaya.metamodel.spi.ItemFactory
@@ -0,0 +1,26 @@
+#
+# 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.metamodel.internal.factories.CLIArgumentsFactory
+org.apache.tamaya.metamodel.internal.factories.EnvPropertiesFactory
+org.apache.tamaya.metamodel.internal.factories.FilePropertySourceFactory
+org.apache.tamaya.metamodel.internal.factories.ResourcePropertySourceFactory
+org.apache.tamaya.metamodel.internal.factories.SysPropertiesFactory
+org.apache.tamaya.metamodel.internal.factories.URLPropertySourceFactory
+
+org.apache.tamaya.metamodel.internal.factories.ResourcePropertySourceProviderFactory

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/afc19d0e/metamodel/src/main/resources/META-INF/services/org.apache.tamaya.metamodel.spi.MetaConfigurationReader
----------------------------------------------------------------------
diff --git a/metamodel/src/main/resources/META-INF/services/org.apache.tamaya.metamodel.spi.MetaConfigurationReader b/metamodel/src/main/resources/META-INF/services/org.apache.tamaya.metamodel.spi.MetaConfigurationReader
new file mode 100644
index 0000000..cd2af30
--- /dev/null
+++ b/metamodel/src/main/resources/META-INF/services/org.apache.tamaya.metamodel.spi.MetaConfigurationReader
@@ -0,0 +1,26 @@
+#
+# 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.metamodel.internal.PropertyFilterReader
+org.apache.tamaya.metamodel.internal.PropertyConverterReader
+org.apache.tamaya.metamodel.internal.PropertySourceReader
+org.apache.tamaya.metamodel.internal.ContextReader
+org.apache.tamaya.metamodel.internal.CombinationPolicyReader
+org.apache.tamaya.metamodel.internal.PropertyFilterOrderingReader
+org.apache.tamaya.metamodel.internal.PropertySourceOrderingReader
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/afc19d0e/metamodel/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationProviderSpi
----------------------------------------------------------------------
diff --git a/metamodel/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationProviderSpi b/metamodel/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationProviderSpi
index 6406156..f9a7797 100644
--- a/metamodel/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationProviderSpi
+++ b/metamodel/src/main/resources/META-INF/services/org.apache.tamaya.spi.ConfigurationProviderSpi
@@ -16,4 +16,5 @@
 # specific language governing permissions and limitations
 # under the License.
 #
-org.apache.tamaya.metamodel.dsl.internal.DSLLoadingConfigurationProviderSpi
\ No newline at end of file
+
+org.apache.tamaya.metamodel.internal.DSLLoadingConfigurationProviderSpi
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/afc19d0e/metamodel/src/test/resources/IntegrationTests/empty-config.xml
----------------------------------------------------------------------
diff --git a/metamodel/src/test/resources/IntegrationTests/empty-config.xml b/metamodel/src/test/resources/IntegrationTests/empty-config.xml
new file mode 100644
index 0000000..42faaed
--- /dev/null
+++ b/metamodel/src/test/resources/IntegrationTests/empty-config.xml
@@ -0,0 +1,24 @@
+<!--
+// 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.
+// -->
+<configuration>
+
+    <!-- This is an empty config, which results in an empty and unusable configuration. -->
+
+</configuration>
+

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/afc19d0e/metamodel/src/test/resources/tamaya-config.xml
----------------------------------------------------------------------
diff --git a/metamodel/src/test/resources/tamaya-config.xml b/metamodel/src/test/resources/tamaya-config.xml
index 1d25beb..eb44f83 100644
--- a/metamodel/src/test/resources/tamaya-config.xml
+++ b/metamodel/src/test/resources/tamaya-config.xml
@@ -20,44 +20,68 @@
     <!-- Context is evaluated first. -->
     <context>
         <context-entry name="stage">${properties:system:STAGE?default=DEV}</context-entry>
+        <context-entry name="configdir">${properties:system:configdir?default=.}</context-entry>
         <context-entry name="app">${properties:system.APP?default=NONE}</context-entry>
         <context-entry name="context">${java:org.apache.tamaya.context.Context#id()}</context-entry>
         <context-entry name="company">Trivadis</context-entry>
         <context-entry name="default-formats">yaml,json</context-entry>
+        <context-entry name="default-refresh-period">5 SECOND</context-entry>
     </context>
+    <context name="APP">
+        <context-entry name="application">someAppName</context-entry>
+    </context>
+
+    <!-- combinationPolicy type="" / -->
 
     <!-- Configuration definition. -->
 
-    <config-sources>
+    <property-sources>
        <source enabled="${stage=TEST || stage=PTA || stage=PROD}"
-           uri="properties:environment">
-           <filter type="mapping">ENV.</filter>
-           <filter type="access-control">
+           type="env-properties">
+           <filter type="PropertyMapping">
+               <param name="mapTarget">ENV.</param>
+           </filter>
+           <filter type="AccessMask">
                <param name="roles">admin,power-user</param>
                <param name="policy">mask</param>
+               <param name="mask">*****</param>
+               <param name="matchExpression">SEC_</param>
            </filter>
        </source>
-       <source uri="properties:system"/>
-       <source name="FILE:config.json" refresh-period="5000"
-               uri="file:/./config.json" >
-           <param name="observe-period">20000</param>
-           <param name="formats">json</param>
+       <source type="sys-properties" >
+           <filter type="ImmutablePropertySource" />
        </source>
-       <source-provider name="classpath:application-config.yml" uri="classpath*://META-INF/application-config.yml">
-           <param name="formats">yaml</param>
-       </source-provider>
-       <source name="MINE" uri="class:ch.mypack.MyClassSource">
-           <param name="locale">de</param>
+       <source type="file" refreshable="true">
+           <name>config.json</name>
+           <param name="location">config.json</param>
+       </source>
+        <source type="file" refreshable="true">
+            <name>config.xml</name>
+            <param name="location">config.xml</param>
+            <param name="formats">xml-properties</param>
         </source>
-       <include enabled="${stage==TEST}">TEST-config.xml</include>
-       <source-provider name="CONFIG-DIR" uri="resource:/${CONFIG-DIR}/**/*.json"/>
-       <source name="SERVER" uri="https://www.confdrive.com/cfg/customerId=${}">
-           <param name="locale">de</param>
+       <source-provider type="resource">
+           <name>classpath:application-config.yml</name>
+           <param name="location">/META-INF/application-config.yml</param>
+       </source-provider>
+       <source type="ch.mypack.MyClassSource" />
+       <!--<include enabled="${stage==TEST}">TEST-config.xml</include>-->
+       <source-provider type="resource" enabled="${configdir != null}">
+           <name>config-dir</name>
+           <param name="location">/${configdir}/**/*.json</param>
+       </source-provider>
+       <source type="url" refreshable="true">
+           <name>remote</name>
+           <param name="location">https://www.confdrive.com/cfg/customerId=1234</param>
+           <param name="formats">json</param>
+           <filter type="CachedPropertySource">
+               <param name="ttl">30 SECOND</param>
+           </filter>
        </source>
-    </config-sources>
-    <config-filters>
+    </property-sources>
+    <property-filters>
         <filter type="UsageTrackerFilter"/>
-        <filter type="access-control">
+        <filter type="AccessControl">
             <param name="roles">admin,power-user</param>
             <param name="policy">hide</param>
             <param name="expression">*.secret</param>
@@ -66,10 +90,11 @@
             <param name="ttl">30000</param>
             <param name="expression">cached.*</param>
         </filter>
-    </config-filters>
-    <!--<converters>-->
+    </property-filters>
+    <property-converters>
     <!--<converter type="AllInOneConverter"/>-->
-    <!--</converters>-->
+        <default-converters/>
+    </property-converters>
 
 </configuration>
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/afc19d0e/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 63240ed..9d5b629 100644
--- a/pom.xml
+++ b/pom.xml
@@ -249,6 +249,71 @@ under the License.
             </dependency>
 
             <dependency>
+                <groupId>org.jboss.arquillian</groupId>
+                <artifactId>arquillian-bom</artifactId>
+                <version>${arquillian.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+
+
+            <dependency>
+                <groupId>org.jboss.arquillian.daemon</groupId>
+                <artifactId>arquillian-daemon-container-managed</artifactId>
+                <version>${arquillian.deamon.version}</version>
+                <scope>test</scope>
+            </dependency>
+
+            <dependency>
+                <groupId>org.jboss.arquillian.daemon</groupId>
+                <artifactId>arquillian-daemon-container-common</artifactId>
+                <version>${arquillian.deamon.version}</version>
+                <scope>test</scope>
+            </dependency>
+
+            <dependency>
+                <groupId>org.jboss.arquillian.daemon</groupId>
+                <artifactId>arquillian-daemon-main</artifactId>
+                <version>${arquillian.deamon.version}</version>
+                <scope>test</scope>
+            </dependency>
+
+            <dependency>
+                <groupId>org.jboss.arquillian.daemon</groupId>
+                <artifactId>arquillian-daemon-protocol-arquillian</artifactId>
+                <version>${arquillian.deamon.version}</version>
+                <scope>test</scope>
+            </dependency>
+
+            <dependency>
+                <groupId>org.jboss.arquillian.daemon</groupId>
+                <artifactId>arquillian-daemon-protocol-wire</artifactId>
+                <version>${arquillian.deamon.version}</version>
+                <scope>test</scope>
+            </dependency>
+
+            <dependency>
+                <groupId>org.jboss.arquillian.daemon</groupId>
+                <artifactId>arquillian-daemon-server</artifactId>
+                <version>${arquillian.deamon.version}</version>
+                <scope>test</scope>
+            </dependency>
+
+            <dependency>
+                <groupId>org.mockito</groupId>
+                <artifactId>mockito-core</artifactId>
+                <version>${mockito.version}</version>
+                <scope>test</scope>
+                <exclusions>
+                    <exclusion>
+                        <groupId>org.hamcrest</groupId>
+                        <artifactId>hamcrest-core</artifactId>
+                    </exclusion>
+                </exclusions>
+
+            </dependency>
+
+            <dependency>
                 <groupId>rubygems</groupId>
                 <artifactId>asciidoctor-diagram</artifactId>
                 <version>${asciidoctor-diagramm.version}</version>
@@ -260,24 +325,420 @@ under the License.
                 <artifactId>geronimo-json_1.0_spec</artifactId>
                 <version>${json.spec.version}</version>
             </dependency>
+
             <dependency>
                 <groupId>org.apache.johnzon</groupId>
                 <artifactId>johnzon-core</artifactId>
                 <version>${johnzon.version}</version>
             </dependency>
-            <dependency>
-                <groupId>org.hamcrest</groupId>
-                <artifactId>hamcrest-library</artifactId>
-                <version>${hamcrest.version}</version>
-                <scope>test</scope>
-            </dependency>
+
         </dependencies>
     </dependencyManagement>
 
     <build>
       <defaultGoal>clean install</defaultGoal>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.jacoco</groupId>
+                    <artifactId>jacoco-maven-plugin</artifactId>
+                    <version>0.7.7.201606060606</version>
+                </plugin>
+                <plugin>
+                    <groupId>de.saumya.mojo</groupId>
+                    <artifactId>gem-maven-plugin</artifactId>
+                    <version>${gem.plugin}</version>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-checkstyle-plugin</artifactId>
+                    <version>${checkstyle.version}</version>
+                    <executions>
+                        <execution>
+                            <id>verify-style</id>
+                            <phase>process-classes</phase>
+                            <goals>
+                                <goal>check</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+                    <configuration>
+                        <logViolationsToConsole>true</logViolationsToConsole>
+                        <configLocation>checkstyle/style.xml</configLocation>
+                    </configuration>
+
+                    <dependencies>
+                        <dependency>
+                            <groupId>org.apache.tamaya</groupId>
+                            <artifactId>buildconfigurations</artifactId>
+                            <version>${project.version}</version>
+                        </dependency>
+                        <dependency>
+                            <groupId>com.puppycrawl.tools</groupId>
+                            <artifactId>checkstyle</artifactId>
+                            <version>6.2</version>
+                            <exclusions><!-- MCHECKSTYLE-156 -->
+                                <exclusion>
+                                    <groupId>com.sun</groupId>
+                                    <artifactId>tools</artifactId>
+                                </exclusion>
+                            </exclusions>
+                        </dependency>
+                    </dependencies>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-source-plugin</artifactId>
+                    <version>${sources.plugin}</version>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-toolchains-plugin</artifactId>
+                    <version>${toolchains.plugin}</version>
+                </plugin>
+<!--
+                <plugin>
+                    <groupId>org.codehaus.mojo</groupId>
+                    <artifactId>findbugs-maven-plugin</artifactId>
+                    <version>${findbugs.version}</version>
+
+                    <executions>
+                        <execution>
+                            <id>findbugs-analyze</id>
+                            <phase>compile</phase>
+                            <goals>
+                                <goal>check</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+                    <configuration>
+                        <effort>Max</effort>
+                        <threshold>Low</threshold>
+                        <failOnError>true</failOnError>
+                        <excludeFilterFile>findbugs/findbugs-exclude.xml</excludeFilterFile>
+                    </configuration>
+                    <dependencies>
+                        <dependency>
+                            <groupId>org.apache.tamaya</groupId>
+                            <artifactId>buildconfigurations</artifactId>
+                            <version>${project.version}</version>
+                        </dependency>
+                    </dependencies>
+                </plugin>
+-->
+                <plugin>
+                    <groupId>org.asciidoctor</groupId>
+                    <artifactId>asciidoctor-maven-plugin</artifactId>
+                    <version>${asciidoctor.version}</version>
+                    <dependencies>
+                        <dependency>
+                            <!-- See TAMAYA-10 for details on this dependency -->
+                            <groupId>org.asciidoctor</groupId>
+                            <artifactId>asciidoctorj</artifactId>
+                            <version>${asciidoctorj.version}</version>
+                        </dependency>
+                    </dependencies>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-compiler-plugin</artifactId>
+                    <version>3.5.1</version>
+                    <configuration>
+                        <debug>true</debug>
+                        <optimize>${maven.compile.optimize}</optimize>
+                        <source>${maven.compile.sourceLevel}</source>
+                        <target>${maven.compile.targetLevel}</target>
+                        <encoding>${project.build.sourceEncoding}</encoding>
+                        <showDeprecation>${maven.compile.deprecation}</showDeprecation>
+                    </configuration>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-failsafe-plugin</artifactId>
+                    <inherited>true</inherited>
+                    <executions>
+                        <execution>
+                            <goals>
+                                <goal>integration-test</goal>
+                                <goal>verify</goal>
+                            </goals>
+                            <configuration>
+                                <argLine>-Xms512m -Xmx1048m -XX:MaxPermSize=512m</argLine>
+                            </configuration>
+                        </execution>
+                    </executions>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-surefire-plugin</artifactId>
+                    <inherited>true</inherited>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-jar-plugin</artifactId>
+                    <configuration>
+                        <archive>
+                            <addMavenDescriptor>false</addMavenDescriptor>
+                            <manifestEntries>
+                                <Specification-Title>Apache ${project.name}</Specification-Title>
+                                <Specification-Version>${project.version}</Specification-Version>
+                                <Specification-Vendor>The Apache Software Foundation</Specification-Vendor>
+                                <Implementation-Title>${project.name}</Implementation-Title>
+                                <Implementation-Version>${project.version} ${buildNumber}</Implementation-Version>
+                                <Implementation-Vendor>The Apache Software Foundation</Implementation-Vendor>
+                                <SCM-Revision>${buildNumber}</SCM-Revision>
+                                <SCM-url>${project.scm.url}</SCM-url>
+                            </manifestEntries>
+                        </archive>
+                    </configuration>
+                </plugin>
+                <plugin>
+                    <groupId>biz.aQute.bnd</groupId>
+                    <artifactId>bnd-maven-plugin</artifactId>
+                    <version>3.3.0</version>
+                    <dependencies>
+                        <dependency>
+                            <groupId>ch.qos.logback</groupId>
+                            <artifactId>logback-core</artifactId>
+                            <version>1.1.3</version>
+                        </dependency>
+                        <dependency>
+                            <groupId>org.slf4j</groupId>
+                            <artifactId>slf4j-api</artifactId>
+                            <version>1.7.13</version>
+                        </dependency>
+                    </dependencies>
+                    <executions>
+                        <execution>
+                            <goals>
+                                <goal>bnd-process</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-scm-publish-plugin</artifactId>
+                    <version>1.1</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-site-plugin</artifactId>
+                    <!-- 20160816: 3.5.1 generates a broken site, maybe due to old asciidoc version?! -->
+                    <version>3.4</version>
+                    <inherited>true</inherited>
+                    <dependencies>
+                        <!-- 3.5.1: Fixes class not found
+                         executing org.apache.maven.plugins:maven-site-plugin:3.5.1:site: org/apache/maven/doxia/sink/impl/XhtmlBaseSink
+                        <dependency>
+                            <groupId>org.apache.maven.doxia</groupId>
+                            <artifactId>doxia-core</artifactId>
+                            <version>1.7</version>
+                        </dependency>
+                        -->
+                        <dependency><!-- add support for ssh/scp -->
+                            <groupId>org.apache.maven.wagon</groupId>
+                            <artifactId>wagon-ssh</artifactId>
+                            <version>2.10</version>
+                        </dependency>
+                        <dependency>
+                            <groupId>org.asciidoctor</groupId>
+                            <artifactId>asciidoctor-maven-plugin</artifactId>
+                            <version>${asciidoctor.version}</version>
+                        </dependency>
+                        <dependency>
+                            <groupId>lt.velykis.maven.skins</groupId>
+                            <artifactId>reflow-velocity-tools</artifactId>
+                            <version>${reflow-skin.version}</version>
+                        </dependency>
+                        <!-- Reflow skin requires Velocity >= 1.7  -->
+                        <dependency>
+                            <groupId>org.apache.velocity</groupId>
+                            <artifactId>velocity</artifactId>
+                            <version>1.7</version>
+                        </dependency>
+                    </dependencies>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-release-plugin</artifactId>
+                    <version>2.5.3</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.rat</groupId>
+                    <artifactId>apache-rat-plugin</artifactId>
+                    <version>${rat.version}</version>
+                    <configuration>
+                        <excludes>
+                            <exclude>**/*banner.txt</exclude>
+                            <exclude>banner.txt</exclude>
+                            <exclude>.git</exclude>
+                            <exclude>derby.log</exclude>
+                            <exclude>**/bootstrap-*</exclude>
+                            <exclude>**/js/jquery-*</exclude>
+                            <!-- json can't get comments -->
+                            <exclude>**/*.json</exclude>
+                            <exclude>**/*.md</exclude>
+                            <exclude>**/*.md.vm</exclude>
+                            <exclude>src/site/asciidoc/temp-properties-files-for-site/attributes.adoc</exclude>
+                            <exclude>readme/**</exclude>
+                        </excludes>
+                        <includes>
+                            <include>src/**/*</include>
+                            <include>pom.xml</include>
+                        </includes>
+                    </configuration>
+                    <executions>
+                        <execution>
+                            <phase>validate</phase>
+                            <goals>
+                                <goal>check</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+
+
         <plugins>
             <plugin>
+                <groupId>org.apache.karaf.tooling</groupId>
+                <artifactId>karaf-maven-plugin</artifactId>
+                <version>4.0.5</version>
+                <extensions>true</extensions>
+                <executions>
+                    <execution>
+                        <id>generate</id>
+                        <phase>generate-resources</phase>
+                        <goals>
+                            <goal>features-generate-descriptor</goal>
+                        </goals>
+                        <configuration>
+                            <startLevel>80</startLevel>
+                            <aggregateFeatures>true</aggregateFeatures>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <artifactId>maven-resources-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>bal</id>
+                        <phase>pre-site</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <inherited>false</inherited>
+                        <configuration>
+                            <outputDirectory>${project.basedir}/temp-properties-files-for-site</outputDirectory>
+                            <resources>
+                                <resource>
+                                    <directory>${project.basedir}/src/main/resources</directory>
+                                    <filtering>true</filtering>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-enforcer-plugin</artifactId>
+                <version>${enforcer.version}</version>
+                <executions>
+                    <execution>
+                        <id>enforce-versions</id>
+                        <goals>
+                            <goal>enforce</goal>
+                        </goals>
+                        <configuration>
+                            <rules>
+                                <requireMavenVersion>
+                                    <version>3.0.5</version>
+                                </requireMavenVersion>
+                            </rules>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-failsafe-plugin</artifactId>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <version>${javadoc.version}</version>
+                <executions>
+                    <execution>
+                        <id>attach-javadocs</id>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <detectLinks>false</detectLinks>
+                    <keywords>true</keywords>
+                    <linksource>false</linksource>
+                    <failOnError>true</failOnError>
+                    <source>${maven.compile.sourceLevel}</source>
+                    <verbose>false</verbose>
+                </configuration>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-source-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>source-jar</id>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.rat</groupId>
+                <artifactId>apache-rat-plugin</artifactId>
+            </plugin>
+            <!-- we need to tweak the maven-release-plugin for GIT -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-release-plugin</artifactId>
+                <version>2.5.3</version>
+                <configuration>
+                    <pushChanges>false</pushChanges>
+                    <localCheckout>true</localCheckout>
+                    <autoVersionSubmodules>true</autoVersionSubmodules>
+
+                    <releaseProfiles>release</releaseProfiles>
+                    <preparationGoals>clean install</preparationGoals>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.7</source>
+                    <target>1.7</target>
+                </configuration>
+            </plugin>
+            <plugin>
                 <groupId>biz.aQute.bnd</groupId>
                 <artifactId>bnd-maven-plugin</artifactId>
                 <version>3.3.0</version>
@@ -291,10 +752,12 @@ under the License.
             </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <version>2.5</version>
                 <configuration>
-                    <source>1.7</source>
-                    <target>1.7</target>
+                    <archive>
+                        <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
+                    </archive>
                 </configuration>
             </plugin>
         </plugins>
@@ -315,7 +778,181 @@ under the License.
         <!--<module>ui</module>-->
         <module>osgi</module>
         <module>management</module>
-        <!--<module>metamodel</module>-->
+        <module>metamodel</module>
     </modules>
 
+    <profiles>
+        <!-- The release profile. It ensures that all checks
+             will be done and everything will be build what need
+             to be build. -->
+        <profile>
+            <id>release</id>
+            <activation>
+                <property>
+                    <name>release</name>
+                </property>
+            </activation>
+            <properties>
+                <enforcer.skip>false</enforcer.skip>
+                <findbugs.skip>false</findbugs.skip>
+                <maven.javadoc.skip>false</maven.javadoc.skip>
+                <rat.skip>false</rat.skip>
+            </properties>
+        </profile>
+
+        <profile>
+            <id>release-sign-artifacts</id>
+            <activation>
+                <property>
+                    <name>performRelease</name>
+                    <value>true</value>
+                </property>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-gpg-plugin</artifactId>
+                        <version>1.6</version>
+                        <executions>
+                            <execution>
+                                <id>sign-artifacts</id>
+                                <phase>verify</phase>
+                                <goals>
+                                    <goal>sign</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+
+        <!-- Do a fast build by skipping all code analysis tools -->
+        <profile>
+            <id>fast</id>
+            <activation>
+                <property>
+                    <name>fast</name>
+                </property>
+            </activation>
+
+            <properties>
+                <checkstyle.skip>true</checkstyle.skip>
+                <findbugs.skip>true</findbugs.skip>
+                <rat.skip>true</rat.skip>
+                <maven.javadoc.skip>true</maven.javadoc.skip>
+                <source.skip>true</source.skip>
+                <assembly.skipAssembly>true</assembly.skipAssembly>
+                <maven.test.skip>true</maven.test.skip>
+            </properties>
+        </profile>
+
+        <profile>
+            <id>javadoc</id>
+            <activation>
+                <property>
+                    <name>javadoc</name>
+                </property>
+            </activation>
+            <properties>
+                <maven.javadoc.skip>false</maven.javadoc.skip>
+            </properties>
+        </profile>
+
+        <profile>
+            <id>java8</id>
+            <activation>
+                <jdk>[1.8,)</jdk>
+            </activation>
+            <properties>
+                <additionalparam>-Xdoclint:none</additionalparam>
+            </properties>
+        </profile>
+    </profiles>
+
+    <reporting>
+        <plugins>
+            <plugin>
+                <inherited>true</inherited>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-project-info-reports-plugin</artifactId>
+                <version>2.9</version>
+                <reportSets>
+                    <reportSet>
+                        <reports>
+                            <report>index</report>
+                            <report>project-team</report>
+                            <report>license</report>
+                            <report>mailing-list</report>
+                            <report>issue-tracking</report>
+                            <report>scm</report>
+                        </reports>
+                    </reportSet>
+                </reportSets>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <version>${javadoc.version}</version>
+                <configuration>
+                    <notimestamp>true</notimestamp>
+                    <additionalparam>-Xdoclint:none</additionalparam>
+                    <detectLinks>false</detectLinks>
+                    <keywords>true</keywords>
+                    <linksource>false</linksource>
+                    <failOnError>false</failOnError>
+                    <source>${maven.compile.sourceLevel}</source>
+                    <verbose>false</verbose>
+                </configuration>
+                <reportSets>
+                    <reportSet>
+                        <reports>
+                            <report>javadoc</report>
+                        </reports>
+                    </reportSet>
+                    <reportSet>
+                        <inherited>false</inherited>
+                        <reports>
+                            <report>aggregate</report>
+                        </reports>
+                    </reportSet>
+                </reportSets>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-changes-plugin</artifactId>
+                <version>2.12</version>
+                <inherited>false</inherited>
+                <configuration>
+                    <columnNames>Type,Fix Version,Key,Summary,Assignee,Status,Created</columnNames>
+                    <maxEntries>200</maxEntries>
+                    <onlyCurrentVersion>true</onlyCurrentVersion>
+                    <resolutionIds>Fixed</resolutionIds>
+                    <statusIds>Closed,Resolved</statusIds>
+                    <sortColumnNames>Type</sortColumnNames>
+                    <useJql>true</useJql>
+                </configuration>
+                <reportSets>
+                    <reportSet>
+                        <reports>
+                            <report>jira-report</report>
+                        </reports>
+                    </reportSet>
+                </reportSets>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.rat</groupId>
+                <artifactId>apache-rat-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>findbugs-maven-plugin</artifactId>
+                <version>${findbugs.version}</version>
+                <configuration>
+                    <skip>false</skip>
+                </configuration>
+            </plugin>
+        </plugins>
+    </reporting>
 </project>


Mime
View raw message