org.eclipse.webdav.client
Class CollectionHandle

java.lang.Object
  extended by org.eclipse.webdav.client.AbstractResourceHandle
      extended by org.eclipse.webdav.client.CollectionHandle
All Implemented Interfaces:
WebDAVConstants, WebDAVPropertyNames, WebDAVPropertyValues
Direct Known Subclasses:
WorkspaceHandle

public class CollectionHandle
extends AbstractResourceHandle

The CollectionHandle class represents a resource on the WebDAV server that supports collection semantics.

Note: This class/interface is part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.


Field Summary
 
Fields inherited from class org.eclipse.webdav.client.AbstractResourceHandle
davClient, locator
 
Fields inherited from interface org.eclipse.webdav.internal.kernel.WebDAVPropertyNames
DAV_ACTIVITY_CHECKOUT_SET, DAV_ACTIVITY_VERSION_SET, DAV_AUTO_CHECKIN, DAV_AUTO_CHECKOUT, DAV_AUTO_MERGE_SET, DAV_BASELINE_COLLECTION, DAV_BASELINE_CONTROLLED_COLLECTION, DAV_BASELINE_CONTROLLED_COLLECTION_SET, DAV_BASELINE_SELECTOR, DAV_CHECKED_IN, DAV_CHECKED_OUT, DAV_CHECKIN_DATE, DAV_CHECKIN_FORK, DAV_CHECKOUT_FORK, DAV_CHECKOUT_SET, DAV_COMMENT, DAV_CREATION_DATE, DAV_CREATOR_DISPLAYNAME, DAV_CURRENT_ACTIVITY_SET, DAV_CURRENT_WORKSPACE_SET, DAV_DISPLAY_NAME, DAV_GET_CONTENT_LANGUAGE, DAV_GET_CONTENT_LENGTH, DAV_GET_CONTENT_TYPE, DAV_GET_E_TAG, DAV_GET_LAST_MODIFIED, DAV_HREF, DAV_LABEL_NAME_SET, DAV_LATEST_VERSION, DAV_LOCK_DISCOVERY, DAV_MERGE_SET, DAV_MUTABLE, DAV_PRECURSOR_SET, DAV_PREDECESSOR_SET, DAV_RESOURCE_ID, DAV_RESOURCE_TYPE, DAV_ROOT_VERSION, DAV_SOURCE, DAV_SUBACTIVITY_SET, DAV_SUBBASELINE_SET, DAV_SUCCESSOR_SET, DAV_SUPPORTED_LIVE_PROPERTY_SET, DAV_SUPPORTED_LOCK, DAV_SUPPORTED_METHOD_SET, DAV_SUPPORTED_REPORT_SET, DAV_UNRESERVED, DAV_VERSION_CONTROLLED_CONFIGURATION, DAV_VERSION_HISTORY, DAV_VERSION_NAME, DAV_VERSION_SET, DAV_WORKING_RESOURCE, DAV_WORKSPACE, DAV_WORKSPACE_CHECKOUT_SET, DAV_WORKSPACE_COLLECTION_SET
 
Fields inherited from interface org.eclipse.webdav.internal.kernel.WebDAVPropertyValues
DAV_ACTIVITY_RESOURCE_TYPE, DAV_BASELINE_RESOURCE_TYPE, DAV_COLLECTION_RESOURCE_TYPE, DAV_DISCOURAGED, DAV_FORBIDDEN, DAV_HISTORY_RESOURCE_TYPE, DAV_KEEP_CHECKED_OUT, DAV_LOCKED_UPDATE, DAV_NEW_VERSION, DAV_OK, DAV_OVERWRITE, DAV_UNLOCKED_UPDATE, DAV_VERSION_HISTORY_RESOURCE_TYPE, DAV_WORKSPACE_RESOURCE_TYPE
 
Fields inherited from interface org.eclipse.webdav.internal.kernel.WebDAVConstants
DAV_URI
 
Constructor Summary
CollectionHandle(DAVClient davClient, ILocator locator)
          Creates a new CollectionHandle from the given DAVClient and Locator.
 
Method Summary
 void baselineControl()
          Bring the receiver under baseline control.
 void baselineControl(ILocator baseline)
          Create a new version-controlled configuration on the given baseline.
 void bind(String member, ILocator source)
          Binds the given member in this collection to the resource identified by the given source locator.
 void bind(String member, ILocator source, boolean overwrite)
          Binds the given member in this collection to the resource identified by the given source locator.
 AbstractResourceHandle checkOut()
          Check out this resource.
 void create()
          Create this collection in the repository.
 CollectionHandle getCollectionHandle(String name)
          Answer the given member of the receiver as a collection handle.
 ILocator getMember(String memberName)
          Return the locator of the member of this collection, with the given name.
 Set getMembers()
          Return a set of handles representing the members of this collection.
 ResourceHandle getResourceHandle(String name)
           
 WorkspaceHandle getWorkspaceHandle(String name)
           
 boolean isWorkspace()
          Check to see if the receiver is a workspace resource.
 void mkdirs()
          Create the receiver and any parent collections that must be created on the path to the receiver.
protected  void mkdirs(CollectionHandle handle)
           
 
Methods inherited from class org.eclipse.webdav.client.AbstractResourceHandle
asCollectionHandle, asResourceHandle, canTalkDAV, checkIn, closeResponse, copy, copy, delete, delete, equals, examineMultiStatusResponse, examineResponse, examineStatusCode, exists, extractPropStats, getContent, getDAVClient, getLocator, getLocks, getParent, getProperties, getProperties, getProperty, getPropertyNames, getVersionTree, getWorkspaceCollections, hashCode, head, isCheckedIn, isCheckedOut, isCollection, isLocked, isVersion, isVersionControlled, isWorkingResource, lock, lock, move, move, newContext, newDocument, propertyHasChild, protectedCheckIn, protectedCheckOut, refreshLock, removeProperties, removeProperty, setContent, setContent, setProperties, setProperty, supportsLiveProperty, toString, trace, unlock, update, versionControl
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CollectionHandle

public CollectionHandle(DAVClient davClient,
                        ILocator locator)
Creates a new CollectionHandle from the given DAVClient and Locator.

A CollectionHandle is a resource handle for DAV resources with internal members.

Parameters:
davClient - the client used to access the WebDAV server.
locator - the reference to the collection resource on the server.
Method Detail

baselineControl

public void baselineControl()
                     throws DAVException
Bring the receiver under baseline control.

Throws:
DAVException - if the baseline control operation failed.
See Also:
IServer#baselineControl(Locator, Context, Document)

baselineControl

public void baselineControl(ILocator baseline)
                     throws DAVException
Create a new version-controlled configuration on the given baseline.

Throws:
DAVException - if the baseline control operation failed.
See Also:
IServer#baselineControl(Locator, Context, Document)

bind

public void bind(String member,
                 ILocator source)
          throws DAVException
Binds the given member in this collection to the resource identified by the given source locator. If the member already exists, or is already bound to a resource, it is not replaced.

Parameters:
member - a member in this collection
source - the location of a resource
Throws:
DAVException - if the binding could not be created
See Also:
#bind(String, Locator, boolean), IServer#bind(Locator, Locator, Context)

bind

public void bind(String member,
                 ILocator source,
                 boolean overwrite)
          throws DAVException
Binds the given member in this collection to the resource identified by the given source locator. If overwrite is false and such a member already exists, or such a member is already bound to a resource, it is not replaced. Otherwise, if overwrite is true and such a member already exists, or such a member is already bound to a resource, it is replaced.

Parameters:
member - a member in this collection
source - the location of a resource
overwrite - a boolean indicating whether or not any existing resource or binding is replaced
Throws:
DAVException - if the binding could not be created
See Also:
#bind(String, Locator, boolean), IServer#bind(Locator, Locator, Context)

checkOut

public AbstractResourceHandle checkOut()
                                throws DAVException
Check out this resource. Returns a resource handle on the checked out version selector, or the working resource if a version is checked out.

Note that a checked-out version-controlled collection has members that are themselves version-controlled resources, or unversioned resources; however, working collection members are always version history resources.

Specified by:
checkOut in class AbstractResourceHandle
Returns:
the checked out resource as a CollectionHandle.
Throws:
DAVException - if there is a problem checking out the receiver.

create

public void create()
            throws DAVException
Create this collection in the repository.

This corresponds to a WebDAV MKCOL method.

Specified by:
create in class AbstractResourceHandle
Throws:
DAVException - if there was a problem creating this collection
See Also:
IServer#mkcol(ILocator, IContext, IElement)

mkdirs

public void mkdirs()
            throws DAVException
Create the receiver and any parent collections that must be created on the path to the receiver.

Throws:
DAVException - if there is a problem creating the collections.

mkdirs

protected void mkdirs(CollectionHandle handle)
               throws DAVException
Throws:
DAVException

getCollectionHandle

public CollectionHandle getCollectionHandle(String name)
                                     throws DAVException
Answer the given member of the receiver as a collection handle.

Throws:
DAVException - if there is a problem creating the new handle.

getMember

public ILocator getMember(String memberName)
Return the locator of the member of this collection, with the given name. Does NOT perform a call to the server to check the existence of the member.

Parameters:
memberName - the name of the receiver's internal member.
Returns:
the Locator for the member.

getMembers

public Set getMembers()
               throws DAVException
Return a set of handles representing the members of this collection.

Each member of the set will be typed to be a ResourceHandle or a CollectionHandle depending upon whether it implements collection semantics. Note that workspaces will be returned as regular collection handles and should be converted to workspace handles if required (test using isWorkspace()).

Returns:
a Set of ResourceHandle and/or CollectionHandle or an empty set if the receiver has no members.
Throws:
DAVException - if there was a problem getting the members.

getResourceHandle

public ResourceHandle getResourceHandle(String name)
                                 throws DAVException
Throws:
DAVException

getWorkspaceHandle

public WorkspaceHandle getWorkspaceHandle(String name)
                                   throws DAVException
Throws:
DAVException

isWorkspace

public boolean isWorkspace()
                    throws DAVException
Check to see if the receiver is a workspace resource.

The resource is a workspace resource if it has <DAV:workspace-checkout-set> in the <DAV:supported-live-properties-set>.

Returns:
true if the resource is a workspace and false otherwise.
Throws:
DAVException - if a problem occurs determining the state of the resource.


Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.