Navigation:  IM Sequencer >

Custom plugin development

Previous pageReturn to chapter overviewNext page

From version 4.0 plugins are introduced as a new feature. This allows a developer to develop their own plugins that can handle work or can trigger a scheduled task. This chapter will help explain what these plugins are capable of doing and how they need to be developed.

 

There are 3 different types of plugins.
 

Trigger plugin

       
       A trigger plugin is used to indicate if a scheduled task needs to start. For instance trigger if there is pending data within the FIM portal that needs to be synchronized.

       The plugin will connect to the FIM portal and search for changes, if there are changes the trigger will trigger and the task starts.

 

Step plugin

       
       A step plugin is the actual work that a scheduled task performs. For instance move or copy a file, run a batch file etc.

 

Condition plugin

       
       The condition plugin is used to control if the task is allowed to start, even if the "trigger"  indicates that is should.

       A condition will be checked before the task will start. The trigger already indicated that the task needs to start. The condition can validate if the task is allowed to start.
               
       For instance only start when file 'x'  is available or when management agent 'y' is running.

 

Implementation steps
 

When you start developing your own plugin you will need to follow the steps described below:

 

       1.        Reference the file Traxion.IM.Scheduler.dll in your development project. This file contains the interfaces that you need to implement.

       2.        Select the interface that you want to use
               - Use Traxion.IM.Scheduler.Plugins.ICustomTriggerPlugin when you want a custom trigger

               - Use Traxion.IM.Scheduler.Plugins.ICustomStepPlugin when you want a custom step

               - Use Traxion.IM.Scheduler.Plugins.ICustomConditionPlugin when you want a custom condition

       3.        Write your code for the implementation

       4.        Decorate (see below) your class with the attribute CustomPluginClass and set the settings "Name"  and "Description"

       5.        Define some plugin settings and decorate (see below) them with standard component model attributes

       6.        Compile your code to a dll and copy this dll to the "<IM Sequencer installation root directory>\bin\plugins\"

       7.        Create a new scheduled tasks and select the appropriate option (Custom Trigger, Custom Step or Custom Condition).

       8.        When you dll implements the correct interface it will be selectable within the interface (as shown below)
 
               
 

 

Plugin class

You need to set the attribute CustomPluginClass on your class and define the settings "Name"  and "Description". This information is used within the interface and can help the user understand what your plugin does.
 
Below is an example:

[CustomPluginClassAttribute(Name = "Example", Description = "Example trigger implementation")]

public class TriggerExample : ICustomTriggerPlugin
       
Plugin settings

When using the plugin you can define the settings that you need. The IM Sequencer will generate the appropriate interface according to the settings information within the plugin.
To create a setting you can define a "get and set property" and decorate it with several standard .NET component model attributes. The following attributes can be used:

 

[DisplayName("Multiple file download")]        : The name displayed in the propertygrid control

[Description("Transfer mode")]                : The description

[Category("General")]                        : The category where this property belongs to

[ReadOnly(true)]                                : If "True" the property is only shown as readonly, default "False"

[DefaultValue(TransferMode.Automatic)]        : The default value that is displayed when you create a new plugin, will be made bold when the value differs from the default, must also be set in class constructor

[PropertyOrder(12)]                                : Order of properties within each category

[PasswordPropertyText(true)]                : If "True" the value is masked

 

If you have a public get or set property it will always be displayed within the interface and can be adjusted, if you don't want the property to be visiable, decorate it with:

[Browsable(false)]                                : If "False" this property is not displayed, default "True"

 

Converters

You can use the following type converters for a property, type converters will display the actual property value is a user friendly way:
[TypeConverter(typeof(YesNoConverter))]                        : Converts boolean values to 'Yes' or 'No'

[TypeConverter(typeof(NumericUpDownTypeConverter))]        : Converts text to numbers using the numeric up and down control

[TypeConverter(typeof(DisplayNameEnumConverter))]        : Displays enumerations with their displayname (if displayname attribute is used for the enumeration value)

 

Editors

You can use the following editors for a property, editors improves user experience because you have a control which handles the setting:

[Editor(typeof(NumericUpDownTypeEditor), typeof(UITypeEditor)), MinMax(0, 86400)]                : Displays a numeric up/down control with incremental steps and minimum and maximum values

[Editor(typeof(FileNameEditor), typeof(UITypeEditor))]                                        : Displays a file selection dialog

[Editor(typeof(FolderNameEditor), typeof(UITypeEditor))]                                        : Displays a folder selection dialog

[Editor(typeof(MultilineStringEditor), typeof(UITypeEditor))]                                        : Displays a multivalue editor

 

Validation

Some properties need to be validated before they are correct, the following rules can be applied to a property:

[RequiredRule]                : Indicates a required attribute

[LengthRule(1,2)]                : The length should be between minimum and maximum value

[PatternRule("[az]")]        : The value should match the regular expression

 

Below is an example setting called "Example".

 

[Category("General"), DisplayName("Example setting"), Description("This is the example description"), DefaultValue("localhost")]

[RequiredRule]

public string Example { get; set; }

 

When creating this plugin through the interface the setting is displayed as shown below:
 

 

The example setting is pre filled and the Should Test is displayed as 'Yes' in stead of 'True' or 'False'

 

Plugin state data

 

Some plugins have "data" that needs to be kept even when the scheduled task is not running. This is called state data. For instance there could be a variable that is holding the last watermark or the last retrieval object id. State data is primarily used within triggers so they can keep track  when they last triggered or what the last change date was for synchronization data. If a property has the state data attribute set the IM Sequencer will store the variable when the service is stopped or when the task is finished and it will be set again when the service is started again or the scheduled task is created in memory.
 
To create a state data attribute you will need to define a property and set the attribute CustomPluginStateDataAttribute. This attribute has no settings, below you will see an example:

 

  [CustomPluginStateDataAttribute]

  [Browsable(false)]

  public String LastWaterMark { get; set; }

 

Plugin logging

 

If you want logging within your plugin you can use the logging mechanism that the IM Sequencer is using log4net. You need to reference the files log4net.dll and Traxion.IM.Library.dll and define the following statement within your class:

 

  // Create a logger for use in this class

  private static readonly ApplicationLog log = ApplicationLogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

 

When you want to log something you have 6 levels beginning with the lowest, more information about log4net can be read here:

TRACE
DEBUG
INFO
WARNING
ERROR
FATAL

 

Example: log.Trace("Start shouldtrigger");

 

This trace message will be included in the general IM Sequencer logging system and will be send to the "configured" appenders. The configuration for this appenders will tell the logging system what to do with it, for instance write to a file or send to the eventlog.

 

Read more about specific plugin implementations here:

Trigger
Step
Condition

 


Page url: http://www.traxionsolutions.com/imsequencer/help/index.html?customplugindevelopment.htm