From b80471e4f68e6d5ba670d03b12b92029e58c0bc7 Mon Sep 17 00:00:00 2001 From: Dan Timoney Date: Tue, 24 Mar 2020 14:30:24 -0400 Subject: Use MariaDB instead of Derby Use MariaDB instead of Derby as backing store for sliboot Change-Id: Ib9fa4abaaf88bcb1eac2276bc974474f067a06d3 Issue-ID: CCSDK-2188 Signed-off-by: Dan Timoney --- .../sliapi/springboot/core/SvcLogicFactory.java | 2 ++ .../sli/core/sliapi/springboot/core/WebConfig.java | 41 ++-------------------- 2 files changed, 5 insertions(+), 38 deletions(-) (limited to 'sliapi/springboot/src/main/java') diff --git a/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/SvcLogicFactory.java b/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/SvcLogicFactory.java index cf8dc5e3..0c8480e1 100644 --- a/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/SvcLogicFactory.java +++ b/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/SvcLogicFactory.java @@ -64,12 +64,14 @@ public class SvcLogicFactory { public Properties getProperties() { Properties props = new Properties(); + String propPath = System.getProperty("serviceLogicProperties", ""); if ("".equals(propPath)) { propPath = System.getenv("SVCLOGIC_PROPERTIES"); } + if ((propPath == null) || propPath.length() == 0) { propPath = "src/main/resources/svclogic.properties"; } diff --git a/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/WebConfig.java b/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/WebConfig.java index 41d3791b..558a82a1 100644 --- a/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/WebConfig.java +++ b/sliapi/springboot/src/main/java/org/onap/ccsdk/sli/core/sliapi/springboot/core/WebConfig.java @@ -21,11 +21,14 @@ package org.onap.ccsdk.sli.core.sliapi.springboot.core; import org.onap.logging.filter.spring.LoggingInterceptor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; +import org.springframework.jdbc.datasource.DriverManagerDataSource; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; import org.springframework.orm.jpa.JpaTransactionManager; @@ -48,43 +51,5 @@ import javax.sql.DataSource; @EnableTransactionManagement public class WebConfig implements WebMvcConfigurer { -/* @Bean - LoggingInterceptor loggingInterceptor() { - return new LoggingInterceptor(); - } - public void addInterceptors(InterceptorRegistry registry) { - registry.addInterceptor(loggingInterceptor()); // handles audit log entries - }*/ - - @Bean - public DataSource dataSource() { - - EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder(); - builder.setName("sdnctl"); - return builder.setType(EmbeddedDatabaseType.DERBY).build(); - } - - @Bean - public EntityManagerFactory entityManagerFactory() { - - HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); - vendorAdapter.setGenerateDdl(true); - - LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean(); - factory.setJpaVendorAdapter(vendorAdapter); - factory.setPackagesToScan("org.onap.ccsdk.sli.core.sliapi.springboot.*"); - factory.setDataSource(dataSource()); - factory.afterPropertiesSet(); - - return factory.getObject(); - } - - @Bean - public PlatformTransactionManager transactionManager() { - - JpaTransactionManager txManager = new JpaTransactionManager(); - txManager.setEntityManagerFactory(entityManagerFactory()); - return txManager; - } } \ No newline at end of file -- cgit 1.2.3-korg