@@ -0,0 +1,1913 @@
+package org.quattor.maven;%0A%0Aimport org.apache.maven.plugin.AbstractMojo;%0Aimport org.apache.maven.plugin.MojoExecutionException;%0A%0Aimport java.io.File;%0Aimport java.io.FileWriter;%0Aimport java.io.IOException;%0A%0A/**%0A * Goal which runs a pan syntax check on source files.%0A * %0A * @goal check%0A * %0A * @phase process-sources%0A */%0Apublic class CheckMojo extends AbstractMojo %7B%0A%0A%09/**%0A%09 * Root directory of the pan sources to check.%0A%09 * %0A%09 * @parameter expression=%22$%7Bpanc.sourceDirectory%7D%22 default-value=%22$%7Bbasedir%7D/src/main/pan%22%0A%09 * @required%0A%09 */%0A%09private File sourceDirectory;%0A%0A%09public void execute() throws MojoExecutionException %7B%0A%0A%09%09File f = outputDirectory;%0A%0A%09%09FileWriter w = null;%0A%09%09try %7B%0A%09%09%09w = new FileWriter(touch);%0A%0A%09%09%09w.write(%22touch.txt%22);%0A%09%09%7D catch (IOException e) %7B%0A%09%09%09throw new MojoExecutionException(%22Error creating file %22 + touch, e);%0A%09%09%7D finally %7B%0A%09%09%09if (w != null) %7B%0A%09%09%09%09try %7B%0A%09%09%09%09%09w.close();%0A%09%09%09%09%7D catch (IOException e) %7B%0A%09%09%09%09%09// ignore%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%0A%09public void collectPanSources(Collection sources, File directory) %7B%0A%09%09%0A%09%09if (directory.exists()) %7B%0A%09%09%09collectPanFiles(sources, directory);%0A%0A%09%09%09List%3CFile%3E subdirs = collectSubdirs(directory);%0A%09%09%09for (File subdir : subdirs) %7B%0A%09%09%09%09collectPanSources(sources, subdir);%0A%09%09%09%7D%0A%09%09%7D%0A%0A%09%7D%0A%09%0A%09public void collectPanFiles(Collection sources, File directory) %7B%0A%09%09if (directory.exists()) %7B%0A%09%09%09return directory.listFiles(null);%0A%09%09%7D else %7B%0A%09%09%09return new File%5B0%5D;%0A%09%09%7D%0A%09%7D%0A%09%0A%09public File%5B%5D collectSubdirs(File directory) %7B%0A%09%09if (directory.exists()) %7B%0A%09%09%09return directory.listFiles(new DirectoryFileFilter());%0A%09%09%7D else %7B%0A%09%09%09return new File%5B0%5D;%0A%09%09%7D%0A%09%7D%0A%09%0A%09public static class DirectoryFileFilter %7B%09%09%0A%09%09public boolean accept(File pathname) %7B%0A%09%09%09return pathname.isDirectory();%0A%09%09%7D%0A%09%7D%0A%0A%09public static class PanSourceFileFilter %7B%09%09%0A%09%09public boolean accept(File pathname) %7B%0A%09%09%09String fname = pathname.getName();%0A%09%09%09return name.endsWith(%22.pan%22) %7C%7C name.endsWith(%22.tpl%22);%0A%09%09%7D%0A%09%7D%0A%7D%0A

add initial check goal outline