Interface RtParser


public interface RtParser
The Parser for the source files collected from the repository. Implementations of this interface can support a specific language, binary content or parse generic text files. New instances of this class are created for each source file to be parsed. The parsing engine ensures that only a single parser instance is used by a single thread at the same time. Used to parse links and the associated elements from the source files. The typical link format is described in RtParsingContext.parseLinks(java.lang.String, com.siemens.polarion.rt.parsers.api.model.RtPosition)

Users who want to create a custom parser should implement this interface. Each implementation class should define a no-argument constructor. To include a custom parser, users should add the parser element to the com.siemens.polarion.rt.parsers extension point in the plugin.xml file.
 
 <extension point="com.siemens.polarion.rt.parsers">
    <parser
          class="com.example.parsers.CustomParser"
          descriptor="com.example.parsers.CustomParserDescriptor"
          name="com.example.parsers.custom">
    </parser>
 </extension>
 
 
Attributes in the parser element are defined as follows:
class the full name of the class that provides the parsing capability. This class should implement RtParser
descriptor the full name of the class that defines the parser's descriptor. This class should implement RtParserDescriptor
name the name of the provided parser. Each custom parser should have a unique name. It should be prefixed with the company's domain name and contain a unique parser id.
Since:
3.17.0
  • Method Summary

    Modifier and Type
    Method
    Description
    Parses the source file RtParsingContext.getFile() that is accessible from the parsing context and returns the collection of elements from the parsed target with the associated link objects RtLink
  • Method Details

    • parse

      @NotNull List<RtElement> parse(@NotNull RtParsingContext context) throws RtParsingException
      Parses the source file RtParsingContext.getFile() that is accessible from the parsing context and returns the collection of elements from the parsed target with the associated link objects RtLink
      Parameters:
      context - the associated context that provides the source file, the parser configuration, the link and element builders and the logging facility.
      Returns:
      the list of elements from the parsed target.
      Throws:
      RtParsingException - the exception that could not be handled by parser implementation. The parsing engine ensures that exceptions will be handled and will not stop the parsing of other files.