ConnectorRegistry registry = ConnectorRegistry.getInstance();
ConnectorDescriptor desc = registry.getDescriptor(connectorName);
AdminObject aoDesc = null;
// The admin-object can be identified by interface name, class name
// or the combination of the both names.
if(adminObjectClassName == null || adminObjectClassName.trim().equals("")){
// get AO through interface name
List<AdminObject> adminObjects =
desc.getAdminObjectsByType(adminObjectType);
if(adminObjects.size() > 1){
String msg = localStrings.getString("aor.could_not_determine_aor_type", adminObjectType);
throw new ConnectorRuntimeException(msg);
}else{
aoDesc = adminObjects.get(0);
}
}else if(adminObjectType == null || adminObjectType.trim().equals("")){
// get AO through class name
List<AdminObject> adminObjects =
desc.getAdminObjectsByClass(adminObjectClassName);
if(adminObjects.size() > 1){
String msg = localStrings.getString("aor.could_not_determine_aor_class", adminObjectClassName);
throw new ConnectorRuntimeException(msg);
}else{
aoDesc = adminObjects.get(0);
}
}else{
// get AO through interface name and class name
aoDesc = desc.getAdminObject(adminObjectType, adminObjectClassName);
}
if(aoDesc==null){
String msg = localStrings.getString("aor.could_not_determine_aor", adminObjectType, adminObjectClassName);
throw new ConnectorRuntimeException(msg);
}
AdministeredObjectResource aor = new AdministeredObjectResource(resourceInfo);
aor.initialize(aoDesc);
aor.setResourceAdapter(connectorName);
Object[] envProps = aoDesc.getConfigProperties().toArray();
//Add default config properties to aor
//Override them if same config properties are provided by the user
for (int i = 0; i < envProps.length; i++) {
ConnectorConfigProperty envProp = (ConnectorConfigProperty ) envProps[i];