|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.jackrabbit.webdav.jcr.DefaultItemCollection
public class DefaultItemCollection
DefaultItemCollection
represents a JCR node item.
Field Summary | |
---|---|
protected boolean |
initedProps
|
protected Item |
item
|
protected DavPropertySet |
properties
|
protected SupportedLock |
supportedLock
|
protected SupportedReportSetProperty |
supportedReports
|
Fields inherited from interface org.apache.jackrabbit.webdav.ordering.OrderingResource |
---|
COMPLIANCE_CLASS, METHODS |
Fields inherited from interface org.apache.jackrabbit.webdav.observation.ObservationResource |
---|
COMPLIANCE_CLASS, METHODS |
Fields inherited from interface org.apache.jackrabbit.webdav.transaction.TransactionResource |
---|
COMPLIANCE_CLASS, METHODS |
Fields inherited from interface org.apache.jackrabbit.webdav.version.DeltaVResource |
---|
COMPLIANCE_CLASS, METHODS, METHODS_INCL_MKWORKSPACE |
Fields inherited from interface org.apache.jackrabbit.webdav.search.SearchResource |
---|
COMPLIANCE_CLASS, METHODS |
Constructor Summary | |
---|---|
protected |
DefaultItemCollection(DavResourceLocator locator,
JcrDavSession session,
DavResourceFactory factory,
Item item)
Create a new DefaultItemCollection . |
Method Summary | |
---|---|
protected void |
addHrefProperty(DavPropertyName name,
Item[] values,
boolean isProtected)
Add a HrefProperty with the
specified property name and values. |
protected void |
addHrefProperty(DavPropertyName name,
Iterator itemIterator,
boolean isProtected)
Add a new href property to the property set, where
all items present in the specifed iterator are referenced in the
resulting property. |
void |
addLockManager(LockManager lockMgr)
Add an external LockManager to this resource. |
void |
addMember(DavResource resource,
InputContext inputContext)
If the specified resource represents a collection, a new node is added to the item represented by this resource. |
void |
addWorkspace(DavResource workspace)
The JCR api does not provide methods to create new workspaces. |
MultiStatusResponse |
alterProperties(DavPropertySet setProperties,
DavPropertyNameSet removePropertyNames)
Builds a single List from the properties to set and the properties to remove and delegates the list to AbstractResource.alterProperties(List) ; |
MultiStatusResponse |
alterProperties(List changeList)
Loops over the given List s and alters the properties accordingly. |
void |
copy(DavResource destination,
boolean shallow)
Copies the underlying repository item to the indicated destination. |
protected DavResource |
createResourceFromLocator(DavResourceLocator loc)
Create a new DavResource from the given locator. |
boolean |
exists()
Returns true if there exists a repository item with the given
resource path, false otherwise. |
DavResource |
getCollection()
Returns the resource representing the parent item of the repository item represented by this resource. |
String |
getComplianceClass()
Returns a string listing the compliance classes for this resource as it is required for the DAV response header. |
String |
getDisplayName()
Retrieves the last segment of the item path (or the resource path if this resource does not exist). |
DavResourceFactory |
getFactory()
Return the DavResourceFactory that created this resource. |
String |
getHref()
Returns the absolute href of this resource as returned in the multistatus response body. |
protected static String |
getItemName(String itemPath)
Retrieves the last segment of the given path and removes the index if present. |
DavResourceLocator |
getLocator()
Returns the locator object for this webdav resource,
which encapsulates the information for building the complete 'href'. |
protected DavResourceLocator |
getLocatorFromItem(Item repositoryItem)
Build a new DavResourceLocator from the given repository item. |
protected DavResourceLocator |
getLocatorFromItemPath(String itemPath)
Build a DavResourceLocator from the given itemPath path. |
ActiveLock |
getLock(Type type,
Scope scope)
Retrieve the lock with the specified type and scope. |
ActiveLock[] |
getLocks()
Returns an array of all locks applied to the given resource. |
DavResourceIterator |
getMembers()
Returns an iterator over all internal members. |
long |
getModificationTime()
Return the time of the last modification or -1 if the modification time could not be retrieved. |
OptionsResponse |
getOptionResponse(OptionsInfo optionsInfo)
Retrieves the information requested in the OPTIONS request body and returns the corresponding values. |
DavPropertySet |
getProperties()
Returns all webdav properties present on this resource. |
DavProperty |
getProperty(DavPropertyName name)
Return the webdav property with the specified name. |
DavPropertyName[] |
getPropertyNames()
Returns an array of all property names available
on this resource. |
QueryGrammerSet |
getQueryGrammerSet()
Returns the protected DAV:supported-method-set property which is defined mandatory by RTF 3253. |
DavResource[] |
getReferenceResources(DavPropertyName hrefPropertyName)
Return an array of DavResource objects that are referenced
by the property with the specified name. |
Report |
getReport(ReportInfo reportInfo)
Runs the report specified by the given ReportInfo . |
protected Session |
getRepositorySession()
Shortcut for getSession().getRepositorySession() |
String |
getResourcePath()
Returns the path of the underlying repository item or the item to be created (PUT/MKCOL). |
DavSession |
getSession()
Retrieve the DavSession associated with this resource. |
String |
getSupportedMethods()
Returns a comma separated list of all METHODS supported by the given resource. |
String |
getTransactionId()
The TransactionId or null according to the value of the
corresponding request header
field. |
protected String |
getWorkspaceHref()
Retrieve the href of the workspace the current session belongs to. |
boolean |
hasLock(Type type,
Scope scope)
Returns true if this resource has a lock applied with the given type and scope. |
void |
init(SubscriptionManager subsMgr)
Initializes this resource. |
void |
init(TxLockManager txMgr,
String transactionId)
Initializes the TransactionResource . |
protected void |
initLockSupport()
Extend the general AbstractResource#supportedLock field by
lock entries specific for this resource: write locks (exclusive or
exclusive session-scoped) in case the underlying node has the node
type mix:lockable. |
protected void |
initProperties()
Fill the property set for this resource. |
protected void |
initSupportedReports()
Defines the additional reports supported by this resource (reports specific for resources representing a repository node ):
export view report
locate corresponding node report
|
boolean |
isCollection()
Always returns true |
boolean |
isLockable(Type type,
Scope scope)
Returns true, if the SupportedLock property contains an entry
with the given type and scope. |
boolean |
isOrderable()
Returns true if this resource exists and the nodetype defining the underlying repository node allow to reorder this nodes children. |
ActiveLock |
lock(LockInfo reqLockInfo)
Creates a lock on this resource by locking the underlying node . |
void |
move(DavResource destination)
Moves the underlying repository item to the indicated destination. |
void |
orderMembers(OrderPatch orderPatch)
Reorder the child nodes of the repository item represented by this resource as indicated by the specified OrderPatch object. |
EventDiscovery |
poll(String subscriptionId,
long timeout)
Retrieve the list of events that where recorded for the event listener with the given SubscriptionId. |
ActiveLock |
refreshLock(LockInfo reqLockInfo,
String lockToken)
Refreshes the lock on this resource. |
void |
removeMember(DavResource member)
Removes the repository item represented by the specified member resource. |
void |
removeProperty(DavPropertyName propertyName)
This implementation of the DavResource does only allow
to remove the mixinnodetypes property. |
MultiStatus |
search(SearchInfo sInfo)
Runs a search with the language and query defined in the SearchInfo
object specified and returns a MultiStatus object listing the
results. |
void |
setProperty(DavProperty property)
This implementation of the DavResource does only allow
to set the mixinnodetypes property. |
void |
spool(OutputContext outputContext)
If this resource represents an existing Node the system
view is spooled as resource content. |
Subscription |
subscribe(SubscriptionInfo info,
String subscriptionId)
Subscribe this resource for event listening defined by the specified subscription info. |
void |
unlock(String lockToken)
Remove the write lock from this resource by unlocking the underlying node . |
void |
unlock(String lockToken,
TransactionInfo tInfo)
Overloads the unlock method of the DavResource
interface. |
void |
unsubscribe(String subscriptionId)
Unsubscribe the event listener with the given SubscriptionId. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.apache.jackrabbit.webdav.DavResource |
---|
addLockManager, alterProperties, copy, exists, getCollection, getDisplayName, getFactory, getHref, getLocator, getLocks, getProperties, getProperty, getPropertyNames, getResourcePath, getSession, isLockable, move |
Field Detail |
---|
protected final Item item
protected boolean initedProps
protected DavPropertySet properties
protected SupportedLock supportedLock
protected SupportedReportSetProperty supportedReports
Constructor Detail |
---|
protected DefaultItemCollection(DavResourceLocator locator, JcrDavSession session, DavResourceFactory factory, Item item)
DefaultItemCollection
.
locator
- session
- Method Detail |
---|
public String getComplianceClass()
getComplianceClass
in interface DavResource
DavResource.getComplianceClass()
public long getModificationTime()
DavResource
getModificationTime
in interface DavResource
public String getSupportedMethods()
DavResource
getSupportedMethods
in interface DavResource
DavResource.getSupportedMethods()
public boolean isCollection()
isCollection
in interface DavResource
DavResource.isCollection()
public void spool(OutputContext outputContext) throws IOException
Node
the system
view is spooled as resource content.
spool
in interface DavResource
outputContext
-
IOException
Session.exportSystemView(String, OutputStream, boolean, boolean)
public void setProperty(DavProperty property) throws DavException
DavResource
does only allow
to set the mixinnodetypes property. Please note that the existing list of
mixin nodetypes will be completely replaced.Node
use addMember(DavResource)
or
addMember(DavResource, InputStream)
or modify the value
of the corresponding resource.
setProperty
in interface DavResource
property
-
DavException
DavResource.setProperty(org.apache.jackrabbit.webdav.property.DavProperty)
,
ItemResourceConstants.JCR_MIXINNODETYPES
public void removeProperty(DavPropertyName propertyName) throws DavException
DavResource
does only allow
to remove the mixinnodetypes property.
removeProperty
in interface DavResource
propertyName
-
DavException
DavResource.removeProperty(org.apache.jackrabbit.webdav.property.DavPropertyName)
,
ItemResourceConstants.JCR_MIXINNODETYPES
public MultiStatusResponse alterProperties(List changeList) throws DavException
List
s and alters the properties accordingly.
Changes are persisted at the end according to the rules defined with
the AbstractItemResource#complete()
method.
Please note: since there is only a single property
(ItemResourceConstants.JCR_MIXINNODETYPES
that can be set or removed with PROPPATCH, this method either succeeds
or throws an exception, even if this violates RFC 2518. Thus no property
specific multistatus will be created in case of an error.
alterProperties
in interface DavResource
changeList
-
DavException
DavResource.alterProperties(org.apache.jackrabbit.webdav.property.DavPropertySet, org.apache.jackrabbit.webdav.property.DavPropertyNameSet)
public void addMember(DavResource resource, InputContext inputContext) throws DavException
added
to the item represented by this resource. If an input stream is specified
together with a collection resource Session.importXML(String, java.io.InputStream, int)
is called instead and this resource path is used as parentAbsPath
argument.
However, if the specified resource is not of resource type collection a
new Property
is set or an existing one is changed by modifying its
value.undefined
resource type, its value will be
changed/set to type binary
.
addMember
in interface DavResource
resource
- inputContext
-
DavException
DavResource.addMember(org.apache.jackrabbit.webdav.DavResource, InputContext)
,
Node.addNode(String)
,
Node.setProperty(String, java.io.InputStream)
public DavResourceIterator getMembers()
DavResource
getMembers
in interface DavResource
DavResourceIterator
over all internal members.DavResource.getMembers()
public void removeMember(DavResource member) throws DavException
removeMember
in interface DavResource
DavException
- if this resource does not exist or if an error occurs
while deleting the underlying item.DavResource.removeMember(DavResource)
,
Item.remove()
public boolean hasLock(Type type, Scope scope)
hasLock
in interface DavResource
type
- scope
-
DavResource.hasLock(org.apache.jackrabbit.webdav.lock.Type, org.apache.jackrabbit.webdav.lock.Scope)
public ActiveLock getLock(Type type, Scope scope)
getLock
in interface DavResource
type
- scope
-
null
. NOTE: If retrieving the write lock present
on the underlying repository item fails, null
is return.DavResource.getLock(org.apache.jackrabbit.webdav.lock.Type, org.apache.jackrabbit.webdav.lock.Scope)
,
for the write locks.
public ActiveLock lock(LockInfo reqLockInfo) throws DavException
node
. Except for the LockInfo.isDeep()
}
all information included in the LockInfo
object is ignored.
Lock timeout is defined by JCR implementation.
lock
in interface DavResource
reqLockInfo
-
DavException
DavResource.lock(org.apache.jackrabbit.webdav.lock.LockInfo)
,
Node.lock(boolean, boolean)
public ActiveLock refreshLock(LockInfo reqLockInfo, String lockToken) throws DavException
lock
present on the underlying node
is refreshed. The timeout indicated by the LockInfo
object is ignored.
refreshLock
in interface DavResource
reqLockInfo
- LockInfo as build from the request.lockToken
-
DavException
- in case the lock could not be refreshed.DavResource.refreshLock(org.apache.jackrabbit.webdav.lock.LockInfo, String)
,
Lock.refresh()
public void unlock(String lockToken) throws DavException
node
.
unlock
in interface DavResource
lockToken
-
DavException
DavResource.unlock(String)
,
Node.unlock()
public boolean isOrderable()
isOrderable
in interface OrderingResource
orderMembers(OrderPatch)
can be called on this resource.OrderingResource.isOrderable()
,
NodeType.hasOrderableChildNodes()
public void orderMembers(OrderPatch orderPatch) throws DavException
OrderPatch
object.
orderMembers
in interface OrderingResource
orderPatch
-
DavException
OrderingResource.orderMembers(org.apache.jackrabbit.webdav.ordering.OrderPatch)
,
Node.orderBefore(String, String)
protected void initLockSupport()
AbstractResource#supportedLock
field by
lock entries specific for this resource: write locks (exclusive or
exclusive session-scoped) in case the underlying node has the node
type mix:lockable.
JcrConstants.MIX_LOCKABLE
protected void initSupportedReports()
node
):
SupportedReportSetProperty
protected void initProperties()
protected void addHrefProperty(DavPropertyName name, Item[] values, boolean isProtected)
HrefProperty
with the
specified property name and values. Each item present in the specified
values array is referenced in the resulting property.
name
- values
- isProtected
- protected void addHrefProperty(DavPropertyName name, Iterator itemIterator, boolean isProtected)
href property
to the property set, where
all items present in the specifed iterator are referenced in the
resulting property.
name
- itemIterator
- isProtected
- addHrefProperty(DavPropertyName, Item[], boolean)
public boolean exists()
repository item
with the given
resource path, false otherwise.
exists
in interface DavResource
DavResource.exists()
public String getDisplayName()
item name
which is exposed with the {http://www.day.com/jcr/webdav/1.0}name
property.
getDisplayName
in interface DavResource
DavResource.getDisplayName()
public DavResource getCollection()
RootCollection
is returned.
getCollection
in interface DavResource
DavResource.getCollection()
public void move(DavResource destination) throws DavException
move
in interface DavResource
destination
-
DavException
DavResource.move(DavResource)
,
Session.move(String, String)
public void copy(DavResource destination, boolean shallow) throws DavException
Workspace.copy(String, String, String)
is used to perform
the copy operation, Workspace.copy(String, String)
otherwise.
Note, that this implementation does not support shallow copy.
copy
in interface DavResource
destination
- shallow
-
DavException
DavResource.copy(DavResource, boolean)
,
Workspace.copy(String, String)
,
Workspace.copy(String, String, String)
public void init(SubscriptionManager subsMgr)
ObservationResource
init
in interface ObservationResource
subsMgr
- subscription manager objectObservationResource.init(SubscriptionManager)
public Subscription subscribe(SubscriptionInfo info, String subscriptionId) throws DavException
ObservationResource
subscribe
in interface ObservationResource
info
- SubscriptionInfo
object as defined by the
request body and headers.subscriptionId
- or null
if the
SubscriptionId
header
is missing.
Subscription
object in case the subscription was
successful.
DavException
ObservationResource.subscribe(org.apache.jackrabbit.webdav.observation.SubscriptionInfo, String)
,
SubscriptionManager.subscribe(org.apache.jackrabbit.webdav.observation.SubscriptionInfo, String, org.apache.jackrabbit.webdav.observation.ObservationResource)
public void unsubscribe(String subscriptionId) throws DavException
ObservationResource
unsubscribe
in interface ObservationResource
subscriptionId
- as present in the SubscriptionId
header.
DavException
ObservationResource.unsubscribe(String)
,
SubscriptionManager.unsubscribe(String, org.apache.jackrabbit.webdav.observation.ObservationResource)
public EventDiscovery poll(String subscriptionId, long timeout) throws DavException
ObservationResource
poll
in interface ObservationResource
subscriptionId
- as present in the
SubscriptionId
header.timeout
- as present in the
ObservationConstants.HEADER_POLL_TIMEOUT
header or 0 (zero) if
none is present.
EventDiscovery
object
DavException
ObservationResource.poll(String, long)
,
SubscriptionManager.poll(String, long, org.apache.jackrabbit.webdav.observation.ObservationResource)
protected String getWorkspaceHref()
null
if this resource
does not represent a repository item.AbstractResource#getWorkspaceHref()
protected static String getItemName(String itemPath)
itemPath
-
public DavResourceLocator getLocator()
DavResource
locator
object for this webdav resource,
which encapsulates the information for building the complete 'href'.
getLocator
in interface DavResource
DavResource.getLocator()
public String getResourcePath()
null
is returned.
getResourcePath
in interface DavResource
DavResource.getResourcePath()
,
DavResourceLocator.getResourcePath()
public String getHref()
DavResource
getHref
in interface DavResource
DavResource.getHref()
,
DavResourceLocator.getHref(boolean)
public DavPropertyName[] getPropertyNames()
DavResource
property names
available
on this resource.
getPropertyNames
in interface DavResource
DavResource.getPropertyNames()
public DavProperty getProperty(DavPropertyName name)
DavResource
getProperty
in interface DavResource
name
- name of the webdav property
DavProperty
with the given name or null
if the property does not exist.DavResource.getProperty(org.apache.jackrabbit.webdav.property.DavPropertyName)
public DavPropertySet getProperties()
DavResource
getProperties
in interface DavResource
DavPropertySet
containing all webdav property
of this resource.DavResource.getProperties()
public MultiStatusResponse alterProperties(DavPropertySet setProperties, DavPropertyNameSet removePropertyNames) throws DavException
AbstractResource.alterProperties(List)
;
alterProperties
in interface DavResource
setProperties
- Set of properties to be added or modifiedremovePropertyNames
- Set of property names to be removed
DavException
- if an error occured. This may be the case if the
general state of the resource prevents any properties to be set or removed
(e.g. due to a lock).DavResource.alterProperties(org.apache.jackrabbit.webdav.property.DavPropertySet, org.apache.jackrabbit.webdav.property.DavPropertyNameSet)
public boolean isLockable(Type type, Scope scope)
SupportedLock
property contains an entry
with the given type and scope. By default resources allow for transaction
lock only.
isLockable
in interface DavResource
type
- scope
-
DavResource.isLockable(org.apache.jackrabbit.webdav.lock.Type, org.apache.jackrabbit.webdav.lock.Scope)
public ActiveLock[] getLocks()
DavResource
getLocks
in interface DavResource
todo improve....
public void addLockManager(LockManager lockMgr)
DavResource
LockManager
to this resource. This method may
throw UnsupportedOperationException
if the resource does handle
locking itself.
addLockManager
in interface DavResource
DavResource.addLockManager(org.apache.jackrabbit.webdav.lock.LockManager)
public DavResourceFactory getFactory()
DavResource
DavResourceFactory
that created this resource.
getFactory
in interface DavResource
DavResource.getFactory()
public DavSession getSession()
DavResource
DavSession
associated with this resource.
getSession
in interface DavResource
DavResource.getSession()
,
DavResource.getSession()
public void init(TxLockManager txMgr, String transactionId)
TransactionResource
TransactionResource
.
init
in interface TransactionResource
TransactionResource.init(TxLockManager, String)
public void unlock(String lockToken, TransactionInfo tInfo) throws DavException
TransactionResource
unlock
method of the DavResource
interface.
unlock
in interface TransactionResource
lockToken
- lock token as present in the request header.tInfo
- transaction info object as present in the UNLOCK request body.
DavException
- if an error occursTransactionResource.unlock(String, org.apache.jackrabbit.webdav.transaction.TransactionInfo)
public String getTransactionId()
TransactionResource
null
according to the value of the
corresponding request header
field.
getTransactionId
in interface TransactionResource
null
TransactionResource.getTransactionId()
public OptionsResponse getOptionResponse(OptionsInfo optionsInfo)
DeltaVResource
getOptionResponse
in interface DeltaVResource
optionsInfo
-
null
DeltaVResource.getOptionResponse(org.apache.jackrabbit.webdav.version.OptionsInfo)
public Report getReport(ReportInfo reportInfo) throws DavException
DeltaVResource
ReportInfo
.
getReport
in interface DeltaVResource
reportInfo
-
DavException
DeltaVResource.getReport(org.apache.jackrabbit.webdav.version.report.ReportInfo)
public void addWorkspace(DavResource workspace) throws DavException
addWorkspace
on this resource will always fail.
addWorkspace
in interface DeltaVResource
workspace
-
DavException
- Always throws.DeltaVResource.addWorkspace(org.apache.jackrabbit.webdav.DavResource)
public DavResource[] getReferenceResources(DavPropertyName hrefPropertyName) throws DavException
DavResource
objects that are referenced
by the property with the specified name.
getReferenceResources
in interface DeltaVResource
hrefPropertyName
-
DavResource
s
DavException
DeltaVResource.getReferenceResources(org.apache.jackrabbit.webdav.property.DavPropertyName)
public QueryGrammerSet getQueryGrammerSet()
SearchResource
DavResource.getProperty(SearchConstants.QUERY_GRAMMER_SET)
.
getQueryGrammerSet
in interface SearchResource
SearchResource.getQueryGrammerSet()
public MultiStatus search(SearchInfo sInfo) throws DavException
SearchResource
SearchInfo
object specified and returns a MultiStatus
object listing the
results.
search
in interface SearchResource
sInfo
-
DavException
SearchResource.search(org.apache.jackrabbit.webdav.search.SearchInfo)
protected DavResource createResourceFromLocator(DavResourceLocator loc) throws DavException
DavResource
from the given locator.
loc
-
DavResource
DavException
protected DavResourceLocator getLocatorFromItemPath(String itemPath)
DavResourceLocator
from the given itemPath path.
itemPath
-
DavResourceLocator
DavLocatorFactory.createResourceLocator(String, String, String)
protected DavResourceLocator getLocatorFromItem(Item repositoryItem)
DavResourceLocator
from the given repository item.
repositoryItem
-
getLocatorFromItemPath(String)
protected Session getRepositorySession()
getSession().getRepositorySession()
AbstractResource.session
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |