Cilia/Cilia DSL types Reference mediator/Cilia Application Description
Cilia Application DSL
The Cilia DSL allows to define a mediation chain, its mediator/adapter instances and the bindings between them.
The Cilia XML root element must be <cilia>. And it could only have as child chain elements.
|cilia||No||It's the root node.|
|cilia/chain||No||Each chain is defined in this chain node.|
<cilia> <chain ...> <!-- --> </chain> <chain ...> <!-- --> </chain> </cilia>
Each mediation chain (chain XML Element) could have a chain type and an unique identifier.
|id||No||Chain unique identification.|
<cilia> <chain id="MyChainId" type="MyChainType"> <!-- --> </chain> </cilia>
Mediator instances, adapter instances, and bindings are declared separately in three different groups. There is an XML element for each group:
|mediators||Yes||It contains all the mediator instances configurations used in each chain.|
|adapters||Yes||It contains all the adapters instances configurations used in each chain.|
|bindings||Yes||It contains all the bindings in the chain.|
<chain> <mediators>..</mediators> <adapters>..</adapters> <bindings>...</bindings> </chain>
Mediator instances are defined in the mediators XML element. Each mediator instance (mediator-instance) is followed by its mediator type and an instance identifier.
Ports must be defined for each mediation instance, the ports XML element is used to describe both, Input Ports (in-port XML Element) and Output Ports (out-port XML Element).
The in-port and out-port XML elements must contain the following attributes:
|name||No||The port name.|
When declaring mediator instances, it is possible to (re)configure some mediator properties. We say, mediator properties are all the properties declared for each of the mediator constituent (scheduler, processor, dispatcher). So, in order to differentiate them is used the XML Element <scheduler>, <processor> or <dispatcher>.
|processor||Yes||To (re)configure the processor properties.|
|scheduler||Yes||To (re)configure the scheduler properties.|
|dispatcher||Yes||To (re)configure the dispatcher properties.|
To declare the property (re)configuration is used the <property> XML element. The information need for each property is followed by the next attributes:
|name||No||The property name.|
|value||No||The property value.|
Mediator Map properties
Mediator properties could be in the form of primitives type, but also they could be Maps (java.util.Map) Map properties values are declared as follow:
<chain id="chainId" type="chainType"> <mediators> <mediator-instance id="mediatorId" type="MyMediatorType"> <processor> <property name="MapProperty"> <item key="keyValue" value="itemValue"/> <item key="otherKeyValue" value="otherItemValue"/> </property> </processor> </mediator-instance> </mediators> </chain>
These properties could be used by all the mediators constituents, such as scheduler, processor and dispatcher.
Mediator Instance Example
<chain id="chainId" type="chainType"> <mediators> <mediator-instance id="mediatorId" type="MyMediatorType"> <ports> <in-port name="entry-port" /> <out-port name="exit-port" /> </ports> <processor> <property name="propertyName" value="propertyValue"/> </processor> <scheduler> <property name="schedPropertyName" value="propertyValue"/> </scheduler> <dispatcher> <property name="dispPropertyName" value="propertyValue"/> </dispatcher> </mediator-instance> </mediators> </chain>
Adapter instances are defined in the adapters XML element. Each adapter instance(adapter-instance) is followed by its adapter type and an instance identifier.
Similar to the mediator instances, adapters could have properties. These properties are handled as the mediator properties, since adapters are also a special mediator type.
Each binding in a mediation chain is declared in the <bindings> section.
<chain id="chainId" type="chainType"> <mediators> <!-- mediator instances --> </mediators> <adapters> <!-- mediator instances --> </adapters> <bindings> <binding from="mediatorId1:exitPoint1" to="mediatorId2:inPoint1" /> </bindings> </chain>
|binding from||Yes||Describes which mediator is the one who sends the data, and which port is used by this binding.|
|binding to||Yes||Describes which mediator is the one who receives the data, and which port is used by this binding.|
|binding type||Yes||Describes the type of the binding between mediators, event-admin-binding is the default one.|
Bindings use predefined linkers, but there is possible to change the linker to use by adding a linker attribute to the binding declaration.
<bindings> <binding from="mediatorId1:std" to="mediatorId2:std" linker="ea-binding"/> </bindings>
Mediation chain example
<cilia> <chain id="MyChainId" type="MyChainType"> <mediators> <mediator-instance type="myMediator" id="mediatorId1"/> <mediator-instance type="myMediator2" id="mediatorId2"/> </mediators> <bindings> <binding from="mediator1:std" to="mediatorId2:std" > </bindings> </chain> </cilia>
Mediation chain - hot deployment
To deploy a mediation chain at runtime using the dscilia language, the bundle cilia-deployer must be installed and started on the OSGi platform.
Mediation chains must be in a file with the file extension .dscilia. This file must be placed based on the file-install configuration. The default directory is ./load.