public ResourceAdapterDConfigBean(DDBean ddBean,
GerResourceadapterType resourceadapter) {
super(ddBean, resourceadapter);
if (getResourceadapterInstance() == null) {
resourceadapter.addNewResourceadapterInstance();
}
ConfigPropertiesHelper.initializeConfigSettings(ddBean, new ConfigPropertiesHelper.ConfigPropertiesSource() {
public GerConfigPropertySettingType[] getConfigPropertySettingArray() {
return getResourceadapterInstance().getConfigPropertySettingArray();
}
public GerConfigPropertySettingType addNewConfigPropertySetting() {
return getResourceadapterInstance().addNewConfigPropertySetting();
}
public void removeConfigPropertySetting(int j) {
}
public ConfigPropertySettings[] getConfigPropertySettings() {
return new ConfigPropertySettings[0];
}
public void setConfigPropertySettings(ConfigPropertySettings[] configs) {
}
}, configPropertiesMap, "config-property", "config-property-name");
//initialize connection definitions
GerOutboundResourceadapterType outboundResourceadapter = resourceadapter.getOutboundResourceadapter();
if (outboundResourceadapter == null) {
outboundResourceadapter = resourceadapter.addNewOutboundResourceadapter();
}
DDBean[] connectionDefinitionDDBeans = ddBean.getChildBean(getXpaths()[1]);
GerConnectionDefinitionType[] connectionDefinitions = outboundResourceadapter.getConnectionDefinitionArray();
if (connectionDefinitions.length == 0) {
//we are new
for (int i = 0; i < connectionDefinitionDDBeans.length; i++) {
DDBean connectionDefinitionDdBean = connectionDefinitionDDBeans[i];
GerConnectionDefinitionType connectionDefinition = outboundResourceadapter.addNewConnectionDefinition();
String connectionfactoryInterface = connectionDefinitionDdBean.getText("connectionfactory-interface")[0];
ConnectionDefinitionDConfigBean connectionDefinitionDConfigBean = new ConnectionDefinitionDConfigBean(connectionDefinitionDdBean, connectionDefinition);
connectionDefinitionsMap.put(connectionfactoryInterface, connectionDefinitionDConfigBean);
}
} else {
//we are read in from xml. Check correct length
assert connectionDefinitionDDBeans.length == connectionDefinitions.length;
for (int i = 0; i < connectionDefinitionDDBeans.length; i++) {
DDBean connectionDefinitionDdBean = connectionDefinitionDDBeans[i];
GerConnectionDefinitionType connectionDefinition = connectionDefinitions[i];
String connectionfactoryInterface = connectionDefinitionDdBean.getText("connectionfactory-interface")[0];
assert connectionfactoryInterface.equals(connectionDefinition.getConnectionfactoryInterface());
ConnectionDefinitionDConfigBean connectionDefinitionDConfigBean = new ConnectionDefinitionDConfigBean(connectionDefinitionDdBean, connectionDefinition);
connectionDefinitionsMap.put(connectionfactoryInterface, connectionDefinitionDConfigBean);
}
}
//admin objects
// DDBean[] adminObjecDdBeans = ddBean.getChildBean(getXpaths()[2]);
// GerAdminobjectType[] adminobjectTypes = getResourceadapter().getAdminobjectArray();
//
// if (adminobjectTypes.length == 0) {
// //we are new
// for (int i = 0; i < adminObjecDdBeans.length; i++) {
// DDBean adminObjectDdBean = adminObjecDdBeans[i];
// GerAdminobjectType adminobjectType = getResourceadapter().addNewAdminobject();
// String adminObjectInterface = adminObjectDdBean.getText("adminobject-interface")[0];
// String adminObjectClass = adminObjectDdBean.getText("adminobject-class")[0];
// AdminObjectDConfigBean adminObjectDConfigBean = new AdminObjectDConfigBean(adminObjectDdBean, adminobjectType);
// adminObjectsMap.put(new Key(adminObjectInterface, adminObjectClass), adminObjectDConfigBean);
// }
// } else {
// //we are read in from xml. Check correct length
// assert adminObjecDdBeans.length == adminobjectTypes.length;
// for (int i = 0; i < adminObjecDdBeans.length; i++) {
// DDBean adminObjectDdBean = adminObjecDdBeans[i];
// GerAdminobjectType adminobjectType = adminobjectTypes[i];
// String adminObjectInterface = adminObjectDdBean.getText("adminobject-interface")[0];
// assert(adminObjectInterface.equals(adminobjectType.getAdminobjectInterface().getStringValue()));
// String adminObjectClass = adminObjectDdBean.getText("adminobject-class")[0];
// assert(adminObjectClass.equals(adminobjectType.getAdminobjectClass().getStringValue()));
// AdminObjectDConfigBean adminObjectDConfigBean = new AdminObjectDConfigBean(adminObjectDdBean, adminobjectType);
// adminObjectsMap.put(new Key(adminObjectInterface, adminObjectClass), adminObjectDConfigBean);
//
// }
// }
}
|