Added version numbers to the help doclet extractor. Since the help system is behaving

more like a resource bundle at this point, changed it over to use the Java ResourceBundle
support classes.


git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@2606 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
hanna 2010-01-15 23:31:29 +00:00
parent 4de7d6a59b
commit 420cef4094
8 changed files with 43 additions and 21 deletions

View File

@ -6,7 +6,7 @@
<property name="source.dir" value="java/src" />
<property name="build.dir" value="build" />
<property name="dist.dir" value="dist" />
<property name="help.file" value="${build.dir}/help.properties" />
<property name="resource.file" value="StingText.properties" />
<property name="single" value="*Test" />
<property name="singleintegration" value="*IntegrationTest" />
@ -99,10 +99,10 @@
<target name="extracthelp" depends="compile"
description="Extract help key/value pair file from the JavaDoc tags."
unless="disable.help">
<javadoc doclet="org.broadinstitute.sting.utils.help.HelpExtractorDoclet"
<javadoc doclet="org.broadinstitute.sting.utils.help.ResourceBundleExtractorDoclet"
docletpath="build"
classpathref="runtime.dependencies"
additionalparam="-out ${help.file}">
additionalparam="-out ${build.dir}/${resource.file}">
<packageset refid="source.files"/>
</javadoc>
</target>
@ -124,7 +124,7 @@
<jar jarfile="${dist.dir}/GenomeAnalysisTK.jar">
<fileset dir="build">
<include name="help.properties" />
<include name="${resource.file}" />
<include name="**/gatk/**/*.class" />
<include name="**/alignment/**/*.class"/>
<include name="**/oneoffprojects/**/*.class" />

View File

@ -58,19 +58,11 @@ public class WalkerManager extends PluginManager<Walker> {
/**
* A collection of help text for walkers and their enclosing packages.
*/
private Properties helpText = new Properties();
private ResourceBundle helpText;
public WalkerManager() {
super(Walker.class,"walker","Walker");
InputStream helpSourceFile = getClass().getClassLoader().getResourceAsStream("help.properties");
if(helpSourceFile != null) {
try {
helpText.load(helpSourceFile);
}
catch(IOException ex) {
throw new StingException("Unable to process help data");
}
}
helpText = ResourceBundle.getBundle("StingText");
}
/**
@ -100,7 +92,7 @@ public class WalkerManager extends PluginManager<Walker> {
String displayNameKey = String.format("%s.%s",packageName,DisplayNameTaglet.NAME);
String displayName = null;
if(helpText.containsKey(displayNameKey)) {
displayName = helpText.getProperty(displayNameKey);
displayName = helpText.getString(displayNameKey);
}
else {
// If no override exists...
@ -121,7 +113,7 @@ public class WalkerManager extends PluginManager<Walker> {
String key = String.format("%s.%s",packageName,SummaryTaglet.NAME);
if(!helpText.containsKey(key))
return "";
return helpText.getProperty(key);
return helpText.getString(key);
}
/**
@ -133,7 +125,7 @@ public class WalkerManager extends PluginManager<Walker> {
String walkerSummary = String.format("%s.%s",walkerType.getName(), SummaryTaglet.NAME);
if(!helpText.containsKey(walkerSummary))
return "";
return helpText.getProperty(walkerSummary);
return helpText.getString(walkerSummary);
}
/**
@ -145,7 +137,7 @@ public class WalkerManager extends PluginManager<Walker> {
String walkerDescription = String.format("%s.%s",walkerType.getName(), DescriptionTaglet.NAME);
if(!helpText.containsKey(walkerDescription))
return "";
return helpText.getProperty(walkerDescription);
return helpText.getString(walkerDescription);
}
/**

View File

@ -17,7 +17,12 @@ import org.broadinstitute.sting.utils.StingException;
* @author mhanna
* @version 0.1
*/
public class HelpExtractorDoclet {
public class ResourceBundleExtractorDoclet {
/**
* Taglet for the particular version number.
*/
private static final String VERSION_TAGLET_NAME = "version";
/**
* Extracts the contents of certain types of javadoc and adds them to an XML file.
* @param rootDoc The documentation root.
@ -72,6 +77,7 @@ public class HelpExtractorDoclet {
private static void renderHelpText(String elementName, Doc element, PrintStream out) {
// Extract overrides from the doc tags.
String name = null;
String version = null;
StringBuilder summaryBuilder = new StringBuilder();
for(Tag tag: element.firstSentenceTags())
summaryBuilder.append(tag.text());
@ -84,6 +90,8 @@ public class HelpExtractorDoclet {
throw new StingException("Only one display name tag can be used per package / walker.");
name = tag.text();
}
else if(tag.name().equals("@"+VERSION_TAGLET_NAME))
version = tag.text();
else if(tag.name().equals("@"+SummaryTaglet.NAME))
summary = tag.text();
else if(tag.name().equals("@"+DescriptionTaglet.NAME))
@ -94,6 +102,9 @@ public class HelpExtractorDoclet {
if(name != null)
out.printf("%s.%s=%s%n",elementName,DisplayNameTaglet.NAME,name);
if(version != null)
out.printf("%s.%s=%s%n",elementName,VERSION_TAGLET_NAME,version);
// Write out an alternate element summary, if exists.
out.printf("%s.%s=%s%n",elementName,SummaryTaglet.NAME,formatText(summary));

View File

@ -24,6 +24,10 @@
<available property="is.{current()}.present" classpath="{$classpath}" classname="{current()}"/>
<fail message="Class {current()} not found" unless="is.{current()}.present" />
</xsl:for-each>
<xsl:for-each select="//properties">
<available property="is.{current()}.present" file="{$staging.dir}/{current()}"/>
<fail message="Property file {current()} not found" unless="is.{current()}.present" />
</xsl:for-each>
<!-- Create an output directory for the package -->
<mkdir dir="{$package.dir}"/>
@ -40,8 +44,11 @@
<root classname="{current()}" />
</xsl:for-each>
</classfileset>
<xsl:for-each select="dependencies/properties">
<fileset file="{$staging.dir}/{current()}" />
</xsl:for-each>
<xsl:for-each select="dependencies/file">
<fileset file="{current()}" />
<fileset file="{$staging.dir}/{current()}" />
</xsl:for-each>
<manifest>
<attribute name="Main-Class" value="{main-class}"/>

View File

@ -4,8 +4,10 @@
<executable>
<name>GenomeAnalysisTK</name>
<main-class>org.broadinstitute.sting.gatk.CommandLineGATK</main-class>
<dependencies>
<!-- Text extracted from the javadocs -->
<properties>StingText.properties</properties>
<!-- The walker -->
<class>org.broadinstitute.sting.gatk.walkers.FixBAMSortOrderTag</class>
</dependencies>
</executable>

View File

@ -7,6 +7,9 @@
<name>GATK-GSA-Pipeline</name>
<main-class>org.broadinstitute.sting.gatk.CommandLineGATK</main-class>
<dependencies>
<!-- Text extracted from the javadocs -->
<properties>StingText.properties</properties>
<!-- Filters -->
<package>org.broadinstitute.sting.gatk.filters</package>
<!-- Quality scores recalibration -->
<class>org.broadinstitute.sting.gatk.walkers.recalibration.CovariateCounterWalker</class>

View File

@ -8,6 +8,9 @@
<name>GATK-Picard</name>
<main-class>org.broadinstitute.sting.gatk.CommandLineGATK</main-class>
<dependencies>
<!-- Text extracted from the javadocs -->
<properties>StingText.properties</properties>
<!-- Filters -->
<package>org.broadinstitute.sting.gatk.filters</package>
<class>org.broadinstitute.sting.gatk.walkers.coverage.DepthOfCoverageWalker</class>
<class>org.broadinstitute.sting.gatk.walkers.PileupWalker</class>

View File

@ -5,7 +5,11 @@
<name>GenomeAnalysisTK</name>
<main-class>org.broadinstitute.sting.gatk.CommandLineGATK</main-class>
<dependencies>
<!-- Text extracted from the javadocs -->
<properties>StingText.properties</properties>
<!-- Filters -->
<package>org.broadinstitute.sting.gatk.filters</package>
<!-- Basic qc walkers -->
<class>org.broadinstitute.sting.gatk.walkers.coverage.DepthOfCoverageWalker</class>
<class>org.broadinstitute.sting.gatk.walkers.PileupWalker</class>
<class>org.broadinstitute.sting.gatk.walkers.PrintReadsWalker</class>