Author: bago
Date: Sat Aug 23 10:21:18 2008
New Revision: 688376
URL: http://svn.apache.org/viewvc?rev=688376&view=rev
Log:
Add a first revision of maven-mailetdocs-plugin (MAILET-14)
This one introduce an index on top of the report and sort matchers/mailets
alphabetically.
Added:
james/mailet/maven-mailetdocs-plugin/trunk/pom.xml
james/mailet/maven-mailetdocs-plugin/trunk/src/
james/mailet/maven-mailetdocs-plugin/trunk/src/main/
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DefaultDescriptorsExtractor.java
(with props)
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DescriptorsExtractor.java
(with props)
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetMatcherDescriptor.java
(with props)
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetdocsMojo.java
(with props)
Modified:
james/mailet/current/pom.xml
Modified: james/mailet/current/pom.xml
URL:
http://svn.apache.org/viewvc/james/mailet/current/pom.xml?rev=688376&r1=688375&r2=688376&view=diff
==============================================================================
--- james/mailet/current/pom.xml (original)
+++ james/mailet/current/pom.xml Sat Aug 23 10:21:18 2008
@@ -38,6 +38,7 @@
<modules>
<module>api</module>
<module>base</module>
+ <module>maven-mailetdocs-plugin</module>
<module>crypto</module>
<module>standard</module>
</modules>
Added: james/mailet/maven-mailetdocs-plugin/trunk/pom.xml
URL:
http://svn.apache.org/viewvc/james/mailet/maven-mailetdocs-plugin/trunk/pom.xml?rev=688376&view=auto
==============================================================================
--- james/mailet/maven-mailetdocs-plugin/trunk/pom.xml (added)
+++ james/mailet/maven-mailetdocs-plugin/trunk/pom.xml Sat Aug 23 10:21:18 2008
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+ -->
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.james</groupId>
+ <artifactId>maven-mailetdocs-plugin</artifactId>
+ <packaging>maven-plugin</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <name>maven-mailetdocs-plugin Maven Mojo</name>
+ <url>http://maven.apache.org</url>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.james</groupId>
+ <artifactId>mailet</artifactId>
+ <version>2.4-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.reporting</groupId>
+ <artifactId>maven-reporting-impl</artifactId>
+ <version>2.0.4.1</version>
+ </dependency>
+ <dependency>
+ <groupId>com.thoughtworks.qdox</groupId>
+ <artifactId>qdox</artifactId>
+ <version>1.6.3</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.2.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-model</artifactId>
+ <version>2.0.9</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven.reporting</groupId>
+ <artifactId>maven-reporting-api</artifactId>
+ <version>2.0.9</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <version>2.0.9</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>2.0.9</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>1.5.6</version>
+ </dependency>
+ </dependencies>
+</project>
\ No newline at end of file
Added:
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DefaultDescriptorsExtractor.java
URL:
http://svn.apache.org/viewvc/james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DefaultDescriptorsExtractor.java?rev=688376&view=auto
==============================================================================
---
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DefaultDescriptorsExtractor.java
(added)
+++
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DefaultDescriptorsExtractor.java
Sat Aug 23 10:21:18 2008
@@ -0,0 +1,198 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you 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. *
+ ****************************************************************/
+
+package org.apache.james.mailet;
+
+import org.apache.mailet.Mailet;
+import org.apache.mailet.Matcher;
+import org.apache.maven.artifact.DependencyResolutionRequiredException;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.project.MavenProject;
+
+import com.thoughtworks.qdox.JavaDocBuilder;
+import com.thoughtworks.qdox.model.JavaClass;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * Looks for any class implementing Mailet or Matchers in the maven source
trees.
+ * Extract javadocs using QDox and extract MailetInfo informations
instantiating
+ * them.
+ */
+public class DefaultDescriptorsExtractor implements DescriptorsExtractor {
+
+ /* (non-Javadoc)
+ * @see org.apache.james.mailet.DescriptorsExtractor#extractDescriptors()
+ */
+ public List extractDescriptors(MavenProject project, Log log) {
+
+ List res = new LinkedList();
+
+ JavaDocBuilder builder = new JavaDocBuilder();
+ for (Iterator i = project.getCompileSourceRoots().iterator(); i
+ .hasNext();) {
+ builder.addSourceTree(new File((String) i.next()));
+ }
+ JavaClass[] classes = builder.getClasses();
+
+ URL[] urls = null;
+ URLClassLoader classLoader = null;
+ try {
+ try {
+ List cpes = project.getCompileClasspathElements();
+ urls = new URL[cpes.size()];
+ for (int k = 0; k < cpes.size(); k++) {
+ log.debug("CPE: " + cpes.get(k));
+ urls[k] = new File((String) cpes.get(k)).toURI().toURL();
+ }
+ classLoader = new URLClassLoader(urls);
+ } catch (DependencyResolutionRequiredException e1) {
+ log.error(e1);
+ }
+ } catch (MalformedURLException e) {
+ log.error(e);
+ }
+ Set dependencies = project.getDependencyArtifacts();
+ if (dependencies != null)
+ for (Iterator i = dependencies.iterator(); i.hasNext();) {
+ log.debug("DEP: " + i.next());
+ }
+
+ log
+ .debug("OutDir: " + project.getBuild().getOutputDirectory());
+
+ for (int i = 0; i < classes.length; i++) {
+ log.debug("Class: " + classes[i].getFullyQualifiedName());
+ try {
+ Class klass = classLoader.loadClass(classes[i]
+ .getFullyQualifiedName());
+
+ log.debug("Constr: " + klass.getConstructor(null));
+
+ List zuper = getAllInterfaces(klass);
+ Class mailetClass = classLoader.loadClass(Mailet.class
+ .getName());
+ Class matcherClass = classLoader.loadClass(Matcher.class
+ .getName());
+ if (zuper.contains(mailetClass)) {
+ Object m = klass.newInstance();
+ String mailetInfo = (String) klass.getMethod(
+ "getMailetInfo", null).invoke(m, null);
+ log.info("Found a Mailet: " + klass.getName());
+ MailetMatcherDescriptor mmdesc = new
MailetMatcherDescriptor();
+ mmdesc.setName(classes[i].getName());
+ mmdesc.setFullyQualifiedName(classes[i]
+ .getFullyQualifiedName());
+ mmdesc.setType(MailetMatcherDescriptor.TYPE_MAILET);
+ if (mailetInfo != null && mailetInfo.length() > 0) {
+ mmdesc.setInfo(mailetInfo);
+ }
+ mmdesc.setClassDocs(classes[i].getComment());
+ res.add(mmdesc);
+
+ } else if (zuper.contains(matcherClass)) {
+ Object m = klass.newInstance();
+ String matcherInfo = (String) klass.getMethod(
+ "getMatcherInfo", null).invoke(m, null);
+ log.info("Found a Matcher: " + klass.getName());
+ MailetMatcherDescriptor mmdesc = new
MailetMatcherDescriptor();
+ mmdesc.setName(classes[i].getName());
+ mmdesc.setFullyQualifiedName(classes[i]
+ .getFullyQualifiedName());
+ mmdesc.setType(MailetMatcherDescriptor.TYPE_MATCHER);
+ if (matcherInfo != null && matcherInfo.length() > 0) {
+ mmdesc.setInfo(matcherInfo);
+ }
+ mmdesc.setClassDocs(classes[i].getComment());
+ res.add(mmdesc);
+ } else if (zuper.size() > 0) {
+ for (int k = 0; k < zuper.size(); k++) {
+ log.debug("I: " + ((Class) zuper.get(k)).getName());
+ }
+ } else {
+ log.debug("No interfaces for " + klass.getName());
+ }
+
+ } catch (ClassNotFoundException e) {
+ log.error("NotFound: " + e.getMessage());
+ } catch (InstantiationException e) {
+ log.info("IE: " + e.getMessage()+" / Probably an abstract
mailet/matcher: "+classes[i].getName());
+ } catch (IllegalAccessException e) {
+ log.error("IAE: " + e.getMessage());
+ } catch (SecurityException e) {
+ log.error("SE: " + e.getMessage());
+ } catch (NoSuchMethodException e) {
+ log.error("NSME: " + e.getMessage());
+ } catch (IllegalArgumentException e) {
+ log.error("IAE2: " + e.getMessage());
+ } catch (InvocationTargetException e) {
+ log.error("ITE: " + e.getMessage());
+ }
+
+ List implementedInterfaces = getAllInterfacesQdox(classes[i]);
+ for (int k = 0; k < implementedInterfaces.size(); k++) {
+ log.info("I: " + implementedInterfaces.get(k));
+ }
+
+ }
+
+ return res;
+ }
+
+
+ private List getAllInterfacesQdox(JavaClass javaClass) {
+ List res = new LinkedList();
+ if (javaClass.getImplementedInterfaces() != null) {
+ JavaClass[] interfaces = javaClass.getImplementedInterfaces();
+ for (int n = 0; n < interfaces.length; n++) {
+ res.add(interfaces[n]);
+ }
+ }
+ if (javaClass.getSuperJavaClass() != null) {
+ res.addAll(getAllInterfacesQdox(javaClass.getSuperJavaClass()));
+ }
+ return res;
+ }
+
+ private List getAllInterfaces(Class klass) {
+ List res = new LinkedList();
+ if (klass.getInterfaces() != null) {
+ Class[] interfaces = klass.getInterfaces();
+ for (int n = 0; n < interfaces.length; n++) {
+ res.add(interfaces[n]);
+ // add also interfaces extensions
+ res.addAll(getAllInterfaces(interfaces[n]));
+ }
+ }
+ if (klass.getSuperclass() != null) {
+ res.addAll(getAllInterfaces(klass.getSuperclass()));
+ }
+ return res;
+
+ }
+
+}
Propchange:
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DefaultDescriptorsExtractor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DefaultDescriptorsExtractor.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DescriptorsExtractor.java
URL:
http://svn.apache.org/viewvc/james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DescriptorsExtractor.java?rev=688376&view=auto
==============================================================================
---
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DescriptorsExtractor.java
(added)
+++
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DescriptorsExtractor.java
Sat Aug 23 10:21:18 2008
@@ -0,0 +1,36 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you 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. *
+ ****************************************************************/
+
+package org.apache.james.mailet;
+
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.project.MavenProject;
+
+import java.util.List;
+
+public interface DescriptorsExtractor {
+
+ /**
+ * Search the source trees for mailets/matchers and returns their
descriptors
+ *
+ * @return List of MailetMatcherDescriptor objects
+ */
+ public abstract List extractDescriptors(MavenProject project, Log log);
+
+}
\ No newline at end of file
Propchange:
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DescriptorsExtractor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/DescriptorsExtractor.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetMatcherDescriptor.java
URL:
http://svn.apache.org/viewvc/james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetMatcherDescriptor.java?rev=688376&view=auto
==============================================================================
---
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetMatcherDescriptor.java
(added)
+++
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetMatcherDescriptor.java
Sat Aug 23 10:21:18 2008
@@ -0,0 +1,81 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you 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. *
+ ****************************************************************/
+
+package org.apache.james.mailet;
+
+/**
+ * Simple bean to describe a mailet or a matcher
+ */
+public class MailetMatcherDescriptor {
+
+ public final static int TYPE_MAILET = 1;
+
+ public final static int TYPE_MATCHER = 2;
+
+ private String fqName;
+
+ private String name;
+
+ private String info;
+
+ private String classDocs;
+
+ private int type;
+
+ public String getFullyQualifiedName() {
+ return fqName;
+ }
+
+ public void setFullyQualifiedName(String fqName) {
+ this.fqName = fqName;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getInfo() {
+ return info;
+ }
+
+ public void setInfo(String info) {
+ this.info = info;
+ }
+
+ public String getClassDocs() {
+ return classDocs;
+ }
+
+ public void setClassDocs(String classDocs) {
+ this.classDocs = classDocs;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public void setType(int type) {
+ this.type = type;
+ }
+
+}
\ No newline at end of file
Propchange:
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetMatcherDescriptor.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetMatcherDescriptor.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added:
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetdocsMojo.java
URL:
http://svn.apache.org/viewvc/james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetdocsMojo.java?rev=688376&view=auto
==============================================================================
---
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetdocsMojo.java
(added)
+++
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetdocsMojo.java
Sat Aug 23 10:21:18 2008
@@ -0,0 +1,268 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you 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. *
+ ****************************************************************/
+
+package org.apache.james.mailet;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections.Predicate;
+import org.apache.maven.doxia.siterenderer.Renderer;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.reporting.AbstractMavenReport;
+import org.apache.maven.reporting.MavenReportException;
+
+import java.io.File;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Locale;
+
+/**
+ * @goal mailetdocs
+ *
+ * @requiresDependencyResolution compile
+ */
+public class MailetdocsMojo extends AbstractMavenReport {
+
+ /**
+ * <i>Maven Internal</i>: The Doxia Site Renderer.
+ *
+ * @component
+ */
+ private Renderer siteRenderer;
+
+ /**
+ * <i>Maven Internal</i>: The Project descriptor.
+ *
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ private MavenProject project;
+
+ /**
+ * The output directory.
+ *
+ * @parameter expression="${project.reporting.outputDirectory}"
+ * @required
+ */
+ private File outputDirectory;
+
+ /**
+ * A imple Predicate to extract only a given type from a list
+ */
+ private static final class TypePredicate implements Predicate {
+ private int type;
+
+ public TypePredicate(int typeMatcher) {
+ this.type = typeMatcher;
+ }
+
+ public boolean evaluate(Object arg0) {
+ return ((MailetMatcherDescriptor) arg0).getType() == type;
+ }
+ }
+
+ protected void executeReport(Locale locale) throws MavenReportException {
+
+ List descriptors = new
DefaultDescriptorsExtractor().extractDescriptors(project, getLog());
+
+ Collections.sort(descriptors, new Comparator() {
+
+ public int compare(Object arg0, Object arg1) {
+ return ((MailetMatcherDescriptor) arg0).getName().compareTo(
+ ((MailetMatcherDescriptor) arg1).getName());
+ }
+
+ });
+
+ getLog().info("Executing Mailets/Matchers Report");
+
+ getSink().head();
+ getSink().title();
+ getSink().text("Mailet and Matchers Reference");
+ getSink().title_();
+ getSink().head_();
+
+ getSink().body();
+
+ List matchers = (List) CollectionUtils.select(descriptors,
+ new TypePredicate(MailetMatcherDescriptor.TYPE_MATCHER));
+ List mailets = (List) CollectionUtils.select(descriptors,
+ new TypePredicate(MailetMatcherDescriptor.TYPE_MAILET));
+
+ getSink().section1();
+ getSink().sectionTitle1();
+ getSink().text("Mailets and Matchers Reference");
+ getSink().sectionTitle1_();
+ getSink().section1_();
+
+ if (matchers.size() > 0 && mailets.size() > 0) {
+ getSink().table();
+ getSink().tableRow();
+ getSink().tableCell();
+ }
+ if (matchers.size() > 0) {
+ outputDescriptorIndex(matchers, "Matchers");
+ }
+ if (matchers.size() > 0 && mailets.size() > 0) {
+ getSink().tableCell_();
+ getSink().tableCell();
+ }
+ if (mailets.size() > 0) {
+ outputDescriptorIndex(mailets, "Mailets");
+ }
+ if (matchers.size() > 0 && mailets.size() > 0) {
+ getSink().tableCell_();
+ getSink().tableRow_();
+ getSink().table_();
+ }
+
+ if (matchers.size() > 0) {
+ outputDescriptorList(matchers, "Matchers");
+ }
+ if (mailets.size() > 0) {
+ outputDescriptorList(mailets, "Mailets");
+ }
+
+ getSink().body_();
+
+ getSink().flush();
+ getSink().close();
+
+ /*
+ * for (Iterator i = getProject().getCompileSourceRoots().iterator();
+ * i.hasNext(); ) { String folder = (String) i.next(); DirectoryScanner
+ * ds = new DirectoryScanner(); ds.setBasedir(folder);
+ * ds.addDefaultExcludes(); ds.setIncludes(new
+ * String[]{"**"+"/"+"*.java"}); ds.scan(); for (int k = 0; k <
+ * ds.getIncludedFiles().length; k++) { getLog().info("include:
+ * "+ds.getIncludedFiles()[k]); } }
+ */
+
+ }
+
+ private void outputDescriptorIndex(List descriptors, String title) {
+ getSink().section2();
+ getSink().sectionTitle2();
+ getSink().text(title);
+ getSink().sectionTitle2_();
+
+ getSink().list();
+ for (int i = 0; i < descriptors.size(); i++) {
+ getSink().listItem();
+ getSink().link(((MailetMatcherDescriptor)
descriptors.get(i)).getName());
+ getSink().text(
+ ((MailetMatcherDescriptor) descriptors.get(i)).getName());
+ getSink().link_();
+ getSink().listItem_();
+ }
+ getSink().list_();
+
+ getSink().section2_();
+ }
+
+ private void outputDescriptorList(List descriptors, String title) {
+ getSink().section1();
+ getSink().sectionTitle1();
+ getSink().text(title);
+ getSink().sectionTitle1_();
+
+ for (int i = 0; i < descriptors.size(); i++) {
+ getSink().section2();
+
+ getSink().sectionTitle2();
+ getSink().anchor(((MailetMatcherDescriptor)
descriptors.get(i)).getName());
+ getSink().text(
+ ((MailetMatcherDescriptor) descriptors.get(i)).getName());
+ getSink().anchor_();
+ getSink().sectionTitle2_();
+
+ getSink().paragraph();
+ if (((MailetMatcherDescriptor) descriptors.get(i)).getType() ==
MailetMatcherDescriptor.TYPE_MAILET) {
+ getSink().text("Mailet Info: ");
+ } else if (((MailetMatcherDescriptor)
descriptors.get(i)).getType() == MailetMatcherDescriptor.TYPE_MAILET) {
+ getSink().text("Matcher Info: ");
+ } else {
+ getSink().text("Info: ");
+ }
+ getSink().bold();
+ getSink().text(
+ ((MailetMatcherDescriptor) descriptors.get(i)).getInfo());
+ getSink().bold_();
+ getSink().paragraph_();
+
+ getSink().paragraph();
+ getSink().rawText(
+ ((MailetMatcherDescriptor) descriptors.get(i))
+ .getClassDocs());
+ getSink().paragraph_();
+
+ getSink().section2_();
+
+ }
+
+ getSink().section1_();
+ }
+
+ protected String getOutputDirectory() {
+ return outputDirectory.getAbsolutePath();
+ }
+
+ /**
+ * @return Returns the siteRenderer.
+ */
+ public Renderer getSiteRenderer() {
+ return siteRenderer;
+ }
+
+ protected MavenProject getProject() {
+ return project;
+ }
+
+ public String getDescription(Locale arg0) {
+ return "Documentation about bundled mailets";
+ }
+
+ public String getName(Locale arg0) {
+ return "Mailet Reference";
+ }
+
+ public String getOutputName() {
+ return "mailet-report";
+ }
+
+ /**
+ * @param siteRenderer
+ * The siteRenderer to set.
+ */
+ public void setSiteRenderer(Renderer siteRenderer) {
+ this.siteRenderer = siteRenderer;
+ }
+
+ /**
+ * For testing purpose only.
+ *
+ * @param project
+ * The project to set.
+ */
+ public void setProject(MavenProject project) {
+ this.project = project;
+ }
+
+}
Propchange:
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetdocsMojo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
james/mailet/maven-mailetdocs-plugin/trunk/src/main/java/org/apache/james/mailet/MailetdocsMojo.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]