Facet Types
Definition of Facet Types
A Facet Type is a unit of capability (or method) represented by a piece of executable code (a Java class) intended to process a request. The facet type’s method selection is based on the facet lifecycle event model. In short, the A-Stack invokes the appropriate facet type method using the current facet pipeline connection context and facet instance information as argument.
Facet Types in the A-Stack
Name | Type Name | Description |
---|---|---|
Message | SffMsgFacet | Generic Message Communication. |
Network | SffNetworkFacet | A-Stack cluster support. Define the list of A-Stack(s) that can participate in syncing their data |
Tql | SffTqlFacet | Thing Query Language Support (Thing Definition, Thing Interaction) |
Workflow | SffWdlFacet | Workflow Language Support |
Behavior Trees | SffBdlFacet | Behavior Tree Implementation |
Topic | SffTopicFacet | Subscription and Notification of Model changes |
Scheduling | SffSequenceFacet | Schedule tasks / jobs (piece of Model code) to be executed in a repeated sequence of defined interval. |
Static Files | SffStaticFileFacet | Serve static files using A-Stack. |
Message
Message Facet Type is a generic Message processing over any given specified transport. Message Facet Type does not support any specific payload to process unlike other Facet types. Message Facet Type can be used process any payload that is passed to it.
Facet Type Name | SffMsgFacet |
---|---|
Language Support | FacetScript |
Transports | HttpServerExtensionArgs WsServerExtensionArgs |
Usage | Facet Types are used in <NewFacetInstance> when creating a Package (Deployment) definition for your models. SffMsgFacet Example <NewFacetInstance fid="smartparking" name="SmartParking" type="SffMsgFacet"> <OnOpen ModifyPipeline="HttpServerExtensionArgs" /> <OnRequest> <!-- Handle Request --> <!-- Any FacetScript Code can go in here... -> <DoResponse> <!-- Send the response back.. -> </DoResponse> </OnRequest> </NewFacetInstance> |
Other Names | SffTcpFacet |
Use Cases |
|
Network
Network Facet Type allows TQL users to specify network definition of their A-Stacks. Network Facet Type is normally used to create a cluster of A-Stacks so that the TQL storage can be shared across those A-Stacks.
Facet Type Name | SffNetworkFacet |
---|---|
Language Support | Network Definition using <Network> Tag. |
Transports | WsServerExtensionArgs |
Usage | Facet Types are used using <NewFacetInstance> when creating a Package (Deployment) definition for your models. Network defintion is created at the time of OnActivate Facet Instance Lifecycle. SffNetworkFacet Example <!-- Define Cluster / Network --> <NewFacetInstance fid="cluster" name="cluster" type="SffNetworkFacet"> <OnActivate> <Process> <Network> <Group name="FarmGatewayGroup" /> <A-Stack name="Cloud0" url="ws://10.0.1.4:8080/fid-cluster" group="FarmGatewayGroup" replicateTo="FarmCloudGroup" documentation="Cloud Summary Holder" /> <Group name="FarmCloudGroup" /> <A-Stack name="Cloud1" url="ws://farm.atomiton.com:8080/fid-cluster" group="FarmCloudGroup" replicateTo="FarmCloudGroup" documentation="Cloud Summary Holder" /> </Network> </Process> </OnActivate> <OnOpen ModifyPipeline="WsServerExtensionArgs" /> </NewFacetInstance> |
Associated within other FacetTypes | Instances of Network Facet Types are normally associated with the TQL Facet types so that the data can be replicated. Association can be done as follows: SffNetworkFacet Associated within SffTqlFacet <!-- Cluster specific replication --> <NewFacetInstance fid="SmartParking" Name="TQL" Type="SffTqlFacet"> <OnActivate> <!-- Associating Instance of Network facet --> <NetworkFacet>cluster</NetworkFacet> </NewFacetInstance> |
Use Cases |
|
TQL
Message Facet Type is a generic Message processing over any given specified transport. Message Facet Type does not support any specific payload to process unlike other Facet types. Message Facet Type can be used process any payload that is passed to it.
Facet Type Name | SffTqlFacet |
---|---|
Language Support | Thing Interaction Language (TIL) - TQL CRUD Queries requested via <Query> tag. |
Transports | HttpServerExtensionArgs WsServerExtensionArgs |
Usage | Facet Types are used using <NewFacetInstance> when creating a Package (Deployment) definition for your models. SffTqlFacet Example <!-- Typical TQL Facet Definition --> <NewFacetInstance fid="[:RuntimeParams.WSFacetIDName:]Cluster" Name="TQL" Type="SffTqlFacet"> <OnActivate> <!-- Associate other facet types; Either Private or Public Instances --> <NewFacetInstance name="tqlwfws" type="SffWdlFacet" /> <!-- Private Instance of wdl facet --> <NetworkFacet>?cluster</NetworkFacet> <!-- Public Instance of Network Facet --> <TopicFacet>?TQLGenericTopic</TopicFacet> <!-- Public Instance of Topic Facet --> <ImportFacet>[:RuntimeParams.MacroFacetID:]</ImportFacet> <!-- Private Instance of Msg facet --> <Process> <!-- Define TQL Storage Scheme --> <Storage Name="[:RuntimeParams.TQLCacheName:]" Type="SqlSff" Comment="[:RuntimeParams.TQLCacheName:] Database SFF Unstructured SQL database" /> <!-- Specify the Model Definition file (TDL). Normally consists of Model definitions --> <Namespace> <Include>cloud.dbm.xml</Include> </Namespace> </Process> </OnActivate> <OnOpen ModifyPipeline="WsServerExtensionArgs" /> <OnRequest> <DoRequest> <!-- HandOff the request to Facet --> <Process Return="CMD_NOP"> <Message> <Value> <Include>$Request.Message.Value</Include> </Value> </Message> </Process> </DoRequest> <DoResponse> <!-- Process the response from Facet or send it straight through --> <Process> <Message type="[:RuntimeParams.TQLOutputFormat:]"> <Value> <Include>$Response.Message.Value</Include> </Value> </Message> </Process> </DoResponse> </OnRequest> </NewFacetInstance> |
Associating Other Facet Types | TQL Facet normally associates other facet types that are either private or public Instances. Private Instances are those that are defined internal with the TQL Facet Instance definition. |
Use Cases |
|
Workflow
Workflow facet types allows users to install workflow definitions that can be called from other models.
Facet Type Name | SffWdlFacet |
---|---|
Language Support | Workflow Definition Language (WDL) |
Transports | HttpServerExtensionArgs WsServerExtensionArg |
Usage | Facet Types are used using <NewFacetInstance> when creating a Package (Deployment) definition for your models. Workflows are typically installed at the time of <OnActivate> Life cycle. Note that Workflows are not a request / response style or external transport. SffWdlFacet Example <NewFacetInstance fid="[:RuntimeParams.WdlFacetIDName:]" Name="wdl" Type="SffWdlFacet"> <OnActivate> <Include></Include> <!-- Specify Workflow defintion files --> </OnActivate> <OnOpen ModifyPipeline="HttpServerExtensionArgs"/> </NewFacetInstance> |
Associated within other Facet Types | Private instances are associated within TQL Facet Types |
Use Cases |
|
Behavior Tree
Behavior Tree Facet implements Behavior Trees
Facet Type Name | SffBdlFacet |
---|---|
Language Support | Behavior Definition Lanauge (BDL) |
Transports | HttpServerExtensionArgs WsServerExtensionArg |
Usage | Facet Types are used using <NewFacetInstance> when creating a Package (Deployment) definition for your models. SffMsgFacet Example <NewFacetInstance fid="bdl" name="bdl" type="SffBdlFacet"> <OnOpen ModifyPipeline="WsServerExtensionArgs"/> </NewFacetInstance> |
Use Cases |
|
Topic
Topic Facet implements Subscription and Notification both at Model - to - model and external over a websocket interface.
Facet Type Name | SffTopicFacet |
---|---|
Language Support | Subscribe and Notification Subscribe Example <Subscribe sid="test" topic="test.ws.*"> <Action> <!-- Take Some Action --> </Action> </Subscribe> |
Transports | HttpServerExtensionArgs WsServerExtensionArg |
Usage | Facet Types are used using <NewFacetInstance> when creating a Package (Deployment) definition for your models. SffTopicFacet Example <NewFacetInstance fid="topic" name="topic" type="SffTopicFacet"> <OnActivate> </OnActivate> <OnOpen ModifyPipeline="WsServerExtensionArgs"/> <OnError> <DoResponse> <Process> <Message type="xml"> <Value> <Error>[:$Error:]</Error> <ErrorRequest>[:$Request:]</ErrorRequest> </Value> </Message> </Process> </DoResponse> </OnError> </NewFacetInstance> |
Associated within Other Facet Types | Public instances are associated within TQL Facet Types |
Use Cases |
|
Scheduling
Sequence Facet supports scheduling of tasks at given time and frequency.
Facet Type Name | SffSeqeunceFacet |
---|---|
Language Support | Sequence Language Sequence Language Example <Execute eid="test" schedule="[30../10sec]" limit="15"> <Action> <JavaScript> sffLog.info("Doing something..."); </JavaScript> </Action> </Execute> |
Transports | HttpServerExtensionArgs WsServerExtensionArg |
Usage | Facet Types are used using <NewFacetInstance> when creating a Package (Deployment) definition for your models. SffSequenceFacet Example <NewFacetInstance fid="seq" name="seq" type="SffSequenceFacet"> <OnActivate> <!-- Schedule something at the time of activation --> </OnActivate> <OnOpen ModifyPipeline="WsServerExtensionArgs"/> </NewFacetInstance> |
Use Cases |
|
Static Files
Static Files Facet Types allows users to serve static files using A-Stack
Facet Type Name | SffStaticFileFacet |
---|---|
Language Support | FacetScript |
Transports | HttpServerExtensionArgs WsServerExtensionArg |
Usage | Facet Types are used using <NewFacetInstance> when creating a Package (Deployment) definition for your models. SffStaticFileFacet Example <NewFacetInstance fid="file" name="File" type="SffStaticFileFacet"> <OnActivate> <Process BasePath="web" Resource="res"/> </OnActivate> </NewFacetInstance> |
Use Cases |
|