KIE EAP - Maven plugin 6.1.0.Final

org.kie.integration.eap.maven.util
Class EAPArtifactUtils

java.lang.Object
  extended by org.kie.integration.eap.maven.util.EAPArtifactUtils

public class EAPArtifactUtils
extends Object

This class contains some artifact utils.


Field Summary
protected static Pattern JAR_NAME_PARSER_PATTERN
           
protected static Pattern PROPERTY_PATTERN
          The pattern for maven propoerties.
 
Constructor Summary
EAPArtifactUtils()
           
 
Method Summary
static org.sonatype.aether.artifact.Artifact cloneArtifact(org.sonatype.aether.artifact.Artifact a)
          Clones an artifact instance.
static org.sonatype.aether.artifact.Artifact createArtifact(String artifactCoordinates)
          Creates an artifact instance.
static org.sonatype.aether.artifact.Artifact createArtifact(String groupId, String artifactId, String version, String packaging)
          Creates an artifact instance.
static org.sonatype.aether.artifact.Artifact createArtifact(String groupId, String artifactId, String version, String packaging, String classifier)
          Creates an artifact instance.
static org.sonatype.aether.artifact.Artifact createProjectArtifact(org.apache.maven.project.MavenProject project)
           
static boolean equals(org.sonatype.aether.artifact.Artifact a1, org.sonatype.aether.artifact.Artifact a2)
          Check if two artifacts are equals.
static boolean equalsNoVersion(org.sonatype.aether.artifact.Artifact a1, org.sonatype.aether.artifact.Artifact a2)
          Check if two artifacts are equals except for the version coordinate.
static String[] extractArtifactCorrdinates(String artifactCoordinates)
          Extract the artifact properties for a given artifact string.
static org.apache.maven.model.Model generateModel(org.sonatype.aether.artifact.Artifact artifact)
          Generates a model for a given artifact.
static String getArtifactCoordinates(org.apache.maven.artifact.Artifact artifact)
          Returns the artifact with all coordinates - groupId:artifactId:type[:classifier]:version TODO: Use maven API?
static String getArtifactCoordinates(org.sonatype.aether.artifact.Artifact artifact)
          Returns the artifact with all coordinates - groupId:artifactId:type[:classifier]:version TODO: Use maven API?
static String getArtifactCoordinatesWithoutVersion(org.sonatype.aether.artifact.Artifact artifact)
          Returns the artifact with all coordinates exception the version one - groupId:artifactId:type[:classifier]
static String getArtifactShortCoordinates(String artifactCoords)
          Returns the artifact with gropupId and artifactId coordinates - groupId:artifactId TODO: Use maven API?
static org.sonatype.aether.graph.DependencyNode getDependencyGraph(org.sonatype.aether.artifact.Artifact rootArtifact, org.sonatype.aether.RepositorySystem repoSystem, org.sonatype.aether.RepositorySystemSession repoSession, List<org.sonatype.aether.repository.RemoteRepository> remoteRepos, boolean includeOptionalDependencies)
          Generates the dependency graph for an artifact.
static EAPModuleGraphNode getNodeWithResource(org.sonatype.aether.artifact.Artifact artifact, EAPModulesGraph graph)
           
static String getPropertyValue(org.apache.maven.model.Model model, String propertyValue)
          Obtain the property value when using a property as a value.
static Collection<EAPStaticModuleDependency> getStaticDependencies(org.sonatype.aether.artifact.Artifact moduleArtifact, org.apache.maven.model.Model moduleModel, String moduleDependenciesRaw)
           
static String getUID(String name, String slot)
           
static boolean isArtifactExcludedInModule(EAPModule module, org.sonatype.aether.artifact.Artifact artifact)
           
static boolean isVersionEqualsThan(org.apache.maven.artifact.versioning.ComparableVersion version1, org.apache.maven.artifact.versioning.ComparableVersion version2)
           
static boolean isVersionGreaterThan(org.apache.maven.artifact.versioning.ComparableVersion version1, org.apache.maven.artifact.versioning.ComparableVersion version2)
           
static boolean isVersionLowerThan(org.apache.maven.artifact.versioning.ComparableVersion version1, org.apache.maven.artifact.versioning.ComparableVersion version2)
           
static String[] parseFileName(String fileName)
          Parses a jar resource name.
static org.sonatype.aether.artifact.Artifact resolveArtifact(org.sonatype.aether.artifact.Artifact art, org.sonatype.aether.RepositorySystem repoSystem, org.sonatype.aether.RepositorySystemSession repoSession, List<org.sonatype.aether.repository.RemoteRepository> remoteRepos)
          Resolves an artifact in remote repositories.
static org.sonatype.aether.artifact.Artifact resolveArtifact(String groupId, String artifactId, String version, String packaging, org.sonatype.aether.RepositorySystem repoSystem, org.sonatype.aether.RepositorySystemSession repoSession, List<org.sonatype.aether.repository.RemoteRepository> remoteRepos)
          Resolves an artifact in remote repositories.
static org.sonatype.aether.artifact.Artifact resolveArtifact(String groupId, String artifactId, String version, String packaging, String classifier, org.sonatype.aether.RepositorySystem repoSystem, org.sonatype.aether.RepositorySystemSession repoSession, List<org.sonatype.aether.repository.RemoteRepository> remoteRepos)
          Resolves an artifact in remote repositories.
static org.sonatype.aether.artifact.Artifact toArtifact(org.sonatype.aether.graph.Dependency dependency)
           
static void toArtifacts(EAPArtifactsHolder holder, Collection<? extends org.sonatype.aether.graph.DependencyNode> nodes, org.sonatype.aether.graph.DependencyFilter filter)
           
static void toArtifacts(EAPArtifactsHolder holder, Collection<? extends org.sonatype.aether.graph.DependencyNode> nodes, org.sonatype.aether.graph.DependencyFilter filter, int depth)
           
static void toArtifacts(EAPArtifactsHolder holder, Collection<? extends org.sonatype.aether.graph.DependencyNode> nodes, org.sonatype.aether.graph.DependencyFilter filter, int depth, int currentDepth)
           
static String toSnaphostVersion(org.sonatype.aether.artifact.Artifact artifact)
           
static String toSnaphostVersion(org.apache.maven.artifact.Artifact artifact)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_PATTERN

protected static final Pattern PROPERTY_PATTERN
The pattern for maven propoerties.


JAR_NAME_PARSER_PATTERN

protected static final Pattern JAR_NAME_PARSER_PATTERN
Constructor Detail

EAPArtifactUtils

public EAPArtifactUtils()
Method Detail

createArtifact

public static org.sonatype.aether.artifact.Artifact createArtifact(String groupId,
                                                                   String artifactId,
                                                                   String version,
                                                                   String packaging)
Creates an artifact instance.

Parameters:
groupId - The artifact's groupId.
artifactId - The artifact's artifactId.
version - The artifact's version.
packaging - The artifact's packaging.
Returns:
The artifact instance.

createArtifact

public static org.sonatype.aether.artifact.Artifact createArtifact(String artifactCoordinates)
Creates an artifact instance.

Parameters:
artifactCoordinates - The artifact's coordinates..
Returns:
The artifact instance.

createArtifact

public static org.sonatype.aether.artifact.Artifact createArtifact(String groupId,
                                                                   String artifactId,
                                                                   String version,
                                                                   String packaging,
                                                                   String classifier)
Creates an artifact instance.

Parameters:
groupId - The artifact's groupId.
artifactId - The artifact's artifactId.
version - The artifact's version.
packaging - The artifact's packaging.
classifier - The artifact's classifier.
Returns:
The artifact instance.

resolveArtifact

public static org.sonatype.aether.artifact.Artifact resolveArtifact(String groupId,
                                                                    String artifactId,
                                                                    String version,
                                                                    String packaging,
                                                                    String classifier,
                                                                    org.sonatype.aether.RepositorySystem repoSystem,
                                                                    org.sonatype.aether.RepositorySystemSession repoSession,
                                                                    List<org.sonatype.aether.repository.RemoteRepository> remoteRepos)
                                                             throws org.sonatype.aether.resolution.ArtifactResolutionException
Resolves an artifact in remote repositories.

Parameters:
groupId - The artifact's groupId.
artifactId - The artifact's artifactId.
version - The artifact's version.
packaging - The artifact's packaging.
classifier - The artifact's classifier..
Returns:
The artifact resolved.
Throws:
org.sonatype.aether.resolution.ArtifactResolutionException

resolveArtifact

public static org.sonatype.aether.artifact.Artifact resolveArtifact(String groupId,
                                                                    String artifactId,
                                                                    String version,
                                                                    String packaging,
                                                                    org.sonatype.aether.RepositorySystem repoSystem,
                                                                    org.sonatype.aether.RepositorySystemSession repoSession,
                                                                    List<org.sonatype.aether.repository.RemoteRepository> remoteRepos)
                                                             throws org.sonatype.aether.resolution.ArtifactResolutionException
Resolves an artifact in remote repositories.

Parameters:
groupId - The artifact's groupId.
artifactId - The artifact's artifactId.
version - The artifact's version.
packaging - The artifact's packaging..
Returns:
The artifact resolved.
Throws:
org.sonatype.aether.resolution.ArtifactResolutionException

resolveArtifact

public static org.sonatype.aether.artifact.Artifact resolveArtifact(org.sonatype.aether.artifact.Artifact art,
                                                                    org.sonatype.aether.RepositorySystem repoSystem,
                                                                    org.sonatype.aether.RepositorySystemSession repoSession,
                                                                    List<org.sonatype.aether.repository.RemoteRepository> remoteRepos)
                                                             throws org.sonatype.aether.resolution.ArtifactResolutionException
Resolves an artifact in remote repositories.

Parameters:
art - The artifact to resolve.
Returns:
The artifact resolved.
Throws:
org.sonatype.aether.resolution.ArtifactResolutionException

equals

public static boolean equals(org.sonatype.aether.artifact.Artifact a1,
                             org.sonatype.aether.artifact.Artifact a2)
Check if two artifacts are equals. The equality is done by comparing artifact coordinates.

Parameters:
a1 - The artifact.
a2 - The other artifact.
Returns:
Are artifact coordinates equals.

equalsNoVersion

public static boolean equalsNoVersion(org.sonatype.aether.artifact.Artifact a1,
                                      org.sonatype.aether.artifact.Artifact a2)
Check if two artifacts are equals except for the version coordinate. The equality is done by comparing artifact coordinates.

Parameters:
a1 - The artifact.
a2 - The other artifact.
Returns:
Are artifact coordinates equals (except for version coordinate).

cloneArtifact

public static org.sonatype.aether.artifact.Artifact cloneArtifact(org.sonatype.aether.artifact.Artifact a)
Clones an artifact instance. Only clones the coordinates: - groupId - artifactId - version - type

Parameters:
a - The artifact to clone.
Returns:
The cloned artifact.

extractArtifactCorrdinates

public static String[] extractArtifactCorrdinates(String artifactCoordinates)
Extract the artifact properties for a given artifact string. TODO: Use maven API?

Parameters:
artifactCoordinates - The artifact string.
Returns:
The artifact properties.

getArtifactCoordinates

public static String getArtifactCoordinates(org.apache.maven.artifact.Artifact artifact)
Returns the artifact with all coordinates - groupId:artifactId:type[:classifier]:version TODO: Use maven API?

Parameters:
artifact - The artifact.
Returns:
The artifact coordinates.

getArtifactCoordinates

public static String getArtifactCoordinates(org.sonatype.aether.artifact.Artifact artifact)
Returns the artifact with all coordinates - groupId:artifactId:type[:classifier]:version TODO: Use maven API?

Parameters:
artifact - The artifact.
Returns:
The artifact coordinates.

getArtifactCoordinatesWithoutVersion

public static String getArtifactCoordinatesWithoutVersion(org.sonatype.aether.artifact.Artifact artifact)
Returns the artifact with all coordinates exception the version one - groupId:artifactId:type[:classifier]

Parameters:
artifact - The artifact.
Returns:
The artifact coordinates without the version one.

toSnaphostVersion

public static String toSnaphostVersion(org.sonatype.aether.artifact.Artifact artifact)

toSnaphostVersion

public static String toSnaphostVersion(org.apache.maven.artifact.Artifact artifact)

getArtifactShortCoordinates

public static String getArtifactShortCoordinates(String artifactCoords)
Returns the artifact with gropupId and artifactId coordinates - groupId:artifactId TODO: Use maven API?

Parameters:
artifactCoords - The artifact coordinates..
Returns:
The artifact short coordinates.

generateModel

public static org.apache.maven.model.Model generateModel(org.sonatype.aether.artifact.Artifact artifact)
                                                  throws IOException,
                                                         org.codehaus.plexus.util.xml.pull.XmlPullParserException
Generates a model for a given artifact.

Parameters:
artifact - The artifact.
Returns:
The model for this artifact's pom file.
Throws:
IOException - Pom file cannot be readed.
org.codehaus.plexus.util.xml.pull.XmlPullParserException - Pom file cannot be parsed.

getPropertyValue

public static String getPropertyValue(org.apache.maven.model.Model model,
                                      String propertyValue)
Obtain the property value when using a property as a value. TODO: Use Maven API?

Parameters:
model -
propertyValue -
Returns:

toArtifacts

public static void toArtifacts(EAPArtifactsHolder holder,
                               Collection<? extends org.sonatype.aether.graph.DependencyNode> nodes,
                               org.sonatype.aether.graph.DependencyFilter filter)

toArtifacts

public static void toArtifacts(EAPArtifactsHolder holder,
                               Collection<? extends org.sonatype.aether.graph.DependencyNode> nodes,
                               org.sonatype.aether.graph.DependencyFilter filter,
                               int depth)

toArtifacts

public static void toArtifacts(EAPArtifactsHolder holder,
                               Collection<? extends org.sonatype.aether.graph.DependencyNode> nodes,
                               org.sonatype.aether.graph.DependencyFilter filter,
                               int depth,
                               int currentDepth)

toArtifact

public static org.sonatype.aether.artifact.Artifact toArtifact(org.sonatype.aether.graph.Dependency dependency)

getDependencyGraph

public static org.sonatype.aether.graph.DependencyNode getDependencyGraph(org.sonatype.aether.artifact.Artifact rootArtifact,
                                                                          org.sonatype.aether.RepositorySystem repoSystem,
                                                                          org.sonatype.aether.RepositorySystemSession repoSession,
                                                                          List<org.sonatype.aether.repository.RemoteRepository> remoteRepos,
                                                                          boolean includeOptionalDependencies)
                                                                   throws org.sonatype.aether.collection.DependencyCollectionException,
                                                                          org.sonatype.aether.resolution.DependencyResolutionException
Generates the dependency graph for an artifact.

Parameters:
rootArtifact - The artifact to generate the dependency graph.
Returns:
The artifact dependency graph.
Throws:
org.sonatype.aether.collection.DependencyCollectionException
org.sonatype.aether.resolution.DependencyResolutionException

createProjectArtifact

public static org.sonatype.aether.artifact.Artifact createProjectArtifact(org.apache.maven.project.MavenProject project)

getUID

public static String getUID(String name,
                            String slot)

getNodeWithResource

public static EAPModuleGraphNode getNodeWithResource(org.sonatype.aether.artifact.Artifact artifact,
                                                     EAPModulesGraph graph)

parseFileName

public static String[] parseFileName(String fileName)
Parses a jar resource name. Extract artifactId and version coordinates.

Parameters:
fileName - the jar file name.
Returns:

isArtifactExcludedInModule

public static boolean isArtifactExcludedInModule(EAPModule module,
                                                 org.sonatype.aether.artifact.Artifact artifact)

getStaticDependencies

public static Collection<EAPStaticModuleDependency> getStaticDependencies(org.sonatype.aether.artifact.Artifact moduleArtifact,
                                                                          org.apache.maven.model.Model moduleModel,
                                                                          String moduleDependenciesRaw)
                                                                   throws EAPModuleDefinitionException
Throws:
EAPModuleDefinitionException

isVersionEqualsThan

public static boolean isVersionEqualsThan(org.apache.maven.artifact.versioning.ComparableVersion version1,
                                          org.apache.maven.artifact.versioning.ComparableVersion version2)

isVersionGreaterThan

public static boolean isVersionGreaterThan(org.apache.maven.artifact.versioning.ComparableVersion version1,
                                           org.apache.maven.artifact.versioning.ComparableVersion version2)

isVersionLowerThan

public static boolean isVersionLowerThan(org.apache.maven.artifact.versioning.ComparableVersion version1,
                                         org.apache.maven.artifact.versioning.ComparableVersion version2)

KIE EAP - Maven plugin 6.1.0.Final

Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.