Class AbstractTychoMapping

  • All Implemented Interfaces:
    org.apache.maven.model.io.ModelReader, org.sonatype.maven.polyglot.mapping.Mapping
    Direct Known Subclasses:
    AbstractXMLTychoMapping, TychoAggregatorMapping, TychoBundleMapping

    public abstract class AbstractTychoMapping
    extends Object
    implements org.sonatype.maven.polyglot.mapping.Mapping, org.apache.maven.model.io.ModelReader
    Base implementation for a Mapping and ModelReader that handles all the low-level stuff, implementations must only handle a small subset
    • Field Detail

      • container

        @Requirement
        protected org.codehaus.plexus.PlexusContainer container
      • logger

        @Requirement
        protected org.codehaus.plexus.logging.Logger logger
    • Constructor Detail

      • AbstractTychoMapping

        public AbstractTychoMapping()
    • Method Detail

      • locatePom

        public File locatePom​(File dir)
        Specified by:
        locatePom in interface org.sonatype.maven.polyglot.mapping.Mapping
      • accept

        public boolean accept​(Map<String,​?> options)
        Specified by:
        accept in interface org.sonatype.maven.polyglot.mapping.Mapping
      • getReader

        public org.apache.maven.model.io.ModelReader getReader()
        Specified by:
        getReader in interface org.sonatype.maven.polyglot.mapping.Mapping
      • getWriter

        public org.apache.maven.model.io.ModelWriter getWriter()
        Specified by:
        getWriter in interface org.sonatype.maven.polyglot.mapping.Mapping
      • read

        public org.apache.maven.model.Model read​(InputStream input,
                                                 Map<String,​?> options)
                                          throws IOException,
                                                 org.apache.maven.model.io.ModelParseException
        Specified by:
        read in interface org.apache.maven.model.io.ModelReader
        Throws:
        IOException
        org.apache.maven.model.io.ModelParseException
      • read

        public org.apache.maven.model.Model read​(File input,
                                                 Map<String,​?> options)
                                          throws IOException,
                                                 org.apache.maven.model.io.ModelParseException
        Specified by:
        read in interface org.apache.maven.model.io.ModelReader
        Throws:
        IOException
        org.apache.maven.model.io.ModelParseException
      • read

        public org.apache.maven.model.Model read​(Reader input,
                                                 Map<String,​?> options)
                                          throws IOException,
                                                 org.apache.maven.model.io.ModelParseException
        Specified by:
        read in interface org.apache.maven.model.io.ModelReader
        Throws:
        IOException
        org.apache.maven.model.io.ModelParseException
      • getRealArtifactFile

        protected File getRealArtifactFile​(File polyglotArtifactFile)
      • findParent

        protected org.apache.maven.model.Parent findParent​(File projectRoot,
                                                           Map<String,​?> projectOptions)
                                                    throws org.apache.maven.model.io.ModelParseException,
                                                           IOException
        Throws:
        org.apache.maven.model.io.ModelParseException
        IOException
      • locatePomReference

        protected PomReference locatePomReference​(File folder,
                                                  String nameHint)
        Locates the PomReference for the given folder and the given nameHint
        Parameters:
        folder - the folder to search
        nameHint - the name hint to use
        Returns:
        the PomReference or null
      • getPriority

        public float getPriority()
        Specified by:
        getPriority in interface org.sonatype.maven.polyglot.mapping.Mapping
      • getFlavour

        public String getFlavour()
        Specified by:
        getFlavour in interface org.sonatype.maven.polyglot.mapping.Mapping
      • isValidLocation

        protected abstract boolean isValidLocation​(String location)
      • getPrimaryArtifact

        protected abstract File getPrimaryArtifact​(File dir)
      • getPackaging

        protected abstract String getPackaging()
      • getPrimaryArtifactCharset

        protected Charset getPrimaryArtifactCharset()
        returns the charset that should be used when reading artifact, default is UTF-8 might be overridden by subclasses
        Returns:
        the charset
      • initModel

        protected abstract void initModel​(org.apache.maven.model.Model model,
                                          Reader artifactReader,
                                          File artifactFile)
                                   throws org.apache.maven.model.io.ModelParseException,
                                          IOException
        Throws:
        org.apache.maven.model.io.ModelParseException
        IOException
      • getPomVersion

        protected static String getPomVersion​(String pdeVersion)