Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
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:
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?
Hi Thearon.
I did remove the extension prior to installing the new one and cleared TomCat cache.
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")
})
Thanks Thearon, I still did not have time to test it. Once I do It I will send u the feedback!
Cheers
Ewerton