From 8f61e18ef0457745719f05bd5c186992a7155416 Mon Sep 17 00:00:00 2001 From: Jorge Hernandez Date: Thu, 22 Jun 2017 17:17:28 -0500 Subject: [POLICY-30] remove problematic layers add configurability through telemetry API Change-Id: I77ebde12a417d421b98646c32dc74824f4494c2e Signed-off-by: Jorge Hernandez --- .../policy/drools/utils/OrderedServiceImpl.java | 8 +++++++- .../policy/drools/utils/PropertyUtil.java | 18 ------------------ .../policy/drools/utils/ReflectionUtil.java | 22 +++++++++------------- 3 files changed, 16 insertions(+), 32 deletions(-) (limited to 'policy-utils/src/main/java') diff --git a/policy-utils/src/main/java/org/openecomp/policy/drools/utils/OrderedServiceImpl.java b/policy-utils/src/main/java/org/openecomp/policy/drools/utils/OrderedServiceImpl.java index c5f9a343..72bf7b8b 100644 --- a/policy-utils/src/main/java/org/openecomp/policy/drools/utils/OrderedServiceImpl.java +++ b/policy-utils/src/main/java/org/openecomp/policy/drools/utils/OrderedServiceImpl.java @@ -27,12 +27,18 @@ import java.util.LinkedList; import java.util.List; import java.util.ServiceLoader; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + /** * This class is a template for building a sorted list of service instances, * which are discovered and created using 'ServiceLoader'. */ public class OrderedServiceImpl { + // logger + private static Logger logger = LoggerFactory.getLogger(OrderedServiceImpl.class); + // sorted list of instances implementing the service private List implementers = null; @@ -113,7 +119,7 @@ public class OrderedServiceImpl // create an unmodifiable version of this list implementers = Collections.unmodifiableList(tmp); - System.out.println("***** OrderedServiceImpl implementers:\n" + implementers); + logger.info("***** OrderedServiceImpl implementers:\n {}", implementers); return(implementers); } diff --git a/policy-utils/src/main/java/org/openecomp/policy/drools/utils/PropertyUtil.java b/policy-utils/src/main/java/org/openecomp/policy/drools/utils/PropertyUtil.java index 34ddcc1c..1e8dc267 100644 --- a/policy-utils/src/main/java/org/openecomp/policy/drools/utils/PropertyUtil.java +++ b/policy-utils/src/main/java/org/openecomp/policy/drools/utils/PropertyUtil.java @@ -382,22 +382,4 @@ public class PropertyUtil stopListening(new File(fileName), listener); } - /* ============================================================ */ - - // TEMPORARY - used to test callback interface - static public class Test implements Listener - { - String name; - - public Test(String name) - { - this.name = name; - } - - public void propertiesChanged(Properties properties, Set changedKeys) - { - System.out.println("Test(" + name + ")\nproperties = " + properties - + "\nchangedKeys = " + changedKeys); - } - } } diff --git a/policy-utils/src/main/java/org/openecomp/policy/drools/utils/ReflectionUtil.java b/policy-utils/src/main/java/org/openecomp/policy/drools/utils/ReflectionUtil.java index 1ab68282..0d82e847 100644 --- a/policy-utils/src/main/java/org/openecomp/policy/drools/utils/ReflectionUtil.java +++ b/policy-utils/src/main/java/org/openecomp/policy/drools/utils/ReflectionUtil.java @@ -23,43 +23,41 @@ */ package org.openecomp.policy.drools.utils; -import org.openecomp.policy.common.logging.eelf.PolicyLogger; - +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Reflection utilities * */ public class ReflectionUtil { + protected final static Logger logger = LoggerFactory.getLogger(ReflectionUtil.class); + /** * returns (if exists) a class fetched from a given classloader * * @param classLoader the class loader - * @param classname the class name + * @param className the class name * @return the actual class * @throws IllegalArgumentException if an invalid parameter has been passed in */ public static Class fetchClass(ClassLoader classLoader, - String classname) + String className) throws IllegalArgumentException { - - PolicyLogger.info("FETCH-CLASS: " + classname + " FROM " + classLoader); - if (classLoader == null) throw new IllegalArgumentException("A class loader must be provided"); - if (classname == null) + if (className == null) throw new IllegalArgumentException("A class name to be fetched in class loader " + classLoader + " must be provided"); try { - Class aClass = Class.forName(classname, + Class aClass = Class.forName(className, true, classLoader); return aClass; } catch (Exception e) { - e.printStackTrace(); - PolicyLogger.error("FETCH-CLASS: " + classname + " IN " + classLoader + " does NOT exist"); + logger.error("FETCHED-CLASS {} IN {} does NOT EXIST", className, classLoader); } return null; @@ -84,8 +82,6 @@ public class ReflectionUtil { * @return */ public static boolean isSubclass(Class parent, Class presumedSubclass) { - PolicyLogger.debug("IS-SUBCLASS: superclass: " + parent.getCanonicalName() + - " subclass: " + presumedSubclass.getCanonicalName()); return (parent.isAssignableFrom(presumedSubclass)); } -- cgit 1.2.3-korg