Add multipage support.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@170885 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Emmanuel Venisse 2005-05-19 07:02:19 +00:00
parent 49568cf67b
commit ae40e024d2
2 changed files with 151 additions and 0 deletions

View File

@ -0,0 +1,72 @@
package org.apache.maven.reporting;
import java.io.InputStream;
import org.apache.maven.reporting.sink.SinkFactory;
import org.codehaus.doxia.sink.Sink;
/*
* Copyright 2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author <a href="evenisse@apache.org">Emmanuel Venisse</a>
* @version $Id: MavenReport.java 163376 2005-02-23 00:06:06Z brett $
*/
public abstract class AbstractMavenMultiPageReport
extends AbstractMavenReport
{
SinkFactory factory;
public void setSinkFactory( SinkFactory factory )
{
this.factory = factory;
if ( getFlavour() != null )
{
factory.setFlavour( getFlavour() );
}
if ( !useDefaultSiteDescriptor() )
{
factory.setSiteDescriptor( getSiteDescriptor() );
}
}
public SinkFactory getSinkFactory()
{
return factory;
}
public String getFlavour()
{
return null;
}
public InputStream getSiteDescriptor()
{
return null;
}
public boolean useDefaultSiteDescriptor()
{
return true;
}
public Sink getSink( String outputName )
throws Exception
{
return factory.getSink( outputName );
}
}

View File

@ -0,0 +1,79 @@
package org.apache.maven.reporting.sink;
import java.io.File;
import java.io.InputStream;
import org.codehaus.doxia.sink.Sink;
import org.codehaus.doxia.site.renderer.SiteRenderer;
import org.codehaus.plexus.util.StringInputStream;
/*
* Copyright 2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @author <a href="evenisse@apache.org">Emmanuel Venisse</a>
* @version $Id: MavenReport.java 163376 2005-02-23 00:06:06Z brett $
*/
public class SinkFactory
{
private String outputDirectory;
private String siteDirectory;
private SiteRenderer siteRenderer;
private InputStream siteDescriptor;
private String flavour;
public void setOutputDirectory( String outputDirectory )
{
this.outputDirectory = outputDirectory;
}
public void setSiteRenderer( SiteRenderer siteRenderer )
{
this.siteRenderer = siteRenderer;
}
public void setSiteDirectory( String siteDirectory )
{
this.siteDirectory = siteDirectory;
}
public void setFlavour( String flavour )
{
this.flavour = flavour;
}
public void setSiteDescriptor( InputStream siteDescriptor )
{
this.siteDescriptor = siteDescriptor;
}
public Sink getSink( String outputFileName )
throws Exception
{
InputStream descriptor = siteDescriptor;
if ( descriptor == null )
{
descriptor = new StringInputStream( "" );
}
return siteRenderer.createSink( new File( siteDirectory ), siteDirectory, outputFileName, outputDirectory,
descriptor, flavour );
}
}