Class Parser


  • public class Parser
    extends Object
    Parser for mvn: protocol.
    Since:
    August 10, 2007
    Author:
    Alin Dreghiciu, Toni Menzel
    • Constructor Detail

      • Parser

        public Parser​(String path)
               throws MalformedURLException
        Creates a new protocol parser.
        Parameters:
        path - the path part of the url (without starting mvn:)
        Throws:
        MalformedURLException - if provided path does not comply to expected syntax or an malformed repository URL
    • Method Detail

      • pathFromMaven

        public static String pathFromMaven​(String uri)
                                    throws MalformedURLException
        Return the artifact path from the given maven uri.
        Parameters:
        uri - the Maven URI.
        Returns:
        the artifact actual path.
        Throws:
        MalformedURLException - in case of "bad" provided URL/URI.
      • pathToMaven

        public static String pathToMaven​(String location,
                                         Map parts)
      • pathToMaven

        public static String pathToMaven​(String location)
      • getRepositoryURL

        public String getRepositoryURL()
        Return the repository URL if present, null otherwise.
        Returns:
        repository URL.
      • toMvnURI

        public String toMvnURI()
        Prints parsed mvn: URI (after possible change of any component)
        Returns:
      • getGroup

        public String getGroup()
        Return the group id of the artifact.
        Returns:
        group ID.
      • getArtifact

        public String getArtifact()
        Return the artifact id.
        Returns:
        artifact id.
      • getVersion

        public String getVersion()
        Return the artifact version.
        Returns:
        version.
      • getType

        public String getType()
        Return the artifact type.
        Returns:
        type.
      • getClassifier

        public String getClassifier()
        Return the artifact classifier.
        Returns:
        classifier.
      • setGroup

        public void setGroup​(String m_group)
        Changes parsed group - to allow printing mvn: URI with changed groupId
        Parameters:
        m_group -
      • setArtifact

        public void setArtifact​(String m_artifact)
        Changes parsed artifact - to allow printing mvn: URI with changed artifactId
        Parameters:
        m_artifact -
      • setVersion

        public void setVersion​(String m_version)
        Changes parsed version - to allow printing mvn: URI with changed version
        Parameters:
        m_version -
      • setType

        public void setType​(String m_type)
        Changes parsed type - to allow printing mvn: URI with changed type
        Parameters:
        m_type -
      • setClassifier

        public void setClassifier​(String m_classifier)
        Changes parsed classifier - to allow printing mvn: URI with changed classifier
        Parameters:
        m_classifier -
      • getArtifactPath

        public String getArtifactPath()
        Return the complete path to artifact as stated by Maven 2 repository layout.
        Returns:
        artifact path.
      • getArtifactPath

        public String getArtifactPath​(String version)
        Return the complete path to artifact as stated by Maven 2 repository layout.
        Parameters:
        version - The version of the artifact.
        Returns:
        artifact path.
      • getSnapshotVersion

        public String getSnapshotVersion​(String version,
                                         String timestamp,
                                         String buildnumber)
        Return the version for an artifact for a snapshot version.
        Parameters:
        version - The version of the snapshot.
        timestamp - The timestamp of the snapshot.
        buildnumber - The buildnumber of the snapshot.
        Returns:
        artifact path.
      • getSnapshotPath

        public String getSnapshotPath​(String version,
                                      String timestamp,
                                      String buildnumber)
        Return the complete path to artifact for a snapshot file.
        Parameters:
        version - The version of the snapshot.
        timestamp - The timestamp of the snapshot.
        buildnumber - The buildnumber of the snapshot.
        Returns:
        artifact path.
      • getVersionMetadataPath

        public String getVersionMetadataPath​(String version)
        Return the path to metadata file corresponding to this artifact version.
        Parameters:
        version - The version of the the metadata.
        Returns:
        metadata file path.
      • getVersionLocalMetadataPath

        public String getVersionLocalMetadataPath​(String version)
        Return the path to local metadata file corresponding to this artifact version.
        Parameters:
        version - The version of the the metadata.
        Returns:
        metadata file path.
      • getArtifactLocalMetdataPath

        public String getArtifactLocalMetdataPath()
        Return the complete path to artifact local metadata file.
        Returns:
        artifact path.
      • getArtifactMetdataPath

        public String getArtifactMetdataPath()
        Return the complete path to artifact metadata file.
        Returns:
        artifact path.