You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by vs...@apache.org on 2008/04/24 14:03:20 UTC
svn commit: r651229 - in
/maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools:
DefaultSiteTool.java ReportComparator.java SiteTool.java
SiteToolException.java
Author: vsiveton
Date: Thu Apr 24 05:03:16 2008
New Revision: 651229
URL: http://svn.apache.org/viewvc?rev=651229&view=rev
Log:
o fixed checkstyle
o added javadoc
Modified:
maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java
maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/ReportComparator.java
maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/SiteTool.java
maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/SiteToolException.java
Modified: maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java?rev=651229&r1=651228&r2=651229&view=diff
==============================================================================
--- maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java (original)
+++ maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/DefaultSiteTool.java Thu Apr 24 05:03:16 2008
@@ -185,6 +185,11 @@
return getSkinArtifactFromRepository( localRepository, remoteArtifactRepositories, new DecorationModel() );
}
+ /**
+ * @param path could be null.
+ * @return the path normalized, i.e. by eliminating "/../" and "/./" in the path.
+ * @see FileUtils#normalize(String)
+ */
protected String getNormalizedPath( String path )
{
String normalized = null;
@@ -1012,7 +1017,8 @@
String variant = "";
StringTokenizer tokenizer = new StringTokenizer( localeCode, "_" );
- if ( tokenizer.countTokens() > 3 )
+ final int maxTokens = 3;
+ if ( tokenizer.countTokens() > maxTokens )
{
if ( getLogger().isWarnEnabled() )
{
@@ -1041,6 +1047,16 @@
// Private methods
// ----------------------------------------------------------------------
+ /**
+ * @param project not null
+ * @param localRepository not null
+ * @param repositories not null
+ * @param locale not null
+ * @return the resolved site descriptor
+ * @throws IOException if any
+ * @throws ArtifactResolutionException if any
+ * @throws ArtifactNotFoundException if any
+ */
private File resolveSiteDescriptor( MavenProject project, ArtifactRepository localRepository, List repositories,
Locale locale )
throws IOException, ArtifactResolutionException, ArtifactNotFoundException
@@ -1112,6 +1128,19 @@
return result;
}
+ /**
+ * @param project not null
+ * @param reactorProjects not null
+ * @param localRepository not null
+ * @param repositories not null
+ * @param siteDirectory not null
+ * @param locale not null
+ * @param origProps not null
+ * @param inputEncoding not null
+ * @param outputEncoding not null
+ * @return the decoration model depending the locale
+ * @throws SiteToolException if any
+ */
private DecorationModel getDecorationModel( MavenProject project, List reactorProjects,
ArtifactRepository localRepository, List repositories,
String siteDirectory, Locale locale, Map origProps,
@@ -1193,6 +1222,11 @@
return decoration;
}
+ /**
+ * @param siteDescriptorContent not null
+ * @return the decoration model object
+ * @throws SiteToolException if any
+ */
private DecorationModel readDecorationModel( String siteDescriptorContent )
throws SiteToolException
{
@@ -1212,6 +1246,11 @@
return decoration;
}
+ /**
+ * @param project not null
+ * @param reactorProjects not null
+ * @param menu not null
+ */
private void populateModulesMenuItemsFromReactorProjects( MavenProject project, List reactorProjects, Menu menu )
{
if ( reactorProjects != null && reactorProjects.size() > 1 )
@@ -1234,6 +1273,11 @@
}
}
+ /**
+ * @param project not null
+ * @param models not null
+ * @param menu not null
+ */
private void populateModulesMenuItemsFromModels( MavenProject project, List models, Menu menu )
{
if ( models != null && models.size() > 1 )
@@ -1252,6 +1296,13 @@
}
}
+ /**
+ * @param project not null
+ * @param menu not null
+ * @param name not null
+ * @param href could be null
+ * @param defaultHref not null
+ */
private void appendMenuItem( MavenProject project, Menu menu, String name, String href, String defaultHref )
{
String selectedHref = href;
@@ -1281,6 +1332,13 @@
menu.addItem( item );
}
+ /**
+ * @param name not null
+ * @param href not null
+ * @param categoryReports not null
+ * @param locale not null
+ * @return the menu item object
+ */
private MenuItem createCategoryMenu( String name, String href, List categoryReports, Locale locale )
{
MenuItem item = new MenuItem();
@@ -1306,7 +1364,7 @@
/**
* Convenience method.
*
- * @param list
+ * @param list could be null
* @return true if the list is <code>null</code> or empty
*/
private static boolean isEmptyList( List list )
Modified: maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/ReportComparator.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/ReportComparator.java?rev=651229&r1=651228&r2=651229&view=diff
==============================================================================
--- maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/ReportComparator.java (original)
+++ maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/ReportComparator.java Thu Apr 24 05:03:16 2008
@@ -30,16 +30,26 @@
*
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @version $Id$
- * @todo move to reporting API?
- * @todo allow reports to define their order in some other way?
+ * @TODO move to reporting API?
+ * @TODO allow reports to define their order in some other way?
*/
public class ReportComparator
implements Comparator
{
+ /** the local */
private final Locale locale;
+ /**
+ * Default constructor.
+ *
+ * @param locale not null
+ */
public ReportComparator( Locale locale )
{
+ if ( locale == null )
+ {
+ throw new IllegalArgumentException( "locale should be defined" );
+ }
this.locale = locale;
}
Modified: maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/SiteTool.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/SiteTool.java?rev=651229&r1=651228&r2=651229&view=diff
==============================================================================
--- maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/SiteTool.java (original)
+++ maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/SiteTool.java Thu Apr 24 05:03:16 2008
@@ -27,7 +27,6 @@
import org.apache.maven.artifact.Artifact;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.doxia.site.decoration.DecorationModel;
-import org.apache.maven.doxia.site.decoration.Skin;
import org.apache.maven.project.MavenProject;
/**
@@ -63,7 +62,7 @@
/**
* Get the default skin artifact for a project from one of the repositories.
- *
+ *
* @param localRepository the Maven local repository, not null.
* @param remoteArtifactRepositories the Maven remote repositories, not null.
* @return the default <code>Skin</code> artifact from a given project and a local repository
@@ -75,8 +74,8 @@
throws SiteToolException;
/**
- * Calculate the relative path between two URL:s or between two files.
- *
+ * Calculate the relative path between two URLs or between two files.
+ *
* For example:
* <dl>
* <dt>to = "http://maven.apache.org" and from = "http://maven.apache.org"</dt>
@@ -90,8 +89,8 @@
* </dl>
* <b>Note</b>: The file separator depends on the system.
*
- * @param to
- * @param from
+ * @param to the <code>to</code> url of file as string
+ * @param from the <code>from</code> url of file as string
* @return a relative path from <code>from</code> to <code>to</code>.
*/
String getRelativePath( String to, String from );
@@ -126,7 +125,7 @@
/**
* Get a decoration model for a project.
- *
+ *
* @param project the Maven project, not null.
* @param reactorProjects the Maven reactor projects, not null.
* @param localRepository the Maven local repository, not null.
@@ -219,7 +218,7 @@
/**
* Populate the modules menu part of the decoration model.
- *
+ *
* @param project a Maven project, not null.
* @param reactorProjects the Maven reactor projects, not null.
* @param localRepository the Maven local repository, not null.
Modified: maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/SiteToolException.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/SiteToolException.java?rev=651229&r1=651228&r2=651229&view=diff
==============================================================================
--- maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/SiteToolException.java (original)
+++ maven/shared/trunk/maven-doxia-tools/src/main/java/org/apache/maven/doxia/tools/SiteToolException.java Thu Apr 24 05:03:16 2008
@@ -35,8 +35,8 @@
* Construct a new <code>SiteToolException</code> exception wrapping an underlying <code>Exception</code>
* and providing a <code>message</code>.
*
- * @param message
- * @param cause
+ * @param message could be null
+ * @param cause could be null
*/
public SiteToolException( String message, Exception cause )
{
@@ -47,8 +47,8 @@
* Construct a new <code>SiteToolException</code> exception wrapping an underlying <code>Throwable</code>
* and providing a <code>message</code>.
*
- * @param message
- * @param cause
+ * @param message could be null
+ * @param cause could be null
*/
public SiteToolException( String message, Throwable cause )
{
@@ -58,7 +58,7 @@
/**
* Construct a new <code>SiteToolException</code> exception providing a <code>message</code>.
*
- * @param message
+ * @param message could be null
*/
public SiteToolException( String message )
{