X-Git-Url: https://gerrit.onap.org/r/gitweb?p=policy%2Fengine.git;a=blobdiff_plain;f=ONAP-PAP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpap%2Fxacml%2Frest%2FPAPRestConfig.java;h=2ca87af28cc36a13b1fe8d000ce4f8e2bb67b0f0;hp=9ccccff05d1d0a57fa28ef4eaa0cd11f2b117706;hb=c2ca6ea5cb44103903e1409e8dd6db80167e61e8;hpb=c1b69dfb1297365d35f2ada8690f13f787d38b4f diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/PAPRestConfig.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/PAPRestConfig.java index 9ccccff05..2ca87af28 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/PAPRestConfig.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/PAPRestConfig.java @@ -24,13 +24,15 @@ package org.onap.policy.pap.xacml.rest; import java.io.FileInputStream; import java.io.InputStream; import java.util.Properties; + import javax.annotation.PostConstruct; import javax.sql.DataSource; + import org.apache.tomcat.dbcp.dbcp2.BasicDataSource; import org.hibernate.SessionFactory; import org.onap.policy.common.logging.flexlogger.FlexLogger; import org.onap.policy.common.logging.flexlogger.Logger; -import org.onap.policy.rest.XACMLRestProperties; +import org.onap.policy.rest.XacmlRestProperties; import org.onap.policy.utils.PeCryptoUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; @@ -45,9 +47,9 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter @Configuration @EnableWebMvc @EnableTransactionManagement -@ComponentScan(basePackages = { "org.onap.*", "com.*" }) +@ComponentScan(basePackages = {"org.onap.*", "com.*"}) public class PAPRestConfig extends WebMvcConfigurerAdapter { - private static final Logger LOGGER = FlexLogger.getLogger(PAPRestConfig.class); + private static final Logger LOGGER = FlexLogger.getLogger(PAPRestConfig.class); private static String dbDriver = null; private static String dbUrl = null; @@ -55,18 +57,18 @@ public class PAPRestConfig extends WebMvcConfigurerAdapter { private static String dbPassword = null; @PostConstruct - public void init(){ + public void init() { Properties prop = new Properties(); - try(InputStream input = new FileInputStream("xacml.pap.properties")) { + try (InputStream input = new FileInputStream("xacml.pap.properties")) { // load a properties file prop.load(input); setDbDriver(prop.getProperty("javax.persistence.jdbc.driver")); setDbUrl(prop.getProperty("javax.persistence.jdbc.url")); setDbUserName(prop.getProperty("javax.persistence.jdbc.user")); - PeCryptoUtils.initAesKey(prop.getProperty(XACMLRestProperties.PROP_AES_KEY)); + PeCryptoUtils.initAesKey(prop.getProperty(XacmlRestProperties.PROP_AES_KEY)); setDbPassword(PeCryptoUtils.decrypt(prop.getProperty("javax.persistence.jdbc.password"))); - }catch(Exception e){ - LOGGER.error("Exception Occured while loading properties file"+e); + } catch (Exception e) { + LOGGER.error("Exception Occured while loading properties file" + e); } }