Sun GlassFish Enterprise Server v3 Prelude Add-On Component Development Guide

Example of Adding an asadmin Command


Example 4–1 Adding an asadmin Command

This example shows the declaration of the class CreateMycontainer that represents an asadmin command that is named create-mycontainer. The command is instantiated for each lookup.

package com.example.mycontainer;

import org.glassfish.api.admin.AdminCommand;
...
import org.jvnet.hk2.annotations.Service;
...
import org.jvnet.hk2.annotations.Scoped;
import org.jvnet.hk2.component.PerLookup;

/**
 * Sample command
 */
@Service(name="create-mycontainer")
@Scoped(PerLookup.class)
public Class CreateMycontainer implements AdminCommand {
…
}