Package org.apache.karaf.util.maven
Class Parser
- java.lang.Object
-
- org.apache.karaf.util.maven.Parser
-
public class Parser extends Object
Parser for mvn: protocol.- Since:
- August 10, 2007
- Author:
- Alin Dreghiciu, Toni Menzel
-
-
Field Summary
Fields Modifier and Type Field Description static StringFILE_SEPARATORFinal artifact path separator.static StringVERSION_LATESTDefault version if none present in the url.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetArtifact()Return the artifact id.StringgetArtifactLocalMetdataPath()Return the complete path to artifact local metadata file.StringgetArtifactMetdataPath()Return the complete path to artifact metadata file.StringgetArtifactPath()Return the complete path to artifact as stated by Maven 2 repository layout.StringgetArtifactPath(String version)Return the complete path to artifact as stated by Maven 2 repository layout.StringgetClassifier()Return the artifact classifier.StringgetGroup()Return the group id of the artifact.StringgetRepositoryURL()Return the repository URL if present, null otherwise.StringgetSnapshotPath(String version, String timestamp, String buildnumber)Return the complete path to artifact for a snapshot file.StringgetSnapshotVersion(String version, String timestamp, String buildnumber)Return the version for an artifact for a snapshot version.StringgetType()Return the artifact type.StringgetVersion()Return the artifact version.StringgetVersionLocalMetadataPath(String version)Return the path to local metadata file corresponding to this artifact version.StringgetVersionMetadataPath(String version)Return the path to metadata file corresponding to this artifact version.static StringpathFromMaven(String uri)Return the artifact path from the given maven uri.static StringpathFromMaven(String uri, String resolved)static StringpathToMaven(String location)static StringpathToMaven(String location, Map parts)voidsetArtifact(String m_artifact)Changes parsed artifact - to allow printing mvn: URI with changed artifactIdvoidsetClassifier(String m_classifier)Changes parsed classifier - to allow printing mvn: URI with changed classifiervoidsetGroup(String m_group)Changes parsed group - to allow printing mvn: URI with changed groupIdvoidsetType(String m_type)Changes parsed type - to allow printing mvn: URI with changed typevoidsetVersion(String m_version)Changes parsed version - to allow printing mvn: URI with changed versionStringtoMvnURI()Prints parsed mvn: URI (after possible change of any component)
-
-
-
Field Detail
-
VERSION_LATEST
public static final String VERSION_LATEST
Default version if none present in the url.- See Also:
- Constant Field Values
-
FILE_SEPARATOR
public static final String FILE_SEPARATOR
Final artifact path separator.- See Also:
- Constant Field Values
-
-
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.
-
pathFromMaven
public static String pathFromMaven(String uri, String resolved) throws MalformedURLException
- Throws:
MalformedURLException
-
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.
-
-