Use org.onap.aaf dependencies 77/34977/1
authorPamela Dragosh <pdragosh@research.att.com>
Fri, 9 Mar 2018 18:17:56 +0000 (13:17 -0500)
committerPamela Dragosh <pdragosh@research.att.com>
Fri, 9 Mar 2018 18:18:14 +0000 (13:18 -0500)
Move from github version to the onap version.

Issue-ID: POLICY-568
Change-Id: I30f91b07cb690e50e829c14725c1bf05a1f4200b
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
LogParser/pom.xml
ONAP-PAP-REST/pom.xml
PolicyEngineUtils/pom.xml
PolicyEngineUtils/src/main/java/org/onap/policy/utils/AAFPolicyClientImpl.java
PolicyEngineUtils/src/main/java/org/onap/policy/utils/PolicyAccess.java

index 16c58dd..db47245 100644 (file)
                                        <artifactId>cambriaClient</artifactId>
                                </exclusion>
                                <exclusion>
-                                       <groupId>com.att.cadi</groupId>
+                                       <groupId>org.onap.aaf.cadi</groupId>
                                        <artifactId>cadi-aaf</artifactId>
                                </exclusion>
                        </exclusions>
index 0c04a86..c0a6d0b 100644 (file)
@@ -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>
index e7196c5..ac2b2a1 100644 (file)
                        </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>
index c3a6be5..7abf60d 100644 (file)
@@ -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);
index a6481aa..1994578 100644 (file)
 
 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);
        }
 }