public class VersionControlledItemCollection extends DefaultItemCollection implements VersionControlledResource
VersionControlledItemCollection
represents a JCR node item and
covers all functionality related to versioning of Node
s.Node
Modifier and Type | Field and Description |
---|---|
protected boolean |
initedProps |
protected Item |
item |
protected DavPropertyNameSet |
names |
protected DavPropertySet |
properties |
protected SupportedLock |
supportedLock |
protected SupportedReportSetProperty |
supportedReports |
ACTIVITY_SET, AUTO_MERGE_SET, AUTO_VERSION, BASELINE_CONTROLLED_COLLECTION, CHECKED_IN, CHECKED_OUT, CHECKIN_FORK, CHECKOUT_FORK, ECLIPSED_SET, MERGE_SET, methods_checkedIn, methods_checkedOut, PREDECESSOR_SET, SUBBASELINE_SET, UNRESERVED, VERSION_HISTORY
METHODS
METHODS_INCL_MKWORKSPACE
METHODS
METHODS
EXCLUSIVE_SESSION, JCR_DEFINITION, JCR_DEPTH, JCR_GET_STRING, JCR_INDEX, JCR_ISMODIFIED, JCR_ISNEW, JCR_LENGTH, JCR_LENGTHS, JCR_MIXINNODETYPES, JCR_NAME, JCR_NAMESPACES, JCR_NODETYPES_CND, JCR_PARENT, JCR_PATH, JCR_PRIMARYITEM, JCR_PRIMARYNODETYPE, JCR_REFERENCES, JCR_SELECTOR_NAME, JCR_TYPE, JCR_UUID, JCR_VALUE, JCR_VALUES, JCR_VERSIONABLEUUID, JCR_WEAK_REFERENCES, JCR_WORKSPACE_NAME, METHODS, NAMESPACE, PRIVILEGE_JCR_ADD_NODE, PRIVILEGE_JCR_READ, PRIVILEGE_JCR_REMOVE, PRIVILEGE_JCR_SET_PROPERTY
ATTR_VALUE_TYPE, IMPORT_UUID_BEHAVIOR, JCR_DEFINITION_LN, JCR_DEPTH_LN, JCR_GET_STRING_LN, JCR_INDEX_LN, JCR_ISMODIFIED_LN, JCR_ISNEW_LN, JCR_LENGTH_LN, JCR_LENGTHS_LN, JCR_MIXINNODETYPES_LN, JCR_NAME_LN, JCR_NAMESPACES_LN, JCR_NODETYPES_CND_LN, JCR_PARENT_LN, JCR_PATH_LN, JCR_PRIMARYITEM_LN, JCR_PRIMARYNODETYPE_LN, JCR_QUERY_RESULT_LN, JCR_REFERENCES_LN, JCR_SELECTOR_NAME_LN, JCR_TYPE_LN, JCR_UUID_LN, JCR_VALUE_LN, JCR_VALUES_LN, JCR_VERSIONABLEUUID_LN, JCR_WEAK_REFERENCES_LN, JCR_WORKSPACE_NAME_LN, NS_PREFIX, NS_URI, RELATION_REMOTE_SESSION_ID, RELATION_USER_DATA, REPORT_EXPORT_VIEW, REPORT_LOCATE_BY_UUID, REPORT_LOCATE_CORRESPONDING_NODE, REPORT_NODETYPES, REPORT_PRIVILEGES, REPORT_REGISTERED_NAMESPACES, REPORT_REPOSITORY_DESCRIPTORS, ROOT_ITEM_PATH, ROOT_ITEM_RESOURCEPATH, VERSIONSTORAGE_PATH, XML_ALLOWUPDATE, XML_CND, XML_DESCRIPTOR, XML_DESCRIPTORKEY, XML_DESCRIPTORVALUE, XML_EXCLUSIVE_SESSION_SCOPED, XML_LENGTH, XML_NAMESPACE, XML_NODETYPENAME, XML_PREFIX, XML_PRIMARYNODETYPE, XML_QUERY_RESULT_COLUMN, XML_RELPATH, XML_REMOVEEXISTING, XML_URI, XML_VALUE
METHODS
METHODS
Constructor and Description |
---|
VersionControlledItemCollection(DavResourceLocator locator,
JcrDavSession session,
DavResourceFactory factory,
Item item)
Create a new
VersionControlledItemCollection . |
Modifier and Type | Method and Description |
---|---|
void |
addLockManager(LockManager lockMgr)
Add an external
LockManager to this resource. |
void |
addVersionControl()
Adds version control to this resource.
|
void |
addWorkspace(DavResource workspace)
The JCR api does not provide methods to create new workspaces.
|
MultiStatusResponse |
alterProperties(List<? extends PropEntry> changeList)
Loops over the given
List s and alters the properties accordingly. |
String |
checkin()
Calls
Node.checkin() on the underlying repository node. |
void |
checkout()
Calls
Node.checkout() on the underlying repository node. |
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 |
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[] |
getLocks()
Returns an array of all locks applied to the given resource.
|
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 that will be
return upon a
DavConstants.PROPFIND_ALL_PROP request. |
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()
Return a comma separated string listing the supported method names.
|
String |
getTransactionId()
The TransactionId or
null according to the value of the
corresponding request header
field. |
VersionHistoryResource |
getVersionHistory()
Returns the
VersionHistory associated with the repository node. |
protected String |
getWorkspaceHref()
Retrieve the href of the workspace the current session belongs to.
|
void |
init(SubscriptionManager subsMgr)
Initializes this resource.
|
void |
init(TxLockManager txMgr,
String transactionId)
Initializes the
TransactionResource . |
protected void |
initProperties()
Fill the property set for this resource.
|
protected void |
initPropertyNames()
Property names common to all resources.
|
protected void |
initSupportedReports()
Define the set of reports supported by this resource.
|
boolean |
isLockable(Type type,
Scope scope)
Returns true, if the
SupportedLock property contains an entry
with the given type and scope. |
void |
label(LabelInfo labelInfo)
Modify the labels present with the versions of this resource.
|
MultiStatus |
merge(MergeInfo mergeInfo)
Merge the repository node represented by this resource according to the
information present in the given
MergeInfo object. |
void |
move(DavResource destination)
Moves the underlying repository item to the indicated destination.
|
EventDiscovery |
poll(String subscriptionId,
long timeout)
Retrieve the list of events that where recorded for the event listener
with the given SubscriptionId.
|
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. |
Subscription |
subscribe(SubscriptionInfo info,
String subscriptionId)
Subscribe this resource for event listening defined by the specified
subscription info.
|
void |
uncheckout()
Not implemented.
|
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.
|
MultiStatus |
update(UpdateInfo updateInfo)
Perform an update on this resource.
|
addHrefProperty, addHrefProperty, addHrefProperty, addMember, getComplianceClass, getCreationDate, getCreatorDisplayName, getHrefProperty, getHrefProperty, getHrefProperty, getLock, getMembers, getModificationTime, hasLock, initLockSupport, isCollection, isOrderable, lock, orderMembers, refreshLock, removeMember, removeProperty, setProperty, spool, unlock
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addWorkspace, getOptionResponse, getReferenceResources, getReport
addLockManager, addMember, copy, exists, getCollection, getComplianceClass, getDisplayName, getFactory, getHref, getLocator, getLock, getLocks, getMembers, getModificationTime, getProperties, getPropertyNames, getResourcePath, getSession, hasLock, isCollection, isLockable, lock, move, refreshLock, removeMember, removeProperty, setProperty, spool, unlock
protected final Item item
protected boolean initedProps
protected DavPropertySet properties
protected DavPropertyNameSet names
protected SupportedLock supportedLock
protected SupportedReportSetProperty supportedReports
public VersionControlledItemCollection(DavResourceLocator locator, JcrDavSession session, DavResourceFactory factory, Item item)
VersionControlledItemCollection
.locator
- session
- factory
- item
- public String getSupportedMethods()
getSupportedMethods
in interface DavResource
getSupportedMethods
in class DefaultItemCollection
DavResource.getSupportedMethods()
public DavProperty<?> getProperty(DavPropertyName name)
DavResource
getProperty
in interface DavResource
getProperty
in class DefaultItemCollection
name
- name of the webdav propertyDavProperty
with the given name or null
if the property does not exist.DavResource.getProperty(org.apache.jackrabbit.webdav.property.DavPropertyName)
public MultiStatusResponse alterProperties(List<? extends PropEntry> changeList) throws DavException
DefaultItemCollection
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
alterProperties
in class DefaultItemCollection
changeList
- DavException
for additional description of non-compliant behaviour.
public void addVersionControl() throws DavException
addVersionControl
in interface VersionableResource
DavException
- if this resource does not
exist yet or if an error occurs while making the underlying node versionable.VersionableResource.addVersionControl()
public String checkin() throws DavException
Node.checkin()
on the underlying repository node.checkin
in interface VersionControlledResource
DavException
VersionControlledResource.checkin()
public void checkout() throws DavException
Node.checkout()
on the underlying repository node.checkout
in interface VersionControlledResource
DavException
VersionControlledResource.checkout()
public void uncheckout() throws DavException
DavException
with error code
HttpServletResponse.SC_NOT_IMPLEMENTED
.uncheckout
in interface VersionControlledResource
DavException
VersionControlledResource.uncheckout()
public MultiStatus update(UpdateInfo updateInfo) throws DavException
updateInfo
this is translated to one of the following methods defined by the JCR API:
Node.restore(javax.jcr.version.Version, boolean)
Node.restore(javax.jcr.version.Version, String, boolean)
Node.restoreByLabel(String, boolean)
Node.update(String)
Limitation: note that the MultiStatus
returned by this method
will not list any nodes that have been removed due to an Uuid conflict.
update
in interface VersionControlledResource
updateInfo
- DavException
VersionControlledResource.update(org.apache.jackrabbit.webdav.version.UpdateInfo)
public MultiStatus merge(MergeInfo mergeInfo) throws DavException
MergeInfo
object.merge
in interface VersionControlledResource
mergeInfo
- MultiStatus
recording all repository items modified
by this merge call as well as the resources that a client must modify to
complete the merge (see RFC 3253)DavException
VersionControlledResource.merge(org.apache.jackrabbit.webdav.version.MergeInfo)
,
Node.merge(String, boolean)
public void label(LabelInfo labelInfo) throws DavException
label
in interface VersionControlledResource
labelInfo
- DavException
VersionHistory.addVersionLabel(String, String, boolean)
,
VersionHistory.removeVersionLabel(String)
public VersionHistoryResource getVersionHistory() throws DavException
VersionHistory
associated with the repository node.
If the node is not versionable an exception is thrown.getVersionHistory
in interface VersionControlledResource
VersionHistoryResource
associated with this resource.DavException
VersionControlledResource.getVersionHistory()
,
Node.getVersionHistory()
protected void initSupportedReports()
initSupportedReports
in class DefaultItemCollection
SupportedReportSetProperty
protected void initPropertyNames()
initPropertyNames
in class DefaultItemCollection
protected void initProperties()
initProperties
in class DefaultItemCollection
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
objectDavException
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 DavPropertySet getProperties()
DavResource
DavConstants.PROPFIND_ALL_PROP
request. The
implementation may in addition expose other (protected or calculated)
properties which should be marked accordingly (see also
DavProperty.isInvisibleInAllprop()
.getProperties
in interface DavResource
DavPropertySet
containing at least all properties
of this resource that are exposed in 'allprop' PROPFIND request.DavResource.getProperties()
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
sDavException
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
.Copyright © 2004–2021 The Apache Software Foundation. All rights reserved.