SmartsIntegrator Extensibility
SmartsIntegrator is inherently
extensible. You can define your own map functoids, transports and activities;
expose and consume WCF services; integrate external assemblies across your solution
in a single operation; and harness the full
power of the .Net Framework via Visual Studio .Net for Applications.
The SmartsIntegrator.Extensibility.DLL assembly is common to much of this extensibility,
and defines a number of base classes and interface points to work from. This
assembly is installed in the SmartsIntegrator installation folder, and can be used
in any .Net solution by simply adding a reference to it. This
page describes the core components in this module.
Classes SmartsIntegrator.Extensibility.ReceiveTransportBase and SmartsIntegrator.Extensibility.SendTransportBase
are respectively the abstract base classes that need implementing in order to define
a receive or send transport respectively. With just a handful of simple functions
to implement (the core one for a receive transport being GetMessage for example),
you can write a SmartsIntegrator transport component in minutes and register
it via the Static Settings / Transports page of the SmartsIntegrator Explorer.
For ReceiveTransportBase, there are 5 functions to implement :
-
public abstract void Initialise(string transportName, string portId, System.Collections.IDictionary
transportParameters);
Implement this function to perform any class initialization. The transportParameters
dictionary will contain any properties you stored from your tab pages.
-
public abstract bool GetMessage(out System.IO.Stream messageContents, out System.Collections.IDictionary
contextParameters, out object callBackContext);
The main polling function to receive a Message. Return null if there
is no Message to retrieve, Populate the contextParameters dictionary with
any context parameters, and return the Message contents in the messageContents stream.
The callBackContext return value allows you to associate a subsequent CommitReceiveMessage
or CancelReceiveMessage call.
-
public abstract void CommitReceivedMessage (object callBackContext, System.Collections.IDictionary
contextParameters);
Commits a received message (i.e. deletes from receive location or otherwise
prevents duplicate processing)
-
public abstract bool CancelReceivedMessage(object callBackContext);
Cancels a received message, and leaves it for reprocessing. Return false
for default resubmit processing.
- public abstract
System.Windows.Forms.Control[] GetTabPages();
Returns a set of controls to be displayed as Property Pages. Each control
should contain its' title as the Text property, and should implement interface SmartsIntegrator.Extensibility.ISmartsIntegratorPropertyPage
for initialization and persistence.
For SendTransportBase, there are just 3 functions
to implement :
- public abstract
void Initialise(string portId, string transportName, System.Collections.IDictionary
transportParameters);
Implement this function to perform any class initialization. The transportParameters
dictionary will contain any properties you stored from your tab pages.
- public abstract
System.IO.Stream SendMessage(System.IO.Stream messageContents, System.Collections.IDictionary
contextParameters);
Main send logic.
- public abstract
System.Windows.Forms.Control[] GetTabPages();
Returns a set of controls to be displayed as Property Pages. Each control
should contain its' title as the Text property, and should implement interface SmartsIntegrator.Extensibility.ISmartsIntegratorPropertyPage
for initialization and persistence.
- You can also override the
Stop method if required to perform custom shutdown logic.
Class SmartsIntegrator.Extensibility.FunctoidBase similarly provides a
base class for writing a custom functoid. There are associated classes SmartsIntegrator.Extensibility.FunctoidInfo
and SmartsIntegrator.Extensibility.FunctoidException.
There are two methods that you must implement :
- public abstract
FunctoidInfo GetDesignTimeFunctoidInfo(System.Collections.IDictionary instanceData);
Implement this method to return information describing your Functoid to the
system, e.g. in terms of in and out parameters
- public abstract
object FunctoidExecute(object[] parameters, object scope, MappingContext context,
ref bool bCancelPath, System.Collections.IDictionary functoidInstanceData);
This is the main functoid logic - you should return the appropriate value based
upon the parameters, scope and context. If your functoid should suppress output,
set bCancelPath to true.
There are also two optional methods you can override :
- public virtual
System.Windows.Forms.Control[] GetCustomTabPages(SmartsIntegrator.Extensibility.MappingContext
context);
Returns a set of controls to be displayed as Property Pages. Each control
should contain its' title as the Text property, and should implement interface SmartsIntegrator.Extensibility.ISmartsIntegratorPropertyPage
for initialization and persistence.
- public virtual
bool EnumerateResult();
Return true here if your functoid returns a collection that should be enumerated
- i.e. if this returns true, the functoid result is enumerated into separate functoid
results rather than being processed as a whole
Interface SmartsIntegrator.Extensibility.ISmartsIntegratorPropertyPage
should be implemented on any property page controls returned through these classes,
and provides methods for you to implement state loading and saving functionality.
Finally static method SmartsIntegrator.Extensibility.SubmitPortMessage.SubmitMessage
provides a means of inserting a message directly into SmartsIntegrator.
It takes the SmartsIntegrator connection string, the port name (or internal id),
the Message body and a dictionary of message Contenxt Properties as parameters.
Any security checks will be based upon the context of the caller. You can
look at your current connection string at registry location HKEY_CURRENT_USER\SmartsIntegrator\GUIConnectionString.
For any further information on extensibility or
best practicies, please contact support@smartsintegrator.com.
|