X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=datarouter-prov%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fdmaap%2Fdatarouter%2Fprovisioning%2FSynchronizerTask.java;h=3097a9dbeb13ac0babda93de8f898972b83ba7d6;hb=refs%2Fchanges%2F51%2F78851%2F11;hp=f9d0867d323dd74047bd48a5471d2bd677d65c9a;hpb=96a4ed9df2c1e79e5edffff8ea58e02c98844d55;p=dmaap%2Fdatarouter.git diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SynchronizerTask.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SynchronizerTask.java index f9d0867d..3097a9db 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SynchronizerTask.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/SynchronizerTask.java @@ -50,6 +50,8 @@ import java.util.TreeSet; import javax.servlet.http.HttpServletResponse; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpGet; @@ -60,7 +62,6 @@ import org.apache.http.entity.ByteArrayEntity; import org.apache.http.entity.ContentType; import org.apache.http.impl.client.AbstractHttpClient; import org.apache.http.impl.client.DefaultHttpClient; -import org.apache.log4j.Logger; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; @@ -117,7 +118,7 @@ public class SynchronizerTask extends TimerTask { private static final String[] stnames = {"UNKNOWN", "ACTIVE", "STANDBY"}; private static final long ONE_HOUR = 60 * 60 * 1000L; - private final Logger logger; + private final EELFLogger logger; private final Timer rolex; private final String spooldir; private int state; @@ -139,7 +140,7 @@ public class SynchronizerTask extends TimerTask { @SuppressWarnings("deprecation") private SynchronizerTask() { - logger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal"); + logger = EELFManager.getInstance().getLogger("InternalLog"); rolex = new Timer(); spooldir = (new DB()).getProperties().getProperty("org.onap.dmaap.datarouter.provserver.spooldir"); state = UNKNOWN; @@ -151,14 +152,14 @@ public class SynchronizerTask extends TimerTask { Properties props = (new DB()).getProperties(); String type = props.getProperty(Main.KEYSTORE_TYPE_PROPERTY, "jks"); String store = props.getProperty(Main.KEYSTORE_PATH_PROPERTY); - String pass = props.getProperty(Main.KEYSTORE_PASSWORD_PROPERTY); + String pass = props.getProperty(Main.KEYSTORE_PASS_PROPERTY); KeyStore keyStore = KeyStore.getInstance(type); try(FileInputStream instream = new FileInputStream(new File(store))) { keyStore.load(instream, pass.toCharArray()); } store = props.getProperty(Main.TRUSTSTORE_PATH_PROPERTY); - pass = props.getProperty(Main.TRUSTSTORE_PASSWORD_PROPERTY); + pass = props.getProperty(Main.TRUSTSTORE_PASS_PROPERTY); KeyStore trustStore = null; if (store != null && store.length() > 0) { trustStore = KeyStore.getInstance(KeyStore.getDefaultType()); @@ -171,7 +172,7 @@ public class SynchronizerTask extends TimerTask { // We are connecting with the node name, but the certificate will have the CNAME // So we need to accept a non-matching certificate name String keystorepass = props.getProperty( - Main.KEYSTORE_PASSWORD_PROPERTY); //itrack.web.att.com/browse/DATARTR-6 for changing hard coded passphase ref + Main.KEYSTORE_PASS_PROPERTY); //itrack.web.att.com/browse/DATARTR-6 for changing hard coded passphase ref try(AbstractHttpClient hc = new DefaultHttpClient()) { SSLSocketFactory socketFactory = (trustStore == null) @@ -282,7 +283,6 @@ public class SynchronizerTask extends TimerTask { } } catch (Exception e) { logger.warn("PROV0020: Caught exception in SynchronizerTask: " + e); - e.printStackTrace(); } } @@ -328,7 +328,7 @@ public class SynchronizerTask extends TimerTask { * Synchronize the Feeds in the JSONArray, with the Feeds in the DB. */ private void syncFeeds(JSONArray ja) { - Collection coll = new ArrayList(); + Collection coll = new ArrayList<>(); for (int n = 0; n < ja.length(); n++) { try { Feed f = new Feed(ja.getJSONObject(n)); @@ -346,7 +346,7 @@ public class SynchronizerTask extends TimerTask { * Synchronize the Subscriptions in the JSONArray, with the Subscriptions in the DB. */ private void syncSubs(JSONArray ja) { - Collection coll = new ArrayList(); + Collection coll = new ArrayList<>(); for (int n = 0; n < ja.length(); n++) { try { //Data Router Subscriber HTTPS Relaxation feature USERSTORYID:US674047. @@ -367,7 +367,7 @@ public class SynchronizerTask extends TimerTask { * Rally:US708115 - Synchronize the Groups in the JSONArray, with the Groups in the DB. */ private void syncGroups(JSONArray ja) { - Collection coll = new ArrayList(); + Collection coll = new ArrayList<>(); for (int n = 0; n < ja.length(); n++) { try { Group g = new Group(ja.getJSONObject(n)); @@ -386,7 +386,7 @@ public class SynchronizerTask extends TimerTask { * Synchronize the Parameters in the JSONObject, with the Parameters in the DB. */ private void syncParams(JSONObject jo) { - Collection coll = new ArrayList(); + Collection coll = new ArrayList<>(); for (String k : jo.keySet()) { String v = ""; try { @@ -413,7 +413,7 @@ public class SynchronizerTask extends TimerTask { } private void syncIngressRoutes(JSONArray ja) { - Collection coll = new ArrayList(); + Collection coll = new ArrayList<>(); for (int n = 0; n < ja.length(); n++) { try { IngressRoute in = new IngressRoute(ja.getJSONObject(n)); @@ -428,7 +428,7 @@ public class SynchronizerTask extends TimerTask { } private void syncEgressRoutes(JSONObject jo) { - Collection coll = new ArrayList(); + Collection coll = new ArrayList<>(); for (String key : jo.keySet()) { try { int sub = Integer.parseInt(key); @@ -447,7 +447,7 @@ public class SynchronizerTask extends TimerTask { } private void syncNetworkRoutes(JSONArray ja) { - Collection coll = new ArrayList(); + Collection coll = new ArrayList<>(); for (int n = 0; n < ja.length(); n++) { try { NetworkRoute nr = new NetworkRoute(ja.getJSONObject(n)); @@ -466,7 +466,7 @@ public class SynchronizerTask extends TimerTask { try { Map newmap = getMap(newc); Map oldmap = getMap(oldc); - Set union = new TreeSet(newmap.keySet()); + Set union = new TreeSet<>(newmap.keySet()); union.addAll(oldmap.keySet()); DB db = new DB(); @SuppressWarnings("resource") @@ -503,13 +503,12 @@ public class SynchronizerTask extends TimerTask { db.release(conn); } catch (SQLException e) { logger.warn("PROV5009: problem during sync, exception: " + e); - e.printStackTrace(); } return changes; } private Map getMap(Collection c) { - Map map = new HashMap(); + Map map = new HashMap<>(); for (Syncable v : c) { map.put(v.getKey(), v); }