@Override protected void postProcess(BeanDefinitionBuilder definitionBuilder, Element element) { Object envValue = DomUtils.getChildElementValueByTagName(element, ENVIRONMENT); if (envValue != null) { // Specific environment settings defined, overriding any shared properties. definitionBuilder.addPropertyValue(JNDI_ENVIRONMENT, envValue); } else { // Check whether there is a reference to shared environment properties... String envRef = element.getAttribute(ENVIRONMENT_REF); if (StringUtils.hasLength(envRef)) { definitionBuilder.addPropertyValue(JNDI_ENVIRONMENT, new RuntimeBeanReference(envRef)); } } String lazyInit = element.getAttribute(LAZY_INIT_ATTRIBUTE); if (StringUtils.hasText(lazyInit) && !DEFAULT_VALUE.equals(lazyInit)) { definitionBuilder.setLazyInit(TRUE_VALUE.equals(lazyInit)); } } }
@Override protected void postProcess(BeanDefinitionBuilder definitionBuilder, Element element) { Object envValue = DomUtils.getChildElementValueByTagName(element, ENVIRONMENT); if (envValue != null) { // Specific environment settings defined, overriding any shared properties. definitionBuilder.addPropertyValue(JNDI_ENVIRONMENT, envValue); } else { // Check whether there is a reference to shared environment properties... String envRef = element.getAttribute(ENVIRONMENT_REF); if (StringUtils.hasLength(envRef)) { definitionBuilder.addPropertyValue(JNDI_ENVIRONMENT, new RuntimeBeanReference(envRef)); } } String lazyInit = element.getAttribute(LAZY_INIT_ATTRIBUTE); if (StringUtils.hasText(lazyInit) && !DEFAULT_VALUE.equals(lazyInit)) { definitionBuilder.setLazyInit(TRUE_VALUE.equals(lazyInit)); } } }
String jtaDataSource = DomUtils.getChildElementValueByTagName(persistenceUnit, JTA_DATA_SOURCE); if (StringUtils.hasText(jtaDataSource)) { unitInfo.setJtaDataSource(this.dataSourceLookup.getDataSource(jtaDataSource.trim())); String nonJtaDataSource = DomUtils.getChildElementValueByTagName(persistenceUnit, NON_JTA_DATA_SOURCE); if (StringUtils.hasText(nonJtaDataSource)) { unitInfo.setNonJtaDataSource(this.dataSourceLookup.getDataSource(nonJtaDataSource.trim())); String provider = DomUtils.getChildElementValueByTagName(persistenceUnit, PROVIDER); if (StringUtils.hasText(provider)) { unitInfo.setPersistenceProviderClassName(provider.trim()); String cacheMode = DomUtils.getChildElementValueByTagName(persistenceUnit, SHARED_CACHE_MODE); if (StringUtils.hasText(cacheMode)) { unitInfo.setSharedCacheMode(SharedCacheMode.valueOf(cacheMode)); String validationMode = DomUtils.getChildElementValueByTagName(persistenceUnit, VALIDATION_MODE); if (StringUtils.hasText(validationMode)) { unitInfo.setValidationMode(ValidationMode.valueOf(validationMode));
String jtaDataSource = DomUtils.getChildElementValueByTagName(persistenceUnit, JTA_DATA_SOURCE); if (StringUtils.hasText(jtaDataSource)) { unitInfo.setJtaDataSource(this.dataSourceLookup.getDataSource(jtaDataSource.trim())); String nonJtaDataSource = DomUtils.getChildElementValueByTagName(persistenceUnit, NON_JTA_DATA_SOURCE); if (StringUtils.hasText(nonJtaDataSource)) { unitInfo.setNonJtaDataSource(this.dataSourceLookup.getDataSource(nonJtaDataSource.trim())); String provider = DomUtils.getChildElementValueByTagName(persistenceUnit, PROVIDER); if (StringUtils.hasText(provider)) { unitInfo.setPersistenceProviderClassName(provider.trim()); String cacheMode = DomUtils.getChildElementValueByTagName(persistenceUnit, SHARED_CACHE_MODE); if (StringUtils.hasText(cacheMode)) { unitInfo.setSharedCacheMode(SharedCacheMode.valueOf(cacheMode)); String validationMode = DomUtils.getChildElementValueByTagName(persistenceUnit, VALIDATION_MODE); if (StringUtils.hasText(validationMode)) { unitInfo.setValidationMode(ValidationMode.valueOf(validationMode));
bd.setDescription(DomUtils.getChildElementValueByTagName(ele, DESCRIPTION_ELEMENT));
bd.setDescription(DomUtils.getChildElementValueByTagName(ele, DESCRIPTION_ELEMENT));
@Override public Object unmarshal(Source source) throws IOException, XmlMappingException { Element documentElement = (Element) ((DOMSource) source).getNode(); String name = DomUtils.getChildElementValueByTagName(documentElement, "name"); Person person = new Person(); person.setName(name); return person; }
bd.setDescription(DomUtils.getChildElementValueByTagName(ele, DESCRIPTION_ELEMENT));
private String extractProfileId(Element profileElement) { String profileId = DomUtils.getChildElementValueByTagName(profileElement, ELEMENT_ID); if (StringUtils.isEmpty(profileId)) { throw new BeanCreationException("A profile must have an <id> element with a profile id as value"); } return profileId; }
private String extractDescription(Element element, BeanDefinitionRegistry registry) { String description = DomUtils.getChildElementValueByTagName(element, ELEMENT_DESCRIPTION); description = description != null ? description : ""; return replaceVariables(registry, description); }
@Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { // parse attributes using conventions super.doParse(element, parserContext, builder); // parse properties String props = DomUtils.getChildElementValueByTagName(element, "cmd-env"); if (StringUtils.hasText(props)) { builder.addPropertyValue("cmdEnv", props); } } }
@Override protected void postProcess(BeanDefinitionBuilder definitionBuilder, Element element) { Object envValue = DomUtils.getChildElementValueByTagName(element, ENVIRONMENT); if (envValue != null) { // Specific environment settings defined, overriding any shared properties. definitionBuilder.addPropertyValue(JNDI_ENVIRONMENT, envValue); } else { // Check whether there is a reference to shared environment properties... String envRef = element.getAttribute(ENVIRONMENT_REF); if (StringUtils.hasLength(envRef)) { definitionBuilder.addPropertyValue(JNDI_ENVIRONMENT, new RuntimeBeanReference(envRef)); } } String lazyInit = element.getAttribute(LAZY_INIT_ATTRIBUTE); if (StringUtils.hasText(lazyInit) && !DEFAULT_VALUE.equals(lazyInit)) { definitionBuilder.setLazyInit(TRUE_VALUE.equals(lazyInit)); } } }
/** * Returns the <tt>groupId</tt> setting in a <tt>pom.xml</tt> file. * * @return a <tt>pom.xml</tt> <tt>groupId</tt>. */ String getGroupIdFromPom(Resource pomXml) { try { DocumentLoader docLoader = new DefaultDocumentLoader(); Document document = docLoader.loadDocument(new InputSource(pomXml.getInputStream()), null, null, XmlValidationModeDetector.VALIDATION_NONE, false); String groupId = DomUtils.getChildElementValueByTagName(document.getDocumentElement(), GROUP_ID_ELEM); // no groupId specified, try the parent definition if (groupId == null) { if (log.isTraceEnabled()) log.trace("No groupId defined; checking for the parent definition"); Element parent = DomUtils.getChildElementByTagName(document.getDocumentElement(), "parent"); if (parent != null) return DomUtils.getChildElementValueByTagName(parent, GROUP_ID_ELEM); } else { return groupId; } } catch (Exception ex) { throw (RuntimeException) new RuntimeException(new ParserConfigurationException("error parsing resource=" + pomXml).initCause(ex)); } throw new IllegalArgumentException("no groupId or parent/groupId defined by resource [" + pomXml.getDescription() + "]"); }
/** * Returns the <code>localRepository</code> settings as indicated by the * <code>settings.xml</code> file. * * @return local repository as indicated by a Maven settings.xml file */ String getMavenSettingsLocalRepository(Resource m2Settings) { // no file found, return null to continue the discovery process if (!m2Settings.exists()) return null; try { DocumentLoader docLoader = new DefaultDocumentLoader(); Document document = docLoader.loadDocument(new InputSource(m2Settings.getInputStream()), null, null, XmlValidationModeDetector.VALIDATION_NONE, false); return (DomUtils.getChildElementValueByTagName(document.getDocumentElement(), LOCAL_REPOSITORY_ELEM)); } catch (Exception ex) { throw (RuntimeException) new RuntimeException(new ParserConfigurationException("error parsing resource=" + m2Settings).initCause(ex)); } }
String args = DomUtils.getChildElementValueByTagName(child, "arguments");
String args = DomUtils.getChildElementValueByTagName(child, "arguments");
String jtaDataSource = DomUtils.getChildElementValueByTagName(persistenceUnit, JTA_DATA_SOURCE); if (StringUtils.hasText(jtaDataSource)) { unitInfo.setJtaDataSource(this.dataSourceLookup.getDataSource(jtaDataSource.trim())); String nonJtaDataSource = DomUtils.getChildElementValueByTagName(persistenceUnit, NON_JTA_DATA_SOURCE); if (StringUtils.hasText(nonJtaDataSource)) { unitInfo.setNonJtaDataSource(this.dataSourceLookup.getDataSource(nonJtaDataSource.trim())); String provider = DomUtils.getChildElementValueByTagName(persistenceUnit, PROVIDER); if (StringUtils.hasText(provider)) { unitInfo.setPersistenceProviderClassName(provider.trim()); String cacheMode = DomUtils.getChildElementValueByTagName(persistenceUnit, SHARED_CACHE_MODE); if (StringUtils.hasText(cacheMode)) { unitInfo.setSharedCacheMode(SharedCacheMode.valueOf(cacheMode)); String validationMode = DomUtils.getChildElementValueByTagName(persistenceUnit, VALIDATION_MODE); if (StringUtils.hasText(validationMode)) { unitInfo.setValidationMode(ValidationMode.valueOf(validationMode));
beanDefinition.setDescription(DomUtils.getChildElementValueByTagName(ele, BeanDefinitionParserDelegate.DESCRIPTION_ELEMENT));
bd.setDescription(DomUtils.getChildElementValueByTagName(ele, DESCRIPTION_ELEMENT));
bd.setDescription(DomUtils.getChildElementValueByTagName(ele, DESCRIPTION_ELEMENT));