Difference between revisions of "Custom Tasks"
(→Setting up AtTask (WorkFront)) |
(→Example Output from lrm-customtest.jar) |
||
(20 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
=Custom Tasks= |
=Custom Tasks= |
||
+ | [[Global Configuration Files]] contains the information for about the configuration files discussed here. It has a good graphic about the directory structure of the configuration files. |
||
− | The config_custom_tasks.xml configuration file contains the specific stages where a plugin can be called. Dynamic information is available to the plugin through the LRM Context object (<code>com.lingoport.lrm.customtask.LRMContext</code>). The lrm-customtasktest.jar, located in the <code>samples/CustomTask/</code> folder of your install directory, contains methods for testing out these different stages. |
||
+ | |||
+ | The '''config_custom_tasks.xml''' configuration file contains the specific stages where a plugin can be called. A template file can be found in <code><HOME>/Lingoport_Data/L10nStreamlining/config/</code>. Dynamic information is available to the plugin through the LRM Context object (<code>com.lingoport.lrm.customtask.LRMContext</code>). The '''lrm-customtasktest.jar''', located in the <code><HOME>/lingoport/lrm-server-x.y/samples/CustomTask/</code> folder of your install directory, contains methods for testing out these different stages. |
||
== Configuration == |
== Configuration == |
||
− | The config_custom_tasks.xml has elements for each stage of the LRM process that allows for custom tasks. The stages are: |
+ | The '''config_custom_tasks.xml''' has elements for each stage of the LRM process that allows for custom tasks. The stages are: |
<pre> |
<pre> |
||
custom-tasks> |
custom-tasks> |
||
Line 42: | Line 44: | ||
* '''onerrorresumenext''' - if '''false''' then the process continues if there is an error that is thrown. If '''true''' then the process will stop with an error. |
* '''onerrorresumenext''' - if '''false''' then the process continues if there is an error that is thrown. If '''true''' then the process will stop with an error. |
||
− | Example using the lrm-customtasktest.jar located in the install directory under <code>samples/CustomTask</code> |
+ | Example using the lrm-customtasktest.jar located in the install directory under <code><HOME>/lingoport/lrm-server-x.y/samples/CustomTask</code> |
<pre> |
<pre> |
||
− | <task url="file:/ |
+ | <task url="file:<HOME>/lingoport/lrm-server-x.y/samples/CustomTask/lrm-customtasktest.jar" |
class="com.lingoport.lrm.customtask.test.CustomTaskTest" |
class="com.lingoport.lrm.customtask.test.CustomTaskTest" |
||
method="testNoArgs" |
method="testNoArgs" |
||
Line 55: | Line 57: | ||
<pre> |
<pre> |
||
<before-notify-changes> |
<before-notify-changes> |
||
− | <task url="file: |
+ | <task url="file:<HOME>/lingoport/lrm-server-x.y/samples/CustomTask/lrm-customtasktest.jar" |
class="com.lingoport.lrm.customtask.test.CustomTaskTest" |
class="com.lingoport.lrm.customtask.test.CustomTaskTest" |
||
method="testLRMContextArg" |
method="testLRMContextArg" |
||
Line 65: | Line 67: | ||
==Sample Custom Tasks == |
==Sample Custom Tasks == |
||
− | The <code>lrm-customtest.jar</code> located in the install directory's <code> |
+ | The <code>lrm-customtest.jar</code> located in the install directory's <code><HOME>/lingoport/lrm-server-x.y/samples/CustomTask</code> folder contains 3 methods that can used for testing. |
*'''testNoArgs''' - this method has no arguments. |
*'''testNoArgs''' - this method has no arguments. |
||
*'''testLRMContextArg''' - this method has the <code>com.lingoport.lrm.customtask.LRMContext</code> argument and will list out all the information in the LRMContext object. |
*'''testLRMContextArg''' - this method has the <code>com.lingoport.lrm.customtask.LRMContext</code> argument and will list out all the information in the LRMContext object. |
||
*'''testThrowError''' - this method will throw an error. Depending on the value of attribute 'onerrorresumenext' the process will either stop or continue. |
*'''testThrowError''' - this method will throw an error. Depending on the value of attribute 'onerrorresumenext' the process will either stop or continue. |
||
+ | |||
+ | === Example Output from lrm-customtest.jar === |
||
+ | |||
+ | The custom test task for 'after-send-locale' output is shown here for one locale, <code>no</code>. It is similar for other locales. |
||
+ | com.lingoport.lrmprocess.controller.customtask.pipeline.stage.CallCustomTasksStage.gatherCustomTaksForDefs: There are custom tasks defined for `after-send-locale` |
||
+ | [...] |
||
+ | INFO 2017-04-27 15:54:53,518 com.lingoport.lrmprocess.customtask.CustomTaskInvoker.invokeCustomTasks: |
||
+ | Available information in LrmContext `[projectname, sendkitid, kitversion, lrmlocale, sendkitvendor, |
||
+ | sendkitname, groupname, sendkitnameforlocale]` |
||
+ | Hello from Lingoport - Thu Apr 27 15:54:53 CDT 2017 |
||
+ | LRMContext contains: |
||
+ | Key: projectname-> LRMandLite-patch-1 |
||
+ | Key: sendkitid-> 3 |
||
+ | Key: kitversion-> 3 |
||
+ | Key: lrmlocale-> no |
||
+ | Key: sendkitvendor-> Lingotek |
||
+ | Key: sendkitname-> Lingoport.LRMandLite-patch-1_3 |
||
+ | Key: groupname-> Lingoport |
||
+ | Key: sendkitnameforlocale-> Lingoport.LRMandLite-patch-1_3 (no) |
||
= Setting up AtTask (WorkFront) = |
= Setting up AtTask (WorkFront) = |
||
− | The creation of AtTask projects require the setup of both the config_attask.properties and the config_custom_tasks.xml configuration files. |
+ | The creation of AtTask projects require the setup of both the '''config_attask.properties''' and the '''config_custom_tasks.xml''' configuration files. |
− | [[Global Configuration Files]] contains the information for configuring the config_attask.properties file in order for projects and |
+ | [[Global Configuration Files]] contains the information for configuring the config_attask.properties file in order for projects and tasks to be created. |
==LRM and AtTask interaction== |
==LRM and AtTask interaction== |
||
Line 83: | Line 104: | ||
==config_custom_tasks.xml setup== |
==config_custom_tasks.xml setup== |
||
− | The config_custom_tasks.xml located in the install directory's <code>deploy |
+ | The '''config_custom_tasks.xml''' located in the install directory's <code><HOME>/lingoport/lrm-server-x.y/deploy/templates/dir_structure/global/config</code> folder contains the sample structure for the implementation of AtTask. The structure is: |
<pre style="margin-bottom:0px; border-style:none"> |
<pre style="margin-bottom:0px; border-style:none"> |
||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
||
Line 90: | Line 111: | ||
<prep-kit> |
<prep-kit> |
||
<before-send-locale> |
<before-send-locale> |
||
− | |||
</before-send-locale> |
</before-send-locale> |
||
</pre> |
</pre> |
||
Line 96: | Line 116: | ||
<after-send-locale> |
<after-send-locale> |
||
<task url="file:" |
<task url="file:" |
||
− | class="com.lingoport.lrm.customtask.CustomTaskController |
+ | class="com.lingoport.lrm.customtask.CustomTaskController" |
+ | method="createAtTaskProjectForLocale" |
||
onerrorresumenext="false"/> |
onerrorresumenext="false"/> |
||
</after-send-locale> |
</after-send-locale> |
||
+ | |||
</pre> |
</pre> |
||
<pre style="margin-bottom:0px; margin-top:0px; border-style:none"> |
<pre style="margin-bottom:0px; margin-top:0px; border-style:none"> |
||
Line 109: | Line 131: | ||
<before-late-prep-kits> |
<before-late-prep-kits> |
||
<task url="file:" |
<task url="file:" |
||
− | class="com.lingoport.lrm.customtask.CustomTaskController" |
+ | class="com.lingoport.lrm.customtask.CustomTaskController" |
+ | method="updateDueDatesFromAtTask" |
||
onerrorresumenext="false"/> |
onerrorresumenext="false"/> |
||
</before-late-prep-kits> |
</before-late-prep-kits> |
||
Line 121: | Line 144: | ||
<pre style="color:blue; margin-bottom:0px; margin-top:0px; border-style:none"> |
<pre style="color:blue; margin-bottom:0px; margin-top:0px; border-style:none"> |
||
<after-import-locale> |
<after-import-locale> |
||
− | <task url="file:" |
+ | <task url="file:" |
− | class="com.lingoport.lrm.customtask.CustomTaskController" |
+ | class="com.lingoport.lrm.customtask.CustomTaskController" |
+ | method="setAtTaskToComplete" |
||
onerrorresumenext="false"/> |
onerrorresumenext="false"/> |
||
</after-import-locale> |
</after-import-locale> |
||
Line 133: | Line 157: | ||
==Location of config_custom_tasks.xml== |
==Location of config_custom_tasks.xml== |
||
− | The config_custom_tasks.xml configuration file may exist in the <code>config</code> folder at either the global, group or project level. The project level is checked first, if it doesn't exist then the group level is checked and finally the global level. |
+ | The '''config_custom_tasks.xml''' configuration file may exist in the <code>config</code> folder at either the global, group or project level. The project level is checked first, if it doesn't exist then the group level is checked and finally the global level. |
If all groups will be creating AtTask projects then the config_custom_tasks.xml file should exist in the <code>config</code> folder at the global level. |
If all groups will be creating AtTask projects then the config_custom_tasks.xml file should exist in the <code>config</code> folder at the global level. |
Latest revision as of 21:19, 27 April 2017
Contents
Custom Tasks
Global Configuration Files contains the information for about the configuration files discussed here. It has a good graphic about the directory structure of the configuration files.
The config_custom_tasks.xml configuration file contains the specific stages where a plugin can be called. A template file can be found in <HOME>/Lingoport_Data/L10nStreamlining/config/
. Dynamic information is available to the plugin through the LRM Context object (com.lingoport.lrm.customtask.LRMContext
). The lrm-customtasktest.jar, located in the <HOME>/lingoport/lrm-server-x.y/samples/CustomTask/
folder of your install directory, contains methods for testing out these different stages.
Configuration
The config_custom_tasks.xml has elements for each stage of the LRM process that allows for custom tasks. The stages are:
custom-tasks> <stages> <prep-kit> <before-send-locale> <!-- Tasks that will run BEFORE files are uploaded to the specified L10n Vendor --> </before-send-locale> <after-send-locale> <!-- Tasks that will run AFTER files have been successfully uploaded to the specified L10n Vendor --> </after-send-locale> </prep-kit> <notification> <before-notify-changes> <!-- Tasks that will run BEFORE the Notify Changes email is sent --> </before-notify-changes> <before-late-prep-kits> <!-- Tasks that will run BEFORE the Late Prep Kit email is sent --> </before-late-prep-kits> </notification> <import-kit> <before-import-locale> <!-- Tasks that will run BEFORE files for a specific locale are imported --> </before-import-locale> <after-import-locale> <!-- Tasks that will run AFTER files for a specific locale have been imported successfully --> </after-import-locale> </import-kit> </stages> </custom-tasks>
Syntax of Task element
The task element has the following attributes:
- url - the location of the jar file that contains the custom task
- class - the class library that is to be used
- method - the method that is to be called. This method has either no arguments or the
com.lingoport.lrm.customtask.LRMContext
argument. - onerrorresumenext - if false then the process continues if there is an error that is thrown. If true then the process will stop with an error.
Example using the lrm-customtasktest.jar located in the install directory under <HOME>/lingoport/lrm-server-x.y/samples/CustomTask
<task url="file:<HOME>/lingoport/lrm-server-x.y/samples/CustomTask/lrm-customtasktest.jar" class="com.lingoport.lrm.customtask.test.CustomTaskTest" method="testNoArgs" onerrorresumenext="true"/>
LRM Context Argument
The com.lingoport.lrm.customtask.LRMContext
argument is a map containing dynamic information for a particular stage. You can view the information that is contained in the LRMContext object for each of the custom task stages by adding the following task to each stage (changing the location of your LRM home if needed). The following is an example of adding a task to the <before-notify-changes> stage:
<before-notify-changes> <task url="file:<HOME>/lingoport/lrm-server-x.y/samples/CustomTask/lrm-customtasktest.jar" class="com.lingoport.lrm.customtask.test.CustomTaskTest" method="testLRMContextArg" onerrorresumenext="true"/> </<before-notify-changes>
The log file will contain the LRMContext information.
Sample Custom Tasks
The lrm-customtest.jar
located in the install directory's <HOME>/lingoport/lrm-server-x.y/samples/CustomTask
folder contains 3 methods that can used for testing.
- testNoArgs - this method has no arguments.
- testLRMContextArg - this method has the
com.lingoport.lrm.customtask.LRMContext
argument and will list out all the information in the LRMContext object. - testThrowError - this method will throw an error. Depending on the value of attribute 'onerrorresumenext' the process will either stop or continue.
Example Output from lrm-customtest.jar
The custom test task for 'after-send-locale' output is shown here for one locale, no
. It is similar for other locales.
com.lingoport.lrmprocess.controller.customtask.pipeline.stage.CallCustomTasksStage.gatherCustomTaksForDefs: There are custom tasks defined for `after-send-locale` [...] INFO 2017-04-27 15:54:53,518 com.lingoport.lrmprocess.customtask.CustomTaskInvoker.invokeCustomTasks: Available information in LrmContext `[projectname, sendkitid, kitversion, lrmlocale, sendkitvendor, sendkitname, groupname, sendkitnameforlocale]` Hello from Lingoport - Thu Apr 27 15:54:53 CDT 2017 LRMContext contains: Key: projectname-> LRMandLite-patch-1 Key: sendkitid-> 3 Key: kitversion-> 3 Key: lrmlocale-> no Key: sendkitvendor-> Lingotek Key: sendkitname-> Lingoport.LRMandLite-patch-1_3 Key: groupname-> Lingoport Key: sendkitnameforlocale-> Lingoport.LRMandLite-patch-1_3 (no)
Setting up AtTask (WorkFront)
The creation of AtTask projects require the setup of both the config_attask.properties and the config_custom_tasks.xml configuration files.
Global Configuration Files contains the information for configuring the config_attask.properties file in order for projects and tasks to be created.
LRM and AtTask interaction
The following methods allow for the interaction between LRM and AtTask (Workfront)
- createAtTaskProjectForLocale - this method creates an AtTask project, if it doesn't exist, for a prep kit and then adds a task that represents the locale. This method will be called after a kit for a locale has been successfully uploaded to the specified L10n vendor.
- updateDueDatesFromAtTask - this method checks the AtTask due date for a particular task. If it's changed then the LRM due date will be changed to match the AtTask due date. The date change will be reflected in the Dashboard. This method will be called when determining if the Late Prep Kit email needs to be sent.
- setAtTaskToComplete - this method sets the AtTask task to complete. This method will be called after a kit for a locale has been successfully imported.
config_custom_tasks.xml setup
The config_custom_tasks.xml located in the install directory's <HOME>/lingoport/lrm-server-x.y/deploy/templates/dir_structure/global/config
folder contains the sample structure for the implementation of AtTask. The structure is:
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <custom-tasks> <stages> <prep-kit> <before-send-locale> </before-send-locale>
<after-send-locale> <task url="file:" class="com.lingoport.lrm.customtask.CustomTaskController" method="createAtTaskProjectForLocale" onerrorresumenext="false"/> </after-send-locale>
</prep-kit> <notification> <before-notify-changes> </before-notify-changes>
<before-late-prep-kits> <task url="file:" class="com.lingoport.lrm.customtask.CustomTaskController" method="updateDueDatesFromAtTask" onerrorresumenext="false"/> </before-late-prep-kits>
</notification> <import-kit> <before-import-locale> </before-import-locale>
<after-import-locale> <task url="file:" class="com.lingoport.lrm.customtask.CustomTaskController" method="setAtTaskToComplete" onerrorresumenext="false"/> </after-import-locale>
</import-kit> </stages> </custom-tasks>
Location of config_custom_tasks.xml
The config_custom_tasks.xml configuration file may exist in the config
folder at either the global, group or project level. The project level is checked first, if it doesn't exist then the group level is checked and finally the global level.
If all groups will be creating AtTask projects then the config_custom_tasks.xml file should exist in the config
folder at the global level.
If specific groups will be creating AtTask projects then the config_custom_tasks.xml file should exist in the config
folder of those groups.
If specific projects will be creating AtTask projects then the config_custom_tasks.xml file should exist in the config
folder of those projects.