})
public static void saveConnectorResource(HandlerContext handlerCtx) {
String jndiName = (String) handlerCtx.getInputValue("jndiName");
String poolName = (String) handlerCtx.getInputValue("poolName");
ConnectorResourceConfig resource = null;
try {
if (! (Boolean) handlerCtx.getInputValue("edit")){
resource = AMXUtil.getDomainConfig().createConnectorResourceConfig(jndiName, poolName, null);
//Work around for bug#6519377. It automatically creates a <resource-ref> for "server"
if (AMXUtil.isEE()){
if (TargetUtil.getResourceRef(jndiName, "server") != null){
TargetUtil.removeResourceRef(jndiName, "server");
}
JavaMailHandlers.createNewTargets(handlerCtx, jndiName);
}else{
Boolean enabled = (Boolean)handlerCtx.getInputValue("enabled");
TargetUtil.setResourceEnabled(resource, "server", enabled);
}
//End of workaround.
/* Original code, should just call this:
* JavaMailHandlers.createNewTargets(handlerCtx, jndiName);
*/
}else{
GuiUtil.prepareSuccessful(handlerCtx);
resource = AMXUtil.getDomainConfig().getConnectorResourceConfigMap().get(jndiName);
if (resource == null){
GuiUtil.handleError(handlerCtx, GuiUtil.getMessage("msg.NoConnectResource"));
}
resource.setPoolName(poolName);
if(! AMXUtil.isEE()){
Boolean enabled = (Boolean) handlerCtx.getInputValue("enabled");
TargetUtil.setResourceEnabled(resource, "server", enabled);
}
}
resource.setDescription((String)handlerCtx.getInputValue("description"));
}catch (Exception ex){
GuiUtil.handleException(handlerCtx, ex);
}
}