Package net.riccardocossu.autodoc.parsers

Examples of net.riccardocossu.autodoc.parsers.PluginFactory


public class HtmlOutputPluginTest {

  @Test
  public void testOutput() {
    PackageParser parser = new PackageParser();
    PluginFactory factory = new PluginFactory();
    factory.registerPlugin(new JPAPlugin());
    PackageContainer pack = parser.parse(
        "net.riccardocossu.autodoc.test.model", factory);
    List<PackageContainer> packages = new ArrayList<PackageContainer>();
    packages.add(pack);
    HtmlOutputPlugin outPlugin = new HtmlOutputPlugin();
View Full Code Here


  }

  public List<PackageContainer> execute() {
    String[] plugins = configuration.getStringArray(CONFIG_INPUT_PLUGINS);
    log.info("Using plugins: {}", (Object) plugins);
    PluginFactory factory = new PluginFactory();
    for (String p : plugins) {
      try {
        factory.registerInputPlugin(p);
      } catch (Exception e) {
        log.error("Error including input plugin " + p, e);
      }
    }
    String[] packages = configuration.getStringArray(CONFIG_PACKAGES);
    log.info("Scanning packages: {}", (Object) packages);
    PackageParser parser = new PackageParser();
    List<PackageContainer> parsedPackages = new ArrayList<PackageContainer>();
    for (String p : packages) {
      PackageContainer pk = parser.parse(p, factory);
      parsedPackages.add(pk);
    }
    String confOutputDir = configuration.getString(CONFIG_BASE_OUTPUT_DIR);
    if (confOutputDir == null) {
      confOutputDir = System.getProperty("java.io.tmpdir");
    }
    File baseOutputDirectory = new File(confOutputDir);
    String[] outputPlugins = configuration
        .getStringArray(CONFIG_OUTPUT_PLUGINS);
    log.info("Using output plugins: {}", (Object) outputPlugins);
    for (String p : outputPlugins) {
      try {
        String[] splittedPackage = p.split(",");
        // identifier is mandatory and it's always the first part
        String identifier = splittedPackage[0];
        String configResource = splittedPackage.length > 1 ? splittedPackage[1]
            : null;
        OutputPlugin pl = factory.initOutputPlugin(identifier,
            configResource);
        pl.process(parsedPackages, baseOutputDirectory);
      } catch (Exception e) {
        log.error("Error including or executing output plugin " + p, e);
      }
View Full Code Here

TOP

Related Classes of net.riccardocossu.autodoc.parsers.PluginFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.