Sign in

E-mail *, (xx@domain.com)
Password *

Register | Forgot password

Blogs

  • Bram de Kruijff
  • Ivo Ladage
  • Mark van Cuijk
  • Martin van Mierloo
  • Martijn van Berkum
  • Michel Teunissen
  • Patrick Atoon

Recent blogs

RSS - Blogs
March 9, 2010
State of OSGi in the Java world
March 4, 2010
Reach more people with Google Translate
March 3, 2010
Get My Advice
February 26, 2010
What? Where!?!
February 11, 2010
Split it!

All Blogs...


WebManager extensions

August 3, 2008

Everyone will know the concept of WCBs by now, which was introduced in WebManager 9. WCBs are sofware components which can be deployed onto running WebManager installations without the need for a server restart. That makes a WCB sound pretty much like an “extension” to the WebManager platform. And it is.

However, WCBs should not be mistaken with WebManager 9 “extensions”. Extensions are really something else, and it is time that we pay a little bit more attention to them. They really do deserve it...


What is an extension?

Well, basically an extension is a small software component that cannot run on its own but modifies or enhances the application it extends. Examples are the spelling checker add-ons for OpenOffice, the Lightning calendar add-on for the e-mail program Thunderbird and the FireFox theme add-ons.

From those examples, WCBs seem to be “extensions”, and they are. WCBs are extensions to the WebManager application. However, a WebManager extension extends a WCB instead. So in case a WCB is extensible (like the WebManager platform itself) one could speak of an “extensible extension”. Isn't that neat?

But back to the question. A WebManager extension basically consists of three parts:

  • The extension consumer. This is the WCB that is designed to be extensible. It is up to the WCB to define what part of the WCB the extension can be modified or enhanced.
  • The extension provider. This is the software that modifies or enhances the behavior of the WCB.
  • The extension point. This is the interface or “contract” between the provider and the consumer. As long as they use the same interface they speak the same language and are thus compatible. The WCB doesn't care about the actual implementation of the extension, as long as it implements the interface.

In fact an OSGi service does exactly that; it consists of an interface and a class that implements that interface. Susequently, everyone is free to use the service, depending only on the interface. In many cases these OSGi services are implemented one-on-one; one interface and one implementation. But there is nothing that stops you from implementing the same service interface many times. And if you do, that is what an extension is basically about.


Examples

So you might wonder if the concept of exentions is used in the WebManager platform. Well, here are some examples:

  • The Online Help WCB is implemented using extensions. You can add Online Help to that WCB by providing a service that implements OnlineHelpProvider. The OnlineHelpProvider is the extension interface (or extension point) and your WCB containing the Online Help is the extension provider; it provides one piece of the Online Help.

  • The concept of extensions facilitates the complete decoupling of the eShop and Books example. The only thing that connects the two is again an extension interface, so you could easily implement your own product database and use it together with the eShop.

  • As of WebManager 9.5 the new “Performance Dashboard” is available. This dashboard provides all kind of measurements to indicate the health of the WebManager application. But now it comes; these indicators are implemented as extensions! So what stops you from providing your own indicators and extend this panel?


System health indicators

So lets go into more detail on that last example; the performance dashboard. Adding your own indicators to this dashboard is fairly simple; just provide a service in your WCB that implements the extension point “SystemHealthIndicator” (see http://www.gxdeveloperweb.com/documentation/javadoc/nl/gx/webmanager/services/systemhealth/SystemHealthIndicator.html ). If you do not exactly know how; just copy the code you already implemented for the Online help provider component. The following implementation of a system health indicator indicates if the GX WebManager search engine is up and running or not.


public class SearchEngineRunningIndicator implements SystemHealthIndicator {
  public String getId() {return "searchengine_running";};
  public String getCategory() {return "GX WebManager Search Engine";}
  public String getType() {return SystemHealthIndicator.TYPE_CUSTOM;};
  public String getMessage(Locale locale) {return "Indicates if ...";}
  public String getName(Locale locale) {return "Search Engine status";}
  public void reset() {}
  public Object getValue() {
    if (GeorgeLibrary.georgeIsAvailable()) {
      return new String("up and running");
    }
    else return new String("down");
  }
  public ValueStatus getValueState() {
    if (GeorgeLibrary.georgeIsAvailable()) {
     return ValueStatus.GREEN;
    }
    else return ValueStatus.RED;
  }
}


The result is immediatel visible in the Performance dashboard when you deploy a WCB containing the extension. An additional tab called “Custom system performance indicators” is added, as displayed below:

Performance dashboard

As you can see, the WebManager Search Engine is apparently not running on my WebManager installation.


Detecting extensible WCBs

So how do you know that a WCB is extensible and what extension interface it provides? The WCB management console indicates if a WCB is extensible and if so, what extension points it exposes. Take a look at the Books example which is extensible:

WCB Management Console

The little '+' icon overlay in the puzzle piece icon indicates that the WCB is extensible. In the “Extension points” part the extension points are summarized.


Conclusion

In my opinion, the WebManager extension mechanism is a very powerfull concept and should be used much much more. I doubt that it is very 'known' feature though. Hopefull this blog contributes to its awareness. Spread the word!

About the Author

Return to all blogs

Ivo Ladage

Ivo Ladage is product architect and is part of one of the SCRUM-teams. Ivo has special interests in Workflow and Authorization processes and Spring MVC.

Read all Ivo's blog entries

Other blog entries:

May 7, 2009
5 Spring pittfalls - Answer issue 3
May 7, 2009
5 Spring pittfalls - Answer issue 2
January 24, 2009
9.7: Pimped archetypes!
January 13, 2009
5 Spring pittfalls - Answer issue 1
December 9, 2008
5 Spring pitfalls
October 22, 2008
New certification process
March 25, 2008
The day of the easter egg
March 19, 2008
Why Spring?
March 7, 2008
On the implementation of RBAC for Workflow and Authorization


Share:

del.icio.us
digg
Technorati
Slashdot
Reddit
YahooMyWeb
NewsVine
ekudos
© 2010 GX creative online development B.V.

Disclaimer

This website (GXdeveloperweb.com) may discuss or contain opinions, (sample) coding, software or other information that does not include GX official interfaces, instructions or guidelines and therefore is not supported by GX. Changes made based on this information are not supported.  GX will not be held liable for any damages caused by using or misusing the information, software, instructions, code or methods suggested on this website, and anyone using these methods does so at his/her own risk. GX offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this website, including any liability resulting from incompatibility between the content of this website and the materials and services offered by GX. By using this website you will not hold, or seek to hold, GX responsible or liable with respect to the content of this website.