Cleanup results of bad merge.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2281 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
hanna 2009-12-07 19:30:49 +00:00
parent 10be5a5de9
commit a3e88c0b1c
3 changed files with 0 additions and 353 deletions

View File

@ -1,120 +0,0 @@
package org.broadinstitute.sting.utils.doc;
import com.sun.tools.doclets.Taglet;
import com.sun.javadoc.Tag;
import java.util.Map;
/**
* Provide an alternate description for the given help system.
*
* @author mhanna
* @version 0.1
*/
public class DescriptionTaglet implements Taglet {
/**
* The key tag for this taglet.
*/
public static final String NAME = "help.description";
/**
* Return the name of this custom tag.
*/
public String getName() {
return NAME;
}
/**
* Will return false since this tag cannot be applied
* to a field.
* @return false since this tag cannot be applied to a field.
*/
public boolean inField() {
return false;
}
/**
* Will return false since this tag cannot be applied
* to a constructor.
* @return false since this tag cannot be applied to a constructor.
*/
public boolean inConstructor() {
return false;
}
/**
* Will return false since this tag cannot be applied
* to a method.
* @return false since this tag cannot be applied to a method.
*/
public boolean inMethod() {
return false;
}
/**
* Will return false since overviews are always named
* by the <code>@WalkerName</code> tag.
* @return false always
*/
public boolean inOverview() {
return true;
}
/**
* Will return true to indicate that packages can be given useful
* description.
* @return true always
*/
public boolean inPackage() {
return true;
}
/**
* Will return false indicating that types cannot be given
* alternate description.
* @return false always.
*/
public boolean inType() {
return false;
}
/**
* Will return false since <code>@todo</code>
* is not an inline tag.
* @return false since <code>@todo</code>
* is not an inline tag.
*/
public boolean isInlineTag() {
return false;
}
/**
* Register this Taglet.
* @param tagletMap the map to register this tag to.
*/
public static void register(Map tagletMap) {
DescriptionTaglet tag = new DescriptionTaglet();
Taglet t = (Taglet)tagletMap.get(tag.getName());
if (t != null) {
tagletMap.remove(tag.getName());
}
tagletMap.put(tag.getName(), tag);
}
/**
* Create a string representation of this tag. Since this tag is only
* used by the help system, don't output any HTML.
*/
public String toString(Tag tag) {
return null;
}
/**
* Create a string representation of this tag. Since this tag is only
* used by the help system, don't output any HTML.
*/
public String toString(Tag[] tags) {
return null;
}
}

View File

@ -1,120 +0,0 @@
package org.broadinstitute.sting.utils.doc;
import com.sun.tools.doclets.Taglet;
import com.sun.javadoc.Tag;
import java.util.Map;
/**
* Provide a display name in the help for packages
*
* @author mhanna
* @version 0.1
*/
public class DisplayNameTaglet implements Taglet {
/**
* The display name for this taglet.
*/
public static final String NAME = "help.display.name";
/**
* Return the name of this custom tag.
*/
public String getName() {
return NAME;
}
/**
* Will return false since this tag cannot be applied
* to a field.
* @return false since this tag cannot be applied to a field.
*/
public boolean inField() {
return false;
}
/**
* Will return false since this tag cannot be applied
* to a constructor.
* @return false since this tag cannot be applied to a constructor.
*/
public boolean inConstructor() {
return false;
}
/**
* Will return false since this tag cannot be applied
* to a method.
* @return false since this tag cannot be applied to a method.
*/
public boolean inMethod() {
return false;
}
/**
* Will return false since overviews are always named
* by the <code>@WalkerName</code> tag.
* @return false always
*/
public boolean inOverview() {
return false;
}
/**
* Will return true to indicate that packages can be given useful
* display text.
* @return true always
*/
public boolean inPackage() {
return true;
}
/**
* Will return false indicating that types cannot be given
* alternate display names.
* @return false always.
*/
public boolean inType() {
return false;
}
/**
* Will return false since <code>@todo</code>
* is not an inline tag.
* @return false since <code>@todo</code>
* is not an inline tag.
*/
public boolean isInlineTag() {
return false;
}
/**
* Register this Taglet.
* @param tagletMap the map to register this tag to.
*/
public static void register(Map tagletMap) {
DisplayNameTaglet tag = new DisplayNameTaglet();
Taglet t = (Taglet)tagletMap.get(tag.getName());
if (t != null) {
tagletMap.remove(tag.getName());
}
tagletMap.put(tag.getName(), tag);
}
/**
* Create a string representation of this tag. Since this tag is only
* used by the help system, don't output any HTML.
*/
public String toString(Tag tag) {
return null;
}
/**
* Create a string representation of this tag. Since this tag is only
* used by the help system, don't output any HTML.
*/
public String toString(Tag[] tags) {
return null;
}
}

View File

@ -1,113 +0,0 @@
package org.broadinstitute.sting.utils.doc;
import com.sun.javadoc.*;
import java.util.HashSet;
import java.util.Set;
import java.util.Scanner;
import java.io.PrintStream;
import java.io.FileNotFoundException;
import org.broadinstitute.sting.utils.StingException;
/**
* Extracts certain types of javadoc (specifically package and class descriptions) and makes them available
* to applications at runtime.
*
* @author mhanna
* @version 0.1
*/
public class HelpExtractorDoclet {
/**
* Extracts the contents of certain types of javadoc and adds them to an XML file.
* @param rootDoc The documentation root.
* @return Whether the JavaDoc run succeeded.
* @throws FileNotFoundException if output can't be written.
*/
public static boolean start(RootDoc rootDoc) throws FileNotFoundException {
PrintStream out = System.out;
for(String[] options: rootDoc.options()) {
if(options[0].equals("-out"))
out = new PrintStream(options[1]);
}
// Cache packages as we see them, since there's no direct way to iterate over packages.
Set<PackageDoc> packages = new HashSet<PackageDoc>();
for(ClassDoc currentClass: rootDoc.classes()) {
PackageDoc containingPackage = currentClass.containingPackage();
packages.add(containingPackage);
String className = containingPackage.name().length() > 0 ?
String.format("%s.%s",containingPackage.name(),currentClass.name()) :
String.format("%s",currentClass.name());
renderHelpText(className,currentClass,out);
}
for(PackageDoc currentPackage: packages)
renderHelpText(currentPackage.name(),currentPackage,out);
return true;
}
/**
* Validate the given options against options supported by this doclet.
* @param option Option to validate.
* @return Number of potential parameters; 0 if not supported.
*/
public static int optionLength(String option) {
if(option.equals("-out")) {
return 2;
}
return 0;
}
/**
* Renders all the help text required for a given name.
* @param elementName element name to use as the key
* @param element Doc element to process.
* @param out Output stream to which to write.
*/
private static void renderHelpText(String elementName, Doc element, PrintStream out) {
// Extract overrides from the doc tags.
String overrideName = null;
String overrideDescription = element.commentText();
for(Tag tag: element.tags()) {
if(tag.name().equals("@"+DisplayNameTaglet.NAME)) {
if(overrideName != null)
throw new StingException("Only one display name tag can be used per package / walker.");
overrideName = tag.text();
}
else if(tag.name().equals("@"+DescriptionTaglet.NAME))
overrideDescription = tag.text();
}
// Write out an alternate element name, if exists.
if(overrideName != null)
out.printf("%s.%s=%s%n",elementName,DisplayNameTaglet.NAME,overrideName);
// Write out an alternate description, if present.
String description = formatText(overrideDescription);
if(description.length() > 0)
out.printf("%s=%s%n",elementName,description);
}
/**
* Format text for consumption by the properties file.
* @param text Text to format.
* @return Formatted text; string trimmed, newlines removed.
*/
private static String formatText(String text) {
Scanner scanner = new Scanner(text);
StringBuilder output = new StringBuilder();
while(scanner.hasNextLine()) {
if(output.length() > 0)
output.append(' ');
output.append(scanner.nextLine().trim());
}
return output.toString();
}
}