org.modeshape.web.jcr.webdav
Interface ContentMapper

All Known Implementing Classes:
DefaultContentMapper

public interface ContentMapper

Interface that supports mapping incoming WebDAV requests to create, modify, and access JCR content to node hierarchies and properties on these nodes.

See Also:
DefaultContentMapper

Method Summary
 void createFile(Node parentNode, String fileName)
           
 void createFolder(Node parentNode, String folderName)
           
 Date getLastModified(Node node)
           
 InputStream getResourceContent(Node node)
           
 long getResourceLength(Node node)
           
 void initialize(javax.servlet.ServletContext context)
          Initialize the content mapper based on the provided context
 boolean isFile(Node node)
           
 boolean isFolder(Node node)
           
 long setContent(Node parentNode, String resourceName, InputStream newContent, String contentType, String characterEncoding)
          Creates or modifies the content of a WebDAV file.
 

Method Detail

initialize

void initialize(javax.servlet.ServletContext context)
Initialize the content mapper based on the provided context

Parameters:
context - the servlet context for this servlet

isFolder

boolean isFolder(Node node)
                 throws RepositoryException
Parameters:
node - the node to check; may not be null
Returns:
true if node should be treated as a WebDAV folder
Throws:
RepositoryException - if the node cannot be accessed

isFile

boolean isFile(Node node)
               throws RepositoryException
Parameters:
node - the node to check; may not be null
Returns:
true if node should be treated as a WebDAV file
Throws:
RepositoryException - if the node cannot be accessed

getResourceContent

InputStream getResourceContent(Node node)
                               throws RepositoryException,
                                      IOException
Parameters:
node - the node to check; may not be null
Returns:
the contents for the node; null if the node maps to a WebDAV folder
Throws:
RepositoryException - if the node cannot be accessed
IOException - if the content of the node cannot be accessed

getResourceLength

long getResourceLength(Node node)
                       throws RepositoryException,
                              IOException
Parameters:
node - the node to check; may not be null
Returns:
the length of the file content for the node; -1 if the node maps to a WebDAV folder
Throws:
RepositoryException - if the node cannot be accessed
IOException - if the content of the node cannot be accessed

getLastModified

Date getLastModified(Node node)
                     throws RepositoryException,
                            IOException
Parameters:
node - the node to check; may not be null
Returns:
the date at which the file was last modified; null if node is a folder
Throws:
RepositoryException - if the node cannot be accessed
IOException - if the content of the node cannot be accessed

createFolder

void createFolder(Node parentNode,
                  String folderName)
                  throws RepositoryException
Parameters:
parentNode - the parent node of the new folder; may not be null
folderName - the name of the folder that is to be created; may not be null
Throws:
RepositoryException - if the node cannot be created

createFile

void createFile(Node parentNode,
                String fileName)
                throws RepositoryException
Parameters:
parentNode - the parent node of the new file; may not be null
fileName - the name of the file that is to be created; may not be null
Throws:
RepositoryException - if the node cannot be created

setContent

long setContent(Node parentNode,
                String resourceName,
                InputStream newContent,
                String contentType,
                String characterEncoding)
                throws RepositoryException,
                       IOException
Creates or modifies the content of a WebDAV file. Implementations may choose whether to store this content directly on the file node or in some other location (e.g., the jcr:content child of the nt:file node that corresponds to the WebDAV file).

Parameters:
parentNode - node corresponding to the parent folder of the file; may not be null
resourceName - the name of the file to which this content belongs; may not be null
newContent - the content to store; may not be null
contentType - the MIME type of the content; may not be null
characterEncoding - the character encoding of the content; may not be null
Returns:
the length of the newly-created content
Throws:
RepositoryException - if the node cannot be created or updated
IOException - if the content of the node cannot be modified or created


Copyright © 2008-2011 JBoss, a division of Red Hat. All Rights Reserved.