eXo JCR :: Component :: Webdav Service 1.15.10-GA

org.exoplatform.services.jcr.webdav.resource
Class FileResource

java.lang.Object
  extended by org.exoplatform.services.jcr.webdav.resource.GenericResource
      extended by org.exoplatform.services.jcr.webdav.resource.FileResource
All Implemented Interfaces:
Resource, PropertyConstants
Direct Known Subclasses:
VersionedFileResource

public class FileResource
extends GenericResource

Created by The eXo Platform SARL .
Resource containing JCR's nt:file/jcr:content underneath. Identified by nt:file's URI jcr:content's jcr:data property contains file's payload

Version:
$Id$
Author:
Gennady Azarenkov

Field Summary
protected static Set<String> CONTENT_SKIP
          The list of properties which are skipped for jcr:content.
protected static Set<String> FILE_SKIP
          The list of properties which are skipped for nt:file.
protected  javax.jcr.Node node
          Node.
 
Fields inherited from class org.exoplatform.services.jcr.webdav.resource.GenericResource
identifier, namespaceContext, PRESET_PROP, type
 
Fields inherited from interface org.exoplatform.services.jcr.webdav.resource.Resource
COLLECTION, FILE, NULL, VERSION, VERSION_HISTORY, VERSIONED_COLLECTION, VERSIONED_FILE
 
Fields inherited from interface org.exoplatform.services.jcr.webdav.util.PropertyConstants
CHILDCOUNT, CREATION_PATTERN, CREATIONDATE, DAV_ALLPROP, DAV_ALLPROP_INCLUDE, DISPLAYNAME, EXCLUSIVE, GETCONTENTLANGUAGE, GETCONTENTLENGTH, GETCONTENTTYPE, GETLASTMODIFIED, HASCHILDREN, IS_READ_ONLY, ISCOLLECTION, ISFOLDER, ISROOT, ISVERSIONED, JCR_CONTENT, JCR_DATA, LOCKDISCOVERY, LOCKSCOPE, LOCKTYPE, MODIFICATION_PATTERN, ORDERING_TYPE, OWNER, PARENTNAME, RESOURCETYPE, SUPPORTEDLOCK, SUPPORTEDMETHODSET, WRITE
 
Constructor Summary
protected FileResource(int type, URI identifier, javax.jcr.Node node, WebDavNamespaceContext namespaceContext)
           
  FileResource(URI identifier, javax.jcr.Node node, WebDavNamespaceContext namespaceContext)
           
 
Method Summary
protected  javax.jcr.Node contentNode()
          Returns the content node.
protected  javax.jcr.Property dataProperty()
          Returns the data property.
 InputStream getContentAsStream()
          Returns the content of node as stream.
 String getContentAsText()
          Returns the content of node as text.
 Set<org.exoplatform.common.util.HierarchicalProperty> getProperties(boolean namesOnly)
          
 org.exoplatform.common.util.HierarchicalProperty getProperty(QName name)
          
 boolean isCollection()
          
 boolean isTextContent()
          if the content of node is text.
 
Methods inherited from class org.exoplatform.services.jcr.webdav.resource.GenericResource
getIdentifier, getNamespaceContext, getType, lockDiscovery, supportedLock, supportedMethodSet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_SKIP

protected static final Set<String> FILE_SKIP
The list of properties which are skipped for nt:file.


CONTENT_SKIP

protected static final Set<String> CONTENT_SKIP
The list of properties which are skipped for jcr:content.


node

protected final javax.jcr.Node node
Node.

Constructor Detail

FileResource

public FileResource(URI identifier,
                    javax.jcr.Node node,
                    WebDavNamespaceContext namespaceContext)
             throws IllegalResourceTypeException,
                    javax.jcr.RepositoryException
Parameters:
identifier - resource identifier
node - node
namespaceContext - namespace context
Throws:
IllegalResourceTypeException - IllegalResourceTypeException
javax.jcr.RepositoryException - RepositoryException

FileResource

protected FileResource(int type,
                       URI identifier,
                       javax.jcr.Node node,
                       WebDavNamespaceContext namespaceContext)
                throws IllegalResourceTypeException,
                       javax.jcr.RepositoryException
Parameters:
type - resource type
identifier - resource identifier
node - node
namespaceContext - namespace context
Throws:
IllegalResourceTypeException - {@link IllegalResourceTypeException
javax.jcr.RepositoryException - RepositoryException
Method Detail

getProperties

public Set<org.exoplatform.common.util.HierarchicalProperty> getProperties(boolean namesOnly)
                                                                    throws javax.jcr.PathNotFoundException,
                                                                           javax.jcr.AccessDeniedException,
                                                                           javax.jcr.RepositoryException

Specified by:
getProperties in interface Resource
Overrides:
getProperties in class GenericResource
Parameters:
namesOnly - - if true "empty" properties will be returned (w/o values inside)
Returns:
all properties belonging to this resource
Throws:
javax.jcr.RepositoryException - RepositoryException
javax.jcr.PathNotFoundException
javax.jcr.AccessDeniedException

getProperty

public org.exoplatform.common.util.HierarchicalProperty getProperty(QName name)
                                                             throws javax.jcr.PathNotFoundException,
                                                                    javax.jcr.AccessDeniedException,
                                                                    javax.jcr.RepositoryException

Parameters:
name - property name
Returns:
property by its name
Throws:
javax.jcr.PathNotFoundException - PathNotFoundException
javax.jcr.AccessDeniedException - AccessDeniedException
javax.jcr.RepositoryException - RepositoryException

isCollection

public boolean isCollection()

Returns:
true if this is collection-able resource - i.e. this resource may contain other resources

getContentAsText

public String getContentAsText()
                        throws javax.jcr.RepositoryException
Returns the content of node as text.

Returns:
content as text
Throws:
javax.jcr.RepositoryException - RepositoryException

getContentAsStream

public InputStream getContentAsStream()
                               throws javax.jcr.RepositoryException
Returns the content of node as stream.

Returns:
content as stream
Throws:
javax.jcr.RepositoryException - RepositoryException

isTextContent

public boolean isTextContent()
if the content of node is text.

Returns:
true if the content of node is text false if not

contentNode

protected javax.jcr.Node contentNode()
                              throws javax.jcr.RepositoryException
Returns the content node.

Returns:
Node, the content node
Throws:
javax.jcr.RepositoryException - RepositoryException

dataProperty

protected javax.jcr.Property dataProperty()
                                   throws javax.jcr.RepositoryException
Returns the data property.

Returns:
Property, the content data property
Throws:
javax.jcr.RepositoryException - RepositoryException

eXo JCR :: Component :: Webdav Service 1.15.10-GA

Copyright © 2014 eXo Platform SAS. All Rights Reserved.