aboutsummaryrefslogtreecommitdiffstats
path: root/PolicyEngineUtils/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'PolicyEngineUtils/src/main/java')
-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);
}
}