Interface SiteTool

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static Locale DEFAULT_LOCALE
      The locale by default for a Maven Site.
    • Method Summary

      All Methods Instance Methods Abstract Methods Deprecated Methods 
      Modifier and Type Method Description
      DecorationModel getDecorationModel​(File siteDirectory, Locale locale, org.apache.maven.project.MavenProject project, List<org.apache.maven.project.MavenProject> reactorProjects, org.apache.maven.artifact.repository.ArtifactRepository localRepository, List<org.apache.maven.artifact.repository.ArtifactRepository> repositories)
      Get a decoration model for a project.
      String getInterpolatedSiteDescriptorContent​(Map<String,​String> props, org.apache.maven.project.MavenProject aProject, String siteDescriptorContent)
      Interpolating several expressions in the site descriptor content.
      org.apache.maven.project.MavenProject getParentProject​(org.apache.maven.project.MavenProject aProject, List<org.apache.maven.project.MavenProject> reactorProjects, org.apache.maven.artifact.repository.ArtifactRepository localRepository)
      Deprecated.
      use MavenProject.getParent()
      String getRelativePath​(String to, String from)
      Calculate the relative path between two URLs or between two files.
      File getSiteDescriptor​(File siteDirectory, Locale locale)
      Get a site descriptor from the project's site directory.
      List<Locale> getSiteLocales​(String locales)
      Extracts from a comma-separated list the locales that are available in site-tool resource bundle.
      org.apache.maven.artifact.Artifact getSkinArtifactFromRepository​(org.apache.maven.artifact.repository.ArtifactRepository localRepository, List<org.apache.maven.artifact.repository.ArtifactRepository> remoteArtifactRepositories, DecorationModel decoration)
      Get a skin artifact from one of the repositories.
      void populateReportsMenu​(DecorationModel decorationModel, Locale locale, Map<String,​List<org.apache.maven.reporting.MavenReport>> reportsPerCategory)
      Populate the pre-defined reports menu of the decoration model, if used through <menu ref="reports"/>.
    • Field Detail

      • DEFAULT_LOCALE

        static final Locale DEFAULT_LOCALE
        The locale by default for a Maven Site.
        See Also:
        Locale.ROOT
    • Method Detail

      • getSkinArtifactFromRepository

        org.apache.maven.artifact.Artifact getSkinArtifactFromRepository​(org.apache.maven.artifact.repository.ArtifactRepository localRepository,
                                                                         List<org.apache.maven.artifact.repository.ArtifactRepository> remoteArtifactRepositories,
                                                                         DecorationModel decoration)
                                                                  throws SiteToolException
        Get a skin artifact from one of the repositories.
        Parameters:
        localRepository - the Maven local repository, not null.
        remoteArtifactRepositories - the Maven remote repositories, not null.
        decoration - the Doxia site descriptor model, not null.
        Returns:
        the Skin artifact defined in a DecorationModel from a given project and a local repository
        Throws:
        SiteToolException - if any
      • getSiteDescriptor

        File getSiteDescriptor​(File siteDirectory,
                               Locale locale)
        Get a site descriptor from the project's site directory.
        Parameters:
        siteDirectory - the site directory, not null
        locale - the locale wanted for the site descriptor, not null. Most specific to least specific lookup from site_language_country_variant.xml, site_language_country.xml, site_language.xml}, to site.xml as last resort for Locale.ROOT, if provided locale defines a variant and/or a country and/or a language.
        Returns:
        the most specific site descriptor file for the given locale
      • getInterpolatedSiteDescriptorContent

        String getInterpolatedSiteDescriptorContent​(Map<String,​String> props,
                                                    org.apache.maven.project.MavenProject aProject,
                                                    String siteDescriptorContent)
                                             throws SiteToolException
        Interpolating several expressions in the site descriptor content. Actually, the expressions can be in the project, the environment variables and the specific properties like encoding.

        For instance:

        ${project.name}
        The value from the POM of:

        <project>
          <name>myProjectName</name>
        </project>

        ${my.value}
        The value from the POM of:

        <properties>
          <my.value>hello</my.value>
        </properties>

        ${JAVA_HOME}
        The value of JAVA_HOME in the environment variables
        Parameters:
        props - a map used for interpolation, not null.
        aProject - a Maven project, not null.
        siteDescriptorContent - the site descriptor file, not null.
        Returns:
        the interpolated site descriptor content.
        Throws:
        SiteToolException - if errors happened during the interpolation.
      • getDecorationModel

        DecorationModel getDecorationModel​(File siteDirectory,
                                           Locale locale,
                                           org.apache.maven.project.MavenProject project,
                                           List<org.apache.maven.project.MavenProject> reactorProjects,
                                           org.apache.maven.artifact.repository.ArtifactRepository localRepository,
                                           List<org.apache.maven.artifact.repository.ArtifactRepository> repositories)
                                    throws SiteToolException
        Get a decoration model for a project.
        Parameters:
        siteDirectory - the site directory, may be null if project from repository
        locale - the locale used for the i18n in DecorationModel, not null. See getSiteDescriptor(File, Locale) for details.
        project - the Maven project, not null.
        reactorProjects - the Maven reactor projects, not null.
        localRepository - the Maven local repository, not null.
        repositories - the Maven remote repositories, not null.
        Returns:
        the DecorationModel object corresponding to the site.xml file with some interpolations.
        Throws:
        SiteToolException - if any
        Since:
        1.7, was previously with other parameter types and order
      • populateReportsMenu

        void populateReportsMenu​(DecorationModel decorationModel,
                                 Locale locale,
                                 Map<String,​List<org.apache.maven.reporting.MavenReport>> reportsPerCategory)
        Populate the pre-defined reports menu of the decoration model, if used through <menu ref="reports"/>. Notice this menu reference is translated into 2 separate menus: "Project Information" and "Project Reports".
        Parameters:
        decorationModel - the Doxia Sitetools DecorationModel, not null.
        locale - the locale used for the i18n in DecorationModel, not null. See getSiteDescriptor(File, Locale) for details.
        reportsPerCategory - reports per category to put in "Reports" or "Information" menus, not null.
        See Also:
        MavenReport.CATEGORY_PROJECT_INFORMATION, MavenReport.CATEGORY_PROJECT_REPORTS
      • getSiteLocales

        List<Locale> getSiteLocales​(String locales)
        Extracts from a comma-separated list the locales that are available in site-tool resource bundle.
        Parameters:
        locales - A comma separated list of locales
        Returns:
        a list of Locales.
        Since:
        1.7, was previously getAvailableLocales(String)
      • getRelativePath

        String getRelativePath​(String to,
                               String from)
        Calculate the relative path between two URLs or between two files. For example:
        to = "http://maven.apache.org" and from = "http://maven.apache.org"
        return ""
        to = "http://maven.apache.org" and from = "http://maven.apache.org/plugins/maven-site-plugin/"
        return "../.."
        to = "http://maven.apache.org/plugins/maven-site-plugin/" and from = "http://maven.apache.org"
        return "plugins/maven-site-plugin"
        to = "/myproject/myproject-module1" and from = "/myproject/myproject"
        return "../myproject-module1"
        Note: The file separator depends on the system. Maven-specific urls are supported, like dav:https://dav.codehaus.org/ or scm:svn:https://svn.apache.org/repos/asf.
        Parameters:
        to - the to url of file as string
        from - the from url of file as string
        Returns:
        a relative path from from to to.
      • getParentProject

        @Deprecated
        org.apache.maven.project.MavenProject getParentProject​(org.apache.maven.project.MavenProject aProject,
                                                               List<org.apache.maven.project.MavenProject> reactorProjects,
                                                               org.apache.maven.artifact.repository.ArtifactRepository localRepository)
        Deprecated.
        use MavenProject.getParent()
        Returns the parent POM with interpolated URLs. If called from Maven 3, just returns project.getParent(), which is already interpolated. But when called from Maven 2, attempts to source this value from the reactorProjects parameters if available (reactor env model attributes are interpolated), or if the reactor is unavailable (-N) resorts to the project.getParent().getUrl() value which will NOT have been interpolated.
        Parameters:
        aProject - a Maven project, not null.
        reactorProjects - the Maven reactor projects, not null.
        localRepository - the Maven local repository, not null.
        Returns:
        the parent project with interpolated URLs.