Generalized handler to allow it to be used with any arbitrary class structure.
DocumentedGATKFeature now includes a field for the group name. Build.xml works with public / private now.
This commit is contained in:
parent
453954182e
commit
f0be7348be
|
|
@ -457,8 +457,9 @@
|
|||
</javadoc>
|
||||
</target>
|
||||
|
||||
<target name="walkerdocs" unless="uptodate.extracthelp"
|
||||
<target name="gatkdocs" unless="uptodate.extracthelp" depends="gatk.compile"
|
||||
description="Extract help key/value pair file from the JavaDoc tags.">
|
||||
<property name="gatk.target" value="private"/>
|
||||
<path id="doclet.classpath">
|
||||
<path refid="external.dependencies" />
|
||||
<pathelement location="${java.classes}" />
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ import org.broadinstitute.sting.utils.GenomeLoc;
|
|||
import org.broadinstitute.sting.utils.baq.BAQ;
|
||||
import org.broadinstitute.sting.utils.collections.Pair;
|
||||
import org.broadinstitute.sting.utils.help.DocumentedGATKFeature;
|
||||
import org.broadinstitute.sting.utils.help.WalkerDocumentationHandler;
|
||||
import org.broadinstitute.sting.utils.help.GenericDocumentationHandler;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ import java.util.List;
|
|||
@ReadFilters(MalformedReadFilter.class)
|
||||
@PartitionBy(PartitionType.NONE)
|
||||
@BAQMode(QualityMode = BAQ.QualityMode.OVERWRITE_QUALS, ApplicationTime = BAQ.ApplicationTime.ON_INPUT)
|
||||
@DocumentedGATKFeature( handler = WalkerDocumentationHandler.class )
|
||||
@DocumentedGATKFeature( groupName = "GATK walkers" )
|
||||
public abstract class Walker<MapType, ReduceType> {
|
||||
final protected static Logger logger = Logger.getLogger(Walker.class);
|
||||
private GenomeAnalysisEngine toolkit;
|
||||
|
|
|
|||
|
|
@ -36,5 +36,6 @@ import java.lang.annotation.*;
|
|||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface DocumentedGATKFeature {
|
||||
Class<? extends DocumentedGATKFeatureHandler> handler();
|
||||
String groupName();
|
||||
Class<? extends DocumentedGATKFeatureHandler> handler() default GenericDocumentationHandler.class;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ import java.util.Map;
|
|||
*/
|
||||
public abstract class DocumentedGATKFeatureHandler {
|
||||
private GATKDoclet doclet;
|
||||
private String groupName;
|
||||
|
||||
protected RootDoc getRootDoc() {
|
||||
return this.doclet.rootDoc;
|
||||
|
|
@ -64,7 +65,14 @@ public abstract class DocumentedGATKFeatureHandler {
|
|||
return ResourceBundleExtractorDoclet.getClassName(doc).replace(".", "_") + ".html";
|
||||
}
|
||||
|
||||
public abstract String getGroupName();
|
||||
final public String getGroupName() {
|
||||
return groupName;
|
||||
}
|
||||
|
||||
final public void setGroupName(String groupName) {
|
||||
this.groupName = groupName;
|
||||
}
|
||||
|
||||
public abstract String getTemplateName(ClassDoc doc) throws IOException;
|
||||
public abstract GATKDoclet.DocumentationData processOne(ClassDoc doc);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ public class GATKDoclet extends ResourceBundleExtractorDoclet {
|
|||
|
||||
List<DocumentationData> indexData = new ArrayList<DocumentationData>();
|
||||
for ( ClassDoc doc : rootDoc.classes() ) {
|
||||
System.out.printf("Considering %s%n", doc);
|
||||
DocumentedGATKFeatureHandler handler = getHandlerForClassDoc(doc);
|
||||
if ( handler != null && handler.shouldBeProcessed(doc) ) {
|
||||
DocumentationData docData = processDocumentationWithHandler(cfg, handler, doc);
|
||||
|
|
@ -132,6 +133,7 @@ public class GATKDoclet extends ResourceBundleExtractorDoclet {
|
|||
if ( docClass.isAnnotationPresent(DocumentedGATKFeature.class) ) {
|
||||
DocumentedGATKFeature feature = docClass.getAnnotation(DocumentedGATKFeature.class);
|
||||
DocumentedGATKFeatureHandler handler = feature.handler().newInstance();
|
||||
handler.setGroupName(feature.groupName());
|
||||
handler.setDoclet(this);
|
||||
return handler;
|
||||
} else {
|
||||
|
|
@ -152,7 +154,7 @@ public class GATKDoclet extends ResourceBundleExtractorDoclet {
|
|||
|
||||
private void processIndex(Configuration cfg, List<DocumentationData> indexData) throws IOException {
|
||||
/* Get or create a template */
|
||||
Template temp = cfg.getTemplate("walker.index.template.html");
|
||||
Template temp = cfg.getTemplate("generic.index.template.html");
|
||||
|
||||
/* Merge data-model with template */
|
||||
Writer out = new OutputStreamWriter(new FileOutputStream(new File("testdoc/index.html")));
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ import java.util.Map;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
public class WalkerDocumentationHandler extends DocumentedGATKFeatureHandler {
|
||||
public class GenericDocumentationHandler extends DocumentedGATKFeatureHandler {
|
||||
@Override
|
||||
public boolean shouldBeProcessed(ClassDoc doc) {
|
||||
try {
|
||||
|
|
@ -59,17 +59,14 @@ public class WalkerDocumentationHandler extends DocumentedGATKFeatureHandler {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGroupName() { return "GATK Walkers"; }
|
||||
|
||||
@Override
|
||||
public String getTemplateName(ClassDoc doc) throws IOException {
|
||||
return "walker.template.html";
|
||||
return "generic.template.html";
|
||||
}
|
||||
|
||||
@Override
|
||||
public GATKDoclet.DocumentationData processOne(ClassDoc doc) {
|
||||
System.out.printf("Walker class %s%n", doc);
|
||||
System.out.printf("%s class %s%n", getGroupName(), doc);
|
||||
Map<String, Object> root = buildWalkerDataModel(doc); // Create the root hash
|
||||
return new GATKDoclet.DocumentationData(doc.name(), (String)root.get("summary"), root);
|
||||
}
|
||||
|
|
@ -136,9 +133,9 @@ public class WalkerDocumentationHandler extends DocumentedGATKFeatureHandler {
|
|||
}
|
||||
|
||||
private FieldDoc getFieldDoc(ClassDoc classDoc, String name, boolean primary) {
|
||||
System.out.printf("Looking for %s in %s%n", name, classDoc.name());
|
||||
//System.out.printf("Looking for %s in %s%n", name, classDoc.name());
|
||||
for ( FieldDoc fieldDoc : classDoc.fields(false) ) {
|
||||
System.out.printf("fieldDoc " + fieldDoc + " name " + fieldDoc.name());
|
||||
//System.out.printf("fieldDoc " + fieldDoc + " name " + fieldDoc.name());
|
||||
if ( fieldDoc.name().equals(name) )
|
||||
return fieldDoc;
|
||||
|
||||
Loading…
Reference in New Issue