Java Code Examples for org.apache.commons.io.filefilter.FileFilterUtils#makeSVNAware()

The following examples show how to use org.apache.commons.io.filefilter.FileFilterUtils#makeSVNAware() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LicenseHeaderUpdate.java    From kfs with GNU Affero General Public License v3.0 6 votes vote down vote up
public static void handleJavaStyleComments( String baseDir ) throws Exception {
    IOFileFilter sourceFileFilter = FileFilterUtils.orFileFilter(
            FileFilterUtils.suffixFileFilter("java"),
            FileFilterUtils.suffixFileFilter("js") );
    sourceFileFilter = FileFilterUtils.orFileFilter(
            sourceFileFilter,
            FileFilterUtils.suffixFileFilter("css") );
    sourceFileFilter = FileFilterUtils.orFileFilter(
            sourceFileFilter,
            FileFilterUtils.suffixFileFilter("groovy") );
    sourceFileFilter = FileFilterUtils.makeSVNAware(sourceFileFilter);
    sourceFileFilter = FileFilterUtils.makeFileOnly(sourceFileFilter);

    LicensableFileDirectoryWalker dw = new LicensableFileDirectoryWalker(sourceFileFilter, "/*", " * ", " */");
    Collection<String> results = dw.run( baseDir );
    System.out.println( results );
}
 
Example 2
Source File: LicenseHeaderUpdate.java    From kfs with GNU Affero General Public License v3.0 6 votes vote down vote up
public static void handleXMLStyleComments( String baseDir ) throws Exception {
    IOFileFilter sourceFileFilter = FileFilterUtils.orFileFilter(
            FileFilterUtils.suffixFileFilter("xml"),
            FileFilterUtils.suffixFileFilter("jrxml") );
    sourceFileFilter = FileFilterUtils.orFileFilter(
            sourceFileFilter,
            FileFilterUtils.suffixFileFilter("html") );
    sourceFileFilter = FileFilterUtils.orFileFilter(
            sourceFileFilter,
            FileFilterUtils.suffixFileFilter("htm") );
    sourceFileFilter = FileFilterUtils.orFileFilter(
            sourceFileFilter,
            FileFilterUtils.suffixFileFilter("xsd") );
    sourceFileFilter = FileFilterUtils.orFileFilter(
            sourceFileFilter,
            FileFilterUtils.suffixFileFilter("tld") );
    sourceFileFilter = FileFilterUtils.makeSVNAware(sourceFileFilter);
    sourceFileFilter = FileFilterUtils.makeFileOnly(sourceFileFilter);

    LicensableFileDirectoryWalker dw = new LicensableFileDirectoryWalker(sourceFileFilter, "<!--", "   - ", " -->");
    Collection<String> results = dw.run( baseDir );
    System.out.println( results );
}
 
Example 3
Source File: IOUtil.java    From celerio with Apache License 2.0 5 votes vote down vote up
/**
 * Recurse in the folder to get the list all files and folders of all non svn files
 *
 * @param folder the folder to parse
 */
@SuppressWarnings("unchecked")
public Collection<String> listFolders(File folder) {
    IOFileFilter ioFileFilter = FileFilterUtils.makeSVNAware(FileFilterUtils.makeCVSAware(FileFilterUtils.trueFileFilter()));
    Collection<File> files = FileUtils.listFiles(folder, FileFilterUtils.fileFileFilter(), ioFileFilter);
    Set<String> ret = newTreeSet();
    for (File file : files) {
        ret.add(file.getParentFile().getAbsolutePath());
    }
    return ret;
}
 
Example 4
Source File: LicenseHeaderUpdate.java    From kfs with GNU Affero General Public License v3.0 5 votes vote down vote up
public static void handleJSPStyleComments( String baseDir ) throws Exception {
    IOFileFilter sourceFileFilter = FileFilterUtils.orFileFilter(
            FileFilterUtils.suffixFileFilter("jsp"),
            FileFilterUtils.suffixFileFilter("tag") );
    sourceFileFilter = FileFilterUtils.orFileFilter(
            sourceFileFilter,
            FileFilterUtils.suffixFileFilter("inc") );
    sourceFileFilter = FileFilterUtils.makeSVNAware(sourceFileFilter);
    sourceFileFilter = FileFilterUtils.makeFileOnly(sourceFileFilter);

    LicensableFileDirectoryWalker dw = new LicensableFileDirectoryWalker(sourceFileFilter, "<%--", "   - ", "--%>");
    Collection<String> results = dw.run( baseDir );
    System.out.println( results );
}
 
Example 5
Source File: LicenseHeaderUpdate.java    From kfs with GNU Affero General Public License v3.0 5 votes vote down vote up
public static void handlePropertyStyleComments( String baseDir ) throws Exception {
    IOFileFilter sourceFileFilter = FileFilterUtils.orFileFilter(
            FileFilterUtils.suffixFileFilter("properties"),
            FileFilterUtils.suffixFileFilter("cmd") );
    sourceFileFilter = FileFilterUtils.orFileFilter(
            sourceFileFilter,
            FileFilterUtils.suffixFileFilter("sh") );
    sourceFileFilter = FileFilterUtils.makeSVNAware(sourceFileFilter);
    sourceFileFilter = FileFilterUtils.makeFileOnly(sourceFileFilter);

    LicensableFileDirectoryWalker dw = new LicensableFileDirectoryWalker(sourceFileFilter, "########################################", "# ", "########################################");
    Collection<String> results = dw.run( baseDir );
    System.out.println( results );
}
 
Example 6
Source File: LicenseHeaderUpdate.java    From kfs with GNU Affero General Public License v3.0 5 votes vote down vote up
public static void handleSQLStyleComments( String baseDir ) throws Exception {
    IOFileFilter sourceFileFilter = FileFilterUtils.suffixFileFilter("sql");
    sourceFileFilter = FileFilterUtils.makeSVNAware(sourceFileFilter);
    sourceFileFilter = FileFilterUtils.makeFileOnly(sourceFileFilter);

    LicensableFileDirectoryWalker dw = new LicensableFileDirectoryWalker(sourceFileFilter, "--", "-- ", LINE_SEPARATOR);
    Collection<String> results = dw.run( baseDir );
    System.out.println( results );
}
 
Example 7
Source File: AbstractIteratorMojo.java    From iterator-maven-plugin with Apache License 2.0 5 votes vote down vote up
public List<String> getFolders()
    throws MojoExecutionException
{
    IOFileFilter folders = FileFilterUtils.and( HiddenFileFilter.VISIBLE, DirectoryFileFilter.DIRECTORY );
    IOFileFilter makeSVNAware = FileFilterUtils.makeSVNAware( folders );
    IOFileFilter makeCVSAware = FileFilterUtils.makeCVSAware( makeSVNAware );

    String[] list = folder.list( makeCVSAware );
    if ( list == null )
    {
        throw new MojoExecutionException( "The specified folder doesn't exist: " + folder );
    }

    List<File> listOfDirectories = new ArrayList<File>();
    for ( String item : list )
    {
        listOfDirectories.add( new File( folder, item ) );
    }

    Collections.sort( listOfDirectories, convertSortOrder() );
    List<String> resultList = new ArrayList<String>();
    for ( File file : listOfDirectories )
    {
        resultList.add( file.getName() );
    }
    return resultList;
}
 
Example 8
Source File: FileFilterHelper.java    From appassembler with MIT License 4 votes vote down vote up
/**
 * This will create a FileFilter which is the same as in plexus-utils (DirectoryScanner.DEFAULTEXCLUDES).
 *
 * @return The initialized filter.
 */
public static IOFileFilter createDefaultFilter()
{

    IOFileFilter filter = null;

    // CVS
    // "**/CVS", "**/CVS/**",
    filter = FileFilterUtils.makeCVSAware( filter );

    // "**/.cvsignore",
    filter = makeFileNameAware( filter, ".cvsignore" );

    // Subversion
    // "**/.svn", "**/.svn/**",
    filter = FileFilterUtils.makeSVNAware( filter );

    // RCS
    // "**/RCS", "**/RCS/**",
    filter = makeDirectoryAware( filter, "RCS" );

    // SCCS
    // "**/SCCS", "**/SCCS/**",
    filter = makeDirectoryAware( filter, "SCCS" );

    // "**/*~", "**/#*#", "**/.#*", "**/%*%", "**/._*",
    filter = makeSuffixAware( filter, "~" );
    filter = makePatternFileNameAware( filter, "#.*#" );
    filter = makePatternFileNameAware( filter, "%.*%" );
    filter = makeSuffixAware( filter, ".#" );
    filter = makeSuffixAware( filter, "._" );

    // Visual SourceSafe
    // "**/vssver.scc",
    filter = makeFileNameAware( filter, "vssver.scc" );

    // MKS
    // "**/project.pj",
    filter = makeFileNameAware( filter, "project.pj" );

    // Arch
    // "**/.arch-ids", "**/.arch-ids/**",
    filter = makeDirectoryAware( filter, ".arch-ids" );

    // Bazaar
    // "**/.bzr", "**/.bzr/**",
    filter = makeDirectoryAware( filter, ".bzr" );

    // SurroundSCM
    // "**/.MySCMServerInfo",
    filter = makeFileNameAware( filter, ".MySCMServerInfo" );

    // Mac
    // "**/.DS_Store",
    filter = makeDirectoryAware( filter, ".DS_Store" );

    // Serena Dimensions Version 10
    // "**/.metadata", "**/.metadata/**",
    filter = makeDirectoryAware( filter, ".metadata" );

    // Mercurial
    // "**/.hg", "**/.hg/**",
    filter = makeDirectoryAware( filter, ".hg" );

    // git
    // "**/.git", "**/.gitignore", "**/.gitattributes", "**/.git/**",
    filter = makeDirectoryAware( filter, ".git" );
    filter = makeFileNameAware( filter, ".gitignore" );

    // BitKeeper
    // "**/BitKeeper", "**/BitKeeper/**", "**/ChangeSet", "**/ChangeSet/**",
    filter = makeDirectoryAware( filter, "BitKeeper" );
    filter = makeDirectoryAware( filter, "ChangeSet" );

    // darcs
    // "**/_darcs", "**/_darcs/**", "**/.darcsrepo", "**/.darcsrepo/**", "**/-darcs-backup*", "**/.darcs-temp-mail"
    // };
    filter = makeDirectoryAware( filter, "_darcs" );
    filter = makeDirectoryAware( filter, ".darcsrepo" );

    return filter;
}