Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Assume that i have a ThingShape named SolvableSolutionProvider and it has a method submitJob() ;
If i mark the method as overrideable i can override the implementation provided in the Thingshape in the template or a thing.
Is it possible to provide a java implementation for the method ?
Also interested in knowing, how to override an service using the extension sdk.
Any help?
In 7.x you can now override Services.
Not sure how to do it with extensions sorry.
In the metadata of an entity you want the isAllowOverride="true" aspect to be set. That is pertaining to a service defined in XML.
When you use the Eclipse plugin, if you right-click on a .java file and hover over the ThingWorx menu option you have the ability to add a new Service or Property to that class. Add a new service, and there will be an "allow Override" checkbox available for you to select by default. Finish creating that service and you will see the aspect added. This is only available with the 7.x extension sdk and latest ThingWorx plugin for Eclipse.
The service will look something like this (see isAllowOverride set to true below):
@ThingworxServiceDefinition(name = "TestingService", description = "", category = "", isAllowOverride = true, aspects = {
"isAsync:false" })
@ThingworxServiceResult(name = "Result", description = "", baseType = "NOTHING")
public void TestingService() {
_logger.trace("Entering Service: TestingService");
_logger.trace("Exiting Service: TestingService");
}
Thanks, I resorted to a similar workaround.
Defined the main ThingTemplate in the Composer, with an overridable service.
Afterwards in the extension, added a ThingTemplate which had the previous one (created in the composer) as the BaseTemplate. Defined the same service signature. And "voilà"