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 java.lang.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 Summary

      Fields 
      Modifier and Type Field Description
      protected org.codehaus.plexus.PlexusContainer container  
      protected org.codehaus.plexus.logging.Logger logger  
      private static java.lang.String MODEL_PARENT  
      private static java.lang.String PARENT_POM_DEFAULT_VALUE  
      private static java.lang.String QUALIFIER_SUFFIX  
      private static java.lang.String TYCHO_POMLESS_PARENT  
      private org.apache.maven.model.io.ModelWriter writer  
      • Fields inherited from interface org.sonatype.maven.polyglot.mapping.Mapping

        ARTIFACT_ID_PROPERTY, DESCRIPTION_PROPERTY, GROUP_ID_PROPERTY, NAME_PROPERTY, PACKAGING_PROPERTY, PROPERTY_PREFIX, URL_PROPERTY, VERSION_PROPERTY
      • Fields inherited from interface org.apache.maven.model.io.ModelReader

        INPUT_SOURCE, IS_STRICT
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean accept​(java.util.Map<java.lang.String,​?> options)  
      protected org.apache.maven.model.Parent findParent​(java.io.File projectRoot, java.util.Map<java.lang.String,​?> projectOptions)  
      protected static java.util.Properties getBuildProperties​(java.io.File dir)  
      java.util.Properties getEnhancementProperties​(java.util.Map<java.lang.String,​?> options)  
      java.lang.String getFlavour()  
      protected abstract java.lang.String getPackaging()  
      protected static java.lang.String getPomVersion​(java.lang.String pdeVersion)  
      protected abstract java.io.File getPrimaryArtifact​(java.io.File dir)  
      protected java.nio.charset.Charset getPrimaryArtifactCharset()
      returns the charset that should be used when reading artifact, default is UTF-8 might be overridden by subclasses
      float getPriority()  
      org.apache.maven.model.io.ModelReader getReader()  
      protected java.io.File getRealArtifactFile​(java.io.File polyglotArtifactFile)  
      org.apache.maven.model.io.ModelWriter getWriter()  
      protected abstract void initModel​(org.apache.maven.model.Model model, java.io.Reader artifactReader, java.io.File artifactFile)  
      protected abstract boolean isValidLocation​(java.lang.String location)  
      java.io.File locatePom​(java.io.File dir)  
      protected PomReference locatePomReference​(java.io.File folder, java.lang.String nameHint)
      Locates the PomReference for the given folder and the given nameHint
      org.apache.maven.model.Model read​(java.io.File input, java.util.Map<java.lang.String,​?> options)  
      org.apache.maven.model.Model read​(java.io.InputStream input, java.util.Map<java.lang.String,​?> options)  
      private org.apache.maven.model.Model read​(java.io.Reader artifactReader, java.io.File artifactFile, java.util.Map<java.lang.String,​?> options)  
      org.apache.maven.model.Model read​(java.io.Reader input, java.util.Map<java.lang.String,​?> options)  
      private static void setLocation​(org.apache.maven.model.Model model, java.io.File modelSource)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • TYCHO_POMLESS_PARENT

        private static final java.lang.String TYCHO_POMLESS_PARENT
        See Also:
        Constant Field Values
      • PARENT_POM_DEFAULT_VALUE

        private static final java.lang.String PARENT_POM_DEFAULT_VALUE
      • QUALIFIER_SUFFIX

        private static final java.lang.String QUALIFIER_SUFFIX
        See Also:
        Constant Field Values
      • container

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

        @Requirement
        protected org.codehaus.plexus.logging.Logger logger
      • writer

        private org.apache.maven.model.io.ModelWriter writer
    • Constructor Detail

      • AbstractTychoMapping

        public AbstractTychoMapping()
    • Method Detail

      • locatePom

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

        public boolean accept​(java.util.Map<java.lang.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​(java.io.InputStream input,
                                                 java.util.Map<java.lang.String,​?> options)
                                          throws java.io.IOException,
                                                 org.apache.maven.model.io.ModelParseException
        Specified by:
        read in interface org.apache.maven.model.io.ModelReader
        Throws:
        java.io.IOException
        org.apache.maven.model.io.ModelParseException
      • read

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

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

        private org.apache.maven.model.Model read​(java.io.Reader artifactReader,
                                                  java.io.File artifactFile,
                                                  java.util.Map<java.lang.String,​?> options)
                                           throws org.apache.maven.model.io.ModelParseException,
                                                  java.io.IOException
        Throws:
        org.apache.maven.model.io.ModelParseException
        java.io.IOException
      • getRealArtifactFile

        protected java.io.File getRealArtifactFile​(java.io.File polyglotArtifactFile)
      • findParent

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

        protected PomReference locatePomReference​(java.io.File folder,
                                                  java.lang.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 java.lang.String getFlavour()
        Specified by:
        getFlavour in interface org.sonatype.maven.polyglot.mapping.Mapping
      • isValidLocation

        protected abstract boolean isValidLocation​(java.lang.String location)
      • getPrimaryArtifact

        protected abstract java.io.File getPrimaryArtifact​(java.io.File dir)
      • getPackaging

        protected abstract java.lang.String getPackaging()
      • getPrimaryArtifactCharset

        protected java.nio.charset.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,
                                          java.io.Reader artifactReader,
                                          java.io.File artifactFile)
                                   throws org.apache.maven.model.io.ModelParseException,
                                          java.io.IOException
        Throws:
        org.apache.maven.model.io.ModelParseException
        java.io.IOException
      • getBuildProperties

        protected static java.util.Properties getBuildProperties​(java.io.File dir)
                                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • getEnhancementProperties

        public java.util.Properties getEnhancementProperties​(java.util.Map<java.lang.String,​?> options)
        Specified by:
        getEnhancementProperties in interface org.sonatype.maven.polyglot.mapping.Mapping
      • setLocation

        private static void setLocation​(org.apache.maven.model.Model model,
                                        java.io.File modelSource)
      • getPomVersion

        protected static java.lang.String getPomVersion​(java.lang.String pdeVersion)