if (isRunning(adminAddress.getHost(), adminAddress.getPort()))
throw new CommandException(strings.get("domain.is.running",
getDomainName(), getDomainRootDir()));
DomainConfig domainConfig = new DomainConfig(getDomainName(),
getDomainsDir().getAbsolutePath());
PEDomainsManager manager = new PEDomainsManager();
String mp = super.readFromMasterPasswordFile();
if (mp == null) {
mp = passwords.get("AS_ADMIN_MASTERPASSWORD");
if (mp == null) {
mp = super.readPassword(strings.get("current.mp"));
}
}
if (mp == null) throw new CommandException(strings.get("no.console"));
if (!super.verifyMasterPassword(mp))
throw new CommandException(strings.get("incorrect.mp"));
String nmp = getPassword("newmasterpassword", strings.get("new.mp"), true);
if (nmp == null)
throw new CommandException(strings.get("no.console"));
domainConfig.put(DomainConfig.K_MASTER_PASSWORD, mp);
domainConfig.put(DomainConfig.K_NEW_MASTER_PASSWORD, nmp);
domainConfig.put(DomainConfig.K_SAVE_MASTER_PASSWORD, savemp);
manager.changeMasterPassword(domainConfig);
return 0;
} catch(Exception e) {
throw new CommandException(e.getMessage(),e);
}