Search in sources :

Example 1 with ApiReferenceTemplateHandler

use of com.zimbra.doc.soap.template.ApiReferenceTemplateHandler in project zm-mailbox by Zimbra.

the class ZmApiDoclet method start.

/**
     * Starts processing the classes at the root document
     *
     * @param root the root document
     * @throws IOException 
     * @throws SoapDocException 
     */
public static boolean start(RootDoc root) throws IOException, SoapDocException {
    if (apiListener == null) {
        setListener(new DocletApiListener());
    }
    apiListener.processJavadocResults(root);
    // map between class name and associated documentation
    Map<String, ApiClassDocumentation> javadocInfo = apiListener.getDocMap();
    readOptions(root.options());
    Root soapApiDataModelRoot = WsdlDocGenerator.processJaxbClasses(javadocInfo);
    // process FreeMarker templates
    Properties templateContext = new Properties();
    templateContext.setProperty(TemplateHandler.PROP_TEMPLATES_DIR, templatesDir);
    templateContext.setProperty(TemplateHandler.PROP_OUTPUT_DIR, outputDir);
    templateContext.setProperty(TemplateHandler.PROP_BUILD_VERSION, buildVersion);
    templateContext.setProperty(TemplateHandler.PROP_BUILD_DATE, buildDate);
    // generate the API Reference documentation
    ApiReferenceTemplateHandler templateHandler = new ApiReferenceTemplateHandler(templateContext);
    templateHandler.process(soapApiDataModelRoot);
    // generate a JSON representation of the API used when creating a changelog
    SoapApiDescription jsonDesc = new SoapApiDescription(buildVersion, buildDate);
    jsonDesc.build(soapApiDataModelRoot);
    File json = new File(apiDescriptionJson);
    jsonDesc.serializeToJson(json);
    return true;
}
Also used : ApiReferenceTemplateHandler(com.zimbra.doc.soap.template.ApiReferenceTemplateHandler) Root(com.zimbra.doc.soap.Root) SoapApiDescription(com.zimbra.doc.soap.apidesc.SoapApiDescription) Properties(java.util.Properties) File(java.io.File) ApiClassDocumentation(com.zimbra.doc.soap.ApiClassDocumentation)

Aggregations

ApiClassDocumentation (com.zimbra.doc.soap.ApiClassDocumentation)1 Root (com.zimbra.doc.soap.Root)1 SoapApiDescription (com.zimbra.doc.soap.apidesc.SoapApiDescription)1 ApiReferenceTemplateHandler (com.zimbra.doc.soap.template.ApiReferenceTemplateHandler)1 File (java.io.File)1 Properties (java.util.Properties)1