1 Reply Latest reply on Apr 7, 2015 3:26 PM by meghan RSS
    benr Newbie

    How to add Java service to FileRepository via extension - possible?

    I'm trying to create a Thingworx extension that adds a special type of ThingTemplate to the system. I'd like the base template to be a FileRepository, so Things that use the template can read a spreadsheet and use custom services to interrogate the spreadsheet.

    I have my extension created to the point where I can see my custom services appear in the composer, but it's just on a generic ThingTemplate, not one that uses FileRepository. It seems that if I try and modify my project in that way, I can then see all the FileRepository services on my new template, but my custom services disappear.

    I have a few questions:
    - Does the Java class that powers my ThingPackage need to extend Thing or FileRepositoryThing?
    - In my metadata.xml, should my ThingTemplate 'thingPackage' and 'effectiveThingPackage' attributes both point to my custom ThingPackage?
    - Is it correct for my ThingTemplate's 'baseThingTemplate' attribute to be FileRepository?

    The problem I'm having is that I can either see my custom service on my template, OR the file repository services, but not both at the same time.

      • How to add Java service to FileRepository via extension - possible?
        meghan Communicator

        Hello BenR,


        If you want to use the FileRepository as your baseThingTemplate then you will need to implement a ThingShape within your ThingPackage that has your custom services defined.

        1. You would simply nest the following within your custom <ThingPackage></ThingPackage> tags: 



        &lt;ImplementedShape name="YourCustomThingShape" type="ThingShape" /&gt;


        2. In metadata.xml for the ThingTemplate tags yes, you should make thingPackage and effectiveThingPackage both point to the custom ThingPackage and the baseThingTemplate point to FileRepository.

        3. Below all of those tags you will want to do the following:



        &lt;ThingShape name="YourCustomThingShape"&gt;





        &lt;ResultType baseType="+YourDesiredType" name="YourCustomServiceName" +/&gt;

        <ParameterDefinitions />





        By defining this separate ThingShape you should no longer lose your custom services.


        Meghan Hollenbach