diff options
author | Krzysztof Opasiak <k.opasiak@samsung.com> | 2019-01-28 21:24:13 +0100 |
---|---|---|
committer | Krzysztof Opasiak <k.opasiak@samsung.com> | 2019-02-02 11:15:39 +0100 |
commit | dd64c2c344196e30543fda9a7840bd5b3e03f587 (patch) | |
tree | d0ed4d82752a96c5fc3cb0c81b9f19173a08f396 /controlloop/common | |
parent | 49f2cf0492b55736577d45b33adf1c81d6fd9b8d (diff) |
Use helper class to retrieve network logger
Instead of abusing constant from Topic interface use new dedicated
helper class to retrive network logger.
Issue-ID: POLICY-1486
Depends-On: Ic1f07466e1ab6abcc00098e617f0e82da19e852d
Change-Id: I453a14c3dda337f2a4d08914ead32b37adc17353
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Diffstat (limited to 'controlloop/common')
5 files changed, 38 insertions, 32 deletions
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java index c2dfc908d..f9a01a70c 100644 --- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuardXacmlHelper.java @@ -3,13 +3,14 @@ * guard * ================================================================================ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -41,6 +42,7 @@ import java.util.UUID; import org.apache.commons.io.IOUtils; import org.apache.http.entity.ContentType; import org.json.JSONObject; +import org.onap.policy.common.utils.slf4j.LoggerFactoryWrapper; import org.onap.policy.drools.system.PolicyEngine; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -48,8 +50,7 @@ import org.slf4j.LoggerFactory; public class PolicyGuardXacmlHelper { private static final Logger logger = LoggerFactory.getLogger(PolicyGuardXacmlHelper.class); - private static final Logger netLogger = - LoggerFactory.getLogger(org.onap.policy.common.endpoints.event.comm.Topic.NETWORK_LOGGER); + private static final Logger netLogger = LoggerFactoryWrapper.getNetworkLogger(); // Constant for the systme line separator private static final String SYSTEM_LS = System.lineSeparator(); @@ -80,7 +81,7 @@ public class PolicyGuardXacmlHelper { /** * Call PDP. - * + * * @param xacmlReq the XACML request * @return the response */ @@ -127,7 +128,7 @@ public class PolicyGuardXacmlHelper { /** * This makes an HTTP POST call to a running PDP RESTful servlet to get a decision. - * + * * @param is the InputStream * @param authorization the Authorization * @param clientauth the ClientAuth @@ -217,7 +218,7 @@ public class PolicyGuardXacmlHelper { /** * Parse XACML PDP response. - * + * * @param xacmlResponse the XACML response * @return the PolicyGuardResponse */ diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java index 96d606a01..6136aee93 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AaiManager.java @@ -3,13 +3,14 @@ * aai * ================================================================================ * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -27,6 +28,7 @@ import java.util.Map; import java.util.UUID; import org.onap.policy.aai.util.Serialization; +import org.onap.policy.common.utils.slf4j.LoggerFactoryWrapper; import org.onap.policy.rest.RestManager; import org.onap.policy.rest.RestManager.Pair; import org.slf4j.Logger; @@ -44,8 +46,7 @@ public final class AaiManager { private static final Logger logger = LoggerFactory.getLogger(AaiManager.class); /** The Constant netLogger. */ - private static final Logger netLogger = - LoggerFactory.getLogger(org.onap.policy.common.endpoints.event.comm.Topic.NETWORK_LOGGER); + private static final Logger netLogger = LoggerFactoryWrapper.getNetworkLogger(); /** The rest manager. */ // The REST manager used for processing REST calls for this AAI manager diff --git a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncManager.java b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncManager.java index 2e39cd9e1..ae43200ef 100644 --- a/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncManager.java +++ b/controlloop/common/model-impl/sdnc/src/main/java/org/onap/policy/sdnc/SdncManager.java @@ -3,6 +3,7 @@ * Copyright (C) 2018 Huawei. All rights reserved. * ================================================================================ * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +28,7 @@ import java.util.HashMap; import java.util.Map; import org.drools.core.WorkingMemory; +import org.onap.policy.common.utils.slf4j.LoggerFactoryWrapper; import org.onap.policy.drools.system.PolicyEngine; import org.onap.policy.rest.RestManager; import org.onap.policy.rest.RestManager.Pair; @@ -34,7 +36,7 @@ import org.onap.policy.sdnc.util.Serialization; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - + public final class SdncManager implements Runnable { private static final String SYSTEM_LS = System.lineSeparator(); @@ -44,15 +46,14 @@ public final class SdncManager implements Runnable { private SdncRequest sdncRequest; private WorkingMemory workingMem; private static final Logger logger = LoggerFactory.getLogger(SdncManager.class); - private static final Logger netLogger = - LoggerFactory.getLogger(org.onap.policy.common.endpoints.event.comm.Topic.NETWORK_LOGGER); + private static final Logger netLogger = LoggerFactoryWrapper.getNetworkLogger(); // The REST manager used for processing REST calls for this Sdnc manager private RestManager restManager; - + /** * Constructor. - * + * * @param wm Drools working memory * @param request request */ @@ -67,13 +68,13 @@ public final class SdncManager implements Runnable { restManager = new RestManager(); - setSdncParams(getPeManagerEnvProperty("sdnc.url"), getPeManagerEnvProperty("sdnc.username"), + setSdncParams(getPeManagerEnvProperty("sdnc.url"), getPeManagerEnvProperty("sdnc.username"), getPeManagerEnvProperty("sdnc.password")); } /** * Set the parameters. - * + * * @param baseUrl base URL * @param name username * @param pwd password @@ -157,7 +158,7 @@ public final class SdncManager implements Runnable { String enginePropertyValue = PolicyEngine.manager.getEnvironmentProperty(enginePropertyName); if (enginePropertyValue == null) { throw new IllegalArgumentException( - "The value of policy engine manager environment property \"" + "The value of policy engine manager environment property \"" + enginePropertyName + "\" may not be null" ); } diff --git a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoManager.java b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoManager.java index 20136f713..7c145e01d 100644 --- a/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoManager.java +++ b/controlloop/common/model-impl/so/src/main/java/org/onap/policy/so/SoManager.java @@ -3,6 +3,7 @@ * so * ================================================================================ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +30,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import org.drools.core.WorkingMemory; +import org.onap.policy.common.utils.slf4j.LoggerFactoryWrapper; import org.onap.policy.drools.system.PolicyEngine; import org.onap.policy.rest.RestManager; import org.onap.policy.rest.RestManager.Pair; @@ -45,8 +47,8 @@ import org.slf4j.LoggerFactory; */ public final class SoManager { private static final Logger logger = LoggerFactory.getLogger(SoManager.class); - private static final Logger netLogger = - LoggerFactory.getLogger(org.onap.policy.common.endpoints.event.comm.Topic.NETWORK_LOGGER); + private static final Logger netLogger = LoggerFactoryWrapper.getNetworkLogger(); + private static ExecutorService executors = Executors.newCachedThreadPool(); private static final int SO_RESPONSE_ERROR = 999; @@ -121,10 +123,10 @@ public final class SoManager { * @param request the SO request * @return a concurrent Future for the thread that handles the request */ - public Future<SoResponse> asyncSoRestCall(final String requestId, + public Future<SoResponse> asyncSoRestCall(final String requestId, final WorkingMemory wm, - final String serviceInstanceId, - final String vnfInstanceId, + final String serviceInstanceId, + final String vnfInstanceId, final String vfModuleInstanceId, final SoRequest request) { return executors.submit(new AsyncSoRestCallThread(requestId, wm, serviceInstanceId, vnfInstanceId, vfModuleInstanceId, request)); @@ -151,9 +153,9 @@ public final class SoManager { * @param vfModuleInstanceId the vf module instance id (not null in case of delete vf module request) * @param request the request itself */ - private AsyncSoRestCallThread(final String requestId, + private AsyncSoRestCallThread(final String requestId, final WorkingMemory wm, final String serviceInstanceId, - final String vnfInstanceId, final String vfModuleInstanceId, + final String vnfInstanceId, final String vfModuleInstanceId, final SoRequest request) { this.requestId = requestId; this.wm = wm; diff --git a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcManager.java b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcManager.java index 7cca6c51b..0acab8b05 100644 --- a/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcManager.java +++ b/controlloop/common/model-impl/vfc/src/main/java/org/onap/policy/vfc/VfcManager.java @@ -2,6 +2,7 @@ * ============LICENSE_START======================================================= * Copyright (C) 2017-2018 Intel Corp, AT&T. All rights reserved. * Modifications Copyright (C) 2018-2019 AT&T Corporation. All rights reserved. + * Modifications Copyright (C) 2019 Samsung Electronics Co., Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +26,7 @@ import java.util.HashMap; import java.util.Map; import org.drools.core.WorkingMemory; +import org.onap.policy.common.utils.slf4j.LoggerFactoryWrapper; import org.onap.policy.drools.system.PolicyEngine; import org.onap.policy.rest.RestManager; import org.onap.policy.rest.RestManager.Pair; @@ -41,15 +43,14 @@ public final class VfcManager implements Runnable { private VfcRequest vfcRequest; private WorkingMemory workingMem; private static final Logger logger = LoggerFactory.getLogger(VfcManager.class); - private static final Logger netLogger = - LoggerFactory.getLogger(org.onap.policy.common.endpoints.event.comm.Topic.NETWORK_LOGGER); + private static final Logger netLogger = LoggerFactoryWrapper.getNetworkLogger(); // The REST manager used for processing REST calls for this VFC manager private RestManager restManager; /** * Constructor. - * + * * @param wm Drools working memory * @param request request */ @@ -70,7 +71,7 @@ public final class VfcManager implements Runnable { /** * Set the parameters. - * + * * @param baseUrl base URL * @param name username * @param pwd password @@ -163,7 +164,7 @@ public final class VfcManager implements Runnable { /** * Protected setter for rest manager to allow mocked rest manager to be used for testing. - * + * * @param restManager the test REST manager */ protected void setRestManager(final RestManager restManager) { @@ -173,7 +174,7 @@ public final class VfcManager implements Runnable { /** * This method reads and validates environmental properties coming from the policy engine. Null * properties cause an {@link IllegalArgumentException} runtime exception to be thrown - * + * * @param string the name of the parameter to retrieve * @return the property value */ |