diff --git a/maven-reporting/maven-reporting-api/src/main/java/org/apache/maven/reporting/AbstractMavenMultiPageReport.java b/maven-reporting/maven-reporting-api/src/main/java/org/apache/maven/reporting/AbstractMavenMultiPageReport.java new file mode 100644 index 0000000000..68de0d89a4 --- /dev/null +++ b/maven-reporting/maven-reporting-api/src/main/java/org/apache/maven/reporting/AbstractMavenMultiPageReport.java @@ -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 Emmanuel Venisse + * @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 ); + } +} \ No newline at end of file diff --git a/maven-reporting/maven-reporting-api/src/main/java/org/apache/maven/reporting/sink/SinkFactory.java b/maven-reporting/maven-reporting-api/src/main/java/org/apache/maven/reporting/sink/SinkFactory.java new file mode 100644 index 0000000000..ec284717d6 --- /dev/null +++ b/maven-reporting/maven-reporting-api/src/main/java/org/apache/maven/reporting/sink/SinkFactory.java @@ -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 Emmanuel Venisse + * @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 ); + } +}