Follow the instructions below to add a new sample asset for the asset type device, which is defined in the
device.rxt, at server startup:
Create a folder by the plural-name of the asset type (RXT), which is devices, in the Publisher sample artifacts
<ES_HOME>/repository/deployment/server/jaggeryapps/publisher/samples/assetsdirectory, where sample artifacts for each asset type are available in ES.
- Add a parent installation script for the sample asset type
- Copy the asset specific
Each sample contains a parent installation script, which is defined in the
install.jsfile, in the latter mentioned path. The
install.jsscripts found within sub-folders (e.g., devices, gadgets and sites) of this path will override the default parent script to perform any specific operations relevant to that asset type.
Search and change the following tags appropriately in the copied script:
<ASSET_LIFECYCLE>: Lifecycle definition to which the asset type
deviceis attached to, which is SampleLifeCycle2.
Note that the lifecycle should be one of the lifecycle definitions found inside the
<ASSET_RXT_NAME>: The RXT name of the asset type for which the samples are made, which is
Save and close the
- Copy the asset specific
Create a folder by the name of the sample artifact, which is
firealarm, inside the
<ES_HOME>/repository/deployment/server/jaggeryapps/publisher/samples/assets/devicesdirectory, which is the asset specific parent directory.You can continue by adding any number of folders per sample artifact of the asset type (e.g., firearm, raspberryPi, arduino etc.). Artifact specific details go into these folders.
The folder structure at the
<ES_HOME>/repository/deployment/server/jaggeryapps/publisher/samplesdirectory should look as follows:
Define the asset specific attributes that need to be used when creating the sample
You need to define the latter mentioned asset specific attributes in a JSON file, which has the same name as the asset type RXT (e.g.,
RXT_NAME.json). In this case as the RXT file name for the asset type named device is
device.rxtthe JSON file that defines the asset specific attributes need to be named as follows:
device.jsonfile into the
Add any images used for the thumbnail and banner views of the sample artifact in the artifact specific directory, which is the
Define the paths to the latter mentioned images in the
Make the following additions in the
publisher-tenant.jsonfile, which is available in the
Add the asset type, which is
device, to the
Add the plural name of the asset type, which is device, to the sub-unit
collections, which is nested under the
Add a new type by the same plural-name of the asset type, which is devices, for sub-unit
assetData, which is nested under the
Restart the ES server.
The new sample artifact should get created for the specific asset type. This can be viewed via the Publisher. The artifact will be listed under the asset type in the Store according to the lifecycle state mentioned for the
overview_statusattribute in the
device.jsonfile. In this tutorial, as we have set the lifecycle status to
Publishedthe artifact is visible in the Store.
The following are some useful tips that you need to keep in mind when working on the above tutorial:
- Be sure to add the lifecycle definition to the
- Be sure to name the attributes (e.g.,
<storagePath>....</storagePath>) appropriately in the asset type RXT file.
- Be sure that the
nameattribute and the
overview_nameattribute both have the same value (e.g.,
Raspberry Piwill not work). The attribute referred to as
nameis the asset name and the
overview_nameis the value that is used when creating the resource path in the registry.