# Task Plugins # The *Task* entities defined in a *Processor* definition can be implemented as dedicated native java plugins or as scripts written in Perl, Python or Shell. ## Java plugins Dedicated native java plugins can be developed by implementing the GenericTaskInterface process method defined in the DES library **GenericTaskInterface Interface** ```java public interface GenericTaskInterface { /** * * @param basepath Basepath as configured in DistributionServer.ini * @param aoi_name AOI name contained in the $processor.processor_config.xml * @param processor_name Processor name related to the $processor.processor_config.xml * @param entity_name Name of executing entity (Task, Consumer, etc.) * @param parameters Parameters as defined by <Parameter> * @param args List of arguments of the Task (String or Hashtables, to be checked by the plugin) * @param files List of files of the Task iff <FileType>regexp</FileType> is defined, else null * @return ExitCodes */ public int process(String basepath, String aoi_name, String processor_name, String entity_name, Hashtable parameters, Object[] args, String[] files); } ``` The implemented plugin should be packaged as a jar file and placed in the DES ./plugins directory where it is automatically loaded at Runtime. The plugin can be executed in a given *Processor* *Task* with the following definition: Example: ```xml <Task name="renameFiles" type="class" active="yes" priority="NORM"> <Command>class</Command> <FileType>SAMPLE.*.AA.txt</FileType> <Parameter>edu.eurac.distributionserver.tasks.generic.FileRename</Parameter> <FilePrefix>RENAME</FilePrefix> </Task> ``` The parameters can be passed to the *Task* plugin with one of the following options: - By using a custom keyword tag eg. *FilePrefix* in the *Task* definition and then accessing the parameter with the Hashtable parameters in the Interface ```java String file_prefix = (String)parameters.get("FilePrefix"); ``` - By using the <Parameter> keyword tag in the *Task* definition and than referencing the parameter with the Object[] args type in the Interface ```java String classname = (String)args[1]; ``` Note: Note: args[0] is the class name