Class XmlMappingLoader

java.lang.Object
org.openehealth.ipf.commons.map.xml.XmlMappingLoader
All Implemented Interfaces:
MappingLoader

public class XmlMappingLoader extends Object implements MappingLoader
MappingLoader for *.mapping.xml files, the recommended format for IPF's own mappings.

Every file is validated against META-INF/ipf/mapping.xsd as it is read, so an unknown element, an unknown attribute or a misspelt one is an error at startup with a line and a column. The two constraints the schema language cannot express, that mode="fixed" needs a value and mode="function" a registered function, are checked here.

Since:
6.0
  • Field Details

    • EXTENSION

      public static final String EXTENSION
      File extension this loader claims. Two-part on purpose: .xml alone says nothing about which of the many XML formats in healthcare integration a file holds.
      See Also:
    • FORMAT

      public static final String FORMAT
      Format id under which this loader can be selected explicitly.
      See Also:
  • Constructor Details

    • XmlMappingLoader

      public XmlMappingLoader()
  • Method Details

    • format

      public String format()
      Description copied from interface: MappingLoader
      Short, stable identifier of the format this loader reads, e.g. xml, yaml or conceptmap-r4-json. It is what a caller names to select this loader regardless of the source's file extension, and it is compared case-insensitively.

      Two loaders on one classpath must not share a format id, since the id is what picks one of them; qualify it the way conceptmap-r4-json does when a format has versions or encodings that a second loader might read.

      Specified by:
      format in interface MappingLoader
      Returns:
      the format id, never null or blank
    • supports

      public boolean supports(URI source)
      Description copied from interface: MappingLoader
      Whether this loader claims a source that nobody named a format for. Implementations decide by file extension: a source it cannot recognize from its name alone is not its own, even if it could read the content, because that is what keeps dispatch predictable.
      Specified by:
      supports in interface MappingLoader
      Parameters:
      source - location of the mapping source, used for its file extension
      Returns:
      whether this loader can read the given source
    • load

      public List<Mapping> load(InputStream in, URI source, MappingFunctionRegistry functions)
      Description copied from interface: MappingLoader
      Reads all mappings contained in one source document.
      Specified by:
      load in interface MappingLoader
      Parameters:
      in - the source content; the caller closes the stream
      source - location of the source, for diagnostics
      functions - registry a loader may add functions to, and against which it should validate any Unmatched.Computed reference it produces
      Returns:
      the mappings read, in declaration order