9 Replies Latest reply on Jan 27, 2014 9:42 AM by whoiskevin

    Customizing SkinUtils via Plugin

    jochen

      Hi guys,

       

      We are trying to find a way to customize a static method of com.jivesoftware.community.util.SkinUtils to introduce a new icon. Some logic is involved, it's not just a global replacement of an existing icon, so CSS is not the way to go.  Following are the options we have considered so far:

       

      1. Overlay. Obviously this will work, but it will require a custom WAR file. We  are trying to stay away from this approach since deploying a custom WAR file for a single file change doesn't seem like a good practice.
      2. Customize what needs to be changed directly in the theme. This means that every template that calls our com.jivesoftware.community.util.SkinUtils method needs to be customized. Across JSPs, FTLs, SOYs and potentially JS and CSS files, that'd be a lot of changes. Hence, this approach seems even less favorable than #1 above.
      3. Update icons after rendering via JS. Unfortunately, this would require additional WS requests for each icon to determine whether it needs to be updated or not. The overhead of this approach makes it unattractive.

       

      We are wondering if there are additional options that we missed (a different kind of packaging, AspectJ, ...). Any suggestions would be appreciated.

       

      Thanks,

      Jochen

        • Re: Customizing SkinUtils via Plugin
          whoiskevin

          Hey Jochen,

           

          Is the icon you need to introduce a replacement for an existing type?  If so I think you can override and replace the IconGenerator and add it to the SkinUtils class. (6.x).

          1 person found this helpful
          • Re: Customizing SkinUtils via Plugin
            jochen

            For anyone interested, I followed Using AspectJ with Spring applications in an attempt to make things work via AspectJ load time weaving. Following is a quick outline:

             

            1. Create @Aspect class in plugin
            2. Add aop.xml to plugin
            3. Add <context:load-time-weaver/> in spring.xml
            4. Add -javaagent:/path/to/spring-instrument-3.0.3.RELEASE.jar to startup command

             

            Unfortunately, the result is not very encouraging:

             

            [INFO] [talledLocalContainer] 2014-01-13 11:40:20,590 [localhost-startStop-1] [:] ERROR org.springframework.web.context.ContextLoader - Context initialization failed
            [INFO] [talledLocalContainer] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.weaving.AspectJWeavingEnabler#0':
            Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loadTimeWeaver':
            Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver]:
            Constructor threw exception; nested exception is java.lang.IllegalStateException: ClassLoader [com.jivesoftware.community.util.ChainingClassLoader] does NOT provide an 'addTransformer(ClassFileTransformer)' method.
            

             

            I'm no AspectJ expert, but what I'm making of this is that in order to make this work, I'd need to find a way to replace Jive's custom classloader with a LTW-compatible classloader which would likely cause all sorts of problems. I'm putting this approach on ice, but would appreciate any additional input from folks who are more familiar with AspectJ LTW.

             

            - Jochen

              • Re: Customizing SkinUtils via Plugin
                sdureja

                Hi kevin/Jochen

                I have posted a case for Jive support Customizing SkinUtils via Plugin in Jive7

                This case has been posted in this secret group only and so hopefully you should have necessary access. Please feel free to follow and respond to same.

                 

                Based on my conversation with Kevin, following is plan of action for this issue

                a) Sudhir to create a Jive support case (Done)

                b) Kevin to follow up with Jive product management and include Sudhir

                c) Based on discussion with Jive product management we need to make a decision around next steps for this customization.

                These decision need to happen by Monday next week so that this customization can deloyed to stage. We are holding off this stage deployment due to  lack of clarity around future of this customization

              • Re: Customizing SkinUtils via Plugin
                kevin.lazorik

                An idea has been opened in the Jive Product Space: https://community.jivesoftware.com/ideas/4322