--- /dev/null
+/*\r
+ * ============LICENSE_START========================================================================\r
+ * ONAP : tr-069-adapter\r
+ * =================================================================================================\r
+ * Copyright (C) 2020 CommScope Inc Intellectual Property.\r
+ * =================================================================================================\r
+ * This tr-069-adapter software file is distributed by CommScope Inc under the Apache License,\r
+ * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You\r
+ * may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\r
+ * either express or implied. See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ===============LICENSE_END=======================================================================\r
+ */\r
+\r
+\r
+package org.commscope.tr069adapter.acs.requestprocessor.handler;\r
+\r
+import static org.commscope.tr069adapter.acs.common.utils.AcsConstants.TR069_NBI_REQUEST_CF;\r
+import static org.commscope.tr069adapter.acs.common.utils.AcsConstants.TR069_NBI_REQUEST_Q;\r
+\r
+import org.commscope.tr069adapter.acs.common.DeviceRPCRequest;\r
+import org.commscope.tr069adapter.acs.common.exception.SessionConcurrentAccessException;\r
+import org.commscope.tr069adapter.acs.common.exception.TR069EventProcessingException;\r
+import org.commscope.tr069adapter.acs.requestprocessor.impl.TR069RequestProcessEngine;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+import org.slf4j.MDC;\r
+import org.springframework.beans.factory.annotation.Autowired;\r
+import org.springframework.jms.annotation.JmsListener;\r
+import org.springframework.stereotype.Component;\r
+import org.springframework.transaction.annotation.Transactional;\r
+\r
+@Component\r
+public class DeviceRPCRequestHandler {\r
+\r
+ private static final Logger logger = LoggerFactory.getLogger(DeviceRPCRequestHandler.class);\r
+\r
+ private static final String CLIENT_STR = "client";\r
+\r
+ @Autowired\r
+ private TR069RequestProcessEngine tr069RequestProcessEngine;\r
+\r
+ @JmsListener(destination = TR069_NBI_REQUEST_Q, containerFactory = TR069_NBI_REQUEST_CF)\r
+ @Transactional(rollbackFor = Exception.class)\r
+ public void onMessage(DeviceRPCRequest mapperDeviceOperationRequest)\r
+ throws SessionConcurrentAccessException {\r
+ logger.debug("Received a JMS message from Mapper for TR069 Device RPC operation");\r
+ try {\r
+ if (mapperDeviceOperationRequest != null) {\r
+ MDC.put(CLIENT_STR, mapperDeviceOperationRequest.getDeviceDetails().getDeviceId());\r
+ logger.debug("Received a TR069 operation request from Mapper with operation ID: {} ",\r
+ mapperDeviceOperationRequest.getOperationId());\r
+ tr069RequestProcessEngine.processDeviceRPCRequest(mapperDeviceOperationRequest);\r
+ }\r
+ } catch (TR069EventProcessingException ex) {\r
+ logger.error(ex.getMessage());\r
+ } finally {\r
+ MDC.remove(CLIENT_STR);\r
+ }\r
+ }\r
+\r
+}\r