...
FacetType | FacetScript Supported | Required | Examples |
---|
SffMsgFacet | Yes | Optional | Note that SffMsgFacet does not expose any specific language constructs. FacetScript is the only option to use when using SffMsgFacet at that time of the package definition. Code Block |
---|
language | xml |
---|
theme | Eclipse |
---|
title | Facetscript within TQL Query |
---|
linenumbers | true |
---|
| <NewFacetInstance fid="[:CONFIG.FsExecutorFid:]" name="Atomiton.FsExecutor" type="SffMsgFacet">
<OnActivate>
<ImportFacet>[:CONFIG.CommonMacroFid:]</ImportFacet>
<!--============ MACROS ==============================================================-->
<Include>[:Default.Location:]private/macros/fs/reset-fs.mc.xml</Include>
</OnActivate>
</NewFacetInstance> |
|
SffTqlFacet | Yes | Optional | Here we use FacetScript to loop through the Find Result and Update the VendorTitle value. Code Block |
---|
language | xml |
---|
theme | Eclipse |
---|
title | Facetscript within TQL Query |
---|
linenumbers | true |
---|
| <Query>
<Find format="Version">
<VendorInfo>
<vendorSysId ne=""/>
</VendorInfo>
</Find>
<For each="val" in="Find.Result.VendorInfo">
<IF Condition="/'[:$LocalData.val.VendorTitle.Value:]' eq 'Sensor Provider'">
<Log Message="Found Sensor Provider"/>
</IF>
<SetResponseData Key="val.VendorTitle.Value" Value="Actuator Provider"/>
</For>
<!-- Do an Update -->
<Update From="Result">
<Include>$Response.Message.Value.Find</Include>
</Update>
</Query> |
|
SffWdlFacet | Yes, when wrapped within Workflow Task's Invoke | Optional | Code Block |
---|
language | xml |
---|
theme | Eclipse |
---|
title | Facetscript within Workflow Definition |
---|
linenumbers | true |
---|
| <Workflow wid="[:CONFIG.WfExecutorWid:]" Limit="1" Live="1">
<Task name="Executor" while="true">
<Event name="Argument"/>
<Invoke name="Execute" waitFor="Argument" fid="[%:Event.Argument.ExeFid:%]">
<Include>[%:@WFRT:%]Event.Argument.Task</Include>
</Invoke>
<Invoke name="SetResult" fid="[:CONFIG.BehaviorFid:]">
<FacetScript>
<Process>
<Message>
<Value>
<Set wid="[%:Event.Argument.Response.Wid:%]" target="[%:Event.Argument.Response.Result:%]">
<Value>
<Include>[%:@WFRT:%]Invoke.Execute.Message.Value</Include>
</Value>
</Set>
<Set wid="[%:Event.Argument.Response.Wid:%]" target="[%:Event.Argument.Response.Event:%]" value="true"/>
</Value>
</Message>
</Process>
</FacetScript>
</Invoke>
</Task>
</Workflow> |
|
Mandatory within Package Definition
Using FacetScript is mandatory when defining a new package. New package definition contains the list of FacetTypes that the developer intends to deploy in TQLEngine. Note that NewPackage itself is part of FacetScript.
Code Block |
---|
language | xml |
---|
theme | Eclipse |
---|
title | Facetscript in NewPackage Definition |
---|
|
<NewPackage>
<!-- ======================================================================= -->
<NewFacetInstance fid="test" name="static" type="SffHttpStaticFileFacet">
<OnActivate>
<Process>
<Resource>res</Resource>
</Process>
</OnActivate>
</NewFacetInstance>
<!-- ======================================================================= -->
<NewFacetInstance fid="wstest" name="wstest" type="SffTcpFacet" context="keep">
<OnOpen ModifyPipeline="WebSocketServerExtensionArgs"/>
<OnRequest>
<DoResponse target="wstest:*" process="wstest.$Request"/>
</OnRequest>
</NewFacetInstance>
<!-- ======================================================================= -->
</NewPackage> |