use of com.sun.enterprise.admin.report.PlainTextActionReporter in project Payara by payara.
the class MonitoringReporter method runAggregate.
private void runAggregate() {
List<String> list = getOutputLines();
ActionReport aggregateReporter = null;
if (aggregateDataOnly) {
plainReporter = new PlainTextActionReporter();
aggregateReporter = plainReporter.addSubActionsReport();
} else
aggregateReporter = reporter.addSubActionsReport();
setClusterInfo(aggregateReporter, list);
if (aggregateDataOnly) {
reporter = plainReporter;
context.setActionReport(plainReporter);
}
}
use of com.sun.enterprise.admin.report.PlainTextActionReporter in project Payara by payara.
the class EmbeddedAdminCtrImpl method execute.
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;
}
use of com.sun.enterprise.admin.report.PlainTextActionReporter in project Payara by payara.
the class AdminCommandContextTest method testSerialization.
@Test
public void testSerialization() throws IOException, ClassNotFoundException {
ByteArrayOutputStream os = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(os);
ActionReport report = new PlainTextActionReporter();
AdminCommandContext context = new AdminCommandContextImpl(null, /* logger */
report);
report.setFailureCause(new RuntimeException("Test"));
oos.writeObject(context);
ByteArrayInputStream is = new ByteArrayInputStream(os.toByteArray());
ObjectInputStream ois = new ObjectInputStream(is);
AdminCommandContext restored = (AdminCommandContextImpl) ois.readObject();
assertEquals("failureCause", "Test", restored.getActionReport().getFailureCause().getMessage());
// context.setPayload
}
use of com.sun.enterprise.admin.report.PlainTextActionReporter in project Payara by payara.
the class EmbeddedDeployerImpl method deploy.
@Override
public String deploy(ReadableArchive archive, DeployCommandParameters params) {
// ensure server is started. start it if not started.
try {
server.start();
} catch (LifecycleException e) {
throw new RuntimeException(e);
}
ActionReport report = new PlainTextActionReporter();
if (params == null) {
params = new DeployCommandParameters();
}
ExtendedDeploymentContext initialContext = new DeploymentContextImpl(report, archive, params, env);
ArchiveHandler archiveHandler = null;
try {
archiveHandler = deployment.getArchiveHandler(archive);
} catch (IOException e) {
throw new RuntimeException(e);
}
if (archiveHandler == null) {
throw new RuntimeException("Cannot find archive handler for source archive");
}
if (params.name == null) {
params.name = archiveHandler.getDefaultApplicationName(archive, initialContext);
}
ExtendedDeploymentContext context = null;
try {
context = deployment.getBuilder(logger, params, report).source(archive).archiveHandler(archiveHandler).build(initialContext);
} catch (IOException e) {
throw new RuntimeException(e);
}
if (params.property != null) {
context.getAppProps().putAll(params.property);
}
if (params.properties != null) {
context.getAppProps().putAll(params.properties);
}
ApplicationInfo appInfo = null;
try {
appInfo = deployment.deploy(context);
} catch (Exception e) {
logger.log(Level.SEVERE, KernelLoggerInfo.deployException, e);
}
if (appInfo != null) {
boolean isDirectory = new File(archive.getURI().getPath()).isDirectory();
EmbeddedDeployedInfo info = new EmbeddedDeployedInfo(appInfo, context.getModulePropsMap(), context.getAppProps(), isDirectory);
deployedApps.put(appInfo.getName(), info);
return appInfo.getName();
}
return null;
}
Aggregations