Class DoapUtil

java.lang.Object
org.apache.maven.plugin.doap.DoapUtil

public class DoapUtil extends Object
Utility class for DoapMojo class.
Since:
1.0
Author:
Vincent Siveton
  • Field Details

  • Constructor Details

    • DoapUtil

      public DoapUtil()
  • Method Details

    • writeHeader

      public static void writeHeader(org.codehaus.plexus.util.xml.XMLWriter writer)
      Write comments in the DOAP file header
      Parameters:
      writer - not null
    • writeComment

      public static void writeComment(org.codehaus.plexus.util.xml.XMLWriter writer, String comment) throws IllegalArgumentException
      Write comment.
      Parameters:
      writer - not null
      comment - not null
      Throws:
      IllegalArgumentException - if comment is null or empty
      Since:
      1.1
    • writeElement

      public static void writeElement(org.codehaus.plexus.util.xml.XMLWriter writer, String xmlnsPrefix, String name, String value) throws IllegalArgumentException
      Parameters:
      writer - not null
      xmlnsPrefix - could be null
      name - not null
      value - could be null. In this case, the element is not written.
      Throws:
      IllegalArgumentException - if name is null or empty
    • writeElement

      public static void writeElement(org.codehaus.plexus.util.xml.XMLWriter writer, String xmlnsPrefix, String name, String value, String lang) throws IllegalArgumentException
      Parameters:
      writer - not null
      xmlnsPrefix - could be null
      name - not null
      value - could be null. In this case, the element is not written.
      lang - not null
      Throws:
      IllegalArgumentException - if name is null or empty
    • writeStartElement

      public static void writeStartElement(org.codehaus.plexus.util.xml.XMLWriter writer, String xmlnsPrefix, String name) throws IllegalArgumentException
      Parameters:
      writer - not null
      xmlnsPrefix - could be null
      name - not null
      Throws:
      IllegalArgumentException - if name is null or empty
      Since:
      1.1
    • writeRdfResourceElement

      public static void writeRdfResourceElement(org.codehaus.plexus.util.xml.XMLWriter writer, String xmlnsPrefix, String name, String value) throws IllegalArgumentException
      Parameters:
      writer - not null
      xmlnsPrefix - could be null
      name - not null
      value - could be null. In this case, the element is not written.
      Throws:
      IllegalArgumentException - if name is null or empty
    • writeRdfNodeIdElement

      public static void writeRdfNodeIdElement(org.codehaus.plexus.util.xml.XMLWriter writer, String xmlnsPrefix, String name, String value) throws IllegalArgumentException
      Parameters:
      writer - not null
      name - not null
      value - could be null. In this case, the element is not written.
      Throws:
      IllegalArgumentException - if name is null or empty
    • getContributorsWithDeveloperRole

      public static List<org.apache.maven.model.Contributor> getContributorsWithDeveloperRole(org.codehaus.plexus.i18n.I18N i18n, List<org.apache.maven.model.Contributor> developersOrContributors)
      Parameters:
      i18n - the internationalization component
      developersOrContributors - list of Contributor
      Returns:
      a none null list of Contributor which have a developer DOAP role.
    • getContributorsWithDocumenterRole

      public static List<org.apache.maven.model.Contributor> getContributorsWithDocumenterRole(org.codehaus.plexus.i18n.I18N i18n, List<org.apache.maven.model.Contributor> developersOrContributors)
      Parameters:
      i18n - the internationalization component
      developersOrContributors - list of Contributor
      Returns:
      a none null list of Contributor which have a documenter DOAP role.
    • getContributorsWithHelperRole

      public static List<org.apache.maven.model.Contributor> getContributorsWithHelperRole(org.codehaus.plexus.i18n.I18N i18n, List<org.apache.maven.model.Contributor> developersOrContributors)
      Parameters:
      i18n - the internationalization component
      developersOrContributors - list of Contributor
      Returns:
      a none null list of Contributor which have an helper DOAP role.
    • getContributorsWithMaintainerRole

      public static List<org.apache.maven.model.Contributor> getContributorsWithMaintainerRole(org.codehaus.plexus.i18n.I18N i18n, List<org.apache.maven.model.Contributor> developersOrContributors)
      Parameters:
      i18n - the internationalization component
      developersOrContributors - list of Contributor
      Returns:
      a none null list of Contributor which have a maintainer DOAP role.
    • getContributorsWithTesterRole

      public static List<org.apache.maven.model.Contributor> getContributorsWithTesterRole(org.codehaus.plexus.i18n.I18N i18n, List<org.apache.maven.model.Contributor> developersOrContributors)
      Parameters:
      i18n - the internationalization component
      developersOrContributors - list of Contributor
      Returns:
      a none null list of Contributor which have a tester DOAP role.
    • getContributorsWithTranslatorRole

      public static List<org.apache.maven.model.Contributor> getContributorsWithTranslatorRole(org.codehaus.plexus.i18n.I18N i18n, List<org.apache.maven.model.Contributor> developersOrContributors)
      Parameters:
      i18n - the internationalization component
      developersOrContributors - list of Contributor
      Returns:
      a none null list of Contributor which have a translator DOAP role.
    • getContributorsWithUnknownRole

      public static List<org.apache.maven.model.Contributor> getContributorsWithUnknownRole(org.codehaus.plexus.i18n.I18N i18n, List<org.apache.maven.model.Contributor> developersOrContributors)
      Parameters:
      i18n - the internationalization component
      developersOrContributors - list of Contributor
      Returns:
      a none null list of Contributor which have an unknown DOAP role.
    • addOrganization

      public static DoapUtil.Organization addOrganization(String name, String url)
      put an organization from the pom file in the organization list.
      Parameters:
      name - from the pom file (e.g. Yoyodyne)
      url - from the pom file (e.g. http://yoyodyne.example.org/about)
      Returns:
      the existing organization if a duplicate, or a new one.
    • getNodeId

      public static String getNodeId()
      get a unique (within the DoaP file) RDF blank node ID
      Returns:
      the nodeID
      See Also:
    • getOrganizations

      public static Set<Map.Entry<String, DoapUtil.Organization>> getOrganizations()
      get the set of Organizations that people are members of
      Returns:
      Map.EntrySet of DoapUtil.Organization
    • validate

      public static List<String> validate(File doapFile)
      Validate the given DOAP file.
      Parameters:
      doapFile - not null and should exist
      Returns:
      an empty list if the DOAP file is valid, otherwise a list of errors.
      Since:
      1.1
    • isValidEmail

      public static boolean isValidEmail(String str)
      Parameters:
      str - not null
      Returns:
      true if the str parameter is a valid email, false otherwise.
      Since:
      1.1
    • fetchURL

      public static void fetchURL(org.apache.maven.settings.Settings settings, URL url) throws IOException
      Fetch a URL.
      Parameters:
      settings - the user settings used to fetch the URL with an active proxy, if defined
      url - the URL to fetch
      Throws:
      IOException - if any
      Since:
      1.1
      See Also:
    • interpolate

      public static String interpolate(String value, org.apache.maven.project.MavenProject project, org.apache.maven.settings.Settings settings)
      Interpolate a string with project and settings.
      Parameters:
      value - could be null
      project - not null
      settings - could be null
      Returns:
      the value trimmed and interpolated or null if the interpolation doesn't work.
      Since:
      1.1