org.apache.jetspeed.page.document.psml
Class FileSystemFolderHandler

java.lang.Object
  extended by org.apache.jetspeed.page.document.psml.FileSystemFolderHandler
All Implemented Interfaces:
FileCacheEventListener, FolderHandler

public class FileSystemFolderHandler
extends java.lang.Object
implements FolderHandler, FileCacheEventListener

FileSystemFolderHandler

Implementation of FolderHanlder that is based off of the file system.

Version:
$Id: FileSystemFolderHandler.java 553584 2007-07-05 18:09:45Z taylor $
Author:
Scott T. Weaver

Nested Class Summary
 class FileSystemFolderHandler.DocumentTypeFilter
           
 
Field Summary
protected static java.io.FilenameFilter FOLDER_FILTER
           
 
Constructor Summary
FileSystemFolderHandler(java.lang.String documentRoot, DocumentHandlerFactory handlerFactory, FileCache fileCache)
           
 
Method Summary
protected  void addToCache(java.lang.String id, java.lang.Object objectToCache)
           addToCache
 void evict(FileCacheEntry entry)
           evict
protected  java.lang.String[] getChildrenNames(java.lang.String path, java.io.FilenameFilter filter)
           
 Folder getFolder(java.lang.String path)
           getFolder
 Folder getFolder(java.lang.String path, boolean fromCache)
           getFolder
 NodeSet getFolders(java.lang.String path)
           getFolders
 NodeSet getNodes(java.lang.String path, boolean regexp, java.lang.String documentType)
           getChildNodes
 boolean isFolder(java.lang.String path)
          Returns true if the path is a folder
 java.lang.String[] list(java.lang.String folderPath, java.lang.String documentType)
           list
 java.lang.String[] listAll(java.lang.String folderPath)
           listAll
 void refresh(FileCacheEntry entry)
           refresh
 void removeFolder(Folder folder)
           removeFolder
 void updateFolder(Folder folder)
           updateFolder
protected  void verifyPath(java.io.File path)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FOLDER_FILTER

protected static final java.io.FilenameFilter FOLDER_FILTER
Constructor Detail

FileSystemFolderHandler

public FileSystemFolderHandler(java.lang.String documentRoot,
                               DocumentHandlerFactory handlerFactory,
                               FileCache fileCache)
                        throws java.io.FileNotFoundException,
                               UnsupportedDocumentTypeException
Parameters:
documentRoot - directory on file system to use as the root when locating folders
handlerFactory - A DocumentHandlerFactory
fileCache - For caching folder instances
Throws:
java.io.FileNotFoundException - if the documentRoot does not exist
UnsupportedDocumentTypeException - if no DocumentHnadler could be found that supports folder metadata (folder.metadata) in the handlerFactory.
Method Detail

getFolder

public Folder getFolder(java.lang.String path)
                 throws FolderNotFoundException,
                        InvalidFolderException,
                        NodeException

getFolder

Specified by:
getFolder in interface FolderHandler
Parameters:
path -
Returns:
@throws FolderNotFoundException
Throws:
FolderNotFoundException
InvalidFolderException
NodeException
DocumentNotFoundException
DocumentException - if there was an error processing the request.
See Also:
FolderHandler.getFolder(java.lang.String)

verifyPath

protected void verifyPath(java.io.File path)
                   throws java.io.FileNotFoundException
Throws:
java.io.FileNotFoundException

getFolder

public Folder getFolder(java.lang.String path,
                        boolean fromCache)
                 throws NodeException,
                        FolderNotFoundException,
                        InvalidFolderException

getFolder

Specified by:
getFolder in interface FolderHandler
Parameters:
path -
fromCache -
Returns:
@throws DocumentException, FolderNotFoundException
Throws:
InvalidFolderException
DocumentNotFoundException
DocumentException - if there was an error processing the request.
NodeException
FolderNotFoundException
See Also:
FolderHandler.getFolder(java.lang.String, boolean)

updateFolder

public void updateFolder(Folder folder)
                  throws FailedToUpdateFolderException

updateFolder

Specified by:
updateFolder in interface FolderHandler
Parameters:
folder -
Throws:
FailedToUpdateFolderException
See Also:
FolderHandler.updateFolder(org.apache.jetspeed.om.folder.Folder)

removeFolder

public void removeFolder(Folder folder)
                  throws FailedToDeleteFolderException

removeFolder

Specified by:
removeFolder in interface FolderHandler
Parameters:
folder -
Throws:
FailedToDeleteFolderException
See Also:
FolderHandler.removeFolder(org.apache.jetspeed.om.folder.Folder)

getFolders

public NodeSet getFolders(java.lang.String path)
                   throws FolderNotFoundException,
                          InvalidFolderException,
                          NodeException

getFolders

Specified by:
getFolders in interface FolderHandler
Parameters:
path -
Returns:
@throws FolderNotFoundException
Throws:
FolderNotFoundException
InvalidFolderException
NodeException
DocumentException - if an error is encountered reading the folders.
See Also:
FolderHandler.getFolders(java.lang.String)

list

public java.lang.String[] list(java.lang.String folderPath,
                               java.lang.String documentType)
                        throws FolderNotFoundException

list

Specified by:
list in interface FolderHandler
Parameters:
documentType -
folderPath - folder path to search under
Returns:
@throws FolderNotFoundException
Throws:
FolderNotFoundException - if the folderPath does not exsit.
See Also:
org.apache.jetspeed.page.document.FolderHandler#list(java.lang.String)

listAll

public java.lang.String[] listAll(java.lang.String folderPath)
                           throws FolderNotFoundException

listAll

Specified by:
listAll in interface FolderHandler
Parameters:
folderPath -
Returns:
@throws FolderNotFoundException
Throws:
FolderNotFoundException
See Also:
FolderHandler.listAll(java.lang.String)

getChildrenNames

protected java.lang.String[] getChildrenNames(java.lang.String path,
                                              java.io.FilenameFilter filter)
                                       throws FolderNotFoundException
Throws:
FolderNotFoundException

getNodes

public NodeSet getNodes(java.lang.String path,
                        boolean regexp,
                        java.lang.String documentType)
                 throws FolderNotFoundException,
                        InvalidFolderException,
                        NodeException

getChildNodes

Specified by:
getNodes in interface FolderHandler
Parameters:
path -
regexp -
documentType -
Returns:
NodeSet
Throws:
FolderNotFoundException
DocumentException
InvalidFolderException
NodeException
See Also:
FolderHandler.getNodes(java.lang.String,boolean,java.lang.String)

addToCache

protected void addToCache(java.lang.String id,
                          java.lang.Object objectToCache)

addToCache

Parameters:
id -
objectToCache -

refresh

public void refresh(FileCacheEntry entry)
             throws java.lang.Exception

refresh

Specified by:
refresh in interface FileCacheEventListener
Parameters:
entry -
Throws:
java.lang.Exception
See Also:
FileCacheEventListener.refresh(org.apache.jetspeed.cache.file.FileCacheEntry)

evict

public void evict(FileCacheEntry entry)
           throws java.lang.Exception

evict

Specified by:
evict in interface FileCacheEventListener
Parameters:
entry -
Throws:
java.lang.Exception
See Also:
FileCacheEventListener.evict(org.apache.jetspeed.cache.file.FileCacheEntry)

isFolder

public boolean isFolder(java.lang.String path)
Description copied from interface: FolderHandler
Returns true if the path is a folder

Specified by:
isFolder in interface FolderHandler
Returns:


Copyright © 1999-2009 Apache Software Foundation. All Rights Reserved.