Question

I'm updating a gwt plugin that function properly in BI 3.x-4.x. I made some corrections in code and now the plugin is able to save/load its data in the repository and load its status when i type url in browser

http://localhost:8080/pentaho/content/stdashboard?path=/home/admin&action=test2.std&mode=view#dashboard

First I note that action in operations from may content-type don't do anything and i used a perspective referenced later in plugin.xml and plugin.spring.xml.

When run the application the generated url is

http://localhost:8080/pentaho/api/repos/:home:admin:test2.std/run?ts=1395256028350

and in my ContentGenerator (class i receive the path value as "/home/admin/test2.std" which is ok according to this version but i thing i'm missing or doing something wrong because the GWT-WS is not called, only ContexGenerator.

When I type url in browser the application exec first ContentGenerator, then WS and then again the ConntextGenerator.

plugin.xml

<plugin title='STDashboard Pentaho Plugin' loader="OVERRIDING" name="stdashboard">
  <webservice id="olapInteraction" type="gwt" 
      class="com.stratebi.stdashboard.server.OlapInteractionImplLite"/>
  <content-type type="std" mime-type="text/html">
    <title>STDashboard Plugin</title>
    <description>STDashboard configuration file</description>
    <icon-url>content/stdashboard-res/stdashboard_16.jpg</icon-url>
    <meta-provider>com.stratebi.stdashboard.STDashboardContentTypeMetaProvider</meta-provider>
    <operations>
      <operations>
        <operation>
        <id>RUN</id>
        <perspective>run</perspective>
      </operation>
    </operations>
  </content-type>
  <content-generator id="std" title="STDashboard" type="std.run"
      class="com.stratebi.stdashboard.STDashboardContentGenerator"/>
    <static-paths>
      <static-path url="/stdashboard-res" localFolder="resources"/>
    </static-paths>
  <overlays>
    <overlay id="startup.STDashboardPlugin" 
         resourcebundle="content/stdashboard-res/stdashboard">
      <button id="openSTDashboard" label="${stdashboard.tooltip}" 
              command="Home.openFile('STDashboard','STDashboard',
              'content/stdashboard?solution=system&amp;path=temp&amp;action=true');
              $('#btnCreateNew').popover('hide')" />
    </overlay>
    <overlay id="launch" resourcebundle="content/stdashboard-res/stdashboard">
          <button id="stdashboardButton" image="content/stdashboard-res/stdashboard.png"
              command="Home.openFile('STDashboard','STDashboard',
              'content/stdashboard?solution=system&amp;path=temp&amp;action=true')"
              label="${stdashboard.tooltip}" />
        </overlay>
    </overlays>
</plugin>

plugin.spring.xml

<beans "namespaces list...">
  <context:annotation-config />
  <bean id="stdashboard" 
        class="com.stratebi.stdashboard.STDashboardContentGenerator" scope="prototype"/>
  <bean id="stdashboard.run" 
        class="com.stratebi.stdashboard.STDashboardContentGenerator" scope="prototype"/>
</beans>

Thanks in advance

Was it helpful?

Solution

Not sure if it helps, but I'd look into exposing functionality via Rest Endpoints using Jersey.

That way you only need to declare your endpoint in plugin.spring.xml and you call them using

/pentaho/plugin/<your plugin>/<whatever urls you decide to create>

The rule of thumb we use here at webdetails is if you're generating file-based content to show to the user, use the content generator and the api/repos/...../<run or edit or generatedContent>.

If you're exposing a service that will be consumed by your plugin, use a REST endpoint with a Jersey resource.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top