Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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 TQLEngine 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 TQLEngineA-Stack

Name

Type NameDescription
MessageSffMsgFacetGeneric Message Communication.
NetworkSffNetworkFacet
TQLEngine
A-Stack cluster support. Define the list of
TQLEngine
A-Stack(s) that can participate in syncing their data
TqlSffTqlFacetThing Query Language Support (Thing Definition, Thing Interaction)
WorkflowSffWdlFacetWorkflow Language Support
Behavior TreesSffBdlFacetBehavior Tree Implementation
TopicSffTopicFacetSubscription and Notification of Model changes
SchedulingSffSequenceFacetSchedule tasks / jobs (piece of Model code) to be executed in a repeated sequence of defined interval.
Static FilesSffStaticFileFacetServe static files using
TQLEngine
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 NameSffMsgFacet
Language SupportFacetScript
Transports

HttpServerExtensionArgs

WsServerExtensionArg

WsServerExtensionArgs

Usage

 Facet Types are used

using

in <NewFacetInstance> when creating a Package (Deployment) definition for your models.

Code Block
languagexml
titleSffMsgFacet Example
linenumberstrue
<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 NamesSffTcpFacet
Use Cases
  1. Publish HTTP or WebSocket Endpoint served by
TQLEngine
  1. A-Stack to process any request and send response.
  2. Can be used to create a proxy to other facet types (like SffTqlFacet).

...


Network

Network

...

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 itFacet 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
SffMsgFacet
SffNetworkFacet
Language Support
FacetScript
Network Definition using <Network> Tag.
Transports

HttpServerExtensionArgs

WsServerExtensionArg

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.

Code Block
languagexml
title
SffMsgFacet
SffNetworkFacet Example
linenumberstrue
<!-- Define Cluster / Network -->
<NewFacetInstance fid="
smartparking
cluster" name="
SmartParking
cluster" type="
SffMsgFacet
SffNetworkFacet">
		<OnActivate>
<OnOpen ModifyPipeline="HttpServerExtensionArgs
			<Process>
				<Network>
					<Group name="FarmGatewayGroup" />
					<A-Stack name="Cloud0" 
<OnRequest> <!-- Handle Request --> <!-- Any FacetScript Code can go in here... -> <DoResponse> <!-- Send the response back.. -> </DoResponse> </OnRequest> </NewFacetInstance>Other NamesSffTcpFacetUse Cases
  1. Publish HTTP or WebSocket Endpoint served by TQLEngine to process any request and send response.
  2. Can be used to create a proxy to other facet types (like SffTqlFacet).

...

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:

Code Block
languagexml
titleSffNetworkFacet Associated within SffTqlFacet
linenumberstrue
 <!-- Cluster specific replication -->
 <NewFacetInstance fid="SmartParking" Name="TQL" Type="SffTqlFacet">
 <OnActivate>
<!-- Associating Instance of Network facet -->
 <NetworkFacet>cluster</NetworkFacet>
</NewFacetInstance>
Use Cases
  1. Replicate data between different instances of A-Stack.
  2. Broadcast messages to TQEngine(s)


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
SffMsgFacet
SffTqlFacet
Language Support
FacetScript
Thing Interaction Language (TIL) - TQL CRUD Queries requested via <Query> tag.
Transports

HttpServerExtensionArgs

WsServerExtensionArg

WsServerExtensionArgs

Usage

 Facet Types are used using <NewFacetInstance> when creating a Package (Deployment) definition for your models.

Code Block
languagexml
title
SffMsgFacet
SffTqlFacet Example
linenumberstrue
<!-- Typical TQL Facet Definition -->
	<NewFacetInstance fid="
smartparking
[:RuntimeParams.WSFacetIDName:]Cluster"
name
		Name="
SmartParking
TQL" 
type
Type="
SffMsgFacet"> <OnOpen ModifyPipeline="HttpServerExtensionArgs" /> <OnRequest>
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> <!-- 
Handle Request
Private Instance of Msg facet -->
			<Process>
                <!-- 
Any
Define 
FacetScript
TQL 
Code
Storage 
can
Scheme 
go in here... -> <DoResponse>
-->
				<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> <!-- 
Send
Process the response 
back..
from Facet or send it straight through -->
				<Process>
					<Message type="[:RuntimeParams.TQLOutputFormat:]">
						<Value>
							<Include>$Response.Message.Value</Include>
						</Value>
					</
DoResponse>
Message>
				</Process>
			</DoResponse>
		</OnRequest>
</NewFacetInstance>
Other NamesSffTcpFacet
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
  1. Publish HTTP or WebSocket Endpoint served by TQLEngine to process any request and send response.
  2. Can be used to create a proxy to other facet types (like SffTqlFacet).

 

Workflow

...

  1. Handle TQL Query request from external users over a given transport (Http or WS).


Workflow

Workflow facet types allows users to install workflow definitions that can be called from other models.

Facet Type Name
SffMsgFacet
SffWdlFacet
Language Support
FacetScript
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.

Code Block
languagexml
title
SffMsgFacet
SffWdlFacet Example
linenumberstrue
<NewFacetInstance fid="
smartparking
[:RuntimeParams.WdlFacetIDName:]" 
name
Name="
SmartParking
wdl" 
type
Type="
SffMsgFacet
SffWdlFacet">
  
<OnOpen
 
ModifyPipeline="HttpServerExtensionArgs" />
 <OnActivate>
  
<OnRequest>
    <Include></Include> <!-- 
Handle
Specify 
Request
Workflow 
-->
defintion files 
<!-
-
Any FacetScript Code can go in here...
->

   
<DoResponse>
 
<!-- Send the response back.. -> </DoResponse>
</OnActivate>
    <OnOpen ModifyPipeline="HttpServerExtensionArgs"/>
  </
OnRequest> </NewFacetInstance>Other NamesSffTcpFacet
NewFacetInstance>

Associated within

other Facet Types

Private instances are associated within TQL Facet Types
Use Cases
  1. Publish HTTP or WebSocket Endpoint served by TQLEngine to process any request and send response.
  2. Can be used to create a proxy to other facet types (like SffTqlFacet).

 

Behavior Trees

...

  1. Implement complex business logic either (Thing or App) using Workflows.
  2. Private instance of Workflow Facet is a requirement for Thing and App Facets to function correctly as part of Tql Facet types.


Behavior Tree

Behavior Tree Facet implements Behavior Trees

Facet Type Name
SffMsgFacet
SffBdlFacet
Language Support
FacetScript
Behavior Definition Lanauge (BDL)
Transports

HttpServerExtensionArgs

WsServerExtensionArg

Usage

 Facet Types are used using <NewFacetInstance> when creating a Package (Deployment) definition for your models.

Code Block
languagexml
titleSffMsgFacet Example
linenumberstrue
<NewFacetInstance fid="
smartparking
bdl" name="
SmartParking
bdl" type="
SffMsgFacet
SffBdlFacet">
      <OnOpen ModifyPipeline="
HttpServerExtensionArgs
WsServerExtensionArgs"
/>
<OnRequest> <!-- Handle Request --> <!-- Any FacetScript Code can go in here... -
</NewFacetInstance>
Use Cases
  1. Implement complex business logic either (Thing or App) using Behavior trees.


Topic

Topic Facet implements Subscription and Notification both at Model - to - model and external over a websocket interface.

Facet Type NameSffTopicFacet
Language Support

Subscribe and Notification

Code Block
languagexml
titleSubscribe Example
linenumberstrue
<Subscribe sid="test" topic="test.ws.*">
    
<DoResponse>
<Action>
       <!-- 
Send
Take 
the
Some 
response back..
Action -->
    </
DoResponse>
Action>
</
OnRequest> </NewFacetInstance>Other NamesSffTcpFacetUse Cases
  1. Publish HTTP or WebSocket Endpoint served by TQLEngine to process any request and send response.
  2. Can be used to create a proxy to other facet types (like SffTqlFacet).

 

Topic

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 NameSffMsgFacetLanguage SupportFacetScript
Subscribe>
Transports

HttpServerExtensionArgs

WsServerExtensionArg

Usage

 Facet Types are used using <NewFacetInstance> when creating a Package (Deployment) definition for your models.

Code Block
languagexml
title
SffMsgFacet
SffTopicFacet Example
linenumberstrue
<NewFacetInstance fid="
smartparking
topic" name="
SmartParking
topic" type="
SffMsgFacet
SffTopicFacet">
      <OnActivate>
       </OnActivate>
      <OnOpen ModifyPipeline="
HttpServerExtensionArgs" /> <OnRequest>
WsServerExtensionArgs"/>
      <OnError>
        <DoResponse>
          <Process>
            <Message type="xml">
              <Value>
                
<!-- Handle Request -->
<Error>[:$Error:]</Error>
                
<!-- Any FacetScript Code can go in here... ->
<ErrorRequest>[:$Request:]</ErrorRequest>
              </Value>
    
<DoResponse>
        <
!-- Send the response back.. ->
/Message>
          </Process>
        </DoResponse>
      </
OnRequest>
OnError>
 </NewFacetInstance>

Associated within

Other

NamesSffTcpFacet

Facet Types

Public instances are associated within TQL Facet Types
Use Cases
  1. Publish HTTP or WebSocket Endpoint served by TQLEngine to process any request and send response.
  2. Can be used to create a proxy to other facet types (like SffTqlFacet).

 

Scheduling

...

  1. Allows Model to model and external Subscription and Notifications.
  2. Private instance of Topic Facet is a requirement for Model subscription to function correctly as part of Tql Facet types.


Scheduling

Sequence Facet supports scheduling of tasks at given time and frequency.

Facet Type Name
SffMsgFacet
SffSeqeunceFacet
Language Support
FacetScript

Sequence Language

Code Block
languagexml
titleSequence Language Example
linenumberstrue
<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.

Code Block
languagexml
title
SffMsgFacet
SffSequenceFacet Example
linenumberstrue
<NewFacetInstance fid="
smartparking
seq" name="
SmartParking
seq" type="
SffMsgFacet
SffSequenceFacet">
  
<OnOpen
 
ModifyPipeline="HttpServerExtensionArgs"
 
/>
  
<OnRequest>
<OnActivate>
    
<!-- Handle
 
Request
 
-->
     <!-- 
Any
Schedule 
FacetScript
something 
Code
at 
can
the 
go
time 
in here...
of activation -->
    
<DoResponse>
  
<
!--
/OnActivate>
Send
 
the
 
response
 
back..
 
->
  
</DoResponse>
<OnOpen ModifyPipeline="WsServerExtensionArgs"/>
 
</
OnRequest> </
NewFacetInstance>
Other NamesSffTcpFacetFacet Type NameSffMsgFacet
Use Cases
  1. Publish HTTP or WebSocket Endpoint served by TQLEngine to process any request and send response.
  2. Can be used to create a proxy to other facet types (like SffTqlFacet).

 

Static Files

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. 

  1. Scheduling of tasks at given interval and frequency.
  2. Schedule Format is: StartTime..EndTime/Interval Where StartTime and EndTime can be a hierarchical dot-delimited format.

    Example of dot-delimited format:


    2015.MAY.25.14.30min means 2015-May-25:14:30. It is not necessary to specify time units on each element as long as there is at least one and you follow the standard time interval hierarchy (i.e. year-month-day-hour-minute-second-millisecond). In the above example, “MAY” is used by the system to match all the numerals with time units (i.e. it recognizes that if MAY is a month then to the left of it must be the year and to the right must be day, hour, minute etc.). For non-standard definitions, you can always specify time unit explicitly (e.g. 2015yr.128doy.15hr, where 2015 is a year, 128 is day of the year and 15 is hour of the day). Only 24 hours format is currently supported.


Static Files

Static Files Facet Types allows users to serve static files using A-Stack

...

Facet Type Name
SffStaticFileFacet
Language SupportFacetScript
Transports

HttpServerExtensionArgs

WsServerExtensionArg

Usage

 Facet Types are used using <NewFacetInstance> when creating a Package (Deployment) definition for your models.

Code Block
languagexml
title
SffMsgFacet
SffStaticFileFacet Example
linenumberstrue
<NewFacetInstance fid="
smartparking
file" name="
SmartParking
File" type="
SffMsgFacet
SffStaticFileFacet">
  
<OnOpen
 
ModifyPipeline="HttpServerExtensionArgs"
 
/>
   
<OnRequest> <!-- Handle Request -->
 <OnActivate>
       
<!--
 
Any
 
FacetScript
 
Code
 
can
 
go in here... -> <DoResponse> <!-- Send the response back.. ->
<Process BasePath="web" Resource="res"/>
        </
DoResponse>
OnActivate>
</
OnRequest> </
NewFacetInstance>
Other NamesSffTcpFacet
Use Cases
  1. Publish HTTP or WebSocket Endpoint served by TQLEngine to process any request and send response.
  2. Can be used to create a proxy to other facet types (like SffTqlFacet).

 

  1. Handy to serve your html5 Javascript Application using A-Stack. Avoid overhead of spinning yet another http file server!