if(admins == null) {
adminobjects = new AdminObjectDCB[0];
} else {
// Match up each Geronimo adminobject with a ra.xml adminobject and create DConfigBeans accordingly
for (int i = 0; i < admins.length; i++) {
GerAdminobjectType admin = admins[i];
String aoClass = admin.getAdminobjectClass();
String aoIface = admin.getAdminobjectInterface();
AdminObjectDCB dcb = (AdminObjectDCB) dcbs.get("class "+aoClass+" iface "+aoIface);
if(dcb != null) {
// this is a second Geronimo adminobject block of the same type; there will not be a matching DDBean any more
// merge the adminobject-instance entries instead!!!
if(admin.getAdminobjectInstanceArray().length > 0) {
GerAdminobjectType old = dcb.getAdminObject();
GerAdminobjectInstanceType[] array = admin.getAdminobjectInstanceArray();
int oldCount = dcb.getAdminObjectInstance().length;
for (int j = 0; j < array.length; j++) {
GerAdminobjectInstanceType instance = array[j];
XmlCursor source = instance.newCursor();
XmlCursor dest = old.newCursor();
dest.toEndToken();
if(!source.moveXml(dest)) {
throw new RuntimeException("Unable to move admin object instance");
}
source.dispose();
dest.dispose();
dcb.addAdminObjectInstance(old.getAdminobjectInstanceArray(oldCount+j));
}
}
continue;
}
DDBean target = null;
for (int j = 0; j < ddBeans.size(); j++) {
DDBean ddBean = (DDBean) ddBeans.get(j);
String ddClass = ddBean.getText("adminobject-class")[0];
String ddIface = ddBean.getText("adminobject-interface")[0];
if(ddClass.equals(aoClass) && ddIface.equals(aoIface)) {
target = ddBean;
ddBeans.remove(j);
break;
}
}
if(target == null) {
System.out.println("Geronimo connector deployment plan has admin object with interface '"+aoIface+"' and class '"+aoClass+"' but the ra.xml does not have a matching adminobject declared. Deleting this adminobject from the Geronimo plan.");
continue;
}
dcb = new AdminObjectDCB(target, admin);
dcbs.put("class "+aoClass+" iface "+aoIface, dcb);
}
}
// There are some admin object types in ra.xml with no matching instances; create DConfigBeans for those
for (int i = 0; i < ddBeans.size(); i++) {
DDBean ddBean = (DDBean) ddBeans.get(i);
String ddClass = ddBean.getText("adminobject-class")[0];
String ddIface = ddBean.getText("adminobject-interface")[0];
GerAdminobjectType admin = connector.addNewAdminobject();
dcbs.put("class "+ddClass+" iface "+ddIface, new AdminObjectDCB(ddBean, admin));
}
List adminResults = new ArrayList();
for (Iterator it = dcbs.keySet().iterator(); it.hasNext();) {
String key = (String) it.next();