Configuring an Edge Thing Shape
The configuration of an Edge Thing Shape (ETS) is described using a Data Shape. The configuration can be serialized to JSON, using the infotable format. Internally, configuration information is shared between the core Java SDK and an ETS using an infotable.
Configuration Files
The core Java SDK loads the configuration file of an ETS and persists the new configuration. Loading the configuration file is the last step of loading an ETS. The configuration is de-serialized to an infotable and passed to the ETS through its onConfigure method. The name of the configuration file for an ETS should be the name of the ETS that is passed with the defineThingShape method, plus the extension, .json. If no configuration file is found, the initialConfiguration method is called to obtain a default configuration infotable.
To obtain the location of a configuration file, use the getShapeConfigDirectory() method of the EdgeThingTemplate. The default location should be a directory called shapes in the current working directory of your edge application. Each ETS receives its configuration as part of the loading process.
Edge Thing Shapes should define a data shape that is appropriate for their configuration. This data shape is available through the method, EdgeRemoteConfigurable.getConfigDataShape(). The EdgeRemoteConfigurable interface is explained in more detail below.
Persistence of the Configuration
The core Java SDK provides a mechanism for an ETS to update its configuration. The SDK persists this updated configuration. For information about persisting a configuration file to disk, see
Local Configuration. For more details about the configuration interface,
EdgeRemoteConfigurable, continue to the next section.
EdgeRemoteConfigurable Interface
The configuration life cycle of an Edge Thing Shape is supported by one event, onConfigure() and a set of functions that manage the infotable that holds its configuration. These management functions make it possible for you to define an initial configuration that is used the first time that the component is started. The initial configuration is provided in the form of an infotable with a complete Data Shape and default values that the ETT uses to configure the version of the bound edge Thing on a ThingWorx Platform. These settings then appear on the bound Thing in its configuration table as a subset named after the identifier property of the ETS.
The following diagram shows the methods of the EdgeRemoteConfigurable interface: