Fix: Update Sonar needed parameters
[oam/tr069-adapter.git] / common / src / main / java / org / commscope / tr069adapter / common / scheduler / SchedulerManager.java
1 /*\r
2  * ============LICENSE_START========================================================================\r
3  * ONAP : tr-069-adapter\r
4  * =================================================================================================\r
5  * Copyright (C) 2020 CommScope Inc Intellectual Property.\r
6  * =================================================================================================\r
7  * This tr-069-adapter software file is distributed by CommScope Inc under the Apache License,\r
8  * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You\r
9  * may obtain a copy of the License at\r
10  *\r
11  * http://www.apache.org/licenses/LICENSE-2.0\r
12  *\r
13  * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\r
14  * either express or implied. See the License for the specific language governing permissions and\r
15  * limitations under the License.\r
16  * ===============LICENSE_END=======================================================================\r
17  */\r
18 \r
19 \r
20 package org.commscope.tr069adapter.common.scheduler;\r
21 \r
22 import java.util.List;\r
23 import java.util.Map;\r
24 import java.util.Set;\r
25 \r
26 public interface SchedulerManager {\r
27 \r
28   /**\r
29    * Add the given job to the scheduler along with trigger details provided. This method is used to\r
30    * run the job repeatedly at a given time interval. It throws an scheduler exception in case any\r
31    * problem with the given data or some unexpected exception occurred while adding the job to the\r
32    * scheduler.\r
33    * \r
34    * @param jobName - String object representing the job name. which can be used later to query the\r
35    *        job\r
36    * @param triggerInfo - object contains the information about the trigger of this particular job.\r
37    * @param jobContext - jobContext information which can be passed at the time of scheduling the\r
38    *        job. Note that it is strictly recommended to put only primitive types in this map.\r
39    *        Putting objects are not recommended.\r
40    * \r
41    * @throws SchedulerException - An object representing the error details which caused the problem\r
42    *         while scheduling the job.\r
43    */\r
44   public void scheduleJob(String jobName, TriggerInfo triggerInfo, ExecutionContext jobContext)\r
45       throws SchedulerException;\r
46 \r
47   /**\r
48    * Add the given job to the scheduler along with trigger details provided. This method is used to\r
49    * run the job repeatedly at a given time interval. It throws an scheduler exception in case any\r
50    * problem with the given data or some unexpected exception occurred while adding the job to the\r
51    * scheduler.\r
52    * \r
53    * @param jobName - String object representing the job name. which can be used later to query the\r
54    *        job\r
55    * @param jobGroup - String object representing the job group. which can be used later to query\r
56    *        the job *\r
57    * @param triggerInfo - object contains the information about the trigger of this particular job.\r
58    * @param jobContext - jobContext information which can be passed at the time of scheduling the\r
59    *        job. Note that it is strictly recommended to put only primitive types in this map.\r
60    *        Putting objects are not recommended.\r
61    * \r
62    * @throws SchedulerException - An object representing the error details which caused the problem\r
63    *         while scheduling the job.\r
64    */\r
65   public void scheduleJob(String jobName, String jobGroup, TriggerInfo triggerInfo,\r
66       ExecutionContext jobContext) throws SchedulerException;\r
67 \r
68   /**\r
69    * Add the given job to the scheduler along with trigger details provided. This method is used to\r
70    * run the job repeatedly at a given time interval. It throws an scheduler exception in case any\r
71    * problem with the given data or some unexpected exception occurred while adding the job to the\r
72    * scheduler.\r
73    * \r
74    * @param jobName - String object representing the job name. which can be used later to query the\r
75    *        job\r
76    * @param triggerInfo - object contains the information about the trigger of this particular job.\r
77    * @param expiredTriggerInfo - object contains the information about the trigger of this\r
78    *        particular job which will mark it to expire after end time.\r
79    * @param jobContext - jobContext information which can be passed at the time of scheduling the\r
80    *        job. Note that it is strictly recommended to put only primitive types in this map.\r
81    *        Putting objects are not recommended.\r
82    * @param expiredExecutionContext - expiredExecutionContext information which can be passed at the\r
83    *        time of scheduling the job. Note that it is strictly recommended to put only primitive\r
84    *        types in this map. Putting objects are not recommended.\r
85    * \r
86    * @throws SchedulerException - An object representing the error details which caused the problem\r
87    *         while scheduling the job.\r
88    */\r
89   public void scheduleJob(String jobName, String jobGroup, TriggerInfo triggerInfo,\r
90       ExecutionContext jobContext, TriggerInfo expiredTriggerInfo,\r
91       ExecutionContext expiredExecutionContext) throws SchedulerException;\r
92 \r
93   /**\r
94    * Modifies the existing scheduled job which causes the changes in the job execution times as per\r
95    * the given data.\r
96    * \r
97    * @param jobName - String object representing the job name. which can be used later to query the\r
98    *        job\r
99    * @param triggerInfo - object contains the information about the trigger of this particular job.\r
100    * @throws SchedulerException - An object representing the error details which caused the problem\r
101    *         while scheduling the job.\r
102    */\r
103   public void modifySchedule(String jobName, TriggerInfo triggerInfo) throws SchedulerException;\r
104 \r
105   /**\r
106    * Modifies the existing scheduled job which causes the changes in the job execution times as per\r
107    * the given data.\r
108    * \r
109    * @param jobName - String object representing the job name. which can be used later to query the\r
110    *        job\r
111    * @param jobGroup - String object representing the job group. which can be used later to query\r
112    *        the job\r
113    * @param triggerInfo - object contains the information about the trigger of this particular job.\r
114    * @throws SchedulerException - An object representing the error details which caused the problem\r
115    *         while scheduling the job.\r
116    */\r
117   public void modifySchedule(String jobName, String jobGroup, TriggerInfo triggerInfo)\r
118       throws SchedulerException;\r
119 \r
120   public void modifySchedule(String jobName, String jobGroup, TriggerInfo triggerInfo,\r
121       TriggerInfo expiredTriggerInfo, ExecutionContext expiredExecutionContext)\r
122       throws SchedulerException;\r
123 \r
124   /**\r
125    * Returns the list of scheduled jobs along with the job details such as the job status\r
126    * (enabled/disabled) etc..\r
127    * \r
128    * @return\r
129    */\r
130   public List<JobInfo> getJobList();\r
131 \r
132   /**\r
133    * Returns the job details for a given job name such as the job status (enabled/disabled) etc..\r
134    * \r
135    * @return\r
136    */\r
137   public JobInfo getJobInfo(String jobId);\r
138 \r
139   /**\r
140    * Removes the given job from the schedule. Throws an exceptions in case the job does not exist.\r
141    * \r
142    * @param jobName - String object representing the job name. which can be used later to query the\r
143    *        job\r
144    * \r
145    * @throws SchedulerException - An object representing the error details which caused the problem\r
146    *         while scheduling the job.\r
147    */\r
148   public void deleteSchedule(String jobName) throws SchedulerException;\r
149 \r
150   /**\r
151    * Removes the given job from the schedule. Throws an exceptions in case the job does not exist.\r
152    * \r
153    * @param jobName - String object representing the job name. which can be used later to query the\r
154    *        job\r
155    * @param jobGroup - String object representing the job group. which can be used later to query\r
156    *        the job\r
157    * @throws SchedulerException - An object representing the error details which caused the problem\r
158    *         while scheduling the job.\r
159    */\r
160   public void deleteSchedule(String jobName, String jobGroup) throws SchedulerException;\r
161 \r
162   /**\r
163    * Checks if the given job is enabled or not.\r
164    * \r
165    * @param jobName - String object representing the job name. which can be used later to query the\r
166    *        job\r
167    * @return - returns true if job is enabled. False otherwise.\r
168    */\r
169   public boolean isJobEnabled(String jobName);\r
170 \r
171   /**\r
172    * Checks if the given job is enabled or not.\r
173    * \r
174    * @param jobName - String object representing the job name. which can be used later to query the\r
175    *        job\r
176    * @param jobGroup - String object representing the job group. which can be used later to query\r
177    *        the job\r
178    * @return - returns true if job is enabled. False otherwise.\r
179    */\r
180   public boolean isJobEnabled(String jobName, String jobGroup);\r
181 \r
182   /**\r
183    * Enables the given job. Throws an exception in case job does not exist.\r
184    * \r
185    * @param jobName - String object representing the job name. which can be used later to query the\r
186    *        job\r
187    * \r
188    * @throws SchedulerException\r
189    */\r
190   public void enableJob(String jobName) throws SchedulerException;\r
191 \r
192   /**\r
193    * Enables the given job. Throws an exception in case job does not exist.\r
194    * \r
195    * @param jobName - String object representing the job name. which can be used later to query the\r
196    *        job\r
197    * @param jobGroup - String object representing the job group. which can be used later to query\r
198    *        the job\r
199    * \r
200    * @throws SchedulerException\r
201    */\r
202   public void enableJob(String jobName, String jobGroup) throws SchedulerException;\r
203 \r
204   /**\r
205    * Disables the given job. throws an exception in case the job does not exist.\r
206    * \r
207    * @param jobName - String object representing the job name. which can be used later to query the\r
208    *        job\r
209    * \r
210    * @throws SchedulerException\r
211    */\r
212   public void disableJob(String jobName) throws SchedulerException;\r
213 \r
214   /**\r
215    * Disables the given job. throws an exception in case the job does not exist.\r
216    * \r
217    * @param jobName - String object representing the job name. which can be used later to query the\r
218    *        job\r
219    * @param jobGroup - String object representing the job group. which can be used later to query\r
220    *        the job\r
221    * @throws SchedulerException\r
222    */\r
223   public void disableJob(String jobName, String jobGroup) throws SchedulerException;\r
224 \r
225   /**\r
226    * Checks if the job is present already in the system or not.\r
227    * \r
228    * @param jobName - String object representing the job name. which can be used later to query the\r
229    *        job\r
230    * @return - returns false if job is not present in the system.\r
231    * @throws SchedulerException\r
232    */\r
233   public boolean isJobExist(String jobName) throws SchedulerException;\r
234 \r
235   /**\r
236    * Checks if the job is present already in the system or not.\r
237    * \r
238    * @param jobName - String object representing the job name. which can be used later to query the\r
239    *        job\r
240    * @param jobGroup - String object representing the job group. which can be used later to query\r
241    *        the job\r
242    * @return - returns false if job is not present in the system.\r
243    * @throws SchedulerException\r
244    */\r
245   public boolean isJobExist(String jobName, String jobGroup) throws SchedulerException;\r
246 \r
247   public JobInfo getJobInfo(String jobId, String string);\r
248 \r
249   /**\r
250    * Checks if the job schedule exists in the system or not.\r
251    * \r
252    * @param jobName - String object representing the job name. which can be used later to query the\r
253    *        job\r
254    * @return - returns false if job is not present in the system.\r
255    * @throws SchedulerException\r
256    */\r
257   public boolean isJobScheduleExist(String jobName, String jobGroup) throws SchedulerException;\r
258 \r
259   public void updateJobData(String jobName, String jobGroup, Map<String, Object> jobData)\r
260       throws SchedulerException;\r
261 \r
262   public Map<String, Object> getJobData(String jobName, String jobGroup) throws SchedulerException;\r
263 \r
264   public void deleteJobData(String jobName, String jobGroup, Set<String> keys)\r
265       throws SchedulerException;\r
266 \r
267   public boolean resumeQuartzSchedulars() throws SchedulerException;\r
268 \r
269   public boolean stopQuartzSchedulars() throws SchedulerException;\r
270 \r
271   public void switchToStandby() throws SchedulerException;\r
272 \r
273   public void switchToActive() throws SchedulerException;\r
274 \r
275   public boolean isQuartzRunninginActiveMode();\r
276 \r
277   void deleteSchedule(String startJobName, String endJobName, String monitorJobName,\r
278       String jobGroup) throws SchedulerException;\r
279 \r
280 }\r