org.ops4j.pax.construct.util
Class PomUtils

java.lang.Object
  extended by org.ops4j.pax.construct.util.PomUtils

public final class PomUtils
extends java.lang.Object

Provide API PomUtils.Pom and factory for editing Maven project files


Nested Class Summary
static class PomUtils.ExistingElementException
          Thrown when a POM element already exists and can't be overwritten PomUtils.Pom
static interface PomUtils.Pom
          API for editing Maven project files
 
Method Summary
static PomUtils.Pom createModulePom(java.io.File here, java.lang.String groupId, java.lang.String artifactId)
          Factory method that provides an editor for a new Maven project file
static boolean downloadFile(org.apache.maven.artifact.Artifact artifact, org.apache.maven.artifact.resolver.ArtifactResolver resolver, java.util.List remoteRepos, org.apache.maven.artifact.repository.ArtifactRepository localRepo)
          Look for the artifact in local and remote Maven repositories
static java.lang.String getCompoundId(java.lang.String groupId, java.lang.String artifactId)
          Try to combine overlapping group and artifact identifiers to remove duplicate elements
static boolean getFile(org.apache.maven.artifact.Artifact artifact, org.apache.maven.artifact.resolver.ArtifactResolver resolver, org.apache.maven.artifact.repository.ArtifactRepository localRepo)
          Look for the artifact in local Maven repository
static java.lang.String getMetaVersion(org.apache.maven.artifact.Artifact artifact)
          Find the symbolic (meta) Maven version, such as 1.0-SNAPSHOT
static java.lang.String getReleaseVersion(org.apache.maven.artifact.Artifact artifact, org.apache.maven.artifact.metadata.ArtifactMetadataSource source, java.util.List remoteRepos, org.apache.maven.artifact.repository.ArtifactRepository localRepo, org.apache.maven.artifact.versioning.VersionRange range)
           
static boolean isBundleArtifact(org.apache.maven.artifact.Artifact artifact, org.apache.maven.artifact.resolver.ArtifactResolver resolver, java.util.List remoteRepos, org.apache.maven.artifact.repository.ArtifactRepository localRepo, boolean testMetadata)
           
static boolean isBundleProject(org.apache.maven.project.MavenProject project)
           
static boolean isBundleProject(org.apache.maven.project.MavenProject project, org.apache.maven.artifact.resolver.ArtifactResolver resolver, java.util.List remoteRepos, org.apache.maven.artifact.repository.ArtifactRepository localRepo, boolean testMetadata)
           
static boolean isEmpty(java.lang.String param)
           
static boolean isNotEmpty(java.lang.String param)
           
static boolean needReleaseVersion(java.lang.String version)
           
static PomUtils.Pom readPom(java.io.File here)
          Factory method that provides an editor for an existing Maven project file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

readPom

public static PomUtils.Pom readPom(java.io.File here)
                            throws java.io.IOException
Factory method that provides an editor for an existing Maven project file

Parameters:
here - a Maven POM, or a directory containing a file named 'pom.xml'
Returns:
simple Maven project editor
Throws:
java.io.IOException

createModulePom

public static PomUtils.Pom createModulePom(java.io.File here,
                                           java.lang.String groupId,
                                           java.lang.String artifactId)
                                    throws java.io.IOException
Factory method that provides an editor for a new Maven project file

Parameters:
here - the file, or directory for the new Maven project
groupId - project group id
artifactId - project artifact id
Returns:
simple Maven project editor
Throws:
java.io.IOException

isBundleProject

public static boolean isBundleProject(org.apache.maven.project.MavenProject project)
Parameters:
project - Maven project
Returns:
true if this is an OSGi bundle project, otherwise false

isBundleProject

public static boolean isBundleProject(org.apache.maven.project.MavenProject project,
                                      org.apache.maven.artifact.resolver.ArtifactResolver resolver,
                                      java.util.List remoteRepos,
                                      org.apache.maven.artifact.repository.ArtifactRepository localRepo,
                                      boolean testMetadata)
Parameters:
project - Maven project
resolver - artifact resolver
remoteRepos - sequence of remote repositories
localRepo - local Maven repository
testMetadata - check jar manifest for OSGi attributes if true
Returns:
true if this is an OSGi bundle project, otherwise false

isBundleArtifact

public static boolean isBundleArtifact(org.apache.maven.artifact.Artifact artifact,
                                       org.apache.maven.artifact.resolver.ArtifactResolver resolver,
                                       java.util.List remoteRepos,
                                       org.apache.maven.artifact.repository.ArtifactRepository localRepo,
                                       boolean testMetadata)
Parameters:
artifact - Maven artifact
resolver - artifact resolver
remoteRepos - sequence of remote repositories
localRepo - local Maven repository
testMetadata - check jar manifest for OSGi attributes if true
Returns:
true if this is an OSGi bundle artifact, otherwise false

getFile

public static boolean getFile(org.apache.maven.artifact.Artifact artifact,
                              org.apache.maven.artifact.resolver.ArtifactResolver resolver,
                              org.apache.maven.artifact.repository.ArtifactRepository localRepo)
Look for the artifact in local Maven repository

Parameters:
artifact - Maven artifact
resolver - artifact resolver
localRepo - local Maven repository
Returns:
true if the artifact is available, otherwise false

downloadFile

public static boolean downloadFile(org.apache.maven.artifact.Artifact artifact,
                                   org.apache.maven.artifact.resolver.ArtifactResolver resolver,
                                   java.util.List remoteRepos,
                                   org.apache.maven.artifact.repository.ArtifactRepository localRepo)
Look for the artifact in local and remote Maven repositories

Parameters:
artifact - Maven artifact
resolver - artifact resolver
remoteRepos - sequence of remote repositories
localRepo - local Maven repository
Returns:
true if the artifact is available, otherwise false

getCompoundId

public static java.lang.String getCompoundId(java.lang.String groupId,
                                             java.lang.String artifactId)
Try to combine overlapping group and artifact identifiers to remove duplicate elements

Parameters:
groupId - project group id
artifactId - project artifact id
Returns:
the combined group and artifact sequence

getMetaVersion

public static java.lang.String getMetaVersion(org.apache.maven.artifact.Artifact artifact)
Find the symbolic (meta) Maven version, such as 1.0-SNAPSHOT

Parameters:
artifact - Maven artifact
Returns:
meta version for the artifact

needReleaseVersion

public static boolean needReleaseVersion(java.lang.String version)
Parameters:
version - project version
Returns:
true if we need to resolve this version

getReleaseVersion

public static java.lang.String getReleaseVersion(org.apache.maven.artifact.Artifact artifact,
                                                 org.apache.maven.artifact.metadata.ArtifactMetadataSource source,
                                                 java.util.List remoteRepos,
                                                 org.apache.maven.artifact.repository.ArtifactRepository localRepo,
                                                 org.apache.maven.artifact.versioning.VersionRange range)
                                          throws org.apache.maven.plugin.MojoExecutionException
Parameters:
artifact - Maven artifact
source - metadata source
remoteRepos - sequence of remote repositories
localRepo - local Maven repository
range - acceptable versions
Returns:
the release version if available, otherwise throws MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

isEmpty

public static boolean isEmpty(java.lang.String param)
Parameters:
param - Maven plugin parameter
Returns:
true if parameter is empty, otherwise false

isNotEmpty

public static boolean isNotEmpty(java.lang.String param)
Parameters:
param - Maven plugin parameter
Returns:
false if parameter is empty, otherwise true


Copyright © 2007-2008 OPS4J. All Rights Reserved.