private void replaceResourceAdapterDConfigBean(GerResourceadapterType resourceAdapter) { DDBean ddBean = getDDBean(); String path = getXpaths()[0]; System.out.println("********** Searching XPath "+path+" -- "+ddBean.getChildBean(path)); DDBean childDDBean = ddBean.getChildBean(path)[0]; resourceAdapterDConfigBean = new ResourceAdapterDConfigBean(childDDBean, resourceAdapter); }
public RemoteRefDConfigBean(DDBean ddBean, XmlObject ref, String namePath) { super(ddBean, ref); this.ref = ref; assert ddBean.getChildBean(namePath)[0].getText().equals(getRefName()); }
public LocalRefDConfigBean(DDBean ddBean, XmlObject ref, String namePath) { super(ddBean, ref); this.ref = ref; assert ddBean.getChildBean(namePath)[0].getText().equals(getRefName()); }
private void replaceWebAppDConfigBean(GerWebAppType webApp) { DDBean ddBean = getDDBean(); webAppBean = new WebAppDConfigBean(ddBean.getChildBean(XPATHS[0])[0], webApp); }
/** * Look up the J2EE connection definition corresponding to this one (based on connectionfactory-interface) */ private DDBean getConnectionDefinitionDDBean() { String iface = getConnectionFactoryInterface(); if(iface == null || iface.equals("")) { return null; } DDBean list[] = resourceAdapter.getChildBean("outbound-resourceadapter/connection-definition"); for (int i = 0; i < list.length; i++) { DDBean bean = list[i]; String[] test = bean.getText("connectionfactory-interface"); if(test.length > 0) { String myface = test[0]; if(myface.equals(iface)) { return bean; } } } return null; }
/** * Look up the J2EE connection definition corresponding to this one (based on connectionfactory-interface) */ private DDBean getConnectionDefinitionDDBean() { String iface = getConnectionFactoryInterface(); if(iface == null || iface.equals("")) { return null; } DDBean list[] = resourceAdapter.getChildBean("outbound-resourceadapter/connection-definition"); for (int i = 0; i < list.length; i++) { DDBean bean = list[i]; String[] test = bean.getText("connectionfactory-interface"); if(test.length > 0) { String myface = test[0]; if(myface.equals(iface)) { return bean; } } } return null; }
public DDBean[] getChildBean(String xpath) { if (xpath.startsWith("/")) { xpath = xpath.substring(1); } int index = xpath.indexOf('/'); String childName = (index == -1) ? xpath : xpath.substring(0, index); if (("/" + childName).equals(docBean.getXpath())) { if (index == -1) { return new DDBean[]{new DDBeanImpl((DDBeanImpl) docBean, xpath)}; } else { DDBean[] newDDBeans = docBean.getChildBean(xpath.substring(index + 1)); if (newDDBeans != null) { for (int i = 0; i < newDDBeans.length; i++) { newDDBeans[i] = new DDBeanImpl((DDBeanImpl) newDDBeans[i], xpath); } } return newDDBeans; } } else { return null; } }
public static void test_remove(DConfigBean config, DDBean dd) { try { System.out.println(config.getXpaths().length + " xpaths."); String targetXPath = config.getXpaths()[0]; System.out.println(targetXPath + " is the first."); DDBean first = dd.getChildBean(targetXPath)[0]; DConfigBean cnfg = config.getDConfigBean(first); System.out.println("cnfg has " + cnfg.getXpaths().length + " sub kids"); config.removeDConfigBean(cnfg); System.out.println("cnfg has " + cnfg.getXpaths().length + " sub kids"); System.out.println(config.getXpaths().length + " xpaths."); } catch (Exception e) { System.out.println("ERROR: " + e.getMessage()); e.printStackTrace(); } }
public ConnectorDCB(DDBean connectorDDBean, final GerConnectorType connector) { super(connectorDDBean, connector); DDBean[] list = connectorDDBean.getChildBean("resourceadapter"); if(list.length > 0) { resourceAdapterDDBean = list[0]; } //todo: do something if resourceAdapterDDBean is null loadExistingData(connector); // Make sure we're told if /connector/resourceadapter is replaced! connectorDDBean.addXpathListener("resourceadapter", new XpathListener() { public void fireXpathEvent(XpathEvent event) { if(event.isRemoveEvent()) { resourceAdapterDDBean = null; //todo: all our info was just invalidated } else if(event.isAddEvent()) { resourceAdapterDDBean = event.getBean(); //todo: reload defaults from DDBean } else { System.out.println("Detected change to J2EE DD /connector/resourceadapter property "+event.getChangeEvent().getPropertyName()); } } }); }
public ConnectorDCB(DDBean connectorDDBean, final GerConnectorType connector) { super(connectorDDBean, connector); DDBean[] list = connectorDDBean.getChildBean("resourceadapter"); if(list.length > 0) { resourceAdapterDDBean = list[0]; } //todo: do something if resourceAdapterDDBean is null loadExistingData(connector); // Make sure we're told if /connector/resourceadapter is replaced! connectorDDBean.addXpathListener("resourceadapter", new XpathListener() { public void fireXpathEvent(XpathEvent event) { if(event.isRemoveEvent()) { resourceAdapterDDBean = null; //todo: all our info was just invalidated } else if(event.isAddEvent()) { resourceAdapterDDBean = event.getBean(); //todo: reload defaults from DDBean } else { System.out.println("Detected change to J2EE DD /connector/resourceadapter property "+event.getChangeEvent().getPropertyName()); } } }); }
private void replaceConnectionDefinitionDConfigBean(GerConnectionDefinitionType connectionDefinition) { DDBean ddBean = getDDBean(); DDBean childDDBean = ddBean.getChildBean(getXpaths()[0])[0]; connectionDefinitionDConfigBean = new ConnectionDefinitionDConfigBean(childDDBean, connectionDefinition); }
public static void test_remove(DConfigBean config, DDBean dd) { try { System.out.println(config.getXpaths().length + " xpaths."); String targetXPath = config.getXpaths()[0]; System.out.println(targetXPath + " is the first."); DDBean first = dd.getChildBean(targetXPath)[0]; DConfigBean cnfg = config.getDConfigBean(first); System.out.println("cnfg has " + cnfg.getXpaths().length + " sub kids"); config.removeDConfigBean(cnfg); System.out.println("cnfg has " + cnfg.getXpaths().length + " sub kids"); System.out.println(config.getXpaths().length + " xpaths."); } catch (Exception e) { System.out.println("ERROR: " + e.getMessage()); e.printStackTrace(); } }
private void replaceConnectionDefinitionDConfigBean(GerConnectionDefinitionType connectionDefinition) { DDBean ddBean = getDDBean(); DDBean childDDBean = ddBean.getChildBean(getXpaths()[0])[0]; connectionDefinitionDConfigBean = new ConnectionDefinitionDConfigBean(childDDBean, connectionDefinition); }
private void replaceResourceAdapterDConfigBean(GerResourceadapterType resourceAdapter) { DDBean ddBean = getDDBean(); String path = getXpaths()[0]; // System.out.println("********** Searching XPath "+path+" -- "+ddBean.getChildBean(path)); DDBean childDDBean = ddBean.getChildBean(path)[0]; resourceAdapterDConfigBean = new ResourceAdapterDConfigBean(childDDBean, resourceAdapter); }
void configure(DDBean resourceAdapter, GerConnectionDefinitionType definition) { this.resourceAdapter = resourceAdapter; setXmlObject(definition); //todo: handle unmatched interfaces below instances = new ConnectionDefinitionInstance[definition.getConnectiondefinitionInstanceArray().length]; DDBean[] beans = resourceAdapter.getChildBean("outbound-resourceadapter/connection-definition"); DDBean match = null; for (int i = 0; i < beans.length; i++) { DDBean bean = beans[i]; if(bean.getText("connectionfactory-interface")[0].equals(definition.getConnectionfactoryInterface())) { match = bean; break; } } for (int i = 0; i < instances.length; i++) { GerConnectiondefinitionInstanceType gerInstance = definition.getConnectiondefinitionInstanceArray()[i]; instances[i] = new ConnectionDefinitionInstance(match, gerInstance); } }
void configure(DDBean resourceAdapter, GerConnectionDefinitionType definition) { this.resourceAdapter = resourceAdapter; setXmlObject(definition); //todo: handle unmatched interfaces below instances = new ConnectionDefinitionInstance[definition.getConnectiondefinitionInstanceArray().length]; DDBean[] beans = resourceAdapter.getChildBean("outbound-resourceadapter/connection-definition"); DDBean match = null; for (int i = 0; i < beans.length; i++) { DDBean bean = beans[i]; if(bean.getText("connectionfactory-interface")[0].equals(definition.getConnectionfactoryInterface())) { match = bean; break; } } for (int i = 0; i < instances.length; i++) { GerConnectiondefinitionInstanceType gerInstance = definition.getConnectiondefinitionInstanceArray()[i]; instances[i] = new ConnectionDefinitionInstance(match, gerInstance); } }
public static void traverse(DConfigBean config, DDBean dd, int indent) throws ConfigurationException { indent += 3; indentPrint(indent, "starting \"" + dd.getXpath() + "\", config of type " + trimClass(config.getClass())); String[] pathsToFollow = config.getXpaths(); if (pathsToFollow.length > 0) indentPrint(indent, "- There are " + pathsToFollow.length + " xpaths returned."); indent += 4; for (int i = 0; i < pathsToFollow.length; i++) { String s = "path " + i + ": " + pathsToFollow[i]; DDBean[] lesserBeans = dd.getChildBean(pathsToFollow[i]); indentPrint(indent, s + " , " + lesserBeans.length + " found."); for (int j = 0; j < lesserBeans.length; j++) { DConfigBean cb = config.getDConfigBean(lesserBeans[j]); traverse(cb, lesserBeans[j], indent); } } }
public static void traverse(DConfigBean config, DDBean dd, int indent) throws ConfigurationException { indent += 3; indentPrint(indent, "starting \"" + dd.getXpath() + "\", config of type " + trimClass(config.getClass())); String[] pathsToFollow = config.getXpaths(); if (pathsToFollow.length > 0) indentPrint(indent, "- There are " + pathsToFollow.length + " xpaths returned."); indent += 4; for (int i = 0; i < pathsToFollow.length; i++) { String s = "path " + i + ": " + pathsToFollow[i]; DDBean[] lesserBeans = dd.getChildBean(pathsToFollow[i]); indentPrint(indent, s + " , " + lesserBeans.length + " found."); for (int j = 0; j < lesserBeans.length; j++) { DConfigBean cb = config.getDConfigBean(lesserBeans[j]); traverse(cb, lesserBeans[j], indent); } } }
void configure(DDBean connectionDefinition, GerConnectiondefinitionInstanceType definition) { this.connectionDefinition = connectionDefinition; super.configure(connectionDefinition, definition); if(connectionDefinition != null) { DDBean parent = connectionDefinition.getChildBean("..")[0]; ConnectionManager oldMgr = manager; if(oldMgr == null) { if(definition.getConnectionmanager() != null) { manager = new ConnectionManager(parent, definition.getConnectionmanager()); } else { manager = new ConnectionManager(parent, definition.addNewConnectionmanager()); } } else { if(definition.getConnectionmanager() != null) { manager.configure(parent, definition.getConnectionmanager()); } else { manager.configure(parent, definition.addNewConnectionmanager()); } } pcs.firePropertyChange("connectionManager", oldMgr, manager); } }
void configure(DDBean connectionDefinition, GerConnectiondefinitionInstanceType definition) { this.connectionDefinition = connectionDefinition; super.configure(connectionDefinition, definition); if(connectionDefinition != null) { DDBean parent = connectionDefinition.getChildBean("..")[0]; ConnectionManager oldMgr = manager; if(oldMgr == null) { if(definition.getConnectionmanager() != null) { manager = new ConnectionManager(parent, definition.getConnectionmanager()); } else { manager = new ConnectionManager(parent, definition.addNewConnectionmanager()); } } else { if(definition.getConnectionmanager() != null) { manager.configure(parent, definition.getConnectionmanager()); } else { manager.configure(parent, definition.addNewConnectionmanager()); } } pcs.firePropertyChange("connectionManager", oldMgr, manager); } }