Class Artifact
- java.lang.Object
-
- org.apache.sling.provisioning.model.Traceable
-
- org.apache.sling.provisioning.model.Commentable
-
- org.apache.sling.provisioning.model.Artifact
-
- All Implemented Interfaces:
java.lang.Comparable
public class Artifact extends Commentable implements java.lang.Comparable
Description of an artifact. An artifact is described by it's Apache Maven coordinates consisting of group id, artifact id, and version. In addition, the classifier and type can be specified as well. If no type is specified, "jar" is assumed. An artifact can have any metadata.
-
-
Constructor Summary
Constructors Constructor Description Artifact(java.lang.String gId, java.lang.String aId, java.lang.String version, java.lang.String classifier, java.lang.String type)
Create a new artifact objectArtifact(java.lang.String gId, java.lang.String aId, java.lang.String version, java.lang.String classifier, java.lang.String type, java.util.Map<java.lang.String,java.lang.String> metadata)
Create a new artifact object
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(java.lang.Object o)
boolean
equals(java.lang.Object o)
static Artifact
fromMvnUrl(java.lang.String url)
Create a new artifact from a maven url, 'mvn:' [ repository-url '!' ] group-id '/' artifact-id [ '/' [version] [ '/' [type] [ '/' classifier ] ] ] ]java.lang.String
getArtifactId()
Return the artifact id.java.lang.String
getClassifier()
Return the optional classifier.java.lang.String
getGroupId()
Return the group id.java.util.Map<java.lang.String,java.lang.String>
getMetadata()
Get the metadata of the artifact.java.lang.String
getRepositoryPath()
Create a Maven like relative repository path.java.lang.String
getType()
Return the type.java.lang.String
getVersion()
Return the version.int
hashCode()
java.lang.String
toMvnUrl()
Return a mvn urljava.lang.String
toString()
-
Methods inherited from class org.apache.sling.provisioning.model.Commentable
getComment, setComment
-
Methods inherited from class org.apache.sling.provisioning.model.Traceable
getLocation, setLocation
-
-
-
-
Constructor Detail
-
Artifact
public Artifact(java.lang.String gId, java.lang.String aId, java.lang.String version, java.lang.String classifier, java.lang.String type)
Create a new artifact object- Parameters:
gId
- The group id (required)aId
- The artifact id (required)version
- The version (required)classifier
- The classifier (optional)type
- The type/extension (optional, defaults to jar)
-
Artifact
public Artifact(java.lang.String gId, java.lang.String aId, java.lang.String version, java.lang.String classifier, java.lang.String type, java.util.Map<java.lang.String,java.lang.String> metadata)
Create a new artifact object- Parameters:
gId
- The group id (required)aId
- The artifact id (required)version
- The version (required)classifier
- The classifier (optional)type
- The type/extension (optional, defaults to jar)metadata
- The metadata associated with the Artifact
-
-
Method Detail
-
fromMvnUrl
public static Artifact fromMvnUrl(java.lang.String url)
Create a new artifact from a maven url, 'mvn:' [ repository-url '!' ] group-id '/' artifact-id [ '/' [version] [ '/' [type] [ '/' classifier ] ] ] ]- Parameters:
url
- The url- Returns:
- A new artifact
- Throws:
java.lang.IllegalArgumentException
- If the url is not valid
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
compareTo
public int compareTo(java.lang.Object o)
- Specified by:
compareTo
in interfacejava.lang.Comparable
-
toMvnUrl
public java.lang.String toMvnUrl()
Return a mvn url- Returns:
- A mvn url
- See Also:
fromMvnUrl(String)
-
getGroupId
public java.lang.String getGroupId()
Return the group id.- Returns:
- The group id.
-
getArtifactId
public java.lang.String getArtifactId()
Return the artifact id.- Returns:
- The artifact id.
-
getVersion
public java.lang.String getVersion()
Return the version.- Returns:
- The version.
-
getClassifier
public java.lang.String getClassifier()
Return the optional classifier.- Returns:
- The classifier or null.
-
getType
public java.lang.String getType()
Return the type.- Returns:
- The type.
-
getMetadata
public java.util.Map<java.lang.String,java.lang.String> getMetadata()
Get the metadata of the artifact.- Returns:
- The metadata.
-
getRepositoryPath
public java.lang.String getRepositoryPath()
Create a Maven like relative repository path.- Returns:
- A relative repository path.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classCommentable
-
-