X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ONAP-PAP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpap%2Fxacml%2Frest%2Fcomponents%2FNotifyOtherPaps.java;h=c3171de39cb8da919f9c926a3224ef3669a51458;hb=5a5842e77e4e0f0b6207192b374d99753db26c7e;hp=34dd73c57a588b16d5cff2033c9d450420d243fe;hpb=766f999081e73b301062f1b96bffb9c52d7e9852;p=policy%2Fengine.git diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/NotifyOtherPaps.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/NotifyOtherPaps.java index 34dd73c57..c3171de39 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/NotifyOtherPaps.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/NotifyOtherPaps.java @@ -3,6 +3,7 @@ * ONAP-PAP-REST * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +36,7 @@ import java.util.UUID; import org.onap.policy.common.logging.flexlogger.FlexLogger; import org.onap.policy.common.logging.flexlogger.Logger; -import org.onap.policy.rest.XACMLRestProperties; +import org.onap.policy.rest.XacmlRestProperties; import org.onap.policy.rest.jpa.PolicyDBDaoEntity; import org.onap.policy.utils.PeCryptoUtils; @@ -60,7 +61,7 @@ public class NotifyOtherPaps { + entityType + "," + newGroupId + ") called"); failedPaps = new ArrayList<>(); - List otherServers = PolicyDBDao.getPolicyDBDaoInstance().getOtherServers(); + List otherServers = PolicyDbDao.getPolicyDbDaoInstance().getOtherServers(); // Notify other paps startNotifyThreads(otherServers, entityId, entityType, newGroupId); // Retry for failed paps @@ -104,10 +105,9 @@ public class NotifyOtherPaps { @Override public void run() { - PolicyDBDao dao = new PolicyDBDao(); + PolicyDbDao dao = new PolicyDbDao(); PolicyDBDaoEntity dbdEntity = (PolicyDBDaoEntity) obj; String otherPap = dbdEntity.getPolicyDBDaoUrl(); - String username = dbdEntity.getUsername(); String txt; try { txt = PeCryptoUtils.decrypt(dbdEntity.getPassword()); @@ -118,7 +118,6 @@ public class NotifyOtherPaps { } HttpURLConnection connection = null; - UUID requestId = UUID.randomUUID(); URL url; String papUrl; try { @@ -176,6 +175,10 @@ public class NotifyOtherPaps { LOGGER.warn("Caught ProtocolException on connection.setRequestMethod(\"PUT\");", e); return; } + + String username = dbdEntity.getUsername(); + UUID requestId = UUID.randomUUID(); + Base64.Encoder encoder = Base64.getEncoder(); String encoding = encoder.encodeToString((username + ":" + txt).getBytes(StandardCharsets.UTF_8)); connection.setRequestProperty("Authorization", "Basic " + encoding); @@ -185,7 +188,7 @@ public class NotifyOtherPaps { int readTimeout; try { readTimeout = - Integer.parseInt(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_NOTIFY_TIMEOUT)); + Integer.parseInt(XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_NOTIFY_TIMEOUT)); } catch (Exception e) { LOGGER.error("xacml.rest.pap.notify.timeoutms property not set, using a default.", e); readTimeout = 10000;