org.apache.jetspeed.page.document
Class CastorFileSystemDocumentHandler

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

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

CastorFileSystemDocumentHandler

Version:
$Id: CastorFileSystemDocumentHandler.java 227142 2005-08-03 00:32:26Z dlestrat $
Author:
Scott T. Weaver

Field Summary
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
           
protected  org.exolab.castor.mapping.Mapping mapping
          the Castor mapping file name
protected  String mappingFile
           
private static String PSML_DOCUMENT_ENCODING
           
 
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
 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
protected  void loadMapping()
           
 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)
           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

mappingFile

protected String mappingFile

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

mapping

protected org.exolab.castor.mapping.Mapping mapping
the Castor mapping file name


format

private org.apache.xml.serialize.OutputFormat format

handlerFactory

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

CastorFileSystemDocumentHandler

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

CastorFileSystemDocumentHandler

public CastorFileSystemDocumentHandler(String mappingFile,
                                       String documentType,
                                       String expectedReturnType,
                                       String documentRoot,
                                       org.apache.jetspeed.cache.file.FileCache fileCache)
                                throws FileNotFoundException,
                                       ClassNotFoundException
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

updateDocument

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

loadMapping

protected void loadMapping()

unmarshallDocument

protected Object unmarshallDocument(Class clazz,
                                    String path,
                                    String extension)
                             throws org.apache.jetspeed.page.document.NodeNotFoundException,
                                    org.apache.jetspeed.page.document.DocumentException
Throws:
org.apache.jetspeed.page.document.NodeNotFoundException
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:
DocumentNotFoundException
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.NodeException

getDocument

Specified by:
getDocument in interface org.apache.jetspeed.page.document.DocumentHandler
Parameters:
name -
Returns:
@throws DocumentNotFoundException
Throws:
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-2005 Apache Software Foundation. All Rights Reserved.