Making Your GlassFish v3 Prelude Administration Console Plugin Pluggable
In my last article, I talked about writing plugins for the GlassFish v3 Prelude Administration Console, which showed the various integration types supported out-of-the box by the console, but what if a plugin developer would like to allow <i>other</i> plugins to extend it just like the console itself does. In this short article, we’ll show how to do exactly that.
As we saw in the last article, the GlassFish v3 Prelude Administration Console offers a wide range of integration types, but it is also possible to create your own types, should you wish to allow other plugins to interact/integrate with your own plugin, and doing so is very simple. All that is required is the selection of an integration type identifier, which must be unique across the system. By convention, your integration types should be a Java package-like name followed by a colon and a specific integration point name (as we saw in the integration type table above in the other article). For example, let’s say you’re writing a plugin for you company’s fantastic GlassFish extension, Winnie. In your plugin, your ConsoleProvider class in in com.foo.winnie.admin, and you’d like to be able allow other plugins to add tabs to main Winnie config page. Your integration type, then, would be com.foo.winnie.admin:tab. When the Winne plugin authors define the intregation point, they would specify that as the type, and your tab’s id as the parentId.
Now we have a new integration type defined, but how does one consume the integration points that are of this new type? To include any integration points defined for a given type, the GlassFish v3 Prelude Administration Console provides a few JSFTemplating Handlers (for more information on what a handler is, please see the previous article and/or the JSFTemplating documentation). To include all integration points for a given type, your markup might look like this:
In some cases, you may want only one integration point, with the deciding factor being the priority (see below). The GlassFish v3 Prelude Administration Console does for its :masthead integration type used in the theming support. Such a use might look like this:
That’s all there is to it. With this code in place in <i>your</i> plugin and the integration type published where others can find it, your plugin can be easily extended by anyone. The possibilities in extending GlassFish v3 Prelude Administration Console — as well as its extensions — are limited only by our imagination.