}
@Override
protected int executeCommand() throws CommandException {
try {
final Service service = ServiceFactory.getService(dirs, getType());
PlatformServicesInfo info = service.getInfo();
info.setTrace(logger.isLoggable(Level.FINER));
info.setDryRun(dry_run);
info.setForce(force);
info.setAppServerUser(getProgramOptions().getUser());
if (ok(serviceName))
info.setServiceName(serviceName);
if (ok(serviceUser))
info.setServiceUser(serviceUser);
if (programOpts.getPasswordFile() != null)
info.setPasswordFile(SmartFile.sanitize(
new File(programOpts.getPasswordFile())));
service.setServiceProperties(serviceProperties);
service.createService();
// Why the messiness? We don't want to talk about the help
// file inside the help file thus the complications below...
String help = service.getSuccessMessage();
String tellUserAboutHelp = strings.get("create.service.runtimeHelp", help,
new File(dirs.getServerDir(), "PlatformServices.log"));
logger.info(tellUserAboutHelp);
service.writeReadmeFile(help);
}
catch (Exception e) {
// We only want to wrap the string -- not the Exception.
// Otherwise the message that is printed out to the user will be like this: