From: Pamela Dragosh Date: Fri, 9 Mar 2018 18:17:56 +0000 (-0500) Subject: Use org.onap.aaf dependencies X-Git-Tag: v1.2.0~70^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=policy%2Fengine.git;a=commitdiff_plain;h=37ca14cde10e1b507464d88ed2ebbc3fcaa7e7bb Use org.onap.aaf dependencies Move from github version to the onap version. Issue-ID: POLICY-568 Change-Id: I30f91b07cb690e50e829c14725c1bf05a1f4200b Signed-off-by: Pamela Dragosh --- diff --git a/LogParser/pom.xml b/LogParser/pom.xml index 16c58dd4c..db47245b6 100644 --- a/LogParser/pom.xml +++ b/LogParser/pom.xml @@ -125,7 +125,7 @@ cambriaClient - com.att.cadi + org.onap.aaf.cadi cadi-aaf diff --git a/ONAP-PAP-REST/pom.xml b/ONAP-PAP-REST/pom.xml index 0c04a8600..c0a6d0bb8 100644 --- a/ONAP-PAP-REST/pom.xml +++ b/ONAP-PAP-REST/pom.xml @@ -84,7 +84,7 @@ cambriaClient - com.att.cadi + org.onap.aaf.cadi cadi-aaf diff --git a/PolicyEngineUtils/pom.xml b/PolicyEngineUtils/pom.xml index e7196c511..ac2b2a1a9 100644 --- a/PolicyEngineUtils/pom.xml +++ b/PolicyEngineUtils/pom.xml @@ -118,9 +118,9 @@ - com.att.cadi - cadi-aaf - 1.3.0 + org.onap.aaf.cadi + cadi-aaf + 1.0.0-SNAPSHOT com.google.code.gson diff --git a/PolicyEngineUtils/src/main/java/org/onap/policy/utils/AAFPolicyClientImpl.java b/PolicyEngineUtils/src/main/java/org/onap/policy/utils/AAFPolicyClientImpl.java index c3a6be568..7abf60dae 100644 --- a/PolicyEngineUtils/src/main/java/org/onap/policy/utils/AAFPolicyClientImpl.java +++ b/PolicyEngineUtils/src/main/java/org/onap/policy/utils/AAFPolicyClientImpl.java @@ -24,16 +24,16 @@ package org.onap.policy.utils; import java.util.Properties; import org.apache.log4j.Logger; +import org.onap.aaf.cadi.Access.Level; +import org.onap.aaf.cadi.CadiException; +import org.onap.aaf.cadi.PropAccess; +import org.onap.aaf.cadi.aaf.AAFPermission; +import org.onap.aaf.cadi.aaf.v2_0.AAFAuthn; +import org.onap.aaf.cadi.aaf.v2_0.AAFCon; +import org.onap.aaf.cadi.aaf.v2_0.AAFConDME2; +import org.onap.aaf.cadi.aaf.v2_0.AAFLurPerm; +import org.onap.aaf.cadi.config.Config; -import com.att.cadi.Access; -import com.att.cadi.Access.Level; -import com.att.cadi.CadiException; -import com.att.cadi.aaf.AAFPermission; -import com.att.cadi.aaf.v2_0.AAFAuthn; -import com.att.cadi.aaf.v2_0.AAFCon; -import com.att.cadi.aaf.v2_0.AAFConDME2; -import com.att.cadi.aaf.v2_0.AAFLurPerm; -import com.att.cadi.config.Config; /** @@ -62,7 +62,7 @@ public class AAFPolicyClientImpl implements AAFPolicyClient{ private static AAFCon aafCon = null; private static AAFLurPerm aafLurPerm = null; private static AAFAuthn aafAuthn = null; - private static Access access = null; + private static PropAccess access = null; private AAFPolicyClientImpl(Properties properties) throws AAFPolicyException{ setup(properties); diff --git a/PolicyEngineUtils/src/main/java/org/onap/policy/utils/PolicyAccess.java b/PolicyEngineUtils/src/main/java/org/onap/policy/utils/PolicyAccess.java index a6481aaeb..1994578e6 100644 --- a/PolicyEngineUtils/src/main/java/org/onap/policy/utils/PolicyAccess.java +++ b/PolicyEngineUtils/src/main/java/org/onap/policy/utils/PolicyAccess.java @@ -20,87 +20,18 @@ package org.onap.policy.utils; -import java.io.IOException; -import java.io.InputStream; -import java.util.Date; import java.util.Properties; -import org.apache.log4j.Logger; +import org.onap.aaf.cadi.PropAccess; -import com.att.cadi.Access; /** * PolicyAccess used by AAF for logging purposes. * */ -public class PolicyAccess implements Access { - private static final Logger logger = Logger.getLogger(PolicyAccess.class.getName()); - - private Properties properties = new Properties(); - private Access.Level logLevel = Access.Level.INFO; - - public PolicyAccess(Properties properties, Level level) { - this.properties = properties; - if(level!=null){ - logLevel = level; - } - } - - @Override - public ClassLoader classLoader() { - return getClass().getClassLoader(); - } - - @Override - public String decrypt(String enc, boolean arg1) throws IOException { - return enc; - } - - @Override - public String getProperty(String prop, String def) { - return properties.getProperty(prop, def); - } - - @Override - public void load(InputStream in) throws IOException { - properties.load(in); - } - - @Override - public void log(Level level, Object... args) { - if (logLevel.compareTo(level) > 0) { - return; - } - StringBuilder sb = new StringBuilder(); - sb.append(new Date()).append(' ').append(level); - logtail(sb, args); - } - - @Override - public void log(Exception e, Object... args) { - StringBuilder sb = new StringBuilder(); - sb.append(new Date()).append(" EXCEPTION ").append(e.getMessage()); - logtail(sb, args); - logger.error(e.getMessage() + e); - } - - @Override - public void setLogLevel(Level level) { - logLevel = level; - } - - private void logtail(StringBuilder sb, Object[] args) { - for (Object o: args) { - String s = o.toString(); - if (s.length() > 0) { - sb.append(' ').append(s); - } - } - logger.info(sb.toString()); - } - - @Override - public boolean willLog(Level arg0) { - return false; +public class PolicyAccess extends PropAccess { + public PolicyAccess (Properties props, Level level) { + super(props); + this.setLogLevel(level); } }