/** * Read an XML document from the given String. * @see #getReader() */ public Document readDocumentFromString(String documentContent) { InputSource is = new InputSource(new StringReader(documentContent)); try { return this.reader.doLoadDocument(is, getResource()); } catch (Exception ex) { throw new BeanDefinitionStoreException("Failed to read XML document", ex); } }
/** * Read an XML document from the given String. * @see #getReader() */ public Document readDocumentFromString(String documentContent) { InputSource is = new InputSource(new StringReader(documentContent)); try { return this.reader.doLoadDocument(is, getResource()); } catch (Exception ex) { throw new BeanDefinitionStoreException("Failed to read XML document", ex); } }
if (logger.isDebugEnabled()) { logger.debug("Skipped XML bean definition file due to specified profiles [" + profileSpec + "] not matching: " + getReaderContext().getResource());
Resource relativeResource = getReaderContext().getResource().createRelative(location); if (relativeResource.exists()) { importCount = getReaderContext().getReader().loadBeanDefinitions(relativeResource); String baseLocation = getReaderContext().getResource().getURL().toString(); importCount = getReaderContext().getReader().loadBeanDefinitions( StringUtils.applyRelativePath(baseLocation, location), actualResources);
if (logger.isDebugEnabled()) { logger.debug("Skipped XML bean definition file due to specified profiles [" + profileSpec + "] not matching: " + getReaderContext().getResource());
parseQualifierElements(ele, bd); bd.setResource(this.readerContext.getResource()); bd.setSource(extractSource(ele));
Resource relativeResource = getReaderContext().getResource().createRelative(location); if (relativeResource.exists()) { importCount = getReaderContext().getReader().loadBeanDefinitions(relativeResource); String baseLocation = getReaderContext().getResource().getURL().toString(); importCount = getReaderContext().getReader().loadBeanDefinitions( StringUtils.applyRelativePath(baseLocation, location), actualResources);
parseQualifierElements(ele, bd); bd.setResource(this.readerContext.getResource()); bd.setSource(extractSource(ele));
@Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { attributesToProperties(element, builder, "basedir"); URL configFileURL; try { configFileURL = parserContext.getReaderContext().getResource().getURL(); } catch (IOException e) { configFileURL = null; } if (configFileURL != null) { builder.addPropertyValue("configFileURL", configFileURL); } ElementSelector pathSelector = and(sameNs(element), name("path")); List<Object> paths = createManagedList(element, parserContext); for (Element subElement : subElements(element, pathSelector)) { paths.add(parsePath(subElement, parserContext)); } builder.addPropertyValue("paths", paths); }
@Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { attributesToProperties(element, builder, "basedir"); URL configFileURL; try { configFileURL = parserContext.getReaderContext().getResource().getURL(); } catch (IOException e) { configFileURL = null; } if (configFileURL != null) { builder.addPropertyValue("configFileURL", configFileURL); } ElementSelector pathSelector = and(sameNs(element), name("path")); List<Object> paths = createManagedList(element, parserContext); for (Element subElement : subElements(element, pathSelector)) { paths.add(parsePath(subElement, parserContext)); } builder.addPropertyValue("paths", paths); }
configFileURL = parserContext.getReaderContext().getResource().getURL(); } catch (IOException e) { configFileURL = null;
configFileURL = parserContext.getReaderContext().getResource().getURL(); } catch (IOException e) { configFileURL = null;
Resource relativeResource = getReaderContext().getResource().createRelative(location); if (relativeResource.exists()) { importCount = getReaderContext().getReader().loadBeanDefinitions(relativeResource); String baseLocation = getReaderContext().getResource().getURL().toString(); importCount = getReaderContext().getReader().loadBeanDefinitions( StringUtils.applyRelativePath(baseLocation, location), actualResources);
parseQualifierElements(ele, bd); bd.setResource(this.readerContext.getResource()); bd.setSource(extractSource(ele));
private void initOrigin(NacosPropertySource nacosPropertySource, XmlReaderContext xmlReaderContext) { // Resource Resource resource = xmlReaderContext.getResource(); nacosPropertySource.setOrigin(resource); }
@Override protected void doParse(@Nonnull final Element config, @Nonnull final ParserContext parserContext, @Nonnull final BeanDefinitionBuilder builder) { DeprecationSupport.warnOnce(ObjectType.ELEMENT, "PrincipalAuthenticationMethod", parserContext.getReaderContext().getResource().getDescription(), null); super.doParse(config, parserContext, builder); }
@Override protected void doInitMetadataEvent(NacosPropertySource nacosPropertySource, NacosPropertySourceXmlBeanDefinition beanDefinition, NacosConfigMetadataEvent metadataEvent) { metadataEvent.setXmlResource(beanDefinition.getXmlReaderContext().getResource()); } }
@Override protected void doInitMetadataEvent(NacosPropertySource nacosPropertySource, NacosPropertySourceXmlBeanDefinition beanDefinition, NacosConfigMetadataEvent metadataEvent) { metadataEvent.setXmlResource(beanDefinition.getXmlReaderContext().getResource()); } }
protected BeanDefinitionBuilder getBeanDefinitionBuilder(ParserContext parserContext) { try { return BeanDefinitionBuilder.rootBeanDefinition(messageProcessorClass.getName()); } catch (NoClassDefFoundError noClassDefFoundError) { throw new BeanDefinitionParsingException(new Problem(("Cannot launch the mule app, the message processor class " + messageProcessorClass.getName() + " was not found in the classpath."), new Location(parserContext.getReaderContext().getResource()), null, noClassDefFoundError)); } }
/** * Cause an error with the provided message. * * @param message the message. * @param parserContext the parser context. Used to provide the failing location. * @throws BeanDefinitionParsingException if we encounter a filter */ protected void error(final String message, final ParserContext parserContext) { log.error(message); throw new BeanDefinitionParsingException(new Problem(message, new Location(parserContext.getReaderContext() .getResource()))); }