attrList.put("res-type", resType);
attrList.put(ResourceConstants.ENABLED, enabled.toString());
attrList.put(JNDI_NAME, jndiName);
attrList.put(ServerTags.DESCRIPTION, description);
ResourceStatus rs;
try {
rs = customResMgr.create(domain.getResources(), attrList, properties, target);
} catch(Exception e) {
Logger.getLogger(CreateCustomResource.class.getName()).log(Level.SEVERE,
"Unable to create custom resource " + jndiName, e);
String def = "Custom resource: {0} could not be created, reason: {1}";
report.setMessage(localStrings.getLocalString("create.custom.resource.fail",
def, jndiName) + " " + e.getLocalizedMessage());
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setFailureCause(e);
return;
}
ActionReport.ExitCode ec = ActionReport.ExitCode.SUCCESS;
if (rs.getStatus() == ResourceStatus.FAILURE) {
ec = ActionReport.ExitCode.FAILURE;
if (rs.getMessage() == null) {
report.setMessage(localStrings.getLocalString("create.custom.resource.fail",
"Custom resource {0} creation failed", jndiName, ""));
}
if (rs.getException() != null)
report.setFailureCause(rs.getException());
}
if(rs.getMessage() != null){
report.setMessage(rs.getMessage());
}
report.setActionExitCode(ec);
}