admin@glassfish.java.net

Re: [v3] how to link _at_handler to jsf

From: Ken Paulsen <Ken.Paulsen_at_Sun.COM>
Date: Mon, 07 Apr 2008 13:10:36 -0700

Hi Claudio!

Just saw your email, sorry I missed it until now.

You are doing the right thing... and this should work. :) However,
you've caught up to where we are in our plugin support. The problem is
that we have some classloader issues with finding / invoking Java code
in plugin modules. I got as far as correctly registering and
instantiating the handler classes, however, the handler is unable to
resolve dependencies correctly inside our web application (i.e.
HandlerContext). So I have not yet committed my changes. We're going
to make more of the admin gui into HK2 modules so they can be resolved
by other modules (i.e. plugin modules). I am waiting on support for
Jerome for this, which I think will come very soon... I will keep you
posted.

In the meantime so that you can continue your development / testing, you
can move your files into the admingui/core/src/main/java/... area. The
@Handler files in this directory will work.

I hope this helps!

Ken

P.S. Anything relating to Handlers / .jsf files / etc, feel free to
copy the dev_at_jsftemplating email alias... it gets my attention faster. ;)

Claudio Miranda wrote:
> I see a META-INF/jsftemplating/Handler.map right inside
> console-myplugin-1.0-SNAPSHOT.jar that is copied at GF_HOME/modules
> directory
>
> Their content is:
> $ unzip -c ../modules/console-myplugin-1.0-SNAPSHOT.jar
> META-INF/jsftemplating/Handler.map
> Archive: ../modules/console-myplugin-1.0-SNAPSHOT.jar
> inflating: META-INF/jsftemplating/Handler.map
>
> getServerCertificates.class=org.example.glassfish.admingui.CertificateImpl
> getServerCertificates.method=getServerCertificates
> getServerCertificates.output[0].name=result
> getServerCertificates.output[0].type=java.util.List
>
> Thanks
>
> Claudio Miranda
>
> On Sun, Apr 6, 2008 at 6:55 PM, Claudio Miranda <claudio_at_claudius.com.br> wrote:
>
>> I am trying to show a admin console plugin (based on
>> j1plugin/gfplugin/myplugin), btw thanks for this.
>>
>> I was able to construct the desired window, at JSF level and
>> display at admin console.
>> Now I want to make the JSF code to display a table.
>> But when rendering at admin console I get an exception
>>
>> PWC1406: Servlet.service() for servlet FacesServlet threw exception
>> com.sun.jsftemplating.layout.SyntaxException: Handler
>> 'getServerCertificates' in event 'beforeCreate' is not declared!
>> Ensure the '_at_Handler' annotation has been defined on the handler Java
>> method, that it has been compiled with the annotation processing tool,
>> and that the resulting 'META-INF/jsftemplating/Handler.map' is located
>> in your classpath (you may need to do a clean build).
>>
>> See the relevant source code
>>
>> jsf page
>> <sun:page id="page1">
>> <!beforeCreate
>> setResourceBundle(key="i18n" bundle="core.Strings")
>> setPageSessionAttribute(key="configName",
>> value="$requestParameter{configName}");
>> getServerCertificates(result=>$attribute{listOfRows} );
>> />
>>
>> <sun:table id="deployTable" title="$resource{cert.server.table_title}"
>> sortPanelToggleButton="#{false}"
>> deselectMultipleButton="$boolean{true}"
>> deselectMultipleButtonOnClick="setTimeout('changeThreeTableButtons()',
>> 0)"
>> selectMultipleButton="$boolean{true}"
>> selectMultipleButtonOnClick="setTimeout('changeThreeTableButtons()',
>> 0)" >
>> <!afterCreate
>> getClientId(component="$this{component}" clientId=>$page{tableId});
>> />
>>
>> <sun:tableRowGroup id="rowGroup1" selected="#{td.value.selected}"
>> data={"$attribute{listOfRows}"} sourceVar="td">
>> <!afterCreate
>> getClientId(component="$this{component}"
>> clientId=>$page{tableRowGroupId});
>> />
>>
>>
>> public class CertificateImpl {
>>
>> @Handler(id = "getServerCertificates",
>> output = {
>> @HandlerOutput(name = "result", type = java.util.List.class)
>> })
>> public static void getServerCertificates(HandlerContext handlerCtx) {
>> List result = new ArrayList(4);
>> // some code
>> handlerCtx.setOutputValue("result", result);
>> }
>> }
>>
>> BTW, I am not able to correctly understand this construct. I see they are:
>>
>> getDeployedWebInfo: method name, as void static (does it need to be
>> static void ?)
>> serverName: HandlerInput (inform parameters to the method)
>> result: the method return
>>
>> but, what about $attribute(listOfRows) and this => attribution syntax ?
>>
>> getDeployedWebInfo(serverName='#{request.serverName}',
>> result=>$attribute{listOfRows} );
>>
>
>
>
>