Hi, This is all great stuff, but we currently have two codebases to manage: trunk and this branch. It would be good if refactorings like these could wait until we have only one codebase to manage. I guess that you are not planning to backport this to trunk.
On 2010-05-02 22:45, [email protected] wrote: > Author: hboutemy > Date: Sun May 2 20:45:51 2010 > New Revision: 940318 > > URL: http://svn.apache.org/viewvc?rev=940318&view=rev > Log: > used more Java 5 generics > > Modified: > > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java > > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java > > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/CategorySummaryDocumentRenderer.java > > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportDocumentRenderer.java > > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteDescriptorAttachMojo.java > > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteMap.java > > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteMojo.java > > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteRunMojo.java > > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java > > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteStageMojo.java > > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/webapp/DoxiaBean.java > > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/webapp/DoxiaFilter.java > > maven/plugins/branches/maven-site-plugin-3.x/src/test/java/org/apache/maven/plugins/site/SiteDeployMojoTest.java > > Modified: > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java > URL: > http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java?rev=940318&r1=940317&r2=940318&view=diff > ============================================================================== > --- > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java > (original) > +++ > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractSiteMojo.java > Sun May 2 20:45:51 2010 > @@ -138,7 +138,8 @@ public abstract class AbstractSiteMojo > return ( outputEncoding == null ) ? ReaderFactory.UTF_8 : > outputEncoding; > } > > - protected void populateReportItems( DecorationModel decorationModel, > Locale locale, Map reportsByOutputName ) > + protected void populateReportItems( DecorationModel decorationModel, > Locale locale, > + Map<String, MavenReport> > reportsByOutputName ) > { > for ( Iterator i = decorationModel.getMenus().iterator(); > i.hasNext(); ) > { > @@ -148,17 +149,18 @@ public abstract class AbstractSiteMojo > } > } > > - private void populateItemRefs( List items, Locale locale, Map > reportsByOutputName ) > + private void populateItemRefs( List<MenuItem> items, Locale locale, > Map<String, MavenReport> reportsByOutputName ) > { > - for ( Iterator i = items.iterator(); i.hasNext(); ) > + for ( Iterator<MenuItem> i = items.iterator(); i.hasNext(); ) > { > - MenuItem item = (MenuItem) i.next(); > + MenuItem item = i.next(); > > if ( item.getRef() != null ) > { > - if ( reportsByOutputName.containsKey( item.getRef() ) ) > + MavenReport report = reportsByOutputName.get( item.getRef() > ); > + > + if ( report != null ) > { > - MavenReport report = (MavenReport) > reportsByOutputName.get( item.getRef() ); > > if ( item.getName() == null ) > { > > Modified: > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java > URL: > http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java?rev=940318&r1=940317&r2=940318&view=diff > ============================================================================== > --- > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java > (original) > +++ > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/AbstractSiteRenderingMojo.java > Sun May 2 20:45:51 2010 > @@ -162,7 +162,7 @@ public abstract class AbstractSiteRender > * @todo should we deprecate in favour of reports? > */ > protected File generatedSiteDirectory; > - > + > /** > * The Maven project. > * > @@ -171,26 +171,26 @@ public abstract class AbstractSiteRender > * @readonly > */ > protected MavenProject project; > - > + > /** > * @parameter expression="${session}" > * @required > * @readonly > */ > protected MavenSession mavenSession; > - > + > /** > * > * @component > * @readonly > - */ > + */ > protected PlexusContainer plexusContainer; > > /** > * > * @component > * @readonly > - */ > + */ > protected MavenReportExecutor mavenReportExecutor; > > protected List<MavenReportExecution> getReports() > @@ -347,7 +347,8 @@ public abstract class AbstractSiteRender > * @return A map with all reports keyed by filename having the report > itself as value. The map will be used to > * populate a menu. > */ > - protected Map<String, MavenReport> locateReports( > List<MavenReportExecution> reports, Map documents, Locale locale ) > + protected Map<String, MavenReport> locateReports( > List<MavenReportExecution> reports, > + Map<String, > DocumentRenderer> documents, Locale locale ) > { > // copy Collection to prevent ConcurrentModificationException > List<MavenReportExecution> filtered = new > ArrayList<MavenReportExecution>(reports); > @@ -374,7 +375,7 @@ public abstract class AbstractSiteRender > else > { > RenderingContext renderingContext = new RenderingContext( > siteDirectory, outputName ); > - ReportDocumentRenderer renderer = new > ReportDocumentRenderer( mavenReportExecution, renderingContext, getLog() ); > + DocumentRenderer renderer = new ReportDocumentRenderer( > mavenReportExecution, renderingContext, getLog() ); > documents.put( outputName, renderer ); > } > } > @@ -388,12 +389,11 @@ public abstract class AbstractSiteRender > * @param reports A Collection of MavenReports > * @return A map keyed category having the report itself as value > */ > - protected Map categoriseReports( Collection reports ) > + protected Map categoriseReports( Collection<MavenReport> reports ) > { > Map categories = new HashMap(); > - for ( Iterator i = reports.iterator(); i.hasNext(); ) > + for ( MavenReport report : reports ) > { > - MavenReport report = (MavenReport) i.next(); > List categoryReports = (List) categories.get( > report.getCategoryName() ); > if ( categoryReports == null ) > { > > Modified: > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/CategorySummaryDocumentRenderer.java > URL: > http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/CategorySummaryDocumentRenderer.java?rev=940318&r1=940317&r2=940318&view=diff > ============================================================================== > --- > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/CategorySummaryDocumentRenderer.java > (original) > +++ > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/CategorySummaryDocumentRenderer.java > Sun May 2 20:45:51 2010 > @@ -34,7 +34,6 @@ import org.codehaus.plexus.i18n.I18N; > import java.io.FileNotFoundException; > import java.io.Writer; > import java.util.Collections; > -import java.util.Iterator; > import java.util.List; > import java.util.Locale; > > @@ -56,18 +55,18 @@ public class CategorySummaryDocumentRend > > private I18N i18n; > > - private List categoryReports; > + private List<MavenReport> categoryReports; > > private final Log log; > > public CategorySummaryDocumentRenderer( RenderingContext > renderingContext, String title, String desc1, String desc2, > - I18N i18n, List categoryReports ) > + I18N i18n, List<MavenReport> > categoryReports ) > { > this( renderingContext, title, desc1, desc2, i18n, categoryReports, > null ); > } > > public CategorySummaryDocumentRenderer( RenderingContext > renderingContext, String title, String desc1, String desc2, > - I18N i18n, List categoryReports, > Log log ) > + I18N i18n, List<MavenReport> > categoryReports, Log log ) > { > this.renderingContext = renderingContext; > this.title = title; > @@ -144,10 +143,8 @@ public class CategorySummaryDocumentRend > > if ( categoryReports != null ) > { > - for ( Iterator i1 = categoryReports.iterator(); i1.hasNext(); ) > + for ( MavenReport report : categoryReports ) > { > - MavenReport report = (MavenReport) i1.next(); > - > sink.tableRow(); > sink.tableCell(); > sink.link( report.getOutputName() + ".html" ); > > Modified: > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportDocumentRenderer.java > URL: > http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportDocumentRenderer.java?rev=940318&r1=940317&r2=940318&view=diff > ============================================================================== > --- > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportDocumentRenderer.java > (original) > +++ > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/ReportDocumentRenderer.java > Sun May 2 20:45:51 2010 > @@ -57,7 +57,7 @@ public class ReportDocumentRenderer > private RenderingContext renderingContext; > > private Log log; > - > + > public ReportDocumentRenderer( MavenReportExecution > mavenReportExecution, RenderingContext renderingContext, Log log) > { > this.mavenReportExecution = mavenReportExecution; > @@ -65,7 +65,7 @@ public class ReportDocumentRenderer > this.renderingContext = renderingContext; > > this.log = log; > - > + > } > > private static class MySink > @@ -99,7 +99,7 @@ public class ReportDocumentRenderer > { > private RenderingContext context; > > - private List sinks = new ArrayList(); > + private List<Sink> sinks = new ArrayList<Sink>(); > > public MySinkFactory( RenderingContext ctx ) > { > @@ -134,7 +134,7 @@ public class ReportDocumentRenderer > return null; > } > > - public List sinks() > + public List<Sink> sinks() > { > return sinks; > } > @@ -144,9 +144,9 @@ public class ReportDocumentRenderer > throws RendererException, FileNotFoundException > { > Locale locale = siteRenderingContext.getLocale(); > - > + > MavenReport report = mavenReportExecution.getMavenReport(); > - > + > String localReportName = report.getName( locale ); > log.info( "Generating \"" + localReportName + "\" report." ); > > @@ -178,7 +178,7 @@ public class ReportDocumentRenderer > stringBuilder.append( ", skip LinkageError " + e.getMessage() + > ", please report an issue to maven dev team" ); > log.warn( stringBuilder.toString(), e ); > } > - finally > + finally > { > Thread.currentThread().setContextClassLoader( > originalClassLoader ); > sink.close(); > @@ -188,7 +188,7 @@ public class ReportDocumentRenderer > { > try > { > - List sinks = sf.sinks(); > + List<Sink> sinks = sf.sinks(); > > log.debug( "Multipage report: " + sinks.size() + " > subreports" ); > > > Modified: > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteDescriptorAttachMojo.java > URL: > http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteDescriptorAttachMojo.java?rev=940318&r1=940317&r2=940318&view=diff > ============================================================================== > --- > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteDescriptorAttachMojo.java > (original) > +++ > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteDescriptorAttachMojo.java > Sun May 2 20:45:51 2010 > @@ -33,7 +33,6 @@ import java.io.File; > import java.io.IOException; > import java.io.StringReader; > import java.util.HashMap; > -import java.util.Iterator; > import java.util.List; > import java.util.Locale; > import java.util.Map; > @@ -66,19 +65,17 @@ public class SiteDescriptorAttachMojo > public void execute() > throws MojoExecutionException > { > - List localesList = siteTool.getAvailableLocales( locales ); > + List<Locale> localesList = siteTool.getAvailableLocales( locales ); > > - for ( Iterator iterator = localesList.iterator(); > iterator.hasNext(); ) > + for ( Locale locale : localesList ) > { > - Locale locale = (Locale) iterator.next(); > - > File descriptorFile = siteTool.getSiteDescriptorFromBasedir( > toRelative( project.getBasedir(), > > siteDirectory.getAbsolutePath() ), > > basedir, locale ); > > if ( descriptorFile.exists() ) > { > - Map props = new HashMap(); > + Map<String, String> props = new HashMap<String, String>(); > props.put( "reports", "<menu ref=\"reports\"/>" ); > props.put( "modules", "<menu ref=\"modules\"/>" ); > > > Modified: > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteMap.java > URL: > http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteMap.java?rev=940318&r1=940317&r2=940318&view=diff > ============================================================================== > --- > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteMap.java > (original) > +++ > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteMap.java > Sun May 2 20:45:51 2010 > @@ -138,9 +138,9 @@ public class SiteMap > sink.text( i18n.getString( "site-plugin", locale, > "site.sitemap.description" ) ); > sink.paragraph_(); > > - for ( Iterator it = decoration.getMenus().iterator(); it.hasNext(); ) > + for ( Iterator<Menu> it = decoration.getMenus().iterator(); > it.hasNext(); ) > { > - Menu menu = (Menu) it.next(); > + Menu menu = it.next(); > > sink.section3(); > sink.sectionTitle3(); > @@ -157,7 +157,7 @@ public class SiteMap > sink.body_(); > } > > - private void extractItems( List items, Sink sink ) > + private void extractItems( List<MenuItem> items, Sink sink ) > { > if ( items == null || items.isEmpty() ) > { > @@ -166,10 +166,8 @@ public class SiteMap > > sink.list(); > > - for ( Iterator it = items.iterator(); it.hasNext(); ) > + for ( MenuItem item : items ) > { > - MenuItem item = (MenuItem) it.next(); > - > sink.listItem(); > sink.link( item.getHref() ); > sink.text( item.getName() ); > > Modified: > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteMojo.java > URL: > http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteMojo.java?rev=940318&r1=940317&r2=940318&view=diff > ============================================================================== > --- > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteMojo.java > (original) > +++ > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteMojo.java > Sun May 2 20:45:51 2010 > @@ -22,7 +22,6 @@ package org.apache.maven.plugins.site; > import java.io.File; > import java.io.IOException; > import java.util.Collections; > -import java.util.Iterator; > import java.util.List; > import java.util.Locale; > import java.util.Map; > @@ -38,7 +37,7 @@ import org.apache.maven.reporting.MavenR > * <p> > * Note that links between module sites in a multi module build will > <b>not</b> work. > * </p> > - * > + * > * @author <a href="mailto:[email protected]">Emmanuel Venisse</a> > * @author <a href="mailto:[email protected]">Vincent Siveton</a> > * @version $Id$ > @@ -50,7 +49,7 @@ public class SiteMojo > { > /** > * Directory containing the generated project sites and report > distributions. > - * > + * > * @parameter expression="${siteOutputDirectory}" > default-value="${project.reporting.outputDirectory}" > * @required > */ > @@ -58,7 +57,7 @@ public class SiteMojo > > /** > * Convenience parameter that allows you to disable report generation. > - * > + * > * @parameter expression="${generateReports}" default-value="true" > */ > private boolean generateReports; > @@ -77,7 +76,7 @@ public class SiteMojo > * Generate the project site > * <p/> > * throws MojoExecutionException if any > - * > + * > * @see org.apache.maven.plugin.Mojo#execute() > */ > public void execute() > @@ -88,7 +87,7 @@ public class SiteMojo > getLog().debug( "executing Site Mojo" ); > } > > - List<MavenReportExecution> filteredReports; > + List<MavenReportExecution> filteredReports; > if ( generateReports ) > { > filteredReports = filterReports( getReports() ); > @@ -100,16 +99,14 @@ public class SiteMojo > > try > { > - List localesList = siteTool.getAvailableLocales( locales ); > + List<Locale> localesList = siteTool.getAvailableLocales( locales > ); > > // Default is first in the list > - Locale defaultLocale = (Locale) localesList.get( 0 ); > + Locale defaultLocale = localesList.get( 0 ); > Locale.setDefault( defaultLocale ); > > - for ( Iterator iterator = localesList.iterator(); > iterator.hasNext(); ) > + for ( Locale locale : localesList ) > { > - Locale locale = (Locale) iterator.next(); > - > renderLocale( locale, filteredReports ); > } > } > > Modified: > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteRunMojo.java > URL: > http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteRunMojo.java?rev=940318&r1=940317&r2=940318&view=diff > ============================================================================== > --- > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteRunMojo.java > (original) > +++ > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteRunMojo.java > Sun May 2 20:45:51 2010 > @@ -25,7 +25,6 @@ import java.io.FileOutputStream; > import java.io.IOException; > import java.io.InputStream; > import java.util.HashMap; > -import java.util.Iterator; > import java.util.List; > import java.util.Locale; > import java.util.Map; > @@ -158,21 +157,19 @@ public class SiteRunMojo > > List<MavenReportExecution> filteredReports = filterReports( > getReports() ); > > - List localesList = siteTool.getAvailableLocales( locales ); > + List<Locale> localesList = siteTool.getAvailableLocales( locales ); > webapp.setAttribute( DoxiaFilter.LOCALES_LIST_KEY, localesList ); > > // Default is first in the list > - Locale defaultLocale = (Locale) localesList.get( 0 ); > + Locale defaultLocale = localesList.get( 0 ); > Locale.setDefault( defaultLocale ); > > try > { > - Map i18nDoxiaContexts = new HashMap(); > + Map<String, DoxiaBean> i18nDoxiaContexts = new HashMap<String, > DoxiaBean>(); > > - for ( Iterator it = localesList.iterator(); it.hasNext(); ) > + for ( Locale locale : localesList ) > { > - Locale locale = (Locale) it.next(); > - > SiteRenderingContext i18nContext = > createSiteRenderingContext( locale ); > i18nContext.setInputEncoding( getInputEncoding() ); > i18nContext.setOutputEncoding( getOutputEncoding() ); > > Modified: > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java > URL: > http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java?rev=940318&r1=940317&r2=940318&view=diff > ============================================================================== > --- > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java > (original) > +++ > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteStageDeployMojo.java > Sun May 2 20:45:51 2010 > @@ -129,9 +129,9 @@ public class SiteStageDeployMojo > deployStagingSite(); > } > > - > + > // FIXME too much duplicate code with SiteDeployMojo > - > + > /** > * Deploy the staging directory using the stagingSiteURL. > * > @@ -176,11 +176,11 @@ public class SiteStageDeployMojo > throw new MojoExecutionException( > "Wagon protocol '" + repository.getProtocol() + "' doesn't > support directory copying" ); > } > - > + > try > { > Debug debug = new Debug(); > - > + > > wagon.addSessionListener( debug ); > > @@ -252,7 +252,8 @@ public class SiteStageDeployMojo > * @param usersStagingSiteURL The staging site URL as suggested by the > user's configuration > * @return the site URL for staging > */ > - protected String getStagingSiteURL( MavenProject currentProject, List > reactorProjects, String usersStagingSiteURL ) > + protected String getStagingSiteURL( MavenProject currentProject, > List<MavenProject> reactorProjects, > + String usersStagingSiteURL ) > { > String topLevelURL = null; > String relative = ""; > > Modified: > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteStageMojo.java > URL: > http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteStageMojo.java?rev=940318&r1=940317&r2=940318&view=diff > ============================================================================== > --- > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteStageMojo.java > (original) > +++ > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/SiteStageMojo.java > Sun May 2 20:45:51 2010 > @@ -20,7 +20,6 @@ package org.apache.maven.plugins.site; > */ > > import java.io.File; > -import java.util.Iterator; > import java.util.List; > > import org.apache.maven.model.Site; > @@ -99,12 +98,8 @@ public class SiteStageMojo > > if ( reactorProjects != null && reactorProjects.size() > 1 ) > { > - Iterator reactorItr = reactorProjects.iterator(); > - > - while ( reactorItr.hasNext() ) > + for ( MavenProject reactorProject : reactorProjects ) > { > - MavenProject reactorProject = (MavenProject) > reactorItr.next(); > - > if ( reactorProject != null && reactorProject.getParent() != > null > && project.getArtifactId().equals( > reactorProject.getParent().getArtifactId() ) ) > { > @@ -125,7 +120,8 @@ public class SiteStageMojo > * @param usersStagingDirectory The staging directory as suggested by > the user's configuration > * @return the directory for staging > */ > - protected File getStagingDirectory( MavenProject currentProject, List > reactorProjects, File usersStagingDirectory ) > + protected File getStagingDirectory( MavenProject currentProject, > List<MavenProject> reactorProjects, > + File usersStagingDirectory ) > { > // Check if the user has specified a stagingDirectory > if ( usersStagingDirectory != null ) > @@ -160,15 +156,13 @@ public class SiteStageMojo > * @param reactorProjects The projects in the reactor > * @return The top level project in the reactor, or <code>null</code> if > none can be found > */ > - protected MavenProject getTopLevelProject( List reactorProjects ) > + protected MavenProject getTopLevelProject( List<MavenProject> > reactorProjects ) > { > MavenProject topLevelProject = null; > if ( reactorProjects != null ) > { > - Iterator iterator = reactorProjects.iterator(); > - while ( iterator.hasNext() ) > + for ( MavenProject reactorProject : reactorProjects ) > { > - MavenProject reactorProject = (MavenProject) iterator.next(); > if ( reactorProject.isExecutionRoot() ) > { > getLog().debug( "isExecutionRoot " + > reactorProject.getName() ); > > Modified: > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/webapp/DoxiaBean.java > URL: > http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/webapp/DoxiaBean.java?rev=940318&r1=940317&r2=940318&view=diff > ============================================================================== > --- > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/webapp/DoxiaBean.java > (original) > +++ > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/webapp/DoxiaBean.java > Sun May 2 20:45:51 2010 > @@ -22,6 +22,7 @@ package org.apache.maven.plugins.site.we > import java.io.File; > import java.util.Map; > > +import org.apache.maven.doxia.siterenderer.DocumentRenderer; > import org.apache.maven.doxia.siterenderer.SiteRenderingContext; > > /** > @@ -34,7 +35,7 @@ public class DoxiaBean > { > private SiteRenderingContext context; > > - private Map documents; > + private Map<String, DocumentRenderer> documents; > > private File generatedSiteDirectory; > > @@ -43,7 +44,7 @@ public class DoxiaBean > * @param documents > * @param generatedSiteDirectory > */ > - public DoxiaBean( SiteRenderingContext context, Map documents, > + public DoxiaBean( SiteRenderingContext context, Map<String, > DocumentRenderer> documents, > File generatedSiteDirectory ) > { > this.context = context; > @@ -61,12 +62,12 @@ public class DoxiaBean > this.context = context; > } > > - public Map getDocuments() > + public Map<String, DocumentRenderer> getDocuments() > { > return documents; > } > > - public void setDocuments( Map documents ) > + public void setDocuments( Map<String, DocumentRenderer> documents ) > { > this.documents = documents; > } > > Modified: > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/webapp/DoxiaFilter.java > URL: > http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/webapp/DoxiaFilter.java?rev=940318&r1=940317&r2=940318&view=diff > ============================================================================== > --- > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/webapp/DoxiaFilter.java > (original) > +++ > maven/plugins/branches/maven-site-plugin-3.x/src/main/java/org/apache/maven/plugins/site/webapp/DoxiaFilter.java > Sun May 2 20:45:51 2010 > @@ -36,7 +36,6 @@ import javax.servlet.http.HttpServletReq > import java.io.File; > import java.io.IOException; > import java.util.ArrayList; > -import java.util.Iterator; > import java.util.List; > import java.util.Locale; > import java.util.Map; > @@ -57,9 +56,9 @@ public class DoxiaFilter > > private Renderer siteRenderer; > > - private Map i18nDoxiaContexts; > + private Map<String, DoxiaBean> i18nDoxiaContexts; > > - private List localesList; > + private List<Locale> localesList; > > /** > * @see javax.servlet.Filter#init(javax.servlet.FilterConfig) > @@ -71,9 +70,9 @@ public class DoxiaFilter > > siteRenderer = (Renderer) servletContext.getAttribute( > SITE_RENDERER_KEY ); > > - i18nDoxiaContexts = (Map) servletContext.getAttribute( > I18N_DOXIA_CONTEXTS_KEY ); > + i18nDoxiaContexts = (Map<String, DoxiaBean>) > servletContext.getAttribute( I18N_DOXIA_CONTEXTS_KEY ); > > - localesList = (List) servletContext.getAttribute( LOCALES_LIST_KEY ); > + localesList = (List<Locale>) servletContext.getAttribute( > LOCALES_LIST_KEY ); > } > > /** > @@ -99,14 +98,12 @@ public class DoxiaFilter > > // Handle locale request > SiteRenderingContext context; > - Map documents; > + Map<String, DocumentRenderer> documents; > File generatedSiteDirectory; > > String localeWanted = null; > - for ( Iterator it = localesList.iterator(); it.hasNext(); ) > + for ( Locale locale : localesList ) > { > - Locale locale = (Locale) it.next(); > - > if ( path.startsWith( locale.getLanguage() + "/" ) ) > { > localeWanted = locale.toString(); > @@ -116,7 +113,7 @@ public class DoxiaFilter > > if ( localeWanted == null ) > { > - DoxiaBean defaultDoxiaBean = (DoxiaBean) i18nDoxiaContexts.get( > "default" ); > + DoxiaBean defaultDoxiaBean = i18nDoxiaContexts.get( "default" ); > if ( defaultDoxiaBean == null ) > { > throw new ServletException( "No doxia bean found for the > default locale" ); > @@ -127,7 +124,7 @@ public class DoxiaFilter > } > else > { > - DoxiaBean i18nDoxiaBean = (DoxiaBean) i18nDoxiaContexts.get( > localeWanted ); > + DoxiaBean i18nDoxiaBean = i18nDoxiaContexts.get( localeWanted ); > if ( i18nDoxiaBean == null ) > { > throw new ServletException( "No doxia bean found for the > locale " + localeWanted ); > @@ -174,7 +171,7 @@ public class DoxiaFilter > context.addSiteDirectory( generatedSiteDirectory ); > try > { > - Map locateDocuments = siteRenderer.locateDocumentFiles( > context ); > + Map<String, DocumentRenderer> locateDocuments = > siteRenderer.locateDocumentFiles( context ); > > if ( locateDocuments.containsKey( path ) ) > { > @@ -187,10 +184,9 @@ public class DoxiaFilter > throw new ServletException( e ); > } > > - List originalSiteDirectories = new ArrayList( > context.getSiteDirectories() ); > - for ( Iterator i = originalSiteDirectories.iterator(); > i.hasNext(); ) > + List<File> originalSiteDirectories = new ArrayList<File>( > context.getSiteDirectories() ); > + for ( File dir : originalSiteDirectories ) > { > - File dir = (File) i.next(); > context.addSiteDirectory( dir ); > } > } > > Modified: > maven/plugins/branches/maven-site-plugin-3.x/src/test/java/org/apache/maven/plugins/site/SiteDeployMojoTest.java > URL: > http://svn.apache.org/viewvc/maven/plugins/branches/maven-site-plugin-3.x/src/test/java/org/apache/maven/plugins/site/SiteDeployMojoTest.java?rev=940318&r1=940317&r2=940318&view=diff > ============================================================================== > --- > maven/plugins/branches/maven-site-plugin-3.x/src/test/java/org/apache/maven/plugins/site/SiteDeployMojoTest.java > (original) > +++ > maven/plugins/branches/maven-site-plugin-3.x/src/test/java/org/apache/maven/plugins/site/SiteDeployMojoTest.java > Sun May 2 20:45:51 2010 > @@ -22,7 +22,6 @@ package org.apache.maven.plugins.site; > import junit.framework.TestCase; > import org.apache.maven.artifact.manager.DefaultWagonManager; > import org.apache.maven.artifact.manager.WagonManager; > -import org.apache.maven.wagon.proxy.ProxyInfo; > import org.apache.maven.wagon.repository.Repository; > > /** > @@ -48,7 +47,7 @@ public class SiteDeployMojoTest > // should not fail ;-) > assertTrue( true ); > } > - > + > // FIXME restore this tests ?? > /* > public void testGetProxyInfoNoProxyForRepositoryProtocol() > > > -- Dennis Lundberg --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
