diff options
author | 2018-09-11 14:38:13 -0400 | |
---|---|---|
committer | 2018-09-11 15:59:30 -0400 | |
commit | 78fc81bf6a35077b8ad80cf29b218477baa15a47 (patch) | |
tree | 833f9fecf7388aaa7d39c7e9e5ed8ba7850bd461 /blueprints-processor/adaptors/data-adaptor-provider/src | |
parent | ea45fbffab1f36271def9443fd32cdbd75839f7e (diff) |
Migrate features to Oxygen
Change-Id: Ic9db80e71070093209b8eda1cdd12e053a18aded
Issue-ID: CCSDK-505
Signed-off-by: Alexis de Talhouët <adetalhouet89@gmail.com>
Diffstat (limited to 'blueprints-processor/adaptors/data-adaptor-provider/src')
2 files changed, 27 insertions, 24 deletions
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/config/data/adaptor/dao/ConfigPropertyMapDaoImpl.java b/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/config/data/adaptor/dao/ConfigPropertyMapDaoImpl.java index 423e01451..65e241e7d 100644 --- a/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/config/data/adaptor/dao/ConfigPropertyMapDaoImpl.java +++ b/blueprints-processor/adaptors/data-adaptor-provider/src/main/java/org/onap/ccsdk/config/data/adaptor/dao/ConfigPropertyMapDaoImpl.java @@ -25,6 +25,7 @@ import java.util.concurrent.TimeUnit; import org.apache.commons.lang3.StringUtils;
import org.onap.ccsdk.config.data.adaptor.DataAdaptorConstants;
import org.onap.ccsdk.sli.core.sli.SvcLogicException;
+import org.springframework.jdbc.CannotGetJdbcConnectionException;
import org.springframework.jdbc.core.JdbcTemplate;
import com.att.eelf.configuration.EELFLogger;
import com.att.eelf.configuration.EELFManager;
@@ -45,21 +46,23 @@ public class ConfigPropertyMapDaoImpl implements ConfigPropertyMapDao { if (!(DataAdaptorConstants.PROPERTY_ENV_PROD.equalsIgnoreCase(envType)
|| DataAdaptorConstants.PROPERTY_ENV_SOLO.equalsIgnoreCase(envType))) {
ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
- Runnable task = () -> {
- initializeMap();
- };
+ Runnable task = this::initializeMap;
executor.scheduleWithFixedDelay(task, 60, 15, TimeUnit.MINUTES);
}
}
private void initializeMap() {
- String getPropQuery = "SELECT * FROM CONFIG_PROPERTY_MAP";
- jdbcTemplate.queryForList(getPropQuery).forEach(rows -> {
- String key = StringUtils.trimToEmpty((String) rows.get("reference_key"));
- String value = StringUtils.trimToEmpty((String) rows.get("reference_value"));
- configPropertyMap.put(key, value);
- });
- logger.trace("loaded configPropertyMap : ({})", configPropertyMap);
+ try {
+ String getPropQuery = "SELECT * FROM CONFIG_PROPERTY_MAP";
+ jdbcTemplate.queryForList(getPropQuery).forEach(rows -> {
+ String key = StringUtils.trimToEmpty((String) rows.get("reference_key"));
+ String value = StringUtils.trimToEmpty((String) rows.get("reference_value"));
+ configPropertyMap.put(key, value);
+ });
+ logger.trace("loaded configPropertyMap : ({})", configPropertyMap);
+ } catch (CannotGetJdbcConnectionException e) {
+ // WHAT TO DO?
+ }
}
@Override
diff --git a/blueprints-processor/adaptors/data-adaptor-provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml b/blueprints-processor/adaptors/data-adaptor-provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml index 4cf4d78cc..644fd77f4 100644 --- a/blueprints-processor/adaptors/data-adaptor-provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml +++ b/blueprints-processor/adaptors/data-adaptor-provider/src/main/resources/org/opendaylight/blueprint/impl-blueprint.xml @@ -24,20 +24,6 @@ <reference id="dataSource" interface="javax.sql.DataSource" />
- <!-- Expose the Common Component Bean -->
-
- <bean id="configResourceService"
- class="org.onap.ccsdk.config.data.adaptor.service.ConfigResourceServiceImpl">
- <argument ref="transactionLogDao" />
- <argument ref="configResourceDao" />
- <argument ref="queryExecutorDao" />
- <argument ref="namedQueryExecutorDao" />
- <argument ref="configPropertyMapDao" />
- </bean>
-
- <service ref="configResourceService"
- interface="org.onap.ccsdk.config.data.adaptor.service.ConfigResourceService" />
-
<!-- Data SourceInitialisation -->
<bean id="config.dataSource"
@@ -81,4 +67,18 @@ <argument ref="jdbcTemplate" />
</bean>
+ <!-- Expose the Common Component Bean -->
+
+ <bean id="configResourceService"
+ class="org.onap.ccsdk.config.data.adaptor.service.ConfigResourceServiceImpl">
+ <argument ref="transactionLogDao" />
+ <argument ref="configResourceDao" />
+ <argument ref="queryExecutorDao" />
+ <argument ref="namedQueryExecutorDao" />
+ <argument ref="configPropertyMapDao" />
+ </bean>
+
+ <service ref="configResourceService"
+ interface="org.onap.ccsdk.config.data.adaptor.service.ConfigResourceService" />
+
</blueprint>
|