--- /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
+package org.commscope.tr069adapter.common.timer.impl;\r
+\r
+import static org.commscope.tr069adapter.common.scheduler.impl.TimerAPIConstants.TIMER_DATA_KEY;\r
+import static org.commscope.tr069adapter.common.scheduler.impl.TimerAPIConstants.TIMER_LISTENER_KEY;\r
+\r
+import java.io.Serializable;\r
+import java.util.Date;\r
+\r
+import org.commscope.tr069adapter.common.scheduler.ExecutionContext;\r
+import org.commscope.tr069adapter.common.scheduler.Job;\r
+import org.commscope.tr069adapter.common.scheduler.impl.QuartzJob;\r
+import org.commscope.tr069adapter.common.timer.TimerListener;\r
+import org.slf4j.Logger;\r
+import org.slf4j.LoggerFactory;\r
+import org.springframework.context.ApplicationContext;\r
+import org.springframework.stereotype.Component;\r
+\r
+@Component("timerHandler")\r
+public class TimerHandlerDM implements Job {\r
+\r
+ private static final Logger logger = LoggerFactory.getLogger(TimerHandlerDM.class);\r
+\r
+ @Override\r
+ public void execute(ExecutionContext context) {\r
+\r
+ try {\r
+ logger.debug("Notification is received at {} for timer :{}", new Date(), context.getJobId());\r
+ String beanName = context.getJobData(TIMER_LISTENER_KEY) + "";\r
+ String timerId = context.getJobId();\r
+ Object obj = context.getJobData(TIMER_DATA_KEY);\r
+ Serializable data = (obj == null) ? null : (Serializable) obj;\r
+ ApplicationContext ctx = QuartzJob.getApplicationContext();\r
+ TimerListener listener = (TimerListener) ctx.getBean(beanName);\r
+ listener.notifyTimeout(timerId, data);\r
+ } catch (Exception e) {\r
+ logger.error("Error while notifying timer listener. {}", e.toString());\r
+ }\r
+\r
+ }\r
+\r
+}\r