cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Extending a Remote Thing Template

Highlighted
Amethyst

Extending a Remote Thing Template

I am still playing with the HelloWorld extension and so far I had a good success with it. I am stuck with one thing tough:


My TW extension will create a Thing Template that will be used by a JavaSDK agent to populate thingworx. The HelloWorld extension extends the Thing class so when HelloWorld thing template is create in TW, it is derived from the Generic Thing template.


All I did was to change the class I am extending:



I tried to extend the RemoteThing class and I was able to get it do get some characteristics of a remote thing (such as the Is connected property) but it does not seem to be the correct way to do it as the template in the General Information still shows "generic Thing"




Also, I am not able to map the Remote Properties to it. I can see it is connected:





4 REPLIES 4

Re: Extending a Remote Thing Template

Did you install your extension more than once?

If you imported the extension with the java code written to extend Thing, then imported it again extending RemoteThing, you must restart tomcat in between those installs because the new classes may not be loaded into your instance.  Can you confirm that you restarted Tomcat between extension imports?

Re: Extending a Remote Thing Template

Hi Thearon.

I did remove the extension prior to installing the new one and cleared TomCat cache.

Re: Extending a Remote Thing Template

Ah, I should have thought of this first - you should add this annotation above your class name in the Java file and it should work:

@ThingworxBaseTemplateDefinition(name = "RemoteThing")

Also, as an FYI - if you want to add specific shapes to a ThingTemplate through Java code, this is the annotation:

@ThingworxImplementedShapeDefinitions(shapes = {

     @ThingworxImplementedShapeDefinition(name = "MyShape"),

     @ThingworxImplementedShapeDefinition(name = " OtherShape")

})

Re: Extending a Remote Thing Template

Thanks Thearon, I still did not have time to test it. Once I do It I will send u the feedback!

Cheers

Ewerton