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

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

public class CastorFileSystemDocumentHandler
extends Object
implements org.apache.jetspeed.page.document.DocumentHandler, org.apache.jetspeed.cache.file.FileCacheEventListener

CastorFileSystemDocumentHandler

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

Field Summary
private  org.exolab.castor.xml.ClassDescriptorResolver classDescriptorResolver
           
protected  String documentRoot
           
protected  File documentRootDir
           
protected  String documentType
           
protected  Class expectedReturnType
           
protected  org.apache.jetspeed.cache.file.FileCache fileCache
           
private  org.apache.xml.serialize.OutputFormat format
           
private  org.apache.jetspeed.page.document.DocumentHandlerFactory handlerFactory
           
private static org.apache.commons.logging.Log log
           
private static String PSML_DOCUMENT_ENCODING
           
private  XMLReader xmlReader
           
 
Constructor Summary
CastorFileSystemDocumentHandler(String mappingFile, String documentType, Class expectedReturnType, String documentRoot, org.apache.jetspeed.cache.file.FileCache fileCache)
           
CastorFileSystemDocumentHandler(String mappingFile, String documentType, String expectedReturnType, String documentRoot, org.apache.jetspeed.cache.file.FileCache fileCache)
           
 
Method Summary
protected  void addToCache(String path, Object objectToCache)
           addToCache
protected  void createCastorClassDescriptorResolver(String mappingFile)
           
 void evict(org.apache.jetspeed.cache.file.FileCacheEntry entry)
           evict
 org.apache.jetspeed.om.page.Document getDocument(String name)
           getDocument
 org.apache.jetspeed.om.page.Document getDocument(String name, boolean fromCache)
           getDocument
 org.apache.jetspeed.page.document.DocumentHandlerFactory getHandlerFactory()
           getHandlerFactory
 String getType()
           getType
 void refresh(org.apache.jetspeed.cache.file.FileCacheEntry entry)
           refresh
 void removeDocument(org.apache.jetspeed.om.page.Document document)
           removeDocument
 void setHandlerFactory(org.apache.jetspeed.page.document.DocumentHandlerFactory factory)
           setHandlerFactory
protected  Object unmarshallDocument(Class clazz, String path, String extension)
           
 void updateDocument(org.apache.jetspeed.om.page.Document document)
           
protected  void updateDocument(org.apache.jetspeed.om.page.Document document, boolean systemUpdate)
           updateDocument
protected  void verifyPath(File path)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final org.apache.commons.logging.Log log

PSML_DOCUMENT_ENCODING

private static final String PSML_DOCUMENT_ENCODING
See Also:
Constant Field Values

documentType

protected String documentType

expectedReturnType

protected Class expectedReturnType

documentRoot

protected String documentRoot

documentRootDir

protected File documentRootDir

fileCache

protected org.apache.jetspeed.cache.file.FileCache fileCache

format

private org.apache.xml.serialize.OutputFormat format

xmlReader

private final XMLReader xmlReader

handlerFactory

private org.apache.jetspeed.page.document.DocumentHandlerFactory handlerFactory

classDescriptorResolver

private org.exolab.castor.xml.ClassDescriptorResolver classDescriptorResolver
Constructor Detail

CastorFileSystemDocumentHandler

public CastorFileSystemDocumentHandler(String mappingFile,
                                       String documentType,
                                       Class expectedReturnType,
                                       String documentRoot,
                                       org.apache.jetspeed.cache.file.FileCache fileCache)
                                throws FileNotFoundException,
                                       SAXException,
                                       ParserConfigurationException,
                                       org.exolab.castor.mapping.MappingException
Parameters:
mappingFile - Castor mapping file. THe mapping file must be in the class path
documentType -
expectedReturnType -
Throws:
FileNotFoundException
SAXException
ParserConfigurationException
org.exolab.castor.mapping.MappingException

CastorFileSystemDocumentHandler

public CastorFileSystemDocumentHandler(String mappingFile,
                                       String documentType,
                                       String expectedReturnType,
                                       String documentRoot,
                                       org.apache.jetspeed.cache.file.FileCache fileCache)
                                throws FileNotFoundException,
                                       ClassNotFoundException,
                                       SAXException,
                                       ParserConfigurationException,
                                       org.exolab.castor.mapping.MappingException
Throws:
FileNotFoundException
ClassNotFoundException
SAXException
ParserConfigurationException
org.exolab.castor.mapping.MappingException
Method Detail

getDocument

public org.apache.jetspeed.om.page.Document getDocument(String name)
                                                 throws org.apache.jetspeed.page.document.NodeException,
                                                        org.apache.jetspeed.page.document.DocumentNotFoundException

getDocument

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

updateDocument

public void updateDocument(org.apache.jetspeed.om.page.Document document)
                    throws org.apache.jetspeed.page.document.FailedToUpdateDocumentException
Specified by:
updateDocument in interface org.apache.jetspeed.page.document.DocumentHandler
Throws:
org.apache.jetspeed.page.document.FailedToUpdateDocumentException

updateDocument

protected void updateDocument(org.apache.jetspeed.om.page.Document document,
                              boolean systemUpdate)
                       throws org.apache.jetspeed.page.document.FailedToUpdateDocumentException

updateDocument

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

createCastorClassDescriptorResolver

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

unmarshallDocument

protected Object unmarshallDocument(Class clazz,
                                    String path,
                                    String extension)
                             throws org.apache.jetspeed.page.document.DocumentNotFoundException,
                                    org.apache.jetspeed.page.document.DocumentException
Throws:
org.apache.jetspeed.page.document.DocumentNotFoundException
org.apache.jetspeed.page.document.DocumentException

verifyPath

protected void verifyPath(File path)
                   throws FileNotFoundException
Throws:
FileNotFoundException

removeDocument

public void removeDocument(org.apache.jetspeed.om.page.Document document)
                    throws org.apache.jetspeed.page.document.DocumentNotFoundException,
                           org.apache.jetspeed.page.document.FailedToDeleteDocumentException

removeDocument

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

getDocument

public org.apache.jetspeed.om.page.Document getDocument(String name,
                                                        boolean fromCache)
                                                 throws org.apache.jetspeed.page.document.DocumentNotFoundException,
                                                        org.apache.jetspeed.page.document.NodeException

getDocument

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

addToCache

protected void addToCache(String path,
                          Object objectToCache)

addToCache

Parameters:
path -
objectToCache -

refresh

public void refresh(org.apache.jetspeed.cache.file.FileCacheEntry entry)
             throws Exception

refresh

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

evict

public void evict(org.apache.jetspeed.cache.file.FileCacheEntry entry)
           throws Exception

evict

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

getType

public String getType()

getType

Specified by:
getType in interface org.apache.jetspeed.page.document.DocumentHandler
Returns:
See Also:
DocumentHandler.getType()

getHandlerFactory

public org.apache.jetspeed.page.document.DocumentHandlerFactory getHandlerFactory()

getHandlerFactory

Specified by:
getHandlerFactory in interface org.apache.jetspeed.page.document.DocumentHandler
Returns:
See Also:
DocumentHandler.getHandlerFactory()

setHandlerFactory

public void setHandlerFactory(org.apache.jetspeed.page.document.DocumentHandlerFactory factory)

setHandlerFactory

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


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