Search in sources :

Example 1 with DocumentationProvider

use of org.apache.cxf.jaxrs.model.doc.DocumentationProvider in project cxf by apache.

the class Java2WADLMojo method execute.

public void execute() throws MojoExecutionException {
    System.setProperty("org.apache.cxf.JDKBugHacks.defaultUsesCaches", "true");
    List<Class<?>> resourceClasses = loadResourceClasses();
    initClassResourceInfoList(resourceClasses);
    WadlGenerator wadlGenerator = null;
    if (customWadlGenerator != null) {
        try {
            wadlGenerator = (WadlGenerator) getClassLoader().loadClass(customWadlGenerator).getConstructor(new Class[] { Bus.class }).newInstance(new Object[] { getBus() });
        } catch (Throwable e) {
            getLog().debug("Custom WADLGenerator can not be created, using the default one");
        }
    }
    if (wadlGenerator == null) {
        wadlGenerator = new WadlGenerator(getBus());
    }
    DocumentationProvider documentationProvider = null;
    if (docProvider != null) {
        try {
            documentationProvider = (DocumentationProvider) getClassLoader().loadClass(docProvider).getConstructor(new Class[] { String.class }).newInstance(new Object[] { project.getBuild().getDirectory() });
            wadlGenerator.setDocumentationProvider(documentationProvider);
        } catch (Exception e) {
            throw new MojoExecutionException(e.getMessage(), e);
        }
    }
    setExtraProperties(wadlGenerator);
    StringBuilder sbMain = wadlGenerator.generateWADL(getBaseURI(), classResourceInfos, useJson, null, null);
    getLog().debug("the wadl is =====> \n" + sbMain.toString());
    generateWadl(resourceClasses, sbMain.toString());
}
Also used : Bus(org.apache.cxf.Bus) WadlGenerator(org.apache.cxf.jaxrs.model.wadl.WadlGenerator) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) IOException(java.io.IOException) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) DocumentationProvider(org.apache.cxf.jaxrs.model.doc.DocumentationProvider)

Aggregations

IOException (java.io.IOException)1 Bus (org.apache.cxf.Bus)1 DocumentationProvider (org.apache.cxf.jaxrs.model.doc.DocumentationProvider)1 WadlGenerator (org.apache.cxf.jaxrs.model.wadl.WadlGenerator)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1