Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.web.jcr.webdav
Class DefaultContentMapper

    java.lang.Object
      org.modeshape.web.jcr.webdav.DefaultContentMapper

All Implemented Interfaces:
  ContentMapper

    public class DefaultContentMapper

extends Object
implements ContentMapper

Field Summary
`static String` | `INIT_CONTENT_PRIMARY_TYPE_NAMES`
`static String` | `INIT_NEW_CONTENT_PRIMARY_TYPE_NAME`
`static String` | `INIT_NEW_FOLDER_PRIMARY_TYPE_NAME`
`static String` | `INIT_NEW_RESOURCE_PRIMARY_TYPE_NAME`
`static String` | `INIT_RESOURCE_PRIMARY_TYPES_NAMES`

Constructor Summary
`DefaultContentMapper()`

Method Summary
`void` | `createFile(Node parentNode, String fileName)`
`void` | `createFolder(Node parentNode, String folderName)`
`Date` | `getLastModified(Node node)`
`protected String` | `getParam(javax.servlet.ServletContext servletContext, String name)`
`InputStream` | `getResourceContent(Node node)`
`long` | `getResourceLength(Node node)`
`void` | `initialize(javax.servlet.ServletContext servletContext)` 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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### INIT_CONTENT_PRIMARY_TYPE_NAMES

    public static final String INIT_CONTENT_PRIMARY_TYPE_NAMES

See Also:
  Constant Field Values

### INIT_RESOURCE_PRIMARY_TYPES_NAMES

    public static final String INIT_RESOURCE_PRIMARY_TYPES_NAMES

See Also:
  Constant Field Values

### INIT_NEW_FOLDER_PRIMARY_TYPE_NAME

    public static final String INIT_NEW_FOLDER_PRIMARY_TYPE_NAME

See Also:
  Constant Field Values

### INIT_NEW_RESOURCE_PRIMARY_TYPE_NAME

    public static final String INIT_NEW_RESOURCE_PRIMARY_TYPE_NAME

See Also:
  Constant Field Values

### INIT_NEW_CONTENT_PRIMARY_TYPE_NAME

    public static final String INIT_NEW_CONTENT_PRIMARY_TYPE_NAME

See Also:
  Constant Field Values

Constructor Detail

### DefaultContentMapper

    public DefaultContentMapper()

Method Detail

### initialize

    public void initialize(javax.servlet.ServletContext servletContext)

  Description copied from interface: `ContentMapper`
  Initialize the content mapper based on the provided context

  Specified by:
    `initialize` in interface `ContentMapper`
  Parameters:
    `servletContext` - the servlet context for this servlet

### getParam

    protected String getParam(javax.servlet.ServletContext servletContext,
                              String name)

### getResourceContent

    public InputStream getResourceContent(Node node)
                                   throws RepositoryException

  Specified by:
    `getResourceContent` in interface `ContentMapper`
  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

### getResourceLength

    public long getResourceLength(Node node)
                           throws RepositoryException,
                                  IOException

  Specified by:
    `getResourceLength` in interface `ContentMapper`
  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

    public Date getLastModified(Node node)
                         throws RepositoryException

  Specified by:
    `getLastModified` in interface `ContentMapper`
  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

### isFolder

    public boolean isFolder(Node node)
                     throws RepositoryException

  Specified by:
    `isFolder` in interface `ContentMapper`
  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

    public boolean isFile(Node node)
                   throws RepositoryException

  Specified by:
    `isFile` in interface `ContentMapper`
  Parameters:
    `node` - the node to check
  Returns:
    true if `node`'s primary type is one of the types in `filePrimaryTypes`; may not be null
  Throws:
    `RepositoryException` - if an error occurs checking the node's primary type

### createFile

    public void createFile(Node parentNode,
                           String fileName)
                    throws RepositoryException

  Specified by:
    `createFile` in interface `ContentMapper`
  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

### createFolder

    public void createFolder(Node parentNode,
                             String folderName)
                      throws RepositoryException

  Specified by:
    `createFolder` in interface `ContentMapper`
  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

### setContent

    public long setContent(Node parentNode,
                           String resourceName,
                           InputStream newContent,
                           String contentType,
                           String characterEncoding)
                    throws RepositoryException,
                           IOException

  Description copied from interface: `ContentMapper`
  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).

  Specified by:
    `setContent` in interface `ContentMapper`
  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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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