Search |
|||
Sreenivas Munnangi's blogExtending GlassFish v3 Prelude, As Easy As 1-2-3Posted by msreddy on November 7, 2008 at 11:57 AM PST
Now it is possible, with more ease than ever to write your own add-on and extend the functionality of
GlassFish v3 Prelude application server.
From scratch, GlassFish v3 is designed to be modular, this combined with HK2 component services and OSGi module system made extensibility more natural for Prelude version. For example, to extend the GlassFish server functionality by providing an add-on, one would need support for configuration, runtime, monitoring and administration. It is much better if it allows smoother integration like GlassFish modules themselves. Precisely, this is what the pluggable infrastructure provides. In this series, I plan to explain various pluggability features provided by v3 with examples of working code where appropriate. Some of the pluggability features available presently are:
In this blog, I'll discuss about Admin CLI pluggability. The asadmin utility is a command-line tool for configuring and administering the application server. By using CLI pluggability, the add-on could implement its own CLI commands similar to application server. Declaration of CLI Command
The CLI command will be implemented as a service using the annotation @Service and by implementing the AdminCommand interface. This enables run time discovery of the command. The command name is mycommand which is declared as part of @Service annotation. The scope is defined by the annotation @Scoped, PerLookup means whenever the command is looked up a new instance of the command is created and Singelton retains the same command for the entire session.
Parameters
The CLI command usually includes options and operands which are passed as parameters. For example,
Execute method
Implement the execute method based on inParam. The ActionReport which is obtained from AdminCommandContext is used to return the command status or error message to the client.
Complete Example To work with the example, following are the steps:
Example log
Refer to Add-On Component Development Guide for details.»
Related Topics >>
Glassfish Comments
Comments are listed in date ascending order (oldest first)
|
CategoriesRecent Entries |
||
|
|