Package dev.le_app.mcss_api_java
Class Scheduler
java.lang.Object
dev.le_app.mcss_api_java.Scheduler
Scheduler of a server
Used to create and manage tasks
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreate a new Fixed Time taskcreateIntervalTask(String Name, Boolean Enabled, Boolean repeating, int interval, Job job) Create a new Interval TaskcreateTimelessTask(String Name, Boolean Enabled, Job job) Create a new Interval TaskgetTasks()Get an arraylist of all the tasksintGet total task numberintgetTotalTaskAmount(TaskType filter) Get number of tasks matching filter
-
Constructor Details
-
Scheduler
-
-
Method Details
-
getTotalTaskAmount
public int getTotalTaskAmount() throws APIUnauthorizedException, APINotFoundException, IOException, APINoServerAccessExceptionGet total task number- Returns:
- INT of the total task amount
- Throws:
APIUnauthorizedException- if the API key is invalidAPINotFoundException- if the server is not foundIOException- if there is an IO error (e.g. server is offline)APINoServerAccessException- if the API key does not have access to the server
-
getTotalTaskAmount
public int getTotalTaskAmount(TaskType filter) throws APIUnauthorizedException, APINotFoundException, IOException, APINoServerAccessException Get number of tasks matching filter- Parameters:
filter- The type of task to filter by- Returns:
- INT of the number of tasks matching the filter
- Throws:
APIUnauthorizedException- if the API key is invalidAPINotFoundException- if the server is not foundIOException- if there is an IO error (e.g. server is offline)APINoServerAccessException- if the API key does not have access to the server
-
getTasks
public ArrayList<Task> getTasks() throws APIUnauthorizedException, APINotFoundException, IOException, APIInvalidTaskDetailsException, APINoServerAccessExceptionGet an arraylist of all the tasks- Returns:
- ArrayList of all the tasks
- Throws:
APIUnauthorizedException- if the API key is invalid/expiredAPINotFoundException- if the server is not foundIOException- if there is an IO error (e.g. server is offline)APIInvalidTaskDetailsException- if the task details are invalidAPINoServerAccessException- if the API key does not have access to the server
-
createIntervalTask
public Task createIntervalTask(String Name, Boolean Enabled, Boolean repeating, int interval, Job job) throws APIInvalidTaskDetailsException, APIUnauthorizedException, IOException, APINotFoundException, APINoServerAccessException Create a new Interval Task- Parameters:
Name- Name of the task to createEnabled- Whether the task should be enabled or notrepeating- Whether the task should repeat or notinterval- The interval between each taskjob- The job to run- Returns:
- The created task
- Throws:
APIInvalidTaskDetailsException- if the task details are invalidAPIUnauthorizedException- if the API key is invalid/expiredIOException- if there is an IO error (e.g. server is offline)APINotFoundException- if the server is not foundAPINoServerAccessException- if the API key does not have access to the server
-
createFixedTimeTask
public Task createFixedTimeTask(String Name, Boolean Enabled, Boolean repeating, LocalTime time, Job job) throws APIInvalidTaskDetailsException, APIUnauthorizedException, IOException, APINotFoundException, APINoServerAccessException Create a new Fixed Time task- Parameters:
Name- Name of the task to createEnabled- Whether the task should be enabled or notrepeating- Whether the task should repeat or nottime- The time to run the taskjob- The job to run- Returns:
- The created task
- Throws:
APIInvalidTaskDetailsException- if the task details are invalidAPIUnauthorizedException- if the API key is invalid/expiredIOException- if there is an IO error (e.g. server is offline)APINotFoundException- if the server is not foundAPINoServerAccessException- if the API key does not have access to the server
-
createTimelessTask
public Task createTimelessTask(String Name, Boolean Enabled, Job job) throws APIInvalidTaskDetailsException, APIUnauthorizedException, IOException, APINotFoundException, APINoServerAccessException Create a new Interval Task- Parameters:
Name- Name of the task to createEnabled- Whether the task should be enabled or notjob- The job to run- Returns:
- The created task
- Throws:
APIInvalidTaskDetailsException- if the task details are invalidAPIUnauthorizedException- if the API key is invalid/expiredIOException- if there is an IO error (e.g. server is offline)APINotFoundException- if the server is not foundAPINoServerAccessException- if the API key does not have access to the server
-