ThingWorx Edge Java SDK Edge Extensions > Loading Edge Thing Shapes
Loading Edge Thing Shapes
Edge Thing Shapes are loaded dynamically at runtime. Dynamic loading is done through the library name or class name. The EdgeThingTemplate provides a public method called defineThingShape for loading an ETS library from a jar file, using its class name. The method also accepts a runtime name for the ETS and an optional useNamespace parameter that is preprended to properties, services, and events that are registered by the ETS.
Annotations are provided for loading an ETS on a VirtualThing, which removes the need to call the method, defineThingShape, directory. Thing shapes are collected in an annotation, @ThingworxEdgeThingShapeDefinition. Each thing shape is defined using an @ThingworxEdgeThingShapeDefinition:
@ThingworxEdgeThingShapeDefinition (name="shape_name", className="com.the.package.TheClass", useNamespace=true|false)
If the className consists of only the name of the class, a default package of com.thingworx.client.shapes is prepended to the className property in the annotation.
If any of the properties in an annotation have invalid values, you will see the error, InvalidAnnotationArgumentException. Any conflicts in the names of properties, services, events, and data shapes generate the error, DuplicateCharacteristicException
Was this helpful?