Class FileResource
- java.lang.Object
-
- org.exoplatform.services.jcr.webdav.resource.GenericResource
-
- 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
Fields Modifier and Type Field Description protected static Set<String>CONTENT_SKIPThe list of properties which are skipped for jcr:content.protected static Set<String>FILE_SKIPThe list of properties which are skipped for nt:file.protected javax.jcr.NodenodeNode.-
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.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
-
Fields inherited from interface org.exoplatform.services.jcr.webdav.resource.Resource
COLLECTION, FILE, NULL, VERSION, VERSION_HISTORY, VERSIONED_COLLECTION, VERSIONED_FILE
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedFileResource(int type, URI identifier, javax.jcr.Node node, WebDavNamespaceContext namespaceContext)FileResource(URI identifier, javax.jcr.Node node, WebDavNamespaceContext namespaceContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected javax.jcr.NodecontentNode()Returns the content node.protected javax.jcr.PropertydataProperty()Returns the data property.InputStreamgetContentAsStream()Returns the content of node as stream.StringgetContentAsText()Returns the content of node as text.Set<org.exoplatform.common.util.HierarchicalProperty>getProperties(boolean namesOnly)org.exoplatform.common.util.HierarchicalPropertygetProperty(QName name)booleanisCollection()booleanisTextContent()if the content of node is text.-
Methods inherited from class org.exoplatform.services.jcr.webdav.resource.GenericResource
decodeValue, getIdentifier, getNamespaceContext, getType, lockDiscovery, supportedLock, supportedMethodSet
-
-
-
-
Constructor Detail
-
FileResource
public FileResource(URI identifier, javax.jcr.Node node, WebDavNamespaceContext namespaceContext) throws IllegalResourceTypeException, javax.jcr.RepositoryException
- Parameters:
identifier- resource identifiernode- nodenamespaceContext- namespace context- Throws:
IllegalResourceTypeException-IllegalResourceTypeExceptionjavax.jcr.RepositoryException-RepositoryException
-
FileResource
protected FileResource(int type, URI identifier, javax.jcr.Node node, WebDavNamespaceContext namespaceContext) throws IllegalResourceTypeException, javax.jcr.RepositoryException- Parameters:
type- resource typeidentifier- resource identifiernode- nodenamespaceContext- namespace context- Throws:
IllegalResourceTypeExceptionjavax.jcr.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:
getPropertiesin interfaceResource- Overrides:
getPropertiesin classGenericResource- Parameters:
namesOnly- - if true "empty" properties will be returned (w/o values inside)- Returns:
- all properties belonging to this resource
- Throws:
javax.jcr.RepositoryException-RepositoryExceptionjavax.jcr.PathNotFoundExceptionjavax.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-PathNotFoundExceptionjavax.jcr.AccessDeniedException-AccessDeniedExceptionjavax.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.RepositoryExceptionReturns the content node.- Returns:
- Node, the content node
- Throws:
javax.jcr.RepositoryException-RepositoryException
-
dataProperty
protected javax.jcr.Property dataProperty() throws javax.jcr.RepositoryExceptionReturns the data property.- Returns:
- Property, the content data property
- Throws:
javax.jcr.RepositoryException-RepositoryException
-
-