Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
1 reply Latest Post - ‏2013-03-19T14:13:05Z by SystemAdmin
SystemAdmin
SystemAdmin
139 Posts
ACCEPTED ANSWER

Pinned topic Master Slave example with java class or with one vm-template???

‏2013-03-19T10:49:46Z |
Can anyone provide me the example of master-slave with java class which extends TopologyProvider class??
means creation of vm-templates by java class specialy of link creation??

Can i have master component, slave component and link component in one vm template??? rather than having three templates with if -- else different conditions

I am able to merge template of master and slave but not link ,can we put like this??

Please kindly revert.

Thanks,
Sheetal Chavan
Updated on 2013-03-19T14:13:05Z at 2013-03-19T14:13:05Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    139 Posts
    ACCEPTED ANSWER

    Re: Master Slave example with java class or with one vm-template???

    ‏2013-03-19T14:13:05Z  in response to SystemAdmin
    Sheetal,

    Either you use a templateTransformer based on vm-template or you use your own transformer to create the topology.

    If you look at the hello example, you will see in the comments:

    <scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="false" name="Hello">
    <!-- implementation element determines whether trnasform is Java or Velocity template. -->
    <implementation class="com.ibm.maestro.model.transform.template.TemplateTransformer"/>
    <!-- implementation class="com.ibm.sample.hello.HelloTransformer"/ Java transform -->
    <service>
    <provide interface="com.ibm.maestro.model.transform.TopologyProvider"/>
    </service>
    <!-- {component,link}.template properties used only for template transforms; ignored/not needed for Java transforms. -->
    <property name="component.template" type="String" value="templates/hello.vm"/>
    </scr:component>

    So, the property "component.template" and "link.template" is only used when you use the TemplateTransformer not when you create your own transformer extending the TopologyProvider.

    Then if you create your own TopologyProvider, nothing prevent you (AFAIK), to create a class that generate the topology for your master/slave and link at once.

    Not sure about the ability to merge the link template with the two others, but if I had to try it, I would add the link tempalte as being the last element of the vm-templates array.

    Regards
    Dominique

    Dominique - Follow me on Twitter @ITDoVe - Blog: http://cloud.itdove.com