ThingWorx Edge Java SDK Edge Extensions > Applying Namespaces to ETS Properties, Services, and Data Shapes
Applying Namespaces to ETS Properties, Services, and Data Shapes
If the properties, services, and Data Shapes established by an Edge Thing Shape (ETS) are allowed to overlap with other ETS declarations, you must use namespaces to prevent any conflicts. Since the creator of one ETS cannot always know if another ETS exists with the same names for properties, services, and Data Shapes, a way to compose an ETS with customized names must exist. Although the use of namespaces is optional, it is a best practice to use them.
When the useNamespace attribute is set to true on the ThingworxEdgeThingShapeDefinition attribute of an ETS, all declarations for properties, services, and data shapes are prefixed with the value of the name attribute of the same annotation. For example:
@ThingworxEdgeThingShapeDefinitions(shapes = {
@ThingworxEdgeThingShapeDefinition(className =
"com.thingworx.sdk.edgethingshapes.demos.simple.AddressEdgeShape",
name = "AddressEdgeShape", useNamespace = true ),

@ThingworxEdgeThingShapeDefinition(className =
"com.thingworx.sdk.edgethingshapes.demos.simple.InventoryEdgeShape",
name = "InventoryEdgeShape", useNamespace = true )
})
This declaration would prefix the names of all properties, services, and Data Shapes with either AddressEdgeShape_ or InventoryEdgeShape_, respectively.
Namespacing enables you to control and manage conflicting names in an Edge Thing Teemplate or in an application that uses two Edge Thing Shapes with the same names for properties, services, or events..
Was this helpful?