001/* 002 * Copyright 2016 Anyware Services 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.ametys.core.schedule; 017 018import java.util.Map; 019 020import org.quartz.JobExecutionContext; 021 022import org.ametys.runtime.i18n.I18nizableText; 023import org.ametys.runtime.model.ElementDefinition; 024 025/** 026 * This interface represents a 'job' which can be performed and scheduled. 027 */ 028public interface Schedulable 029{ 030 /** 031 * The action to perform when a trigger is fired. Do not manually call this method. 032 * @param context the context 033 * @throws Exception if an error occured 034 */ 035 public void execute(JobExecutionContext context) throws Exception; 036 037 /** 038 * Returns the id 039 * @return the id 040 */ 041 public String getId(); 042 043 /** 044 * Returns the label 045 * @return the i18n label 046 */ 047 public I18nizableText getLabel(); 048 049 /** 050 * Return the description 051 * @return the i18n description 052 */ 053 public I18nizableText getDescription(); 054 055 /** 056 * Returns the glyph icon 057 * @return the glyph icon 058 */ 059 public String getIconGlyph(); 060 061 /** 062 * Returns the path to the small icon in 16x16 pixels 063 * @return the path to the 16x16 icon 064 */ 065 public String getIconSmall(); 066 067 /** 068 * Returns the path to the medium icon in 32x32 pixels 069 * @return the path to the 32x32 icon 070 */ 071 public String getIconMedium(); 072 073 /** 074 * Returns the path to the large icon in 48x48 pixels 075 * @return the path to the 48x48 icon 076 */ 077 public String getIconLarge(); 078 079 /** 080 * Returns true if the schedulable is private 081 * @return true if the schedulable is private 082 */ 083 public boolean isPrivate(); 084 085 /** 086 * Returns true if two runnables of this schedulable can be executed concurrently 087 * @return true if two runnables of this schedulable can be executed concurrently 088 */ 089 public boolean acceptConcurrentExecution(); 090 091 /** 092 * Get the parameters for job execution 093 * @return the parameters 094 */ 095 public Map<String, ElementDefinition> getParameters(); 096}