summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuangrong Fu <fu.guangrong@zte.com.cn>2022-08-11 08:58:53 +0800
committerGuangrong Fu <fu.guangrong@zte.com.cn>2022-08-11 08:58:53 +0800
commiteeb6517daf02446dda6bfbb6881006647e8add0b (patch)
tree1bbc9a1aad78e2495dfa1c044213e946fa8748a8
parentbd933fe6a9ceaaf300908ebe7da14aa26383b5d5 (diff)
Fixed a DB connection problem
Issue-ID: HOLMES-511 Signed-off-by: Guangrong Fu <fu.guangrong@zte.com.cn> Change-Id: Ic6e31ce8320440b40ef0f69f9fe51fb0133b6b67
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/database/DatabaseConfiguration.java65
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/dmaap/store/ClosedLoopControlNameCache.java2
-rw-r--r--holmes-actions/src/main/java/org/onap/holmes/common/dmaap/store/UniqueRequestIdCache.java2
3 files changed, 25 insertions, 44 deletions
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/database/DatabaseConfiguration.java b/holmes-actions/src/main/java/org/onap/holmes/common/database/DatabaseConfiguration.java
index 101c350..c120e9f 100644
--- a/holmes-actions/src/main/java/org/onap/holmes/common/database/DatabaseConfiguration.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/database/DatabaseConfiguration.java
@@ -16,49 +16,39 @@
package org.onap.holmes.common.database;
import org.jdbi.v3.core.Jdbi;
-import org.jdbi.v3.core.mapper.RowMapper;
-import org.jdbi.v3.core.spi.JdbiPlugin;
import org.jdbi.v3.postgres.PostgresPlugin;
import org.jdbi.v3.sqlobject.SqlObjectPlugin;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
-import org.springframework.jdbc.datasource.TransactionAwareDataSourceProxy;
+import org.springframework.jdbc.datasource.DriverManagerDataSource;
import javax.sql.DataSource;
-import java.util.List;
@Configuration
public class DatabaseConfiguration {
-//
-// @Value("${spring.datasource.url}")
-// private String url;
-//
-// @Value("${spring.datasource.username}")
-// private String username;
-//
-// @Value("${spring.datasource.password}")
-// private String pwd;
-//
-// @Value("${spring.datasource.dirver-class-name}")
-// private String driverClass;
-//
-// @Bean
-// public DataSource driverManagerDataSource() {
-// System.out.println("======================================: " + driverClass);
-// DriverManagerDataSource ds = new DriverManagerDataSource();
-// ds.setDriverClassName(driverClass);
-// ds.setUrl(url);
-// ds.setUsername(username);
-// ds.setPassword(pwd);
-// return ds;
-// }
-// @Bean
-// public DataSourceTransactionManager dataSourceTransactionManager(DataSource dataSource) {
-// DataSourceTransactionManager dataSourceTransactionManager = new DataSourceTransactionManager();
-// dataSourceTransactionManager.setDataSource(dataSource);
-// return dataSourceTransactionManager;
-// }
+ @Value("${spring.datasource.url}")
+ private String url;
+
+ @Value("${spring.datasource.username}")
+ private String username;
+
+ @Value("${spring.datasource.password}")
+ private String pwd;
+
+ @Value("${spring.datasource.dirver-class-name}")
+ private String driverClass;
+
+ @Bean
+ public DataSource driverManagerDataSource() {
+ DriverManagerDataSource ds = new DriverManagerDataSource();
+ ds.setDriverClassName(driverClass);
+ ds.setUrl(url);
+ ds.setUsername(username);
+ ds.setPassword(pwd);
+ return ds;
+ }
@Bean
public Jdbi jdbi(DataSource dataSource) {
@@ -66,13 +56,4 @@ public class DatabaseConfiguration {
.installPlugin(new SqlObjectPlugin())
.installPlugin(new PostgresPlugin());
}
-
-// @Bean
-// public Jdbi jdbi(DataSource ds, List<JdbiPlugin> jdbiPlugins, List<RowMapper<?>> rowMappers) {
-// TransactionAwareDataSourceProxy proxy = new TransactionAwareDataSourceProxy(ds);
-// Jdbi jdbi = Jdbi.create(proxy);
-// jdbiPlugins.forEach(plugin -> jdbi.installPlugin(plugin));
-// rowMappers.forEach(mapper -> jdbi.registerRowMapper(mapper));
-// return jdbi;
-// }
}
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/store/ClosedLoopControlNameCache.java b/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/store/ClosedLoopControlNameCache.java
index 2d9cf99..89514dc 100644
--- a/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/store/ClosedLoopControlNameCache.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/store/ClosedLoopControlNameCache.java
@@ -33,7 +33,7 @@ public class ClosedLoopControlNameCache extends ConcurrentHashMap<String, String
}
public String remove(String packageName) {
- log.info(String.format("<%s> was removed into ClosedLoopControlNameCache.", packageName));
+ log.info(String.format("<%s> was removed from ClosedLoopControlNameCache.", packageName));
return super.remove(packageName);
}
}
diff --git a/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/store/UniqueRequestIdCache.java b/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/store/UniqueRequestIdCache.java
index f4e2459..8c68776 100644
--- a/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/store/UniqueRequestIdCache.java
+++ b/holmes-actions/src/main/java/org/onap/holmes/common/dmaap/store/UniqueRequestIdCache.java
@@ -35,7 +35,7 @@ public class UniqueRequestIdCache extends ConcurrentHashMap<String, String> {
}
public String remove(String alarmId) {
- log.info(String.format("<%s> was removed into UniqueRequestIdCache.", alarmId));
+ log.info(String.format("<%s> was removed from UniqueRequestIdCache.", alarmId));
return super.remove(alarmId);
}
}