RegistrationAccount account =
RegistrationAccountFactory.getInstance().getRegistrationAccount(accountConfig);
String proxy = (String) handlerCtx.getInputValue("proxy");
String port = (String) handlerCtx.getInputValue("port");
RegistrationService regService = getRegServiceForRegister(proxy, port);
if (regService == null){ // This shouldn't happen, error may occur only when we try to user this regService.
GuiUtil.handleError(handlerCtx, GuiUtil.getMessage("reg.error.noRegService"));
return;
}
regService.register(account);
setNodeText(handlerCtx, true);
} catch (Exception ex) {
// FIXME: Log trace instead
ex.printStackTrace();
GuiUtil.handleException(handlerCtx, ex);
return;
}
} else {
String emailAdr = (String) handlerCtx.getInputValue("emailAdr");
String newPswd = (String) handlerCtx.getInputValue("newPswd");
String screenName = (String) handlerCtx.getInputValue("screenName");
String firstName = (String) handlerCtx.getInputValue("firstName");
String lastName = (String) handlerCtx.getInputValue("lastName");
String companyName = (String) handlerCtx.getInputValue("companyName");
String country = (String) handlerCtx.getInputValue("country");
Map map = new HashMap();
map.put(RegistrationAccount.EMAIL, emailAdr);
map.put(RegistrationAccount.PASSWORD, newPswd);
map.put(RegistrationAccount.COUNTRY, country);
if (GuiUtil.isEmpty(screenName)){
screenName = emailAdr;
}
map.put(RegistrationAccount.USERID, screenName);
if (GuiUtil.isEmpty(firstName)) {
firstName=" ";
}
map.put(RegistrationAccount.FIRSTNAME, firstName);
if (GuiUtil.isEmpty(lastName)) {
lastName = " ";
}
map.put(RegistrationAccount.LASTNAME, lastName);
if (! GuiUtil.isEmpty(companyName))
map.put(RegistrationAccount.COMPANY, companyName);
//System.out.println("====== DEBUG ==== Creating account with the following: " + map.toString());
Object[] accountParams = { map };
try {
String proxy = (String) handlerCtx.getInputValue("newProxy");
String port = (String) handlerCtx.getInputValue("newPort");
RegistrationService regService = getRegServiceForRegister(proxy, port);
if (regService == null){
GuiUtil.handleError(handlerCtx, GuiUtil.getMessage("reg.error.noRegService"));
return;
}
RegistrationAccountConfig accountConfig =
new RegistrationAccountConfig("com.sun.enterprise.registration.SOAccount", accountParams);
RegistrationAccount account =
RegistrationAccountFactory.getInstance().getRegistrationAccount(accountConfig);
regService.createRegistrationAccount(account);
regService.register(account);
setNodeText(handlerCtx, true);
} catch(Exception ex) {
// FIXME: Log trace instead
ex.printStackTrace();
GuiUtil.handleException(handlerCtx, ex);