Coming Up for Air

Making Your GlassFish v3 Prelude Administration Console Plugin Pluggable

Thursday, November 06, 2008 |

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:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
<sun:propertySheet>
    <sun:propertySheetSection id="propSheetSection">
         <!afterCreate
            getClientId(component="$this{component}" clientId=>$attribute{sheetId});
        />
    </sun:propertySheetSection>
    <event>
        <!afterCreate
            getUIComponent(clientId="#{sheetId}"  component=>$attribute{component})
            includeIntegrations(type: "org.glassfish.admingui:resources"
              root="#{component}");
        />
    </event>
</sun:propertySheet>

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:

1
2
3
4
5
6
7
<sun:form id="propertyForm">
    <!afterCreate
        getClientId(component="$this{component}" clientId=>$attribute{formId})
        getUIComponent(clientId="#{formId}"  component=>$attribute{component})
        includeFirstIntegrationPoint(type: "org.glassfish.admingui:masthead" root="#{component}");
    />
</sun:form>

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.

Search

    Quotes

    Sample quote

    Quote source

    About

    My name is Jason Lee. I am a software developer living in the middle of Oklahoma. I’ve been a professional developer since 1997, using a variety of languages, including Java, Javascript, PHP, Python, Delphi, and even a bit of C#. I currently work for Red Hat on the WildFly/EAP team, where, among other things, I maintain integrations for some MicroProfile specs, OpenTelemetry, Micrometer, Jakarta Faces, and Bean Validation. (Full resume here. LinkedIn profile)

    I am the president of the Oklahoma City JUG, and an occasional speaker at the JUG and a variety of technical conferences.

    On the personal side, I’m active in my church, and enjoy bass guitar, running, fishing, and a variety of martial arts. I’m also married to a beautiful woman, and have two boys, who, thankfully, look like their mother.

    My Links

    Publications