summaryrefslogtreecommitdiffstats
path: root/PolicyEngineUtils/src/main
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2018-03-09 13:17:56 -0500
committerPamela Dragosh <pdragosh@research.att.com>2018-03-09 13:18:14 -0500
commit37ca14cde10e1b507464d88ed2ebbc3fcaa7e7bb (patch)
treeb3b8307ced602c1eb75d96e3d302aad6353bd460 /PolicyEngineUtils/src/main
parent4e9205fe5586a33461e8207e446147948d3fd309 (diff)
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 <pdragosh@research.att.com>
Diffstat (limited to 'PolicyEngineUtils/src/main')
-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
2 files changed, 15 insertions, 84 deletions
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);
}
}