JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle GlassFish Server 3.1 Add-On Component Development Guide
search filter icon
search icon

Document Information

Preface

1.   Introduction to the Development Environment for GlassFish Server Add-On Components

2.  Writing HK2 Components

3.  Extending the Administration Console

4.  Extending the asadmin Utility

About the Administrative Command Infrastructure of GlassFish Server

Adding an asadmin Subcommand

Representing an asadmin Subcommand as a Java Class

Specifying the Name of an asadmin Subcommand

Ensuring That an AdminCommand Implementation Is Stateless

Example of Adding an asadmin Subcommand

Adding Parameters to an asadmin Subcommand

Representing a Parameter of an asadmin Subcommand

Identifying a Parameter of an asadmin Subcommand

Specifying Whether a Parameter Is an Option or an Operand

Specifying the Name of an Option

Specifying the Long Form of an Option Name

Specifying the Short Form of an Option Name

Specifying the Acceptable Values of a Parameter

Specifying the Default Value of a Parameter

Specifying Whether a Parameter Is Required or Optional

Example of Adding Parameters to an asadmin Subcommand

Making asadmin Subcommands Cluster-Aware

Specifying Allowed Targets

The Target Utility

Specifying asadmin Subcommand Execution

Subcommand Preprocessing and Postprocessing

Running a Command from Another Command

Adding Message Text Strings to an asadmin Subcommand

Enabling an asadmin Subcommand to Run

Setting the Context of an asadmin Subcommand

Changing the Brand in the GlassFish Server CLI

Examples of Extending the asadmin Utility

Implementing Create, Delete, and List Commands Using Annotations

Command Patterns

Resolvers

The @Create Annotation

The @Delete Annotation

The @Listing Annotation

Create Command Decorators

Delete Command Decorators

Specifying Command Execution

Using Multiple Command Annotations

5.  Adding Monitoring Capabilities

6.  Adding Configuration Data for a Component

7.  Adding Container Capabilities

8.  Creating a Session Persistence Module

9.  Packaging, Integrating, and Delivering an Add-On Component

A.  Integration Point Reference

Index

Enabling an asadmin Subcommand to Run

To enable an asadmin subcommand to run, implement the execute method in your implementation of the AdminCommand interface. The declaration of the execute method in your implementation must be as follows.

    public void execute(AdminCommandContext context);

Pass each parameter of the subcommand as a property to your implementation of the execute method. Set the key of the property to the parameter name and set the value of the property to the parameter's value.

In the body of the execute method, provide the code for performing the operation that the command was designed to perform. For examples, see Example 4-6 and Example 4-7.