List of usage examples for org.springframework.util.xml DomUtils getChildElementsByTagName
public static List<Element> getChildElementsByTagName(Element ele, String childEleName)
From source file:com.springsource.hq.plugin.tcserver.plugin.serverconfig.general.GeneralConfigConverter.java
private JmxListener createJmxListener(final Element server, final Properties catalinaProperties) { JmxListener jmxListener = new JmxListener(); for (Element listener : DomUtils.getChildElementsByTagName(server, TAG_NAME_LISTENER)) { if ("com.springsource.tcserver.serviceability.rmi.JmxSocketListener" .equals(listener.getAttribute(ATTRIBUTE_CLASS_NAME))) { jmxListener.setEnabled(true); String accessFile = parseProperties(listener.getAttribute(ACCESS_FILE), catalinaProperties); if (!EMPTY_STRING.equals(accessFile)) { jmxListener.setAccessFile(accessFile); }/* ww w. j a va 2 s.c o m*/ String authenticate = parseProperties(listener.getAttribute(AUTHENTICATE), catalinaProperties); if (!EMPTY_STRING.equals(authenticate)) { jmxListener.setAuthenticate(Boolean.valueOf(authenticate)); } String bind = parseProperties(listener.getAttribute(BIND), catalinaProperties); if (!EMPTY_STRING.equals(bind)) { jmxListener.setBind(bind); } String cipherSuites = parseProperties(listener.getAttribute(CIPHER_SUITES), catalinaProperties); if (!EMPTY_STRING.equals(cipherSuites)) { jmxListener.setCipherSuites(cipherSuites); } String clientAuth = parseProperties(listener.getAttribute(CLIENT_AUTH), catalinaProperties); if (!EMPTY_STRING.equals(clientAuth)) { jmxListener.setClientAuth(Boolean.valueOf(clientAuth)); } String keystoreFile = parseProperties(listener.getAttribute(KEYSTORE_FILE), catalinaProperties); if (!EMPTY_STRING.equals(keystoreFile)) { jmxListener.setKeystoreFile(keystoreFile); } String keystorePass = parseProperties(listener.getAttribute(KEYSTORE_PASS), catalinaProperties); if (!EMPTY_STRING.equals(keystorePass)) { jmxListener.setKeystorePass(keystorePass); } String passwordFile = parseProperties(listener.getAttribute(PASSOWRD_FILE), catalinaProperties); if (!EMPTY_STRING.equals(passwordFile)) { jmxListener.setPasswordFile(passwordFile); } String port = parseProperties(listener.getAttribute(JMX_PORT), catalinaProperties); if (!EMPTY_STRING.equals(port)) { try { jmxListener.setPort(Long.valueOf(port)); } catch (NumberFormatException e) { logNonNumericValue("JMX Listener", JMX_PORT, port); } } String protocols = parseProperties(listener.getAttribute(PROTOCOLS), catalinaProperties); if (!EMPTY_STRING.equals(protocols)) { jmxListener.setProtocols(protocols); } String truststoreFile = parseProperties(listener.getAttribute(TRUSTSTORE_FILE), catalinaProperties); if (!EMPTY_STRING.equals(truststoreFile)) { jmxListener.setTruststoreFile(truststoreFile); } String truststorePass = parseProperties(listener.getAttribute(TRUSTSTORE_PASS), catalinaProperties); if (!EMPTY_STRING.equals(truststorePass)) { jmxListener.setTruststorePass(truststorePass); } String useJdkClientFactory = parseProperties(listener.getAttribute(USE_JDK_CLIENT_FACTORY), catalinaProperties); if (!EMPTY_STRING.equals(useJdkClientFactory)) { jmxListener.setUseJdkClientFactory(Boolean.valueOf(useJdkClientFactory)); } String useSSL = parseProperties(listener.getAttribute(USE_SSL), catalinaProperties); if (!EMPTY_STRING.equals(useSSL)) { jmxListener.setUseSSL(Boolean.valueOf(useSSL)); } return jmxListener; } } jmxListener.setEnabled(false); return jmxListener; }
From source file:com.gfactor.jpa.core.MyPersistenceUnitReader.java
/** * Parse the <code>property</code> XML elements. *//*from w w w .j a v a 2 s . c o m*/ @SuppressWarnings("unchecked") protected void parseProperty(Element persistenceUnit, MySpringPersistenceUnitInfo unitInfo) { Element propRoot = DomUtils.getChildElementByTagName(persistenceUnit, PROPERTIES); if (propRoot == null) { return; } List<Element> properties = DomUtils.getChildElementsByTagName(propRoot, "property"); for (Element property : properties) { String name = property.getAttribute("name"); String value = property.getAttribute("value"); unitInfo.addProperty(name, value); } }
From source file:com.diaimm.april.db.jpa.hibernate.multidbsupport.PersistenceUnitReader.java
/** * Parse the <code>property</code> XML elements. *//*from w w w . j a va 2s . co m*/ @SuppressWarnings("unchecked") protected void parseProperties(Element persistenceUnit, SpringPersistenceUnitInfo unitInfo) { Element propRoot = DomUtils.getChildElementByTagName(persistenceUnit, PROPERTIES); if (propRoot == null) { return; } List<Element> properties = DomUtils.getChildElementsByTagName(propRoot, "property"); for (Element property : properties) { String name = property.getAttribute("name"); String value = property.getAttribute("value"); unitInfo.addProperty(name, value); } }
From source file:com.gfactor.jpa.core.MyPersistenceUnitReader.java
/** * Parse the <code>class</code> XML elements. *///from w w w .jav a 2 s . c om @SuppressWarnings("unchecked") protected void parseClass(Element persistenceUnit, MySpringPersistenceUnitInfo unitInfo) { List<Element> classes = DomUtils.getChildElementsByTagName(persistenceUnit, MANAGED_CLASS_NAME); for (Element element : classes) { String value = DomUtils.getTextValue(element).trim(); if (StringUtils.hasText(value)) unitInfo.addManagedClassName(value); } }
From source file:com.diaimm.april.db.jpa.hibernate.multidbsupport.PersistenceUnitReader.java
/** * Parse the <code>class</code> XML elements. */// w w w . j a v a2 s .c om @SuppressWarnings("unchecked") protected void parseManagedClasses(Element persistenceUnit, SpringPersistenceUnitInfo unitInfo) { List<Element> classes = DomUtils.getChildElementsByTagName(persistenceUnit, MANAGED_CLASS_NAME); for (Element element : classes) { String value = DomUtils.getTextValue(element).trim(); if (StringUtils.hasText(value)) unitInfo.addManagedClassName(value); } }
From source file:com.gfactor.jpa.core.MyPersistenceUnitReader.java
/** * Parse the <code>jar-file</code> XML elements. *//* ww w . j a v a 2 s . c om*/ @SuppressWarnings("unchecked") protected void parseJarFiles(Element persistenceUnit, MySpringPersistenceUnitInfo unitInfo) throws IOException { List<Element> jars = DomUtils.getChildElementsByTagName(persistenceUnit, JAR_FILE_URL); for (Element element : jars) { String value = DomUtils.getTextValue(element).trim(); if (StringUtils.hasText(value)) { Resource[] resources = this.resourcePatternResolver.getResources(value); for (Resource resource : resources) { unitInfo.addJarFileUrl(resource.getURL()); } } } }
From source file:com.apdplat.platform.spring.APDPlatPersistenceUnitReader.java
/** * Parse the <code>property</code> XML elements. *///from w ww . jav a2s.c o m @SuppressWarnings("unchecked") protected void parseProperty(Element persistenceUnit, SpringPersistenceUnitInfo unitInfo) { Element propRoot = DomUtils.getChildElementByTagName(persistenceUnit, PROPERTIES); if (propRoot == null) { return; } List<Element> properties = DomUtils.getChildElementsByTagName(propRoot, "property"); for (Element property : properties) { String name = property.getAttribute("name"); String value = property.getAttribute("value"); unitInfo.addProperty(name, value); } }
From source file:com.diaimm.april.db.jpa.hibernate.multidbsupport.PersistenceUnitReader.java
/** * Parse the <code>jar-file</code> XML elements. *///from w w w.java 2 s . c om @SuppressWarnings("unchecked") protected void parseJarFiles(Element persistenceUnit, SpringPersistenceUnitInfo unitInfo) throws IOException { List<Element> jars = DomUtils.getChildElementsByTagName(persistenceUnit, JAR_FILE_URL); for (Element element : jars) { String value = DomUtils.getTextValue(element).trim(); if (StringUtils.hasText(value)) { Resource[] resources = this.resourcePatternResolver.getResources(value); boolean found = false; for (Resource resource : resources) { if (resource.exists()) { found = true; unitInfo.addJarFileUrl(resource.getURL()); } } if (!found) { // relative to the persistence unit root, according to the JPA spec URL rootUrl = unitInfo.getPersistenceUnitRootUrl(); if (rootUrl != null) { unitInfo.addJarFileUrl(new URL(rootUrl, value)); } else { logger.warn("Cannot resolve jar-file entry [" + value + "] in persistence unit '" + unitInfo.getPersistenceUnitName() + "' without root URL"); } } } } }
From source file:com.gfactor.jpa.core.MyPersistenceUnitReader.java
/** * Parse the <code>mapping-file</code> XML elements. *//*from w w w. j a v a2 s. c o m*/ @SuppressWarnings("unchecked") protected void parseMappingFiles(Element persistenceUnit, MySpringPersistenceUnitInfo unitInfo) { List<Element> files = DomUtils.getChildElementsByTagName(persistenceUnit, MAPPING_FILE_NAME); for (Element element : files) { String value = DomUtils.getTextValue(element).trim(); if (StringUtils.hasText(value)) { unitInfo.addMappingFileName(value); } } }
From source file:com.apdplat.platform.spring.APDPlatPersistenceUnitReader.java
/** * Parse the <code>class</code> XML elements. *//*w w w. ja v a 2 s.com*/ @SuppressWarnings("unchecked") protected void parseClass(Element persistenceUnit, SpringPersistenceUnitInfo unitInfo) { List<Element> classes = DomUtils.getChildElementsByTagName(persistenceUnit, MANAGED_CLASS_NAME); for (Element element : classes) { String value = DomUtils.getTextValue(element).trim(); if (StringUtils.hasText(value)) unitInfo.addManagedClassName(value); } }