de.smartics.analysis.javadoc
Class DefaultJavadocCollector

Package class diagram package DefaultJavadocCollector
java.lang.Object
  extended by de.smartics.analysis.javadoc.DefaultJavadocCollector
All Implemented Interfaces:
JavadocCollector

public class DefaultJavadocCollector
     
     
extends Object
implements JavadocCollector

The base implementation to interface with the Javadoc tool.

Author:
Robert Reiner
See Also:
Running the Standard Doclet Programmatically

Constructor Summary
DefaultJavadocCollector(String programName, Map<String,String> javadocArguments, CollectorContext context)
          Default constructor.
 
Method Summary
 List<com.sun.javadoc.Doc> collect()
          Runs the collector.
protected  Console executeJavadocParser()
          Runs the Javadoc tool.
protected  String[] generateJavadocParserArguments()
          Flattens the arguments found in the properties to an array to be passed to the Javadoc tool.
 Map<String,String> getJavadocArguments()
          Returns the arguments to pass to the Javadoc tool.
 String getProgramName()
          Returns the name of the program that runs the Javadoc collector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultJavadocCollector

public DefaultJavadocCollector(String programName,
                               Map<String,String> javadocArguments,
                               CollectorContext context)
                        throws NullPointerException,
                               IllegalArgumentException
Default constructor.

It is expected that the properties contain the colon separated package names of all packages that are to be excluded from consideration by the name exclude. The exclusion excludes the package and all sub packages.

Typically the property packagenames names each package to consider individually. This property will be resolved to an argument to the Javadoc tool. Expected is a colon separated list of package names. This list will be split and passed to the Javadoc tool correctly.

Maybe the property subpackages is provided to select the packages (colon separated) to be parsed. Again parsing includes sub packages. This is passed as a option to the Javadoc tool.

sourcepath is the name of the property to specify the source path to the Javadoc tool. The expected argument is a pathlist. Since it is platform dependent how this list is formatted you may pass it colon separated and the colons will be replaced by the platform's path separator . This normalization only takes place if you specify this property without the leading dash ( -). If the dash is provided, the value to this property is passed to the Javadoc tool unaltered.

Additionally the following properties should be provided source encoding . Please refer to the javadoc - The Java API Documentation Generator for documentation on these arguments to the Javadoc tool.

Parameters:
programName - the name of the program that runs the Javadoc collector.
javadocArguments - the arguments to pass to the Javadoc tool. The properties are not validated and any property found here is set as an argument to the Javadoc tool. The property names usually start with a dash. If not, the value may be adjusted to meet certain criteria and the dash will be added prior to passing it to the Javadoc tool.
context - the context to control the collector's run. This will be passed to the doclet via static context.
See Also:
javadoc * - The Java API Documentation Generator
Throws:
NullPointerException - if the programName or context is null.
IllegalArgumentException - if the programName is blank.
Method Detail

getProgramName

public String getProgramName()
Returns the name of the program that runs the Javadoc collector. This string will be passed to the Javadoc tool and is used for logging purpose.

Returns:
the name of the program that runs the Javadoc collector.

getJavadocArguments

public Map<String,String> getJavadocArguments()
Returns the arguments to pass to the Javadoc tool. The properties are not validated and any property found here is set as an argument to the Javadoc tool.

Returns:
the arguments to pass to the Javadoc tool.

collect

public List<com.sun.javadoc.Doc> collect()
                                  throws JavadocException
Runs the collector.

Specified by:
collect in interface JavadocCollector
See Also:
JavadocCollector.collect()
Returns:
the list of Javadoc information collected from the Java source tree.
Throws:
JavadocException - if the Javadoc tool reports an return code that is not zero ( 0).

executeJavadocParser

protected Console executeJavadocParser()
Runs the Javadoc tool.

Returns:
the information provided by the Javadoc tool to the console.

generateJavadocParserArguments

protected String[] generateJavadocParserArguments()
Flattens the arguments found in the properties to an array to be passed to the Javadoc tool. If the key does not already start with a '-', it will be prepended.

Hook to override behaviour in subclasses.

Returns:
the properties found in javadocArguments as array.


Copyright © 2008-2011 Kronseder & Reiner GmbH - smartics. All Rights Reserved.