16 Replies Latest reply on Nov 30, 2016 11:40 PM by SunilKr

    issues while developing action plugin on Jive 8

    puja_kumari Intermediate

      Hi All,

       

      As per the steps given in https://community.jivesoftware.com/docs/DOC-3273#comment-2725678

      I created an action plugin on Jive 8 local instance on mac os.

      But the ui does not comes up after uploading the plugin jar via admin console and then restarting the server.

       

      Please help!!!

       

      Thanks and regards,

      Puja

        • Re: issues while developing action plugin on Jive 8
          bergerle Novice

          Maybe we could help you if you show us your Action Class, your struts.xml and your plugin.xml

            • Re: issues while developing action plugin on Jive 8
              puja_kumari Intermediate

              Hi Tobias,

               

              Below are the code:

               

              Plugin.xml

              ========

               

              <plugin xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                  xsi:noNamespaceSchemaLocation="http://www.jivesoftware.com/schemas/clearspace/2_5/plugin.xsd">

                  <name>simple</name>

                  <description>simple</description>

                  <author></author>

                  <version>${project.version}</version>

                  <minServerVersion>${jive.version.min}</minServerVersion>

                  <maxServerVersion>${jive.version.max}</maxServerVersion>

               

                  <components>

                   <component id="user-bar">

                   <tab id="jiveUserMenu5">

                   <item id="sayhello" name="Say Hello">

                   <url><![CDATA[<@s.url action="sayhello" />]]></url>

                   </item>

                   </tab>

                   </component>

                   </components>

                 

                 

                  <!--

                   <authorURL>

                   <pluginURL>

                   <databaseKey>

                   <databaseVersion>

                   <components>

                   <css>

                   <soy>

                   <javascript>

                   <widget>

                   <macro>

                   <urlmapping>

                   <sitemesh>

                   -->

                 

              </plugin>

              struts.xml

               

              <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"

              "http://struts.apache.org/dtds/struts-2.0.dtd">

              <struts>

                  <package name="simple-actions" extends="community-custom" namespace="">

                      <action name="sayhello" class="com.jivesoftware.accenture.soco.SimplePlugin">

                          <!-- Specify the FTL file that should be used to present the data in the case of

                           a "success" result (the default for an action class). -->

                          <result name="success" type="freemarker">/plugins/simple/resources/templates/simple-template.ftl</result>

                         

                      </action>

                  </package>

              </struts>

              Action class= SimplePlugin.java

               

              package com.jivesoftware.accenture.soco;

               

              import com.jivesoftware.community.action.JiveActionSupport; 

               

              /**

              * A "Hello World" plugin that merely receives or returns a greeting.

              * The JavaBeans-style accessors in this class are mapped to

              * property names in resources/simple-template.ftl, which is the FreeMarker

              * template the provides UI for displaying the data. The mapping is

              * done by Struts after the class-to-FTL mapping in the

              * struts.xml file.

              *

              * In other words, this class represents the plugin's data "model,"

              * the FTL file provides its "view," and the code in the struts.xml

              * file provides its "controller."

              */

               

              public class SimplePlugin extends JiveActionSupport

              {

                private static final long serialVersionUID = 1L;

                private String message = "Hello World";

               

                /**

                * Gets the greeting message. This method is mapped by Struts to the

                * $message property used in simple-template.ftl. In other words,

                * in rendering the user interface, the app (via Struts) maps

                * the $message property to a "getter" name of the form

                * get<property_name> -- this getMessage method.

                *

                * @return The greeting text.

                */ 

               

                  public String getMessage() { 

                        return message; 

                    } 

               

                  /**

                  * Sets the greeting message. The FTL file doesn't provide a way

                  * for the user to set the message text. But if it did, this is

                  * the method that would be called.

                  *

                  * @param message The greeting text.

                  */ 

                

                  public void setMessage(String message) { 

                    this.message = message; 

                    } 

            • Re: issues while developing action plugin on Jive 8
              puja_kumari Intermediate

              yeah! initially i was manually installing it... later I uncommented the pluginDirs and put the respective path:

              <plugin.dirs>${basedir}/../simple/target/simple</plugin.dirs>

              Even I was thinking of checking Ui-component. I would have a look on that.

              I was even wondering about the below line in struts.xml:

               

              <package name="simple-actions" extends="community-custom" namespace="">


              I think even community-custom is not available in latest version as I read here : Override struts login action in Jive 6


              It seems it should be like below:

              <package name="simple-actions" namespace="/" extends="community-actions-include"> 


              Actually I tried above too. but it did not work.

              I would check about the ui-component and come back.


              Thanks for the help!


              Regards,

              Puja

                • Re: issues while developing action plugin on Jive 8
                  bergerle Novice

                  this is what I'm using in a jive 8 plugin (which should also be in the file by default):

                  <package name="my-plugin-actions" extends="community-default">
                  
                    • Re: issues while developing action plugin on Jive 8
                      puja_kumari Intermediate

                      Ok. So I think, this should work for building actions as well.

                      In any case if you get the component id for creating a component on jive home page, basically a tab with actin link.

                      Do let me know. I am also looking from my end.

                       

                      Thanks and regards,

                      Puja

                        • Re: issues while developing action plugin on Jive 8
                          bergerle Novice

                          not all links and bars in jive are defined as components. Try writing a class that extends "NavMenuLink" und add it to spring like this:

                           

                          <bean id="simpleActionLink" class="classpath.to.my.link.SimpleActionLink">
                               <property name="ID" value="jive-nav-link-simple"/>
                               <property name="nameKey" value="nav.bar.simpleAction.link"/> <!-- this is a i18n key -->
                               <property name="linkCss" value="j-globalNavLink j-ui-elem"/>
                          </bean>
                          
                          
                          
                          <bean id="extendedNavBarLinks" class="com.jivesoftware.community.util.spring.MergeableCollection" scope="prototype" parent="navBarLinks">
                              <property name="source">
                                  <util:list value-type="com.jivesoftware.community.web.component.ActionLink" scope="prototype">
                                      <ref bean="simpleActionLink"/>
                                  </util:list>
                              </property>
                          </bean>
                          

                           

                          Of course you could also override methods in you class instead of passing properties in spring, but this is just the nicest and easiest way.