tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anat...@apache.org
Subject [4/6] incubator-tamaya git commit: TAMAYA-130: Fixed quality issues.
Date Tue, 10 Nov 2015 14:40:57 GMT
TAMAYA-130: Fixed quality issues.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/1a811b88
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/1a811b88
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/1a811b88

Branch: refs/heads/master
Commit: 1a811b88a99249c2c53add9f9226687a47326f1f
Parents: acddcac
Author: anatole <anatole@apache.org>
Authored: Tue Nov 10 15:32:40 2015 +0100
Committer: anatole <anatole@apache.org>
Committed: Tue Nov 10 15:32:40 2015 +0100

----------------------------------------------------------------------
 .../camel/TamayaPropertiesComponent.java        | 15 +++---
 .../camel/TamayaPropertyCfgResolver.java        | 41 ---------------
 .../camel/TamayaPropertyResolver.java           | 53 ++++++++++++++++++++
 .../camel/TamayaPropertyTamayaResolver.java     | 41 ---------------
 .../META-INF/javaconfiguration.properties       | 18 +++++++
 5 files changed, 78 insertions(+), 90 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a811b88/modules/integration/camel/src/main/java/org/apache/tamaya/integration/camel/TamayaPropertiesComponent.java
----------------------------------------------------------------------
diff --git a/modules/integration/camel/src/main/java/org/apache/tamaya/integration/camel/TamayaPropertiesComponent.java
b/modules/integration/camel/src/main/java/org/apache/tamaya/integration/camel/TamayaPropertiesComponent.java
index e7cad08..d569a74 100644
--- a/modules/integration/camel/src/main/java/org/apache/tamaya/integration/camel/TamayaPropertiesComponent.java
+++ b/modules/integration/camel/src/main/java/org/apache/tamaya/integration/camel/TamayaPropertiesComponent.java
@@ -34,8 +34,8 @@ public class TamayaPropertiesComponent extends PropertiesComponent{
      */
     public TamayaPropertiesComponent(){
         super();
-        addFunction(new TamayaPropertyCfgResolver());
-        addFunction(new TamayaPropertyTamayaResolver());
+        addFunction(new TamayaPropertyResolver("tamaya"));
+        addFunction(new TamayaPropertyResolver("cfg"));
         setTamayaOverrides(true);
     }
 
@@ -44,8 +44,8 @@ public class TamayaPropertiesComponent extends PropertiesComponent{
      */
     public TamayaPropertiesComponent(String ... locations){
         super(locations);
-        addFunction(new TamayaPropertyCfgResolver());
-        addFunction(new TamayaPropertyTamayaResolver());
+        addFunction(new TamayaPropertyResolver("tamaya"));
+        addFunction(new TamayaPropertyResolver("cfg"));
         setTamayaOverrides(true);
     }
 
@@ -54,8 +54,8 @@ public class TamayaPropertiesComponent extends PropertiesComponent{
      */
     public TamayaPropertiesComponent(String location){
         super(location);
-        addFunction(new TamayaPropertyCfgResolver());
-        addFunction(new TamayaPropertyTamayaResolver());
+        addFunction(new TamayaPropertyResolver("tamaya"));
+        addFunction(new TamayaPropertyResolver("cfg"));
         setTamayaOverrides(true);
     }
 
@@ -74,8 +74,7 @@ public class TamayaPropertiesComponent extends PropertiesComponent{
             Properties props = new Properties();
             props.putAll(ConfigurationProvider.getConfiguration().getProperties());
             setOverrideProperties(props);
-        }
-        else{
+        } else{
             setOverrideProperties(null);
         }
     }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a811b88/modules/integration/camel/src/main/java/org/apache/tamaya/integration/camel/TamayaPropertyCfgResolver.java
----------------------------------------------------------------------
diff --git a/modules/integration/camel/src/main/java/org/apache/tamaya/integration/camel/TamayaPropertyCfgResolver.java
b/modules/integration/camel/src/main/java/org/apache/tamaya/integration/camel/TamayaPropertyCfgResolver.java
deleted file mode 100644
index f6ffe43..0000000
--- a/modules/integration/camel/src/main/java/org/apache/tamaya/integration/camel/TamayaPropertyCfgResolver.java
+++ /dev/null
@@ -1,41 +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.integration.camel;
-
-import org.apache.camel.component.properties.PropertiesFunction;
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-
-
-/**
- * Implementation of the Camel Properties SPI using Tamaya configuration.
- */
-public class TamayaPropertyCfgResolver implements PropertiesFunction{
-
-    @Override
-    public String getName() {
-        return "cfg";
-    }
-
-    @Override
-    public String apply(String remainder) {
-        Configuration config = ConfigurationProvider.getConfiguration();
-        return config.get(remainder);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a811b88/modules/integration/camel/src/main/java/org/apache/tamaya/integration/camel/TamayaPropertyResolver.java
----------------------------------------------------------------------
diff --git a/modules/integration/camel/src/main/java/org/apache/tamaya/integration/camel/TamayaPropertyResolver.java
b/modules/integration/camel/src/main/java/org/apache/tamaya/integration/camel/TamayaPropertyResolver.java
new file mode 100644
index 0000000..6b6ada9
--- /dev/null
+++ b/modules/integration/camel/src/main/java/org/apache/tamaya/integration/camel/TamayaPropertyResolver.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.integration.camel;
+
+import org.apache.camel.component.properties.PropertiesFunction;
+import org.apache.tamaya.Configuration;
+import org.apache.tamaya.ConfigurationProvider;
+
+import java.util.Objects;
+
+
+/**
+ * Implementation of the Camel Properties SPI using Tamaya configuration.
+ */
+public class TamayaPropertyResolver implements PropertiesFunction{
+
+    private final String prefix;
+
+    /**
+     * Creates a new instance.
+     * @param configPrefix the prefix to be registered for explicit resolution by this resolver
function, not null.
+     */
+    public TamayaPropertyResolver(String configPrefix){
+        this.prefix = Objects.requireNonNull(configPrefix);
+    }
+
+    @Override
+    public String getName() {
+        return prefix;
+    }
+
+    @Override
+    public String apply(String remainder) {
+        Configuration config = ConfigurationProvider.getConfiguration();
+        return config.get(remainder);
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a811b88/modules/integration/camel/src/main/java/org/apache/tamaya/integration/camel/TamayaPropertyTamayaResolver.java
----------------------------------------------------------------------
diff --git a/modules/integration/camel/src/main/java/org/apache/tamaya/integration/camel/TamayaPropertyTamayaResolver.java
b/modules/integration/camel/src/main/java/org/apache/tamaya/integration/camel/TamayaPropertyTamayaResolver.java
deleted file mode 100644
index 2490fce..0000000
--- a/modules/integration/camel/src/main/java/org/apache/tamaya/integration/camel/TamayaPropertyTamayaResolver.java
+++ /dev/null
@@ -1,41 +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.integration.camel;
-
-import org.apache.camel.component.properties.PropertiesFunction;
-import org.apache.tamaya.Configuration;
-import org.apache.tamaya.ConfigurationProvider;
-
-
-/**
- * Implementation of the Camel Properties SPI using Tamaya configuration.
- */
-public class TamayaPropertyTamayaResolver implements PropertiesFunction{
-
-    @Override
-    public String getName() {
-        return "tamaya";
-    }
-
-    @Override
-    public String apply(String remainder) {
-        Configuration config = ConfigurationProvider.getConfiguration();
-        return config.get(remainder);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a811b88/modules/integration/camel/src/test/resources/META-INF/javaconfiguration.properties
----------------------------------------------------------------------
diff --git a/modules/integration/camel/src/test/resources/META-INF/javaconfiguration.properties
b/modules/integration/camel/src/test/resources/META-INF/javaconfiguration.properties
index ee6d281..fbe9178 100644
--- a/modules/integration/camel/src/test/resources/META-INF/javaconfiguration.properties
+++ b/modules/integration/camel/src/test/resources/META-INF/javaconfiguration.properties
@@ -1 +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.
+#
 message=Good Bye from Apache Tamaya!
\ No newline at end of file


Mime
View raw message