DynamicReloader(Applications applications, ServiceLocator habitat) throws URISyntaxException { this.applications = applications; this.habitat = habitat; initAppReloadInfo(applications); inProgress = new SyncBoolean(false); final InternalSystemAdministrator kernelIdentity = habitat.getService(InternalSystemAdministrator.class); kernelSubject = kernelIdentity.getSubject(); }
private void shutdown() { CommandRunner runner = commandRunnerProvider.get(); if (runner!=null) { final ParameterMap params = new ParameterMap(); // By default we don't want to shutdown forcefully, as that will cause the VM to exit and that's not // a very good behavior for a code known to be embedded in other processes. final boolean noForcedShutdown = Boolean.parseBoolean(context.getArguments().getProperty( com.sun.enterprise.glassfish.bootstrap.Constants.NO_FORCED_SHUTDOWN, "true")); if (noForcedShutdown) { params.set("force", "false"); } final InternalSystemAdministrator kernelIdentity = locator.getService(InternalSystemAdministrator.class); if (env.isDas()) { runner.getCommandInvocation("stop-domain", new DoNothingActionReporter(), kernelIdentity.getSubject()).parameters(params).execute(); } else { runner.getCommandInvocation("_stop-instance", new DoNothingActionReporter(), kernelIdentity.getSubject()).parameters(params).execute(); } } }
Thread.sleep(3000); if (runner!=null) { runner.getCommandInvocation("stop-domain", new DoNothingActionReporter(), kernelIdentity.getSubject()).execute();
ParameterMap commandParams = executer.getParameters(command, newParams); org.glassfish.api.admin.CommandRunner.CommandInvocation inv = executer.getCommandRunner().getCommandInvocation(command, actionReport, kernelIdentity.getSubject()); inv.parameters(commandParams);
commandRunner.getCommandInvocation("deploy", report, kernelIdentity.getSubject()).parameters(deployParams).execute();
p.set((String)entry.getKey(), (String)entry.getValue()); ActionReport report = commandRunner.getActionReport("hk2-agent"); CommandRunner.CommandInvocation inv = commandRunner.getCommandInvocation(commandName, report, internalSystemAdministrator.getSubject()); inv.parameters(p).execute(command); AutodeploymentStatus ds = AutodeploymentStatus.forExitCode(report.getActionExitCode());
public CommandExecution execute(String commandName, CommandParameters params) { ParameterMap props = params.getOptions(); if (params.getOperands().size() > 0) { for (String op : params.getOperands()) props.add("DEFAULT", op); } final ActionReport report = new PlainTextActionReporter(); CommandExecution ce = new CommandExecution() { public ActionReport getActionReport() { return report; } public ActionReport.ExitCode getExitCode() { return report.getActionExitCode(); } public String getMessage() { return report.getMessage(); } }; runner.getCommandInvocation(commandName, report, kernelIdentity.getSubject()).parameters(props).execute(); return ce; }