ProjectDirectoryFilter.java :  » Report » openi » org » openi » project » Java Open Source

Java Open Source » Report » openi 
openi » org » openi » project » ProjectDirectoryFilter.java
/*********************************************************************************
 * The contents of this file are subject to the OpenI Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the
 * License. You may obtain a copy of the License at
 * http://www.openi.org/docs/LICENSE.txt
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
 * the specific language governing rights and limitations under the License.
 *
 * The Original Code is: OpenI Open Source
 *
 * The Initial Developer of the Original Code is Loyalty Matrix, Inc.
 * Portions created by Loyalty Matrix, Inc. are
 * Copyright (C) 2005 Loyalty Matrix, Inc.; All Rights Reserved.
 *
 * Contributor(s): ______________________________________.
 *
 ********************************************************************************/
package org.openi.project;

import java.io.File;
import java.io.FileFilter;
import java.io.IOException;


public class ProjectDirectoryFilter implements FileFilter {
    public boolean accept(File input) {
        // deny WEB-INF, META-INF, .., only directories
        boolean accept = false;

        try {
            String canonpath = input.getCanonicalPath();

            if (input.isDirectory() && (canonpath.indexOf("CVS") < 0)
                    && (canonpath.indexOf("WEB-INF") < 0)
                    && (canonpath.indexOf("META-INF") < 0)
                    && (canonpath.indexOf("..") < 0)) {
                // System.out.println("potentially valid projectpath");
                accept = true;
            }
        } catch (IOException e) {
            e.printStackTrace();
        }

        return accept;
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.