Search in sources :

Example 1 with CommandModelData

use of com.sun.enterprise.admin.util.CommandModelData in project Payara by payara.

the class RemoteCLICommand method prepare.

@Override
protected void prepare() throws CommandException, CommandValidationException {
    try {
        processProgramOptions();
        initializeAuth();
        /*
             * Now we have all the information we need to create
             * the remote admin command object.
             */
        initializeRemoteAdminCommand();
        if (responseFormatType != null) {
            rac.setResponseFormatType(responseFormatType);
        }
        if (userOut != null) {
            rac.setUserOut(userOut);
        }
        /*
             * Initialize a CookieManager so that we can retreive
             * any cookies included in the reply.   These cookies
             * (e.g. JSESSIONID, JROUTE) are used for CLI session
             * based routing.
             */
        initializeCookieManager();
        /*
             * If this is a help request, we don't need the command
             * metadata and we throw away all the other options and
             * fake everything else.
             */
        if (programOpts.isHelp()) {
            CommandModelData cm = new CommandModelData(name);
            cm.add(new ParamModelData("help", boolean.class, true, "false", "?"));
            this.commandModel = cm;
            rac.setCommandModel(cm);
            return;
        }
        /*
             * Find the metadata for the command.
             */
        commandModel = rac.getCommandModel();
    } catch (CommandException cex) {
        if (logger.isLoggable(Level.FINER))
            logger.finer("RemoteCommand.prepare throws " + cex);
        throw cex;
    } catch (Exception e) {
        if (logger.isLoggable(Level.FINER))
            logger.finer("RemoteCommand.prepare throws " + e);
        throw new CommandException(e.getMessage());
    }
}
Also used : CommandModelData(com.sun.enterprise.admin.util.CommandModelData) ParamModelData(com.sun.enterprise.admin.util.CommandModelData.ParamModelData) CommandException(org.glassfish.api.admin.CommandException) StoreException(com.sun.appserv.management.client.prefs.StoreException) CommandException(org.glassfish.api.admin.CommandException) CommandValidationException(org.glassfish.api.admin.CommandValidationException)

Aggregations

StoreException (com.sun.appserv.management.client.prefs.StoreException)1 CommandModelData (com.sun.enterprise.admin.util.CommandModelData)1 ParamModelData (com.sun.enterprise.admin.util.CommandModelData.ParamModelData)1 CommandException (org.glassfish.api.admin.CommandException)1 CommandValidationException (org.glassfish.api.admin.CommandValidationException)1