dap4/d4ts/src/main/java/dap4/d4ts/FrontPage.java
protected void
    buildFileList(Root rootinfo)
            throws DapException
    {
        File root = new File(rootinfo.getFullPath());
        if(!root.isDirectory())
            throw new DapException("FrontPage: specified root directory is not a directory: " + rootinfo.getFullPath());
        if(!root.canRead())
            throw new DapException("FrontPage: specified root directory is not readable: " + rootinfo.getFullPath());

        // take files from set of files immediately under root
        File[] candidates = root.listFiles();
        List<FileSource> activesources = new ArrayList<FileSource>();
        // Capture lists of files for each FileSource
        for(FileSource src : SOURCES) {
            List<File> matches = new ArrayList<File>();
            for(File candidate : candidates) {
                String name = candidate.getName();
                boolean excluded = false;
                for(String exclude : expatterns) {
                    if(name.indexOf(exclude) >= 0) {
                        excluded = true;
                        break;
                    }
                }
                if(excluded) continue;
                if(!name.endsWith(src.ext)) continue;
                if(!candidate.canRead()) {
                    DapLog.info("FrontPage: file not readable: " + candidate);
                    continue;
                }
                matches.add(candidate);
            }
            if(matches.size() > 0) {
                // Sort the set of files
                matches.sort(new Comparator<File>() {
                    public int compare(File f1, File f2) {
                         return f1.getName().compareTo(f2.getName());
                    }});
                if(DUMPFILELIST) {
                    for(File x : matches) {
                        System.err.printf("file: %s/%s%n", rootinfo.prefix, x.getName());
                    }
                }
                FileSource clone = new FileSource(src.ext, src.tag);
                clone.files = matches;
                activesources.add(clone);
            }
        }
        rootinfo.setFiles(activesources);
    }
protected void
    buildFileList(Root rootinfo)
            throws DapException
    {
        File root = new File(rootinfo.getFullPath());
        if(!root.isDirectory())
            throw new DapException("FrontPage: specified root directory is not a directory: " + rootinfo.getFullPath());
        if(!root.canRead())
            throw new DapException("FrontPage: specified root directory is not readable: " + rootinfo.getFullPath());

        // take files from set of files immediately under root
        File[] candidates = root.listFiles();
        List<FileSource> activesources = new ArrayList<FileSource>();
        // Capture lists of files for each FileSource
        for(FileSource src : SOURCES) {
            List<File> matches = new ArrayList<File>();
            for(File candidate : candidates) {
                String name = candidate.getName();
                boolean excluded = false;
                for(String exclude : expatterns) {
                    if(name.indexOf(exclude) >= 0) {
                        excluded = true;
                        break;
                    }
                }
                if(excluded) continue;
                if(!name.endsWith(src.ext)) continue;
                if(!candidate.canRead()) {
                    DapLog.info("FrontPage: file not readable: " + candidate);
                    continue;
                }
                matches.add(candidate);
            }
            if(matches.size() > 0) {
                // Sort the set of files
                matches.sort(new Comparator<File>() {
                    public int compare(File f1, File f2) {
                         return f1.getName().compareTo(f2.getName());
                    }});
                if(DUMPFILELIST) {
                    for(File x : matches) {
                        System.err.printf("file: %s/%s%n", rootinfo.prefix, x.getName());
                    }
                }
                FileSource clone = new FileSource(src.ext, src.tag);
                clone.files = matches;
                activesources.add(clone);
            }
        }
        rootinfo.setFiles(activesources);
    }
protected void buildFileList ( Root rootinfo ) throws DapException { File root = new File ( rootinfo . getFullPath ( ) ) ; if ( ! root . isDirectory ( ) ) throw new DapException ( "FrontPage: specified root directory is not a directory: " + rootinfo . getFullPath ( ) ) ; if ( ! root . canRead ( ) ) throw new DapException ( "FrontPage: specified root directory is not readable: " + rootinfo . getFullPath ( ) ) ; // take files from set of files immediately under root File [ ] candidates = root . listFiles ( ) ; List < FileSource > activesources = new ArrayList < FileSource > ( ) ; // Capture lists of files for each FileSource for ( FileSource src : SOURCES ) { List < File > matches = new ArrayList < File > ( ) ; for ( File candidate : candidates ) { String name = candidate . getName ( ) ; boolean excluded = false ; for ( String exclude : expatterns ) { if ( name . indexOf ( exclude ) >= 0 ) { excluded = true ; break ; } } if ( excluded ) continue ; if ( ! name . endsWith ( src . ext ) ) continue ; if ( ! candidate . canRead ( ) ) { DapLog . info ( "FrontPage: file not readable: " + candidate ) ; continue ; } matches . add ( candidate ) ; } if ( matches . size ( ) > 0 ) { // Sort the set of files matches . sort ( new Comparator < File > ( ) { public int compare ( File f1 , File f2 ) { return f1 . getName ( ) . compareTo ( f2 . getName ( ) ) ; } } ) ; if ( DUMPFILELIST ) { for ( File x : matches ) { System . err . printf ( "file: %s/%s%n" , rootinfo . prefix , x . getName ( ) ) ; } } FileSource clone = new FileSource ( src . ext , src . tag ) ; clone . files = matches ; activesources . add ( clone ) ; } } rootinfo . setFiles ( activesources ) ; }
////////////////////////////////////////////////
////////////////////////////////////////////////