public static void saveJdbc(HandlerContext handlerCtx) {
String jndiName = (String) handlerCtx.getInputValue("jndiName");
String poolName = (String) handlerCtx.getInputValue("poolName");
Boolean edit = (Boolean) handlerCtx.getInputValue("edit");
JDBCResourceConfig jdbc = null;
try{
if (edit){
jdbc = AMXUtil.getDomainConfig().getJDBCResourceConfigMap().get(jndiName);
if (jdbc == null){
GuiUtil.handleError(handlerCtx, GuiUtil.getMessage("msg.NoSuchJDBCResource"));
return;
}
jdbc.setPoolName(poolName);
if(!AMXUtil.isEE()){
Boolean enabled = (Boolean) handlerCtx.getInputValue("enabled");
TargetUtil.setResourceEnabled(jdbc, "server", enabled);
}
GuiUtil.prepareSuccessful(handlerCtx);
}else{
jdbc = AMXUtil.getDomainConfig().createJDBCResourceConfig(jndiName, poolName, null);
JavaMailHandlers.createNewTargets(handlerCtx, jndiName);
}
jdbc.setDescription((String)handlerCtx.getInputValue("description"));
}catch (Exception ex){
GuiUtil.handleException(handlerCtx, ex);
}
}