Package org.glassfish.api.admin

Examples of org.glassfish.api.admin.ParameterMap


    }

    public static Map<String, String> getCurrentValues(String basePath, ServiceLocator habitat) {
        Map<String, String> values = new HashMap<String, String>();
        final String path = (basePath.endsWith(".")) ? basePath.substring(0, basePath.length()-1) : basePath;
        RestActionReporter gr = ResourceUtil.runCommand("get", new ParameterMap() {{
            add ("DEFAULT", path);
        }}, habitat, "");

        MessagePart top = gr.getTopMessagePart();
        for (MessagePart child : top.getChildren()) {
View Full Code Here


   /**
     * Convenience wrapper around ParameterMap constructor to make it easier to use its fluent API
     * @return ParameterMap
     */
    public static ParameterMap parameterMap() {
        return new ParameterMap();
    }
View Full Code Here

        final Collection<String> excludedParams = new ArrayList<String>();
        excludedParams.add(DeploymentProperties.PATH);
        excludedParams.add(DeploymentProperties.DEPLOYMENT_PLAN);
        excludedParams.add(DeploymentProperties.UPLOAD); // We'll force it to true ourselves.

        final ParameterMap paramMap;
        final ParameterMapExtractor extractor = new ParameterMapExtractor(params);
        paramMap = extractor.extract(excludedParams);

        prepareGeneratedContent(dc, paramMap);

        // set the path and plan params

        // get the location properties from the application so the token
        // will be resolved
        Application application = applications.getApplication(params.name);
        Properties appProperties = application.getDeployProperties();
        String archiveLocation = appProperties.getProperty(Application.APP_LOCATION_PROP_NAME);
        final File archiveFile = new File(new URI(archiveLocation));
        paramMap.set("DEFAULT", archiveFile.getAbsolutePath());

        String planLocation = appProperties.getProperty(Application.DEPLOYMENT_PLAN_LOCATION_PROP_NAME);
        if (planLocation != null) {
            final File actualPlan = new File(new URI(planLocation));
            paramMap.set(DeployCommandParameters.ParameterNames.DEPLOYMENT_PLAN, actualPlan.getAbsolutePath());
        }

        // always upload the archives to the instance side
        // but not directories.  Note that we prepare a zip file containing
        // the generated directories and pass that as a single parameter so it
        // will be uploaded even though a deployment directory is not.
        paramMap.set(DeploymentProperties.UPLOAD, "true");

        // pass the params we restored from the previous deployment in case of
        // redeployment
        if (params.previousContextRoot != null) {
            paramMap.set(DeploymentProperties.PRESERVED_CONTEXT_ROOT, params.previousContextRoot);
        }

        // pass the app props so we have the information to persist in the
        // domain.xml
        Properties appProps = dc.getAppProps();
        appProps.remove(DeploymentProperties.APP_CONFIG);
        paramMap.set(DeploymentProperties.APP_PROPS, extractor.propertiesValue(appProps, ':'));

        Properties previousVirtualServers = dc.getTransientAppMetaData(DeploymentProperties.PREVIOUS_VIRTUAL_SERVERS, Properties.class);
        if (previousVirtualServers != null) {
            paramMap.set(DeploymentProperties.PREVIOUS_VIRTUAL_SERVERS, extractor.propertiesValue(previousVirtualServers, ':'));
        }

        Properties previousEnabledAttributes = dc.getTransientAppMetaData(DeploymentProperties.PREVIOUS_ENABLED_ATTRIBUTES, Properties.class);
        if (previousEnabledAttributes != null) {
            paramMap.set(DeploymentProperties.PREVIOUS_ENABLED_ATTRIBUTES, extractor.propertiesValue(previousEnabledAttributes, ':'));
        }

        return paramMap;
    }
View Full Code Here

                 * Parse all the admin options, stopping at the first
                 * non-option, which is the command name.
                 */
                Parser rcp = new Parser(argv, 0,
                        ProgramOptions.getValidOptions(), false);
                ParameterMap params = rcp.getOptions();
                po = new ProgramOptions(params, env);
                readAndMergeOptionsFromAuxInput(po);
                List<String> operands = rcp.getOperands();
                argv = operands.toArray(new String[operands.size()]);
            } else {
View Full Code Here

            throws CommandException {
        final String auxInput = progOpts.getAuxInput();
        if (auxInput == null || auxInput.length() == 0) {
            return;
        }
        final ParameterMap newParamMap = new ParameterMap();
        /*
         * We will place the options passed via the aux. input on the command
         * line and we do not want to repeat the read from stdin again, so
         * remove the aux input setting.
         */
        progOpts.setAuxInput(null);
        try {
            final AsadminInput.InputReader reader = AsadminInput.reader(auxInput);
            final Properties newOptions = reader.settings().get("option");
            for (String propName : newOptions.stringPropertyNames()) {
                newParamMap.add(propName, newOptions.getProperty(propName));
            }
            progOpts.updateOptions(newParamMap);
        } catch (Exception ex) {
            throw new RuntimeException(ex);
        }
View Full Code Here

        try {
            boolean result;
            CommandRunner.CommandInvocation inv = runner.getCommandInvocation(
                    "_recover-transactions-internal", report);

            final ParameterMap parameters = new ParameterMap();
            parameters.add("target", destinationServer);
            parameters.add("DEFAULT", serverToRecover);
            parameters.add("transactionlogdir", transactionLogDir);

            if (_logger.isLoggable(Level.INFO)) {
                _logger.info("==> calling _recover-transactions-internal with params: " + parameters);
            }
View Full Code Here

     * @throws IllegalArgumentException
     * @throws IllegalAccessException
     */
    public ParameterMap extract(final Collection<String> parameterNamesToExclude)
            throws IllegalArgumentException, IllegalAccessException {
        final ParameterMap paramMap = new ParameterMap();

        for (Object target : injectionTargets) {
            if (target != null) {
                extract(target, parameterNamesToExclude, paramMap);
            }
View Full Code Here

            threadPoolSize = 1;

        ExecutorService threadPool = Executors.newFixedThreadPool(threadPoolSize);

        if (map == null) {
            map = new ParameterMap();
        }

        msg = String.format(
            "Executing %s on %d instances using a thread pool of size %d: %s",
            command, nInstances, threadPoolSize,
            serverListToString(targetServers));
        logger.info(msg);

         msg = Strings.get("cluster.command.executing",
                 command, Integer.toString(nInstances));
        progress.setTotalStepCount(nInstances);
        progress.progress(msg);

        // Loop through instance names, construct the command for each
        // instance name, and hand it off to the threadpool.
        for (Server server : targetServers) {
            String iname = server.getName();
            waitingForServerNames.add(iname);

            ParameterMap instanceParameterMap = new ParameterMap(map);
            // Set the instance name as the operand for the commnd
            instanceParameterMap.set("DEFAULT", iname);

            ActionReport instanceReport = runner.getActionReport("plain");
            instanceReport.setActionExitCode(ExitCode.SUCCESS);
            CommandInvocation invocation = runner.getCommandInvocation(
                        command, instanceReport);
View Full Code Here

            logger.info(Strings.get("stop.instance.init", instanceName));
            RemoteRestAdminCommand rac = new ServerRemoteRestAdminCommand(habitat, "_stop-instance",
                    host, port, false, "admin", null, logger);

            // notice how we do NOT send in the instance's name as an operand!!
            ParameterMap map = new ParameterMap();
            map.add("force", Boolean.toString(force));
            rac.executeCommand(map);
        }
        catch (CommandException ex) {
            return Strings.get("stop.instance.racError", instanceName,
                    ex.getLocalizedMessage());
View Full Code Here

    protected String getCommandName() {
        return "list-jobs";
    }

    protected ParameterMap getParameters() {
        return new ParameterMap();
    }
View Full Code Here

TOP

Related Classes of org.glassfish.api.admin.ParameterMap

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.