List of usage examples for javax.enterprise.deploy.model DDBeanRoot getText
public String[] getText(String xpath);
From source file:org.apache.geronimo.console.databasemanager.wizard.DatabasePoolPortlet.java
private ResourceAdapterParams loadConfigPropertiesByPath(PortletRequest request, String rarPath) { DeploymentManager mgr = ManagementHelper.getManagementHelper(request).getDeploymentManager(); try {// w w w . j a va2s.com //URI uri = getRAR(request, rarPath).toURI(); ConnectorDeployable deployable = new ConnectorDeployable( PortletManager.getRepositoryEntryBundle(request, rarPath)); final DDBeanRoot ddBeanRoot = deployable.getDDBeanRoot(); String adapterName = null, adapterDesc = null; String[] test = ddBeanRoot.getText("connector/display-name"); if (test != null && test.length > 0) { adapterName = test[0]; } test = ddBeanRoot.getText("connector/description"); if (test != null && test.length > 0) { adapterDesc = test[0]; } DDBean[] definitions = ddBeanRoot .getChildBean("connector/resourceadapter/outbound-resourceadapter/connection-definition"); List<ConfigParam> configs = new ArrayList<ConfigParam>(); if (definitions != null) { for (DDBean definition : definitions) { String iface = definition.getText("connectionfactory-interface")[0]; if (iface.equals("javax.sql.DataSource")) { DDBean[] beans = definition.getChildBean("config-property"); for (DDBean bean : beans) { String name = bean.getText("config-property-name")[0].trim(); String type = bean.getText("config-property-type")[0].trim(); test = bean.getText("config-property-value"); String value = test == null || test.length == 0 ? null : test[0].trim(); test = bean.getText("description"); String desc = test == null || test.length == 0 ? null : test[0].trim(); configs.add(new ConfigParam(name, type, desc, value)); } } } } return new ResourceAdapterParams(adapterName, adapterDesc, rarPath.substring(11, rarPath.length() - 5), configs.toArray(new ConfigParam[configs.size()])); } catch (Exception e) { log.error("Unable to read configuration properties", e); return null; } finally { if (mgr != null) mgr.release(); } }