Package org.glassfish.api.admin

Examples of org.glassfish.api.admin.CommandModel$ParamModel


            return convert(e);
        }
    }

    ParameterMap getParameters(String command, String[] args) throws CommandException {
        CommandModel commandModel = commandRunner.getModel(command, logger);
        if (commandModel == null) {
            throw new CommandException("Command lookup failed for command " + command);
        }

        // Filter out the global options.
        // We are interested only in --passwordfile option. No other options are relevant when GlassFish is running in embedded mode.
        Parser parser = new Parser(args, 0, ProgramOptions.getValidOptions(), true);
        ParameterMap globalOptions = parser.getOptions();
        List<String> operands = parser.getOperands();
        String argv[] = operands.toArray(new String[operands.size()]);

        parser = new Parser(argv, 0, commandModel.getParameters(), false);
        ParameterMap options = parser.getOptions();
        operands = parser.getOperands();
        options.set("DEFAULT", operands);
        // if command has a "terse" option, set it in options
        if (commandModel.getModelFor("terse") != null)
            options.set("terse", Boolean.toString(terse));

        // Read the passwords from the password file and set it in command options.
        if (globalOptions.size() > 0) {
            String pwfile = globalOptions.getOne(ProgramOptions.PASSWORDFILE);
            if (pwfile != null && pwfile.length() > 0) {
                Map<String, String> passwords = CLIUtil.readPasswordFileOptions(pwfile, true);
                for (CommandModel.ParamModel opt : commandModel.getParameters()) {
                    if (opt.getParam().password()) {
                        String pwdname = opt.getName();
                        String pwd = passwords.get(pwdname);
                        if (pwd != null) {
                            options.set(pwdname, pwd);
View Full Code Here


            return convert(e);
        }
    }

    ParameterMap getParameters(String command, String[] args) throws CommandException {
        CommandModel commandModel = commandRunner.getModel(command, logger);
        if (commandModel == null) {
            throw new CommandException("Command lookup failed for command " + command);
        }

        // Filter out the global options.
        // We are interested only in --passwordfile option. No other options are relevant when GlassFish is running in embedded mode.
        Parser parser = new Parser(args, 0, ProgramOptions.getValidOptions(), true);
        ParameterMap globalOptions = parser.getOptions();
        List<String> operands = parser.getOperands();
        String argv[] = operands.toArray(new String[operands.size()]);

        parser = new Parser(argv, 0, commandModel.getParameters(), false);
        ParameterMap options = parser.getOptions();
        operands = parser.getOperands();
        options.set("DEFAULT", operands);
        // if command has a "terse" option, set it in options
        if (commandModel.getModelFor("terse") != null)
            options.set("terse", Boolean.toString(terse));

        // Read the passwords from the password file and set it in command options.
        if (globalOptions.size() > 0) {
            String pwfile = globalOptions.getOne(ProgramOptions.PASSWORDFILE);
            if (pwfile != null && pwfile.length() > 0) {
                Map<String, String> passwords = CLIUtil.readPasswordFileOptions(pwfile, true);
                for (CommandModel.ParamModel opt : commandModel.getParameters()) {
                    if (opt.getParam().password()) {
                        String pwdname = opt.getName();
                        String pwd = passwords.get(pwdname);
                        if (pwd != null) {
                            options.set(pwdname, pwd);
View Full Code Here

     * @return Collection the meta-data for the parameter of the resource
     * method.
     */
    public static Collection<CommandModel.ParamModel> getParamMetaData(
            String commandName, ServiceLocator habitat, Logger logger) {
        final CommandModel model = habitat.<CommandRunner>getService(CommandRunner.class).getModel(commandName, logger);
        if (model == null) {
            return null;
        }
       
        return model.getParameters();
    }
View Full Code Here

     * method.
     */
    public static Collection<CommandModel.ParamModel> getParamMetaData(
            String commandName, Collection<String> commandParamsToSkip,
            ServiceLocator habitat, Logger logger) {
        CommandModel cm = habitat.<CommandRunner>getService(CommandRunner.class).getModel(commandName, logger);
        Collection<String> parameterNames = cm.getParametersNames();

        ArrayList<CommandModel.ParamModel> metaData = new ArrayList<CommandModel.ParamModel>();
        CommandModel.ParamModel paramModel;
        for (String name : parameterNames) {
            paramModel = cm.getModelFor(name);
            String parameterName = (paramModel.getParam().primary()) ? "id" : paramModel.getName();

            boolean skipParameter = false;
            try {
                skipParameter = commandParamsToSkip.contains(parameterName);
View Full Code Here

     * method.
     */
    public static Collection<CommandModel.ParamModel> getParamMetaData(
            String commandName, Collection<String> commandParamsToSkip,
            ServiceLocator habitat, Logger logger) {
        CommandModel cm = habitat.<CommandRunner>getService(CommandRunner.class).getModel(commandName, logger);
        Collection<String> parameterNames = cm.getParametersNames();

        ArrayList<CommandModel.ParamModel> metaData = new ArrayList<CommandModel.ParamModel>();
        CommandModel.ParamModel paramModel;
        for (String name : parameterNames) {
            paramModel = cm.getModelFor(name);
            String parameterName = (paramModel.getParam().primary()) ? "id" : paramModel.getName();

            boolean skipParameter = false;
            try {
                skipParameter = commandParamsToSkip.contains(parameterName);
View Full Code Here

        return false;
    }

    public Collection<CommandModel.ParamModel> getParamMetaData(String commandName) {
        CommandRunner cr = serviceLocator.getService(CommandRunner.class);
        CommandModel cm = cr.getModel(commandName, RestService.logger);
        Collection<CommandModel.ParamModel> params = cm.getParameters();
        return params;
    }
View Full Code Here

    }

    protected void generateGetPostCommandMethod(ClientClassWriter writer, String resourceName) {
        String commandName = ResourcesGeneratorBase.configBeanToPOSTCommand.get("List"+resourceName);
        if (commandName != null) {
            final CommandModel cm = getCommandModel(commandName);
            if (cm != null ) {//and the command exits
                writer.generateCommandMethod(Util.methodNameFromDtdName(commandName, null), "POST", ResourceUtil.convertToXMLName(resourceName), cm);
            }
        }
    }
View Full Code Here

    //    private void generateCommandMethods(String parentBeanName, ClassWriter parentWriter) {
    protected void generateCommandMethods(ClientClassWriter writer, String className) {
        List<CommandResourceMetaData> commandMetaData = CommandResourceMetaData.getMetaData(className);
        if (commandMetaData.size() > 0) {
            for (CommandResourceMetaData metaData : commandMetaData) {
                CommandModel cm = getCommandModel(metaData.command);
                if (cm != null) {
                    String methodName = Util.methodNameFromDtdName(metaData.command, null);
                    if (!methodName.startsWith("_")) {
                        writer.generateCommandMethod(methodName, metaData.httpMethod, metaData.resourcePath, cm);
                    }
View Full Code Here

        return false;
    }

    public Collection<CommandModel.ParamModel> getParamMetaData(String commandName) {
        CommandRunner cr = serviceLocator.getService(CommandRunner.class);
        CommandModel cm = cr.getModel(commandName, RestLogging.restLogger);
        Collection<CommandModel.ParamModel> params = cm.getParameters();
        return params;
    }
View Full Code Here

     * @return Collection the meta-data for the parameter of the resource
     * method.
     */
    public static Collection<CommandModel.ParamModel> getParamMetaData(
            String commandName, ServiceLocator habitat) {
        final CommandModel model = habitat.<CommandRunner>getService(CommandRunner.class).getModel(commandName, RestLogging.restLogger);
        if (model == null) {
            return null;
        }

        return model.getParameters();
    }
View Full Code Here

TOP

Related Classes of org.glassfish.api.admin.CommandModel$ParamModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.