Package org.glassfish.api.admin

Examples of org.glassfish.api.admin.CommandRunner


    protected Response deleted(ResponseBody responseBody) {
        return Response.ok().entity(responseBody).build();
    }

    protected Response accepted(String command, ParameterMap parameters, URI childUri) {
        CommandRunner cr = Globals.getDefaultHabitat().getService(CommandRunner.class);
        final RestActionReporter ar = new RestActionReporter();
        final CommandRunner.CommandInvocation commandInvocation =
                cr.getCommandInvocation(command, ar, getSubject()).
                parameters(parameters);
        String jobId = DetachedCommandHelper.invokeAsync(commandInvocation);
        return Response
                .status(Response.Status.ACCEPTED)
                .header("Location", uriInfo.getBaseUriBuilder().path("jobs").path("id").path(jobId).build())
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

        }
        return status.toString();
    }

    public void listOfCommands() {
        CommandRunner cr = serviceLocator.getService(CommandRunner.class);
        RestActionReporter ar = new RestActionReporter();
        ParameterMap parameters = new ParameterMap();
        cr.getCommandInvocation("list-commands", ar, getSubject())
                .parameters(parameters).execute();
        List<ActionReport.MessagePart> children = ar.getTopMessagePart().getChildren();
        for (ActionReport.MessagePart part : children) {
            allCommands.add(part.getMessage());

        }
        ar = new RestActionReporter();
        parameters = new ParameterMap();
        parameters.add("DEFAULT", "_");
        cr.getCommandInvocation("list-commands", ar, getSubject()).parameters(parameters).execute();
        children = ar.getTopMessagePart().getChildren();
        for (ActionReport.MessagePart part : children) {
            allCommands.add(part.getMessage());

        }
View Full Code Here

                    for(Resource resource : resources.getResources()){
                        if(resource instanceof ResourcePool){
                            ResourcePool pool = (ResourcePool)resource;
                            if(Boolean.valueOf(pool.getPing())){
                                PoolInfo poolInfo = ResourceUtil.getPoolInfo(pool);
                                CommandRunner commandRunner = commandRunnerProvider.get();
                                ActionReport report = actionReportProvider.get();
                                CommandRunner.CommandInvocation invocation =
                                        commandRunner.getCommandInvocation("ping-connection-pool", report);
                                ParameterMap params = new ParameterMap();
                                params.add("appname",poolInfo.getApplicationName());
                                params.add("modulename",poolInfo.getModuleName());
                                params.add("DEFAULT", poolInfo.getName());
                                invocation.parameters(params).execute();
View Full Code Here

                                                     }
                                                 });
            executor.execute(new Runnable() {
                                    @Override
                                    public void run() {
                                        CommandRunner cr = habitat.getService(CommandRunner.class);
                                        final CommandRunner.CommandInvocation invocation =
                                                        cr.getCommandInvocation("uptime", new PropsFileActionReporter(), kernelIdentity.getSubject());
                                        invocation.parameters(new ParameterMap());
                                        invocation.execute();
                                    }
                                });
            executor.shutdown();
View Full Code Here

        return  paramName;
    }

    protected CommandModel getCommandModel(String commandName) {
        CommandRunner cr = getBaseServiceLocator().getService(CommandRunner.class);
        return cr.getModel(commandName, RestLogging.restLogger);
    }
View Full Code Here

    protected Response deleted(ResponseBody responseBody) {
        return Response.ok().entity(responseBody).build();
    }

    protected Response accepted(String command, ParameterMap parameters, URI childUri) {
        CommandRunner cr = Globals.getDefaultHabitat().getService(CommandRunner.class);
        final RestActionReporter ar = new RestActionReporter();
        final CommandRunner.CommandInvocation commandInvocation =
                cr.getCommandInvocation(command, ar, getSubject()).
                parameters(parameters);
        String jobId = DetachedCommandHelper.invokeAsync(commandInvocation);
        return Response
                .status(Response.Status.ACCEPTED)
                .header("Location", uriInfo.getBaseUriBuilder().path("jobs").path("id").path(jobId).build())
View Full Code Here

        }
        return status.toString();
    }

    public void listOfCommands() {
        CommandRunner cr = serviceLocator.getService(CommandRunner.class);
        RestActionReporter ar = new RestActionReporter();
        ParameterMap parameters = new ParameterMap();
        cr.getCommandInvocation("list-commands", ar, getSubject())
                .parameters(parameters).execute();
        List<ActionReport.MessagePart> children = ar.getTopMessagePart().getChildren();
        for (ActionReport.MessagePart part : children) {
            allCommands.add(part.getMessage());

        }
        ar = new RestActionReporter();
        parameters = new ParameterMap();
        parameters.add("DEFAULT", "_");
        cr.getCommandInvocation("list-commands", ar, getSubject()).parameters(parameters).execute();
        children = ar.getTopMessagePart().getChildren();
        for (ActionReport.MessagePart part : children) {
            allCommands.add(part.getMessage());

        }
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
     */
    public static RestActionReporter runCommand(String commandName,
                                                ParameterMap parameters,
                                                Subject subject) {
        CommandRunner cr = Globals.getDefaultHabitat().getService(CommandRunner.class);
        RestActionReporter ar = new RestActionReporter();
        final CommandInvocation commandInvocation =
                cr.getCommandInvocation(commandName, ar, subject);
        commandInvocation.parameters(parameters).execute();
        addCommandLog(ar, commandName, parameters);

        return ar;
    }
View Full Code Here

TOP

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

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.