1 23 24 package com.sun.enterprise.cli.commands; 25 26 import com.sun.enterprise.cli.framework.*; 27 28 35 public class ChangeAdminPasswordCommand extends GenericCommand 36 { 37 private static final String ADMIN_PASSWORD = "adminpassword"; 38 private static final String PASSWORD = "password"; 39 private static final String INTERACTIVE = "interactive"; 40 private static final String OLD_ADMIN_PASSWORD = "oldadminpassword"; 41 private static final String NEW_ADMIN_PASSWORD = "newadminpassword"; 42 private String sPassword; 43 44 private String getOldAdminPassword() 45 throws CommandValidationException, CommandException 46 { 47 return getPassword(OLD_ADMIN_PASSWORD, 48 "OldAdminPasswordPrompt", null, 49 false, false, false, false, null, null, 50 true, false, true, false); 51 } 52 53 54 private String getNewAdminPassword() 55 throws CommandValidationException, CommandException 56 { 57 return getPassword(NEW_ADMIN_PASSWORD, 58 "NewAdminPasswordPrompt", "NewAdminPasswordConfirmationPrompt", 59 false, false, false, false, null, null, 60 true, true, true, false); 61 } 62 63 64 67 public boolean validateOptions() throws CommandValidationException 68 { 69 super.validateOptions(); 70 71 try { 72 75 setOption(INTERACTIVE, "true"); 76 sPassword = getOldAdminPassword(); 78 setOption(PASSWORD, sPassword); 79 final String adminPassword = getNewAdminPassword(); 81 setOption(ADMIN_PASSWORD, adminPassword); 82 } 83 catch (CommandException ce) { 84 throw new CommandValidationException(ce.getLocalizedMessage()); 85 } 86 87 return true; 88 } 89 90 97 public String getPassword() throws CommandValidationException, CommandException 98 { 99 return sPassword; 100 } 101 102 } 103 | Popular Tags |