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

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

public class CastorFileSystemDocumentHandler
extends java.lang.Object
implements DocumentHandler, FileCacheEventListener

CastorFileSystemDocumentHandler

Version:
$Id: CastorFileSystemDocumentHandler.java 568113 2007-08-21 13:04:07Z woonsan $
Author:
Scott T. Weaver

Field Summary
protected  java.lang.String documentRoot
           
protected  java.io.File documentRootDir
           
protected  java.lang.String documentType
           
protected  java.lang.Class expectedReturnType
           
protected  FileCache fileCache
           
 
Constructor Summary
CastorFileSystemDocumentHandler(java.lang.String mappingFile, java.lang.String documentType, java.lang.Class expectedReturnType, java.lang.String documentRoot, FileCache fileCache)
           
CastorFileSystemDocumentHandler(java.lang.String mappingFile, java.lang.String documentType, java.lang.String expectedReturnType, java.lang.String documentRoot, FileCache fileCache)
           
 
Method Summary
protected  void addToCache(java.lang.String path, java.lang.Object objectToCache)
           addToCache
protected  void createCastorClassDescriptorResolver(java.lang.String mappingFile)
           
 void evict(FileCacheEntry entry)
           evict
 Document getDocument(java.lang.String name)
           getDocument
 Document getDocument(java.lang.String name, boolean fromCache)
           getDocument
 DocumentHandlerFactory getHandlerFactory()
           getHandlerFactory
 java.lang.String getType()
           getType
 void refresh(FileCacheEntry entry)
           refresh
 void removeDocument(Document document)
           removeDocument
 void setHandlerFactory(DocumentHandlerFactory factory)
           setHandlerFactory
protected  java.lang.Object unmarshallDocument(java.lang.Class clazz, java.lang.String path, java.lang.String extension)
           
 void updateDocument(Document document)
           
protected  void updateDocument(Document document, boolean systemUpdate)
           updateDocument
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

documentType

protected java.lang.String documentType

expectedReturnType

protected java.lang.Class expectedReturnType

documentRoot

protected java.lang.String documentRoot

documentRootDir

protected java.io.File documentRootDir

fileCache

protected FileCache fileCache
Constructor Detail

CastorFileSystemDocumentHandler

public CastorFileSystemDocumentHandler(java.lang.String mappingFile,
                                       java.lang.String documentType,
                                       java.lang.Class expectedReturnType,
                                       java.lang.String documentRoot,
                                       FileCache fileCache)
                                throws java.io.FileNotFoundException,
                                       org.xml.sax.SAXException,
                                       javax.xml.parsers.ParserConfigurationException,
                                       org.exolab.castor.mapping.MappingException
Parameters:
mappingFile - Castor mapping file. THe mapping file must be in the class path
documentType -
expectedReturnType -
Throws:
java.io.FileNotFoundException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
org.exolab.castor.mapping.MappingException

CastorFileSystemDocumentHandler

public CastorFileSystemDocumentHandler(java.lang.String mappingFile,
                                       java.lang.String documentType,
                                       java.lang.String expectedReturnType,
                                       java.lang.String documentRoot,
                                       FileCache fileCache)
                                throws java.io.FileNotFoundException,
                                       java.lang.ClassNotFoundException,
                                       org.xml.sax.SAXException,
                                       javax.xml.parsers.ParserConfigurationException,
                                       org.exolab.castor.mapping.MappingException
Throws:
java.io.FileNotFoundException
java.lang.ClassNotFoundException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
org.exolab.castor.mapping.MappingException
Method Detail

getDocument

public Document getDocument(java.lang.String name)
                     throws NodeException,
                            DocumentNotFoundException

getDocument

Specified by:
getDocument in interface DocumentHandler
Parameters:
name -
Returns:
@throws DocumentNotFoundException
Throws:
DocumentException, - DocumentNotFoundException
NodeException
DocumentNotFoundException
See Also:
DocumentHandler.getDocument(java.lang.String)

updateDocument

public void updateDocument(Document document)
                    throws FailedToUpdateDocumentException
Specified by:
updateDocument in interface DocumentHandler
Throws:
FailedToUpdateDocumentException

updateDocument

protected void updateDocument(Document document,
                              boolean systemUpdate)
                       throws FailedToUpdateDocumentException

updateDocument

Parameters:
document -
systemUpdate -
Throws:
FailedToUpdateDocumentException
See Also:
DocumentHandler.updateDocument(org.apache.jetspeed.om.page.Document)

createCastorClassDescriptorResolver

protected void createCastorClassDescriptorResolver(java.lang.String mappingFile)
                                            throws org.exolab.castor.mapping.MappingException
Throws:
org.exolab.castor.mapping.MappingException

unmarshallDocument

protected java.lang.Object unmarshallDocument(java.lang.Class clazz,
                                              java.lang.String path,
                                              java.lang.String extension)
                                       throws DocumentNotFoundException,
                                              DocumentException
Throws:
DocumentNotFoundException
DocumentException

verifyPath

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

removeDocument

public void removeDocument(Document document)
                    throws DocumentNotFoundException,
                           FailedToDeleteDocumentException

removeDocument

Specified by:
removeDocument in interface DocumentHandler
Parameters:
document -
Throws:
DocumentNotFoundException
FailedToDeleteDocumentException
See Also:
DocumentHandler.removeDocument(org.apache.jetspeed.om.page.Document)

getDocument

public Document getDocument(java.lang.String name,
                            boolean fromCache)
                     throws DocumentNotFoundException,
                            NodeException

getDocument

Specified by:
getDocument in interface DocumentHandler
Parameters:
name -
fromCahe - Whether or not the Document should be pulled from the cache.
Returns:
@throws DocumentNotFoundException
Throws:
DocumentNotFoundException
NodeException
See Also:
DocumentHandler.getDocument(java.lang.String, boolean)

addToCache

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

addToCache

Parameters:
path -
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)

getType

public java.lang.String getType()

getType

Specified by:
getType in interface DocumentHandler
Returns:
See Also:
DocumentHandler.getType()

getHandlerFactory

public DocumentHandlerFactory getHandlerFactory()

getHandlerFactory

Specified by:
getHandlerFactory in interface DocumentHandler
Returns:
See Also:
DocumentHandler.getHandlerFactory()

setHandlerFactory

public void setHandlerFactory(DocumentHandlerFactory factory)

setHandlerFactory

Specified by:
setHandlerFactory in interface DocumentHandler
Parameters:
factory -
See Also:
DocumentHandler.setHandlerFactory(org.apache.jetspeed.page.document.DocumentHandlerFactory)


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