summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorge Hernandez <jh1730@att.com>2018-03-09 20:34:42 +0000
committerGerrit Code Review <gerrit@onap.org>2018-03-09 20:34:42 +0000
commit87701d53707aeeb908f47e7d4f76a622ec037905 (patch)
tree53b97efe121b6e2dd8446084e39f50309e99d68a
parent38fa76cdcbe32e2df1da8f483b561395cd010bb3 (diff)
parent37ca14cde10e1b507464d88ed2ebbc3fcaa7e7bb (diff)
Merge "Use org.onap.aaf dependencies"
-rw-r--r--LogParser/pom.xml2
-rw-r--r--ONAP-PAP-REST/pom.xml2
-rw-r--r--PolicyEngineUtils/pom.xml6
-rw-r--r--PolicyEngineUtils/src/main/java/org/onap/policy/utils/AAFPolicyClientImpl.java20
-rw-r--r--PolicyEngineUtils/src/main/java/org/onap/policy/utils/PolicyAccess.java79
5 files changed, 20 insertions, 89 deletions
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 @@
<artifactId>cambriaClient</artifactId>
</exclusion>
<exclusion>
- <groupId>com.att.cadi</groupId>
+ <groupId>org.onap.aaf.cadi</groupId>
<artifactId>cadi-aaf</artifactId>
</exclusion>
</exclusions>
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 @@
<artifactId>cambriaClient</artifactId>
</exclusion>
<exclusion>
- <groupId>com.att.cadi</groupId>
+ <groupId>org.onap.aaf.cadi</groupId>
<artifactId>cadi-aaf</artifactId>
</exclusion>
</exclusions>
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 @@
</exclusions>
</dependency>
<dependency>
- <groupId>com.att.cadi</groupId>
- <artifactId>cadi-aaf</artifactId>
- <version>1.3.0</version>
+ <groupId>org.onap.aaf.cadi</groupId>
+ <artifactId>cadi-aaf</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
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);
}
}