public DDBean[] getChildBean(String xpath) { return root.getChildBean(xpath); }
public JBossExample1ConfigBeanRoot(DDBeanRoot root) { JBossExample1MainConfigBean bean = new JBossExample1MainConfigBean(root, this, null); DeployableObject deployment = root.getDeployableObject(); setBean(bean, deployment); }
protected String[] getXPathsFromNamespace(String uri, String[][] xpathSegments) { String[] attributeNames = ddBean.getRoot().getAttributeNames(); for (int i = 0; i < attributeNames.length; i++) { String attributeName = attributeNames[i]; if (attributeName.startsWith("xmlns")) { if (ddBean.getRoot().getAttributeValue(attributeName).equals(uri)) { if (attributeName.equals("xmlns")) { return getXPathsWithPrefix(null , xpathSegments); } return getXPathsWithPrefix(attributeName.substring(6), xpathSegments); } } } //we can't determine the namespace from looking at attributes, since the namespace is not an attribute. //try assuming that the ddbeans strip namespaces from their xpath handing. return getXPathsWithPrefix(null , xpathSegments); }
private XmlObject loadDefaultData(DDBeanRoot root) { InputStream in = root.getDeployableObject().getEntry("META-INF/geronimo-ra.xml"); if(in == null) { GerConnectorDocument doc = GerConnectorDocument.Factory.newInstance(); DDBean[] list = root.getChildBean("connector"); if(list.length > 0) { connector = new ConnectorDCB(list[0], doc.addNewConnector()); } return doc; } else { try { GerConnectorDocument result = GerConnectorDocument.Factory.parse(in); in.close(); DDBean[] list = root.getChildBean("connector"); if(list.length > 0) { connector = new ConnectorDCB(list[0], result.getConnector()); } return result; } catch (XmlException e) { throw new RuntimeException("Unable to load default Geronimo RA data", e); } catch (IOException e) { throw new RuntimeException("Unable to load default Geronimo RA data", e); } } }
public DeploymentConfiguration createConfiguration(DeployableObject deployable) { if (ModuleType.RAR.equals(deployable.getType())) { String ddBeanRootVersion = deployable.getDDBeanRoot().getDDBeanRootVersion(); if (ddBeanRootVersion != null && ddBeanRootVersion.equals("1.5")) { return new RARConfiguration(deployable, new Connector15DCBRoot(deployable.getDDBeanRoot())); } String[] specVersion = deployable.getDDBeanRoot().getText("connector/spec-version"); if (specVersion.length > 0 && "1.0".equals(specVersion[0])) { return new RARConfiguration(deployable, new ResourceAdapter_1_0DConfigRoot(deployable.getDDBeanRoot())); } throw new IllegalArgumentException("Unknown resource adapter version: " + deployable.getDDBeanRoot().getDDBeanRootVersion()); } else { return null; } }
public String[] getText(String xpath) { return root.getText(xpath); }
public DConfigBeanRoot getDConfigBeanRoot(DDBeanRoot dd) throws ConfigurationException { // If they give us web.xml, return our jboss-web.xml config bean if (configBeans.containsKey(dd.getFilename())) { return (DConfigBeanRoot) configBeans.get(dd.getFilename()); } // Not found, so create it. (lazy initializing) if (dd.getFilename().equals("WEB-INF/web.xml")) { DConfigBeanRoot retval = new WarConfigBeanRoot(dd, deployable); configBeans.put(dd.getFilename(), retval); return retval; } // if they give us some other standard bean, return the jboss specific // None implemented as of now return null; }
WebAppDConfigBean(DDBean ddBean, GerWebAppType webApp) { super(ddBean, webApp); ENCHelper.XmlEnvRefs envRefs = new ENCHelper.XmlEnvRefs(webApp.getEjbRefArray(), webApp.getEjbLocalRefArray(), webApp.getResourceRefArray(), webApp.getResourceEnvRefArray()); //which version are we dealing with? String version = ddBean.getRoot().getAttributeValue("version"); if ("2.4".equals(version)) { encHelper = new ENCHelper(ddBean, envRefs, getXPathsForJ2ee_1_4(ENCHelper.ENC_XPATHS), getXPathsForJ2ee_1_4(ENCHelper.NAME_XPATHS)); } else { encHelper = new ENCHelper(ddBean, envRefs, getXPathsWithPrefix(null, ENCHelper.ENC_XPATHS), getXPathsWithPrefix(null, ENCHelper.NAME_XPATHS)); } }
private XmlObject loadDefaultData(DDBeanRoot root) { InputStream in = root.getDeployableObject().getEntry("META-INF/geronimo-ra.xml"); if(in == null) { GerConnectorDocument doc = GerConnectorDocument.Factory.newInstance(); DDBean[] list = root.getChildBean("connector"); if(list.length > 0) { connector = new ConnectorDCB(list[0], doc.addNewConnector()); } return doc; } else { try { GerConnectorDocument result = GerConnectorDocument.Factory.parse(in); in.close(); DDBean[] list = root.getChildBean("connector"); if(list.length > 0) { connector = new ConnectorDCB(list[0], result.getConnector()); } return result; } catch (XmlException e) { throw new RuntimeException("Unable to load default Geronimo RA data", e); } catch (IOException e) { throw new RuntimeException("Unable to load default Geronimo RA data", e); } } }
public DeploymentConfiguration createConfiguration(DeployableObject deployable) { if (ModuleType.RAR.equals(deployable.getType())) { String ddBeanRootVersion = deployable.getDDBeanRoot().getDDBeanRootVersion(); if (ddBeanRootVersion != null && ddBeanRootVersion.equals("1.5")) { return new RARConfiguration(deployable, new Connector15DCBRoot(deployable.getDDBeanRoot())); } String[] specVersion = deployable.getDDBeanRoot().getText("connector/spec-version"); if (specVersion.length > 0 && "1.0".equals(specVersion[0])) { return new RARConfiguration(deployable, new ResourceAdapter_1_0DConfigRoot(deployable.getDDBeanRoot())); } throw new IllegalArgumentException("Unknown resource adapter version: " + deployable.getDDBeanRoot().getDDBeanRootVersion()); } else { return null; } }
public DConfigBeanRoot getDConfigBeanRoot(DDBeanRoot dd) throws ConfigurationException { // If they give us web.xml, return our jboss-web.xml config bean if (configBeans.containsKey(dd.getFilename())) { return (DConfigBeanRoot)configBeans.get(dd.getFilename()); } // Not found, so create it. (lazy initializing) if (dd.getFilename().equals("WEB-INF/web.xml")) { DConfigBeanRoot retval = new WarConfigBeanRoot(dd, deployable); configBeans.put(dd.getFilename(), retval); return retval; } // if they give us some other standard bean, return the jboss specific // None implemented as of now return null; }
public DDBean[] getChildBean(String xpath) { if (xpath.startsWith("/")) { return getRoot().getChildBean(xpath.substring(1)); } else if(xpath.equals(".")) { return new DDBean[]{this};
public JBossWebConfigBeanRoot(DDBeanRoot root) { JBossWebConfigBean bean = new JBossWebConfigBean(root, this); DeployableObject deployment = root.getDeployableObject(); setBean(bean, deployment); }
protected String[] getXPathsFromNamespace(String uri, String[][] xpathSegments) { String[] attributeNames = ddBean.getRoot().getAttributeNames(); for (int i = 0; i < attributeNames.length; i++) { String attributeName = attributeNames[i]; if (attributeName.startsWith("xmlns")) { if (ddBean.getRoot().getAttributeValue(attributeName).equals(uri)) { if (attributeName.equals("xmlns")) { return getXPathsWithPrefix(null , xpathSegments); } return getXPathsWithPrefix(attributeName.substring(6), xpathSegments); } } } //we can't determine the namespace from looking at attributes, since the namespace is not an attribute. //try assuming that the ddbeans strip namespaces from their xpath handing. return getXPathsWithPrefix(null , xpathSegments); }
public void removeDConfigBean(DConfigBeanRoot bean) throws BeanNotFoundException { String key = bean.getDDBean().getRoot().getFilename(); if (configBeans.containsKey(key)) { System.out.println("its here... not anymore"); configBeans.remove(key); } else { throw new BeanNotFoundException("BNF"); } }
/** * @param ejbRefName searched ejb-ref-name tag value * @param root root bean to search from * @param beanType type of bean to search for * * @return set of the names (ejb-name) of the beans refering to the ejb-ref * with the same ejb-ref-name */ private Set getRelevantBeansEjbRef(String ejbRefName, DDBeanRoot root, BEAN_TYPE beanType) { Set beanNames = new HashSet(); DDBean[] beans = root.getChildBean("/ejb-jar/enterprise-beans/" + beanType.getType()); // NOI18N for (int i = 0; i < beans.length; i++) { DDBean bean = beans[i]; DDBean[] ejbRefs = bean.getChildBean("ejb-ref"); for (int j = 0; ejbRefs != null && j < ejbRefs.length; j++) { String[] names = ejbRefs[j].getText("ejb-ref-name"); // NOI18N String[] types = ejbRefs[j].getText("ejb-ref-type"); // NOI18N if (names.length > 0 && types.length > 0 && names[0].equals(ejbRefName) && ("Session".equals(types[0]) || "Entity".equals(types[0]))) { // NOI18N //store bean's ejb-name tag value beanNames.add(bean.getChildBean("ejb-name")[0].getText()); // NOI18N break; } } } return beanNames; }
public JBossExample2ConfigBeanRoot(DDBeanRoot root) { JBossExample2MainConfigBean bean = new JBossExample2MainConfigBean(root, this, null); DeployableObject deployment = root.getDeployableObject(); setBean(bean, deployment); }
public void removeDConfigBean(DConfigBeanRoot bean) throws BeanNotFoundException { String key = bean.getDDBean().getRoot().getFilename(); if (configBeans.containsKey(key)) { configBeans.remove(key); } else { throw new BeanNotFoundException(bean.getDDBean().getXpath()); } }
/** * @param msgDestRefName searched message-destination-ref tag value * @param root root bean to search from * @param beanType type of bean to search for * * @return set of the names (ejb-name) of the beans refering to the message-destination-ref * with the same message-destination-ref-name */ private Set getRelevantBeansMsgDestRef(String msgDestRefName, DDBeanRoot root, BEAN_TYPE beanType) { Set beanNames = new HashSet(); DDBean[] beans = root.getChildBean("/ejb-jar/enterprise-beans/" + beanType.getType()); // NOI18N for (int i = 0; i < beans.length; i++) { DDBean bean = beans[i]; DDBean[] msgDestRefs = bean.getChildBean("message-destination-ref"); // NOI18N for (int j = 0; msgDestRefs != null && j < msgDestRefs.length; j++) { String[] names = msgDestRefs[j].getText("message-destination-ref-name"); // NOI18N if (names.length > 0 && names[0].equals(msgDestRefName)) { //store bean's ejb-name tag value beanNames.add(bean.getChildBean("ejb-name")[0].getText()); // NOI18N break; } } } return beanNames; }
public JBossExample1ConfigBeanRoot(DDBeanRoot root) { JBossExample1MainConfigBean bean = new JBossExample1MainConfigBean(root, this, null); DeployableObject deployment = root.getDeployableObject(); setBean(bean, deployment); }