org.scijava.util
Class POM

java.lang.Object
  extended by org.scijava.util.XML
      extended by org.scijava.util.POM
All Implemented Interfaces:
Comparable<POM>, Versioned

public class POM
extends XML
implements Comparable<POM>, Versioned

Helper class for working with Maven POMs.

Author:
Curtis Rueden

Constructor Summary
POM(File file)
          Parses a POM from the given file.
POM(InputStream in)
          Parses a POM from the given input stream.
POM(String s)
          Parses a POM from the given string.
POM(URL url)
          Parses a POM from the given URL.
 
Method Summary
 int compareTo(POM pom)
           
static int compareVersions(String v1, String v2)
          Compares two version strings.
static List<POM> getAllPOMs()
          Gets all available Maven POMs on the class path.
 String getArtifactId()
          Gets the POM's artifactId.
 String getGroupId()
          Gets the POM's groupId.
 String getOrganizationName()
          Gets the organization name.
 String getOrganizationURL()
          Gets the organization URL.
static POM getPOM(Class<?> c, String groupId, String artifactId)
          Gets the Maven POM associated with the given class.
 String getProjectDescription()
          Gets the project description.
 String getProjectInceptionYear()
          Gets the project inception year.
 String getProjectName()
          Gets the project name.
 String getProjectURL()
          Gets the project URL.
 String getVersion()
          Gets the POM's version.
 
Methods inherited from class org.scijava.util.XML
cdata, getDocument, getPath, loadXML, loadXML, toString, xpath
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

POM

public POM(File file)
    throws ParserConfigurationException,
           SAXException,
           IOException
Parses a POM from the given file.

Throws:
ParserConfigurationException
SAXException
IOException

POM

public POM(URL url)
    throws ParserConfigurationException,
           SAXException,
           IOException
Parses a POM from the given URL.

Throws:
ParserConfigurationException
SAXException
IOException

POM

public POM(InputStream in)
    throws ParserConfigurationException,
           SAXException,
           IOException
Parses a POM from the given input stream.

Throws:
ParserConfigurationException
SAXException
IOException

POM

public POM(String s)
    throws ParserConfigurationException,
           SAXException,
           IOException
Parses a POM from the given string.

Throws:
ParserConfigurationException
SAXException
IOException
Method Detail

getGroupId

public String getGroupId()
Gets the POM's groupId.


getArtifactId

public String getArtifactId()
Gets the POM's artifactId.


getProjectName

public String getProjectName()
Gets the project name.


getProjectDescription

public String getProjectDescription()
Gets the project description.


getProjectURL

public String getProjectURL()
Gets the project URL.


getProjectInceptionYear

public String getProjectInceptionYear()
Gets the project inception year.


getOrganizationName

public String getOrganizationName()
Gets the organization name.


getOrganizationURL

public String getOrganizationURL()
Gets the organization URL.


compareTo

public int compareTo(POM pom)
Specified by:
compareTo in interface Comparable<POM>

getVersion

public String getVersion()
Gets the POM's version.

Specified by:
getVersion in interface Versioned

getPOM

public static POM getPOM(Class<?> c,
                         String groupId,
                         String artifactId)
Gets the Maven POM associated with the given class.

Parameters:
c - The class to use as a base when searching for a pom.xml.
groupId - The Maven groupId of the desired POM.
artifactId - The Maven artifactId of the desired POM.

getAllPOMs

public static List<POM> getAllPOMs()
Gets all available Maven POMs on the class path.


compareVersions

public static int compareVersions(String v1,
                                  String v2)
Compares two version strings.

Given the variation between versioning styles, there is no single comparison method that can possibly be correct 100% of the time. So this method works on a "best effort" basis; YMMV.

The algorithm is as follows:

Returns:
a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
See Also:
Comparator.compare(Object, Object)


Copyright © 2009–2014 SciJava. All rights reserved.