diff --git a/public/java/src/org/broadinstitute/sting/gatk/CommandLineGATK.java b/public/java/src/org/broadinstitute/sting/gatk/CommandLineGATK.java index 2af29ea70..f8c84116d 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/CommandLineGATK.java +++ b/public/java/src/org/broadinstitute/sting/gatk/CommandLineGATK.java @@ -36,6 +36,7 @@ import org.broadinstitute.sting.gatk.walkers.Walker; import org.broadinstitute.sting.utils.exceptions.UserException; import org.broadinstitute.sting.utils.help.ApplicationDetails; import org.broadinstitute.sting.utils.help.DocumentedGATKFeature; +import org.broadinstitute.sting.utils.help.GATKDoclet; import org.broadinstitute.sting.utils.text.TextFormattingUtils; import java.util.*; @@ -175,12 +176,8 @@ public class CommandLineGATK extends CommandLineExecutable { StringBuilder additionalHelp = new StringBuilder(); Formatter formatter = new Formatter(additionalHelp); - formatter.format("Description:%n"); - - WalkerManager walkerManager = engine.getWalkerManager(); - String walkerHelpText = walkerManager.getWalkerDescriptionText(walkerType); - - printDescriptorLine(formatter,WALKER_INDENT,"",WALKER_INDENT,FIELD_SEPARATOR,walkerHelpText,TextFormattingUtils.DEFAULT_LINE_WIDTH); + formatter.format("For a full description of this walker, see its GATKdocs at:%n"); + formatter.format("%s%n", GATKDoclet.helpLinksToGATKDocs(walkerType)); return additionalHelp.toString(); } @@ -194,8 +191,6 @@ public class CommandLineGATK extends CommandLineExecutable { StringBuilder additionalHelp = new StringBuilder(); Formatter formatter = new Formatter(additionalHelp); - formatter.format("Available analyses:%n"); - // Get the list of walker names from the walker manager. WalkerManager walkerManager = engine.getWalkerManager(); diff --git a/public/java/src/org/broadinstitute/sting/utils/help/DocumentedGATKFeatureHandler.java b/public/java/src/org/broadinstitute/sting/utils/help/DocumentedGATKFeatureHandler.java index 366df0c3a..c561ea54b 100644 --- a/public/java/src/org/broadinstitute/sting/utils/help/DocumentedGATKFeatureHandler.java +++ b/public/java/src/org/broadinstitute/sting/utils/help/DocumentedGATKFeatureHandler.java @@ -50,8 +50,8 @@ public abstract class DocumentedGATKFeatureHandler { public boolean shouldBeProcessed(ClassDoc doc) { return true; } - public String getDestinationFilename(ClassDoc doc) { - return HelpUtils.getClassName(doc).replace(".", "_") + ".html"; + public String getDestinationFilename(ClassDoc doc, Class clazz) { + return GATKDoclet.htmlFilenameForClass(clazz); } public abstract String getTemplateName(ClassDoc doc) throws IOException; diff --git a/public/java/src/org/broadinstitute/sting/utils/help/GATKDocWorkUnit.java b/public/java/src/org/broadinstitute/sting/utils/help/GATKDocWorkUnit.java index 65c6624d5..1f6db2757 100644 --- a/public/java/src/org/broadinstitute/sting/utils/help/GATKDocWorkUnit.java +++ b/public/java/src/org/broadinstitute/sting/utils/help/GATKDocWorkUnit.java @@ -30,19 +30,29 @@ import java.util.HashMap; import java.util.Map; /** -* Created by IntelliJ IDEA. -* User: depristo -* Date: 7/24/11 -* Time: 7:59 PM -* To change this template use File | Settings | File Templates. -*/ -public class GATKDocWorkUnit implements Comparable { - // known at the start - final String name, filename, group; - final DocumentedGATKFeatureHandler handler; - final ClassDoc classDoc; + * Simple collection of all relevant information about something the GATKDoclet can document + * + * Created by IntelliJ IDEA. + * User: depristo + * Date: 7/24/11 + * Time: 7:59 PM + */ +class GATKDocWorkUnit implements Comparable { + /** The class that's being documented */ final Class clazz; + /** The name of the thing we are documenting */ + final String name; + /** the filename where we will be writing the docs for this class */ + final String filename; + /** The name of the documentation group (e.g., walkers, read filters) class belongs to */ + final String group; + /** The documentation handler for this class */ + final DocumentedGATKFeatureHandler handler; + /** The javadoc documentation for clazz */ + final ClassDoc classDoc; + /** The annotation that lead to this Class being in GATKDoc */ final DocumentedGATKFeature annotation; + /** When was this walker built, and what's the absolute version number */ final String buildTimestamp, absoluteVersion; // set by the handler @@ -64,12 +74,21 @@ public class GATKDocWorkUnit implements Comparable { this.absoluteVersion = absoluteVersion; } + /** + * Called by the GATKDoclet to set handler provided context for this work unit + * @param summary + * @param forTemplate + */ public void setHandlerContent(String summary, Map forTemplate) { this.summary = summary; this.forTemplate = forTemplate; } - public Map toMap() { + /** + * Return a String -> String map suitable for FreeMarker to create an index to this WorkUnit + * @return + */ + public Map indexDataMap() { Map data = new HashMap(); data.put("name", name); data.put("summary", summary); @@ -78,6 +97,11 @@ public class GATKDocWorkUnit implements Comparable { return data; } + /** + * Sort in order of the name of this WorkUnit + * @param other + * @return + */ public int compareTo(GATKDocWorkUnit other) { return this.name.compareTo(other.name); } diff --git a/public/java/src/org/broadinstitute/sting/utils/help/GATKDoclet.java b/public/java/src/org/broadinstitute/sting/utils/help/GATKDoclet.java index 49214237a..2647b6983 100644 --- a/public/java/src/org/broadinstitute/sting/utils/help/GATKDoclet.java +++ b/public/java/src/org/broadinstitute/sting/utils/help/GATKDoclet.java @@ -42,6 +42,9 @@ import java.util.*; * */ public class GATKDoclet { + private final static String URL_ROOT_FOR_RELEASE_GATKDOCS = "http://www.broadinstitute.org/gsa/gatkdocs/release/"; + private final static String URL_ROOT_FOR_STABLE_GATKDOCS = "http://iwww.broadinstitute.org/gsa/gatkdocs/stable/"; + private final static String URL_ROOT_FOR_UNSTABLE_GATKDOCS = "http://iwww.broadinstitute.org/gsa/gatkdocs/unstable/"; final protected static File SETTINGS_DIR = new File("settings/helpTemplates"); final protected static File DESTINATION_DIR = new File("gatkdocs"); final protected static Logger logger = Logger.getLogger(GATKDoclet.class); @@ -89,6 +92,19 @@ public class GATKDoclet { return showHiddenFeatures; } + public static String htmlFilenameForClass(Class c) { + return c.getName().replace(".", "_") + ".html"; + } + + public static String helpLinksToGATKDocs(Class c) { + String classPath = htmlFilenameForClass(c); + StringBuilder b = new StringBuilder(); + b.append("release version: ").append(URL_ROOT_FOR_RELEASE_GATKDOCS).append(classPath).append("\n"); + b.append("stable version: ").append(URL_ROOT_FOR_STABLE_GATKDOCS).append(classPath).append("\n"); + b.append("unstable version: ").append(URL_ROOT_FOR_UNSTABLE_GATKDOCS).append(classPath).append("\n"); + return b.toString(); + } + public Set workUnits() { TreeSet m = new TreeSet(); @@ -103,7 +119,7 @@ public class GATKDoclet { DocumentedGATKFeatureHandler handler = createHandler(doc, feature); if ( handler != null && handler.shouldBeProcessed(doc) ) { logger.info("Going to generate documentation for class " + doc); - String filename = handler.getDestinationFilename(doc); + String filename = handler.getDestinationFilename(doc, clazz); GATKDocWorkUnit unit = new GATKDocWorkUnit(doc.name(), filename, feature.groupName(), feature, handler, doc, clazz, @@ -220,7 +236,7 @@ public class GATKDoclet { Set docFeatures = new HashSet(); List> data = new ArrayList>(); for ( GATKDocWorkUnit workUnit : indexData ) { - data.add(workUnit.toMap()); + data.add(workUnit.indexDataMap()); docFeatures.add(workUnit.annotation); }