Hi Imesh,

On Fri, Sep 9, 2016 at 11:02 AM, Imesh Gunaratne <im...@wso2.com> wrote:

> Hi Nuwan,
>
> On Thu, Sep 8, 2016 at 7:50 PM, Nuwan Pallewela <nuw...@wso2.com> wrote:
>
>> Hi All,
>>
>> Mediators in Next-Gen tool can be defined in a module named  Mediators. When
>> new mediator is adding to tool, we need to add to this module as a object
>> with the below defined format. Editor will identify it from these modules
>> and add to tool palette and will be available to use in the editor.
>>
>> Further mediators are divided to several categories( For eg: manipulators
>> ,flow controllers,..). So the folder structure of the mediator definitions
>> can be construct as follows.
>>
>>       --->js
>>
>> |---> mediators
>>
>> |               |--- flow_controllers.js
>>
>> |               |--- manipulators.js
>>
>> .               …………………….
>>
>> |               |---> flow_controllers
>>
>> |               |                          |--- try_block_mediator.js
>>
>> .               .                          ………………….
>>
>> |               |---> manipulators
>>
>> |               |                          |--- log_mediator.js
>>
>> .               .                          ……………………..
>>
>> |
>>
>>
>> Wouldn't it be possible to handle all mediators using a single mediator
> definition and move mediator specific details to a set of JSON files? In
> that way we can minimize the effort needed for updating tooling whenever a
> new mediator is added to the integration server.
>

It would be hard to maintain and less readable if define all in a one file.
Actually this definition *only contain mediator specific* details and will
minimize the effort.

>
> Thanks
>
>> Mediator Defining Parameters
>>
>>    -
>>
>>    id : Unique identifier for mediator type --- [String] , [Required]
>>    -
>>
>>    name : Label name for the mediator --- [String] , [Required]
>>    -
>>
>>    icon : path for the icon --- [String] , [Required]
>>    -
>>
>>    parameters : Array of parameter definitions needed to configure the
>>    mediator --- [Array]
>>
>>                 {
>>
>>   id: "LogMediator",
>>
>>   name: "Log Mediator",
>>
>>   icon: "images/LogMediator.gif",
>>
>>   parameters: [...]
>>
>> }
>>
>> Parameter Definition Format
>>
>> This is the object format to define parameters of the mediator. Each
>> parameter should be defined as this format and need to include in the main
>> mediator definition object’s parameters array.
>>
>>
>>    -
>>
>>    key : Key name need to be add in the mediator instance to this
>>    parameter --- [String] , [Required]
>>    -
>>
>>    label : Label name for the parameter  --- [String] , [Required]
>>    -
>>
>>    required : Boolean value to specify it as a required field for the
>>    mediator configuration---[Boolean] , [Required]
>>    -
>>
>>    value : Object defining the format/type of the value contained by the
>>    parameter --- [Obj] , [Required]
>>
>>  {
>>
>>           key: "level",
>>
>>           label: "Log Level",
>>
>>           required: true,
>>
>>           value: {...}
>>
>>     }
>> Value Definition Format
>>
>> Value object definition changes according to the type of the value. There
>> are three basic different types which the value could be. They are
>>
>>    -
>>
>>    Primitive
>>    -
>>
>>    Object
>>    -
>>
>>    Array
>>
>> Primitive Value Block
>>
>> Value block defining a primitive value can contain a parameter named
>> values which will define the specific primitive values it could hold.
>>
>>    -
>>
>>    type : Type of the value(String,Integer,Double or Boolean)---
>>    [String],[Required]
>>    -
>>
>>    values : Array of objects with key,label pairs it could hold.---
>>    [Array],[Optional]
>>
>>
>>                       {
>>
>>               type: "String",
>>
>>               values: [
>>
>>                   {key: "full", label: "FULL"}, {key: "simple", label:
>> "SIMPLE"},
>>
>>                   {key: "headers",label: "HEADERS"}, {key: "custom",
>> label: "CUSTOM"}
>>
>>       }
>> Object/Array Value Block
>>
>> Value block defining an object or array value contains parameters array
>> which will define the specific parameter values the object holds. *Here
>> we have made the assumption that there could not be an array of primitive
>> values for a parameter values, and it should always be an array of objects.*
>>
>>    -
>>
>>    type : Type of the value(Object)---[String],[Required]
>>    -
>>
>>    parameters : Array of parameter definitions needed to configure the
>>    mediator --- [Array],[Required]
>>
>> {
>>
>>               type: "Array",
>>
>>               parameters : [
>>
>>                   {
>>
>>                       key: "name",
>>
>>                       label: "Property Name",
>>
>>                       required: true,
>>
>>                       value: {
>>
>>                           type: "String"
>>
>>                       }
>>
>>                   },
>>
>>                  ...........................
>>
>>               ]
>>
>>           }
>>
>>
>>
>>
>> I have attached the sample definition done for log mediator.
>>
>>
>> Please share any ideas on other information required to mediator
>> definition or better ways to define rather than this specification.
>>
>>
>> Thanks,
>>
>> Nuwan
>>
>>
>> --
>> ----------------------------------------------------------
>>
>> *Nuwan Chamara Pallewela*
>>
>>
>> *Software Engineer*
>>
>> *WSO2, Inc. *http://wso2.com
>> *lean . enterprise . middleware*
>>
>> Email   *nuw...@wso2.com <nuw...@wso2.com>*
>> Mobile  *+94719079739 <%2B94719079739>@*
>>
>>
>>
>
>
> --
> *Imesh Gunaratne*
> Software Architect
> WSO2 Inc: http://wso2.com
> T: +94 11 214 5345 M: +94 77 374 2057
> W: https://medium.com/@imesh TW: @imesh
> lean. enterprise. middleware
>
>


-- 
----------------------------------------------------------

*Nuwan Chamara Pallewela*


*Software Engineer*

*WSO2, Inc. *http://wso2.com
*lean . enterprise . middleware*

Email   *nuw...@wso2.com <nuw...@wso2.com>*
Mobile  *+94719079739@*
_______________________________________________
Architecture mailing list
Architecture@wso2.org
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to