attrList.put(RESOURCE_ADAPTER_CONFIG_NAME, raName);
//attrList.put("name", name);
attrList.put(THREAD_POOL_IDS, threadPoolIds);
attrList.put(ServerTags.OBJECT_TYPE, objectType);
ResourceStatus rs;
//TODO ASR : need similar validation while creating app-scoped-resource of resource-adapter-config
String appName = raName;
if (!ConnectorsUtil.isStandAloneRA(raName)) {
appName = ConnectorsUtil.getApplicationNameOfEmbeddedRar(raName);
Application application = applications.getApplication(appName);
if(application != null){
//embedded RAR
String resourceAdapterName = ConnectorsUtil.getRarNameFromApplication(raName);
Module module = application.getModule(resourceAdapterName);
if(module != null){
Resources msr = module.getResources();
if(msr != null){
if(hasDuplicate(msr, report)) return;
}
}
}
}else{
//standalone RAR
Application application = applications.getApplication(appName);
if(application != null){
Resources appScopedResources = application.getResources();
if(appScopedResources != null){
if(hasDuplicate(appScopedResources, report)) return;
}
}
}
ResourceAdapterConfigManager resAdapterConfigMgr = new ResourceAdapterConfigManager();
try {
rs = resAdapterConfigMgr.create(domain.getResources(), attrList, properties, target);
} catch (Exception ex) {
Logger.getLogger(CreateResourceAdapterConfig.class.getName()).log(
Level.SEVERE,
"Unable to create resource adapter config for " + raName, ex);
String def = "Resource adapter config: {0} could not be created, reason: {1}";
report.setMessage(localStrings.getLocalString("create.resource.adapter.config.fail",
def, raName) + " " + ex.getLocalizedMessage());
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
report.setFailureCause(ex);
return;
}
ActionReport.ExitCode ec = ActionReport.ExitCode.SUCCESS;
if (rs.getStatus() == ResourceStatus.FAILURE) {
ec = ActionReport.ExitCode.FAILURE;
if (rs.getMessage() != null) {
report.setMessage(rs.getMessage());
} else {
report.setMessage(localStrings.getLocalString("create.resource.adapter.config.fail",
"Resource adapter config {0} creation failed", raName, ""));
}
if (rs.getException() != null)
report.setFailureCause(rs.getException());
}
report.setActionExitCode(ec);
}