dev@glassfish.java.net

How to use _at_Param String targetName?

From: Ken <ken.cavanaugh_at_oracle.com>
Date: Mon, 18 Oct 2010 12:47:08 -0700

I've been working on modifying the iiop-listener commands to support
--target.
For example, I have modified list-iiop-listeners as follows:

@Service(name="list-iiop-listeners")
@Scoped(PerLookup.class)
@I18n("list.iiop.listeners")
@ExecuteOn(value={RuntimeType.DAS,RuntimeType.INSTANCE})
@TargetType(value={CommandTarget.CLUSTER,CommandTarget.CONFIG,
    CommandTarget.DAS,CommandTarget.STANDALONE_INSTANCE }
)
public class ListIiopListeners implements AdminCommand {

    final private static LocalStringManagerImpl localStrings =
            new LocalStringManagerImpl(ListIiopListeners.class);

    @Param(name="target")
    String targetName ;

    @Inject
    Habitat habitat ;


    /**
     * Executes the command
     *
     * @param context information
     */
    @Override
    public void execute(AdminCommandContext context) {
        final ActionReport report = context.getActionReport();
        final Target targetUtil = habitat.getComponent(Target.class ) ;
        final Config config = targetUtil.getConfig(targetName) ;
        final IiopService iiopService = config.getIiopService();

     ...
}

But when I try to build, the built-in tests fail as follows:

Running org.glassfish.orb.admin.cli.ListIiopListenersTest
Oct 18, 2010 12:30:31 PM org.jvnet.hk2.component.InjectionManager inject
INFO: Cannot inject java.lang.String org.glassfish.orb.admin.cli.ListIiopListeners.targetName into component org.glassfish.orb.admin.cli.ListIiopListeners_at_e8efc5
Oct 18, 2010 12:30:31 PM com.sun.logging.LogDomains$1 log
SEVERE: Cannot find targetName in list-iiop-listeners command model, file a bug


So what am I missing? @Param String targetName (as documented on the
wiki) fails in the same way.

Thanks,

Ken.