Initial source code
[oam/tr069-adapter.git] / common / src / main / java / org / commscope / tr069adapter / common / scheduler / SchedulerManager.java
diff --git a/common/src/main/java/org/commscope/tr069adapter/common/scheduler/SchedulerManager.java b/common/src/main/java/org/commscope/tr069adapter/common/scheduler/SchedulerManager.java
new file mode 100644 (file)
index 0000000..f2f4db5
--- /dev/null
@@ -0,0 +1,280 @@
+/*\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.common.scheduler;\r
+\r
+import java.util.List;\r
+import java.util.Map;\r
+import java.util.Set;\r
+\r
+public interface SchedulerManager {\r
+\r
+  /**\r
+   * Add the given job to the scheduler along with trigger details provided. This method is used to\r
+   * run the job repeatedly at a given time interval. It throws an scheduler exception in case any\r
+   * problem with the given data or some unexpected exception occurred while adding the job to the\r
+   * scheduler.\r
+   * \r
+   * @param jobName - String object representing the job name. which can be used later to query the\r
+   *        job\r
+   * @param triggerInfo - object contains the information about the trigger of this particular job.\r
+   * @param jobContext - jobContext information which can be passed at the time of scheduling the\r
+   *        job. Note that it is strictly recommended to put only primitive types in this map.\r
+   *        Putting objects are not recommended.\r
+   * \r
+   * @throws SchedulerException - An object representing the error details which caused the problem\r
+   *         while scheduling the job.\r
+   */\r
+  public void scheduleJob(String jobName, TriggerInfo triggerInfo, ExecutionContext jobContext)\r
+      throws SchedulerException;\r
+\r
+  /**\r
+   * Add the given job to the scheduler along with trigger details provided. This method is used to\r
+   * run the job repeatedly at a given time interval. It throws an scheduler exception in case any\r
+   * problem with the given data or some unexpected exception occurred while adding the job to the\r
+   * scheduler.\r
+   * \r
+   * @param jobName - String object representing the job name. which can be used later to query the\r
+   *        job\r
+   * @param jobGroup - String object representing the job group. which can be used later to query\r
+   *        the job *\r
+   * @param triggerInfo - object contains the information about the trigger of this particular job.\r
+   * @param jobContext - jobContext information which can be passed at the time of scheduling the\r
+   *        job. Note that it is strictly recommended to put only primitive types in this map.\r
+   *        Putting objects are not recommended.\r
+   * \r
+   * @throws SchedulerException - An object representing the error details which caused the problem\r
+   *         while scheduling the job.\r
+   */\r
+  public void scheduleJob(String jobName, String jobGroup, TriggerInfo triggerInfo,\r
+      ExecutionContext jobContext) throws SchedulerException;\r
+\r
+  /**\r
+   * Add the given job to the scheduler along with trigger details provided. This method is used to\r
+   * run the job repeatedly at a given time interval. It throws an scheduler exception in case any\r
+   * problem with the given data or some unexpected exception occurred while adding the job to the\r
+   * scheduler.\r
+   * \r
+   * @param jobName - String object representing the job name. which can be used later to query the\r
+   *        job\r
+   * @param triggerInfo - object contains the information about the trigger of this particular job.\r
+   * @param expiredTriggerInfo - object contains the information about the trigger of this\r
+   *        particular job which will mark it to expire after end time.\r
+   * @param jobContext - jobContext information which can be passed at the time of scheduling the\r
+   *        job. Note that it is strictly recommended to put only primitive types in this map.\r
+   *        Putting objects are not recommended.\r
+   * @param expiredExecutionContext - expiredExecutionContext information which can be passed at the\r
+   *        time of scheduling the job. Note that it is strictly recommended to put only primitive\r
+   *        types in this map. Putting objects are not recommended.\r
+   * \r
+   * @throws SchedulerException - An object representing the error details which caused the problem\r
+   *         while scheduling the job.\r
+   */\r
+  public void scheduleJob(String jobName, String jobGroup, TriggerInfo triggerInfo,\r
+      ExecutionContext jobContext, TriggerInfo expiredTriggerInfo,\r
+      ExecutionContext expiredExecutionContext) throws SchedulerException;\r
+\r
+  /**\r
+   * Modifies the existing scheduled job which causes the changes in the job execution times as per\r
+   * the given data.\r
+   * \r
+   * @param jobName - String object representing the job name. which can be used later to query the\r
+   *        job\r
+   * @param triggerInfo - object contains the information about the trigger of this particular job.\r
+   * @throws SchedulerException - An object representing the error details which caused the problem\r
+   *         while scheduling the job.\r
+   */\r
+  public void modifySchedule(String jobName, TriggerInfo triggerInfo) throws SchedulerException;\r
+\r
+  /**\r
+   * Modifies the existing scheduled job which causes the changes in the job execution times as per\r
+   * the given data.\r
+   * \r
+   * @param jobName - String object representing the job name. which can be used later to query the\r
+   *        job\r
+   * @param jobGroup - String object representing the job group. which can be used later to query\r
+   *        the job\r
+   * @param triggerInfo - object contains the information about the trigger of this particular job.\r
+   * @throws SchedulerException - An object representing the error details which caused the problem\r
+   *         while scheduling the job.\r
+   */\r
+  public void modifySchedule(String jobName, String jobGroup, TriggerInfo triggerInfo)\r
+      throws SchedulerException;\r
+\r
+  public void modifySchedule(String jobName, String jobGroup, TriggerInfo triggerInfo,\r
+      TriggerInfo expiredTriggerInfo, ExecutionContext expiredExecutionContext)\r
+      throws SchedulerException;\r
+\r
+  /**\r
+   * Returns the list of scheduled jobs along with the job details such as the job status\r
+   * (enabled/disabled) etc..\r
+   * \r
+   * @return\r
+   */\r
+  public List<JobInfo> getJobList();\r
+\r
+  /**\r
+   * Returns the job details for a given job name such as the job status (enabled/disabled) etc..\r
+   * \r
+   * @return\r
+   */\r
+  public JobInfo getJobInfo(String jobId);\r
+\r
+  /**\r
+   * Removes the given job from the schedule. Throws an exceptions in case the job does not exist.\r
+   * \r
+   * @param jobName - String object representing the job name. which can be used later to query the\r
+   *        job\r
+   * \r
+   * @throws SchedulerException - An object representing the error details which caused the problem\r
+   *         while scheduling the job.\r
+   */\r
+  public void deleteSchedule(String jobName) throws SchedulerException;\r
+\r
+  /**\r
+   * Removes the given job from the schedule. Throws an exceptions in case the job does not exist.\r
+   * \r
+   * @param jobName - String object representing the job name. which can be used later to query the\r
+   *        job\r
+   * @param jobGroup - String object representing the job group. which can be used later to query\r
+   *        the job\r
+   * @throws SchedulerException - An object representing the error details which caused the problem\r
+   *         while scheduling the job.\r
+   */\r
+  public void deleteSchedule(String jobName, String jobGroup) throws SchedulerException;\r
+\r
+  /**\r
+   * Checks if the given job is enabled or not.\r
+   * \r
+   * @param jobName - String object representing the job name. which can be used later to query the\r
+   *        job\r
+   * @return - returns true if job is enabled. False otherwise.\r
+   */\r
+  public boolean isJobEnabled(String jobName);\r
+\r
+  /**\r
+   * Checks if the given job is enabled or not.\r
+   * \r
+   * @param jobName - String object representing the job name. which can be used later to query the\r
+   *        job\r
+   * @param jobGroup - String object representing the job group. which can be used later to query\r
+   *        the job\r
+   * @return - returns true if job is enabled. False otherwise.\r
+   */\r
+  public boolean isJobEnabled(String jobName, String jobGroup);\r
+\r
+  /**\r
+   * Enables the given job. Throws an exception in case job does not exist.\r
+   * \r
+   * @param jobName - String object representing the job name. which can be used later to query the\r
+   *        job\r
+   * \r
+   * @throws SchedulerException\r
+   */\r
+  public void enableJob(String jobName) throws SchedulerException;\r
+\r
+  /**\r
+   * Enables the given job. Throws an exception in case job does not exist.\r
+   * \r
+   * @param jobName - String object representing the job name. which can be used later to query the\r
+   *        job\r
+   * @param jobGroup - String object representing the job group. which can be used later to query\r
+   *        the job\r
+   * \r
+   * @throws SchedulerException\r
+   */\r
+  public void enableJob(String jobName, String jobGroup) throws SchedulerException;\r
+\r
+  /**\r
+   * Disables the given job. throws an exception in case the job does not exist.\r
+   * \r
+   * @param jobName - String object representing the job name. which can be used later to query the\r
+   *        job\r
+   * \r
+   * @throws SchedulerException\r
+   */\r
+  public void disableJob(String jobName) throws SchedulerException;\r
+\r
+  /**\r
+   * Disables the given job. throws an exception in case the job does not exist.\r
+   * \r
+   * @param jobName - String object representing the job name. which can be used later to query the\r
+   *        job\r
+   * @param jobGroup - String object representing the job group. which can be used later to query\r
+   *        the job\r
+   * @throws SchedulerException\r
+   */\r
+  public void disableJob(String jobName, String jobGroup) throws SchedulerException;\r
+\r
+  /**\r
+   * Checks if the job is present already in the system or not.\r
+   * \r
+   * @param jobName - String object representing the job name. which can be used later to query the\r
+   *        job\r
+   * @return - returns false if job is not present in the system.\r
+   * @throws SchedulerException\r
+   */\r
+  public boolean isJobExist(String jobName) throws SchedulerException;\r
+\r
+  /**\r
+   * Checks if the job is present already in the system or not.\r
+   * \r
+   * @param jobName - String object representing the job name. which can be used later to query the\r
+   *        job\r
+   * @param jobGroup - String object representing the job group. which can be used later to query\r
+   *        the job\r
+   * @return - returns false if job is not present in the system.\r
+   * @throws SchedulerException\r
+   */\r
+  public boolean isJobExist(String jobName, String jobGroup) throws SchedulerException;\r
+\r
+  public JobInfo getJobInfo(String jobId, String string);\r
+\r
+  /**\r
+   * Checks if the job schedule exists in the system or not.\r
+   * \r
+   * @param jobName - String object representing the job name. which can be used later to query the\r
+   *        job\r
+   * @return - returns false if job is not present in the system.\r
+   * @throws SchedulerException\r
+   */\r
+  public boolean isJobScheduleExist(String jobName, String jobGroup) throws SchedulerException;\r
+\r
+  public void updateJobData(String jobName, String jobGroup, Map<String, Object> jobData)\r
+      throws SchedulerException;\r
+\r
+  public Map<String, Object> getJobData(String jobName, String jobGroup) throws SchedulerException;\r
+\r
+  public void deleteJobData(String jobName, String jobGroup, Set<String> keys)\r
+      throws SchedulerException;\r
+\r
+  public boolean resumeQuartzSchedulars() throws SchedulerException;\r
+\r
+  public boolean stopQuartzSchedulars() throws SchedulerException;\r
+\r
+  public void switchToStandby() throws SchedulerException;\r
+\r
+  public void switchToActive() throws SchedulerException;\r
+\r
+  public boolean isQuartzRunninginActiveMode();\r
+\r
+  void deleteSchedule(String startJobName, String endJobName, String monitorJobName,\r
+      String jobGroup) throws SchedulerException;\r
+\r
+}\r