Replace PropertyConfiguration 69/79669/1
authorJim Hahn <jrh3@att.com>
Tue, 5 Mar 2019 00:19:44 +0000 (19:19 -0500)
committerJim Hahn <jrh3@att.com>
Tue, 5 Mar 2019 01:18:32 +0000 (20:18 -0500)
Modified code to use BeanConfigurator instead of PropertyConfiguration.

Change-Id: I296d9047262fbc87f04c3db92f23181f588bfeda
Issue-ID: POLICY-1444
Signed-off-by: Jim Hahn <jrh3@att.com>
feature-distributed-locking/src/main/java/org/onap/policy/distributed/locking/DistributedLockingProperties.java
feature-pooling-dmaap/src/main/java/org/onap/policy/drools/pooling/PoolingProperties.java

index 00db573..0ed5930 100644 (file)
@@ -7,9 +7,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 package org.onap.policy.distributed.locking;
 
 import java.util.Properties;
-import org.onap.policy.common.utils.properties.PropertyConfiguration;
+import org.onap.policy.common.utils.properties.BeanConfigurator;
+import org.onap.policy.common.utils.properties.Property;
 import org.onap.policy.common.utils.properties.exception.PropertyException;
 
 
-public class DistributedLockingProperties extends PropertyConfiguration {
+public class DistributedLockingProperties {
 
     /**
      * Feature properties all begin with this prefix.
@@ -40,7 +41,7 @@ public class DistributedLockingProperties extends PropertyConfiguration {
     /**
      * Properties from which this was constructed.
      */
-    private Properties source;
+    private final Properties source;
 
     /**
      * Database driver.
@@ -66,9 +67,16 @@ public class DistributedLockingProperties extends PropertyConfiguration {
     @Property(name = DB_PWD)
     private String dbPwd;
 
+    /**
+     * Constructs the object, populating fields from the properties.
+     *
+     * @param props properties from which to configure this
+     * @throws PropertyException if an error occurs
+     */
     public DistributedLockingProperties(Properties props) throws PropertyException {
-        super(props);
         source = props;
+
+        new BeanConfigurator().configureFromProperties(this, props);
     }
 
 
index 795bd29..2994961 100644 (file)
@@ -7,9 +7,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 package org.onap.policy.drools.pooling;
 
 import java.util.Properties;
-import org.onap.policy.common.utils.properties.PropertyConfiguration;
+import org.onap.policy.common.utils.properties.BeanConfigurator;
+import org.onap.policy.common.utils.properties.Property;
 import org.onap.policy.common.utils.properties.SpecProperties;
 import org.onap.policy.common.utils.properties.exception.PropertyException;
 
 /**
  * Properties used by the pooling feature, specific to a controller.
  */
-public class PoolingProperties extends PropertyConfiguration {
+public class PoolingProperties {
 
     /**
      * The feature name, used to retrieve properties.
@@ -39,7 +40,7 @@ public class PoolingProperties extends PropertyConfiguration {
      * Feature properties all begin with this prefix.
      */
     public static final String PREFIX = "pooling.";
-    
+
     public static final String FEATURE_ENABLED = PREFIX + "enabled";
     public static final String POOLING_TOPIC = PREFIX + "topic";
     public static final String OFFLINE_LIMIT = PREFIX + "offline.queue.limit";
@@ -130,16 +131,16 @@ public class PoolingProperties extends PropertyConfiguration {
 
     /**
      * Constructor.
-     * 
+     *
      * @param controllerName the name of the controller
      * @param props set of properties used to configure this
      * @throws PropertyException if an error occurs
-     * 
+     *
      */
     public PoolingProperties(String controllerName, Properties props) throws PropertyException {
-        super(new SpecProperties(PREFIX, controllerName, props));
-
         source = props;
+
+        new BeanConfigurator().configureFromProperties(this, new SpecProperties(PREFIX, controllerName, props));
     }
 
     public Properties getSource() {