Thing Templates
Thing Templates provide base functionality with properties, services, events, and subscriptions that Thing instances use in their execution. Every Thing is created from a Thing Template. A Thing Template can extend another Thing Template. When you release a new version of a product, you simply add the additional characteristics of the version without having to redefine the entire model. This model configuration provides multiple levels of generalization of an asset. A Thing Template can derive one or more additional characteristics by implementing Thing Shapes. When you make a change to the Thing Template, the change is propagated to the Things that implement that Thing Template, simplifying the model maintenance.
A Thing Template can be used to classify the kind of a Thing or asset class or as a specific product model with unique capabilities. If you have two product models and their interaction with the solution is the same (same properties, services, and events), you can model them as one Thing Template. You can classify Thing Templates to aggregate Things into collections that are useful in mashups. You can separate Thing Templates for indexing, searching, and future evolutions of the products.
System-Defined Thing Templates
There are a number of system-defined Thing Templates that can be used to create Things for specific tasks. Some of these Thing Templates can be useful as utilities for various services and capabilities when building applications.
The system-defined Thing Templates are the following:
Blog — A blog Thing is used to implement a blog, comments, and/or discussion forum collaboration objects in your mashups.
Content Crawler — A Thing designed to handle a specific interface to an external system or content area. You define a service to get a list of external content to be indexed and also a service to retrieve the details for each content object, ThingWorx will then index the data and make it available via the ThingWorx search functions.
Database — A JDBC connection to any third-party relational database system.
Data Table — A Data Table is similar to a table in a relational database and can be used to store transactional rows of data in ThingWorx.
File Repository — A defined ThingWorx entity for external file content to be stored. When you transfer files to/from an Edge Thing, you do so to/from a specific repository. A file repository points to a folder in the server’s ThingworxStorage/repository folder. The services of a file repository allow you to view and manipulate files in its folder.
Generic Thing — A base Thing with minimal inherited characteristics. It is a best practice to define a custom Thing Template. However, there may be cases where you have a one-off Thing definition and you want to use a generic Thing.
Mail Server — A mail server Thing can be created if you want to send email messages from your application.
Edge — An Edge Thing is a device or data source that is installed on another server, usually through a firewall to a different network. An Edge Thing communicates to the server through a locally installed EMS. An example of an Edge Thing is an OPC-DA server.
Edge Database— An Edge database Thing is for communicating to an OLE-DB or ADO.NET database or data source on a different server or workstation. Examples of an Edge Database is Microsoft Excel or Microsoft Access.
Edge Enhanced— A server model Thing corresponding to a remotely installed device or data store that needs to support remote desktop tunneling or file transfer.
Scheduler — A scheduler Thing can be used to run jobs based on a cron pattern, for example, once a day or once an hour.
Source Control Repository — A source control repository can point to any folder on the server’s file system, which can be the root of your local repository. It is used by Import/Export > Source Control Entities.
Stream — Time series data storage.
Timer — A simple timer that fires an event on a defined interval.
Wiki — A collaboration object for sharing documents and related comments within your mashups.
When you create a specific instance of one of the system Thing Templates, you can configure it to meet your business needs and your IoT environment.
System-Defined Remote Templates
Several system-defined Thing Templates can be used to communicate over Web sockets to edge devices or data stores. RemoteThing is the naming convention for using Web sockets to communicate to another node, or Thing, in the network. The Thing Templates for the WSEMS and the SDKs are as follows:
RemoteDatabase — A remote OLE-DB data source.
RemoteThing — A Remote Thing with no file transfer or tunneling needs. Also used for OPC-DA data source things. Supports properties, services, and events.
RemoteThingWithFileTransfer — A Remote Thing plus file transfer enablement.
RemoteThingWithTunnels — A Remote Thing plus tunneling enablement.
RemoteThingWithTunnelsAndFileTransfer — A Remote Thing with file transfer and tunneling.
EMSGateway — The EMSGateway Thing Template is used when you wish to be able to address the WSEMS as a standalone Thing. This may be useful in situations where the WSEMS is running on a gateway computer and handling communication for one or more Remote Things, which may reside on different IP addresses within a local area network.
SDKGateway — Similar to the EMSGateway, but to be used when you are using an SDK implementation as a gateway.
In addition to the above Thing Templates, the following remote templates can be used in a federated storage scenario, where you want to offload the persistence objects to another server that is optimized for disk IO:
RemoteStream — Create a local proxy object to a stream Thing that is running and persisting data on another ThingWorx server.
RemoteValueStream — Create a local proxy object to a value stream Thing that is running and persisting data on another ThingWorx server.
RemoteDataTable — Create a local proxy object to a Data Table Thing that is running and persisting data on another ThingWorx server.
RemoteBlog — Create a local proxy object to a blog Thing that is running and persisting data on another ThingWorx server.
RemoteWiki — Create a local proxy object to a wiki Thing that is running and persisting data on another ThingWorx server.
Creating Thing Templates with an Extension
Thing Templates created with an extension are basically the same as those created in ThingWorx Composer. They are base templates that are used to create Things with the same properties, configuration parameters, services. The difference between creating them in Composer and inside an extension framework is the language used for the services and visibility of those services.
Composer Template:
Uses JavaScript for services
Source code is visible
Extension SDK Template:
Uses Java for services
Source code is not visible
Can define configuration values
Was this helpful?