@NoImplement public interface AstXmlParser
Provides a mechanism to parse a XML config for a deployable mule artifact into an ArtifactAst.

This parser needs to know the extension models that are used by the artifact in order to generate the ArtifactAst correctly.

A single parser instance may be used to generate more than one ArtifactAst from different configs, since no state specific to a parsing process is kept by this parser. The same parser may be used to parse different configs concurrently, as well.

Since:
1.0
  • Field Details

    • IMPORT_IDENTIFIER

      static final org.mule.runtime.api.component.ComponentIdentifier IMPORT_IDENTIFIER
    • MULE_ROOT_IDENTIFIER

      static final org.mule.runtime.api.component.ComponentIdentifier MULE_ROOT_IDENTIFIER
    • DOMAIN_ROOT_IDENTIFIER

      static final org.mule.runtime.api.component.ComponentIdentifier DOMAIN_ROOT_IDENTIFIER
    • ANNOTATIONS_IDENTIFIER

      static final org.mule.runtime.api.component.ComponentIdentifier ANNOTATIONS_IDENTIFIER
  • Method Details

    • builder

      static AstXmlParser.Builder builder()
      Creates a builder for an AstXmlParser.
      Returns:
      a builder for an AstXmlParser.
    • parseDocument

      ArtifactAst parseDocument(String artifactName, List<org.mule.runtime.api.util.Pair<String,Document>> appXmlConfigDocuments)
      Generate a new ArtifactAst representation from the XML DOM tree.

      The parsing process will resolve references in import tags. Relative paths will be resolved using the currently set ThreadContextClassLoader.

      Note: The component metadata that is generated relies on data populated at the time of parsing the config XML into its Document. In the case of this method, the provided Document must be of level 3 and have that data populated for the component metadata about the underlying DSL to be accurate. The required data is a userData with key XmlMetadataAnnotations.METADATA_ANNOTATIONS_KEY and value of type XmlMetadataAnnotations on every node of the DOM tree.

      Parameters:
      artifactName - the name of the artifact to parse
      appXmlConfigDocuments - the XML content to be parsed. The first part of each pair is the name to be used as fileName in the metadata of the generates ArtifactAst.
      Returns:
      the ArtifactAst representation of the provided XML config.
    • parseDocument

      ArtifactAst parseDocument(List<org.mule.runtime.api.util.Pair<String,Document>> appXmlConfigDocuments)
      Generate a new ArtifactAst representation form the XML DOM tree.

      The parsing process will resolve references in import tags. Relative paths will be resolved using the currently set ThreadContextClassLoader.

      Note: The component metadata that is generated relies on data populated at the time of parsing the config XML into its Document. In the case of this method, the provided Document must be of level 3 and have that data populated for the component metadata about the underlying DSL to be accurate. The required data is a userData with key XmlMetadataAnnotations.METADATA_ANNOTATIONS_KEY and value of type XmlMetadataAnnotations on every node of the DOM tree.

      Parameters:
      appXmlConfigDocuments - the XML content to be parsed. The first part of each pair is the name to be used as fileName in the metadata of the generates ArtifactAst.
      Returns:
      the ArtifactAst representation of the provided XML config.
      Since:
      1.1
    • parse

      ArtifactAst parse(String artifactName, List<org.mule.runtime.api.util.Pair<String,InputStream>> appXmlConfigInputStreams)
      Generate a new ArtifactAst representation form the XML read from the provided inputStreams.

      The parsing process will resolve references in import tags. Relative paths will be resolved using the currently set ThreadContextClassLoader.

      Parameters:
      artifactName - the name of the artifact to parse
      appXmlConfigInputStreams - the streams that will provide the XML content to be parsed. The first part of each pair is the name to be used as fileName in the metadata of the generates ArtifactAst.
      Returns:
      the ArtifactAst representation of the provided XML config.
      Since:
      1.1
    • parse

      ArtifactAst parse(List<org.mule.runtime.api.util.Pair<String,InputStream>> appXmlConfigInputStreams)
      Generate a new ArtifactAst representation form the XML read from the provided inputStreams.

      The parsing process will resolve references in import tags. Relative paths will be resolved using the currently set ThreadContextClassLoader.

      Parameters:
      appXmlConfigInputStreams - the streams that will provide the XML content to be parsed. The first part of each pair is the name to be used as fileName in the metadata of the generates ArtifactAst.
      Returns:
      the ArtifactAst representation of the provided XML config.
    • parse

      ArtifactAst parse(String artifactName, org.mule.runtime.dsl.api.ConfigResource... appXmlConfigResources)
      Generate a new ArtifactAst representation form the XML read from the provided inputStreams.

      The parsing process will resolve references in import tags. Relative paths will be resolved using the currently set ThreadContextClassLoader.

      Parameters:
      artifactName - the name of the artifact to parse
      appXmlConfigResources - the resources that will provide the XML content to be parsed.
      Returns:
      the ArtifactAst representation of the provided XML config.
    • parse

      ArtifactAst parse(org.mule.runtime.dsl.api.ConfigResource... appXmlConfigResources)
      Generate a new ArtifactAst representation form the XML read from the provided inputStreams.

      The parsing process will resolve references in import tags. Relative paths will be resolved using the currently set ThreadContextClassLoader.

      Parameters:
      appXmlConfigResources - the resources that will provide the XML content to be parsed.
      Returns:
      the ArtifactAst representation of the provided XML config.
    • parse

      ArtifactAst parse(String artifactName, String resourceName, InputStream appXmlConfigInputStream)
      Generate a new ArtifactAst representation form the XML read from the provided inputStream.

      The parsing process will resolve references in import tags. Relative paths will be resolved using the currently set ThreadContextClassLoader.

      Parameters:
      artifactName - the name of the artifact to parse
      resourceName - the name to be used as fileName in the metadata of the generates ArtifactAst.
      appXmlConfigInputStream - the stream that will provide the XML content to be parsed.
      Returns:
      the ArtifactAst representation of the provided XML config.
    • parse

      ArtifactAst parse(String resourceName, InputStream appXmlConfigInputStream)
      Generate a new ArtifactAst representation form the XML read from the provided inputStream.

      The parsing process will resolve references in import tags. Relative paths will be resolved using the currently set ThreadContextClassLoader.

      Parameters:
      resourceName - the name to be used as fileName in the metadata of the generates ArtifactAst.
      appXmlConfigInputStream - the stream that will provide the XML content to be parsed.
      Returns:
      the ArtifactAst representation of the provided XML config.
    • parse

      ArtifactAst parse(String artifactName, URI... appXmlConfigUris)
      Generate a new ArtifactAst representation form the XML read from the provided uris.

      The parsing process will resolve references in import tags. Relative paths will be resolved using the currently set ThreadContextClassLoader.

      Parameters:
      artifactName - the name of the artifact to parse
      appXmlConfigUris - the uris that will provide the XML content to be parsed.
      Returns:
      the ArtifactAst representation of the provided XML config.
    • parse

      ArtifactAst parse(URI... appXmlConfigUris)
      Generate a new ArtifactAst representation form the XML read from the provided uris.

      The parsing process will resolve references in import tags. Relative paths will be resolved using the currently set ThreadContextClassLoader.

      Parameters:
      appXmlConfigUris - the uris that will provide the XML content to be parsed.
      Returns:
      the ArtifactAst representation of the provided XML config.
    • parse

      ArtifactAst parse(String artifactName, URL... appXmlConfigUrls)
      Generate a new ArtifactAst representation form the XML read from the provided urls.

      The parsing process will resolve references in import tags. Relative paths will be resolved using the currently set ThreadContextClassLoader.

      Parameters:
      artifactName - the name of the artifact to parse
      appXmlConfigUrls - the urls that will provide the XML content to be parsed.
      Returns:
      the ArtifactAst representation of the provided XML config.
    • parse

      ArtifactAst parse(URL... appXmlConfigUrls)
      Generate a new ArtifactAst representation form the XML read from the provided urls.

      The parsing process will resolve references in import tags. Relative paths will be resolved using the currently set ThreadContextClassLoader.

      Parameters:
      appXmlConfigUrls - the urls that will provide the XML content to be parsed.
      Returns:
      the ArtifactAst representation of the provided XML config.