public void execute(AdminCommandContext context) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); modulesRegistry.dumpState(new PrintStream(baos)); ActionReport report = context.getActionReport(); report.setActionExitCode(ExitCode.SUCCESS); String msg = baos.toString(); // the proper way to do this is to check the user-agent of the caller, // but I can't access that -- so I'll just check the type of the // ActionReport. If we are sending back to CLI then linefeeds will // cause problems. Manifest.write() is OK but Manifest.read() explodes! if(report instanceof PropsFileActionReporter) { msg = ManifestUtils.encode(msg); } report.setMessage(msg); } }
@Override public void execute(AdminCommandContext context) { StringBuilder sb = new StringBuilder(); if (contract == null) { dumpContracts(sb); dumpModules(sb); dumpTypes(sb); } else { dumpInhabitantsImplementingContractPattern(contract, sb); } String msg = sb.toString(); ActionReport report = context.getActionReport(); report.setActionExitCode(ExitCode.SUCCESS); if (report instanceof PropsFileActionReporter) { msg = ManifestUtils.encode(msg); } report.setMessage(msg); }