Code Search for Developers
 
 
  

FolderAdapter.java from Kneobase at Krugle


Show FolderAdapter.java syntax highlighted

/*
 * Created on 15/10/2004
 *
 */
package com.kneobase.driver.fs;

import java.io.File;
import java.util.Collection;
import java.util.Iterator;
import java.util.Vector;

import com.kneobase.driver.content.A_TreeCompositeContent;
import com.kneobase.driver.content.I_CompositeContent;
import com.kneobase.driver.content.I_Content;

/**
 * @author Ernesto De Santis
 *
 */
public class FolderAdapter extends A_TreeCompositeContent {

    public FolderAdapter(Object concreteSource) {
        super(concreteSource);
    }

    /**
     * @param concreteSource
     * @param parent
     */
    public FolderAdapter(Object concreteSource, I_CompositeContent parent) {
        super(concreteSource, parent);
    }

    public Iterator getChildrenIterator() {
        File[] files = getFolder().listFiles();

        Collection children = new Vector();
        for (int i = 0; i < files.length; i++) {
            I_Content content;
            if (files[i].isDirectory()) {
                content = new FolderAdapter(files[i], this);
            } else {
                content = new FileAdapter(files[i], this);
            }
            children.add(content);
        }
        return children.iterator();
    }

    public String getName() {
        return getFolder().getName();
    }
    
    public File getFolder(){
        return (File) getContentObject(); 
    }

    public String getAbsolutePath() {
        return getFolder().getAbsolutePath();
    }

    public char separatorChar() {
        return File.separatorChar;
    }

    public long lastModified() {
        return getFolder().lastModified();
    }

    public long getSize() {
        return getFolder().length();
    }

}




See more files for this project here

Kneobase

Kneobase is an enterprise search engine, based upon the Lucene search engine and the Spring framework. It allows to perform full-text search across many different content sources. It is highly adaptable out-of-the-box and has a pluggable architecture.

Project homepage: http://sourceforge.net/projects/kneobase
Programming language(s): Java,XML
License: other

  condition/
    FSCategoryCondition.java
    FSRegularExpressionCondition.java
  documentbuilder/
    A_FSFieldBuilder.java
  FSContentSource.java
  FSPathCriteria.java
  FileAdapter.java
  FolderAdapter.java