| java.lang.Object com.ibm.webdav.impl.ResourceImpl
All known Subclasses: com.ibm.webdav.impl.CollectionImpl,
ResourceImpl | public class ResourceImpl implements IRResource(Code) | | Implements the Resource interface and all the WebDAV semantics. ResourceImpl
delegates certain low-level repository operations to managers provided for a
particular repository implementation. There are three repository managers
factoring the repository-specific behavior: NamesapceManager, PropertiesManager,
and LockManager. ResourceImplFactory constructs the appropriate managers for
this resource based on its URL. Mapping information from URL to repository
manager is configured in the dav4j.properties file.
ResourceImpl is generally used by a server to implement the WebDAV protocol.
However, it may also be used directly on the client if the resource URL is the localhost
and in that case, there are no remote procedure calls, and no need for a
server to run.
author: Jim Amsden <jamsden@us.ibm.com> See Also: ResourceImplCollection See Also: ResourceHTTPSkel |
Method Summary | |
public MultiStatus | atomicMove(ResourceContext context, String destinationURL, boolean overwrite) Copy this resource to the destination URL.
Partial results are possible, check the returned status for details.
Parameters: destinationURL - the destination Parameters: overwrite - true implies overrite the destination if it exists Parameters: propertiesToCopy - a collection of properties that must be copied orthe method will fail. | public boolean | authenticateUser(String user, String pwd) | public void | checkin() | public void | checkout() | public void | closeContentsOutputStream(ResourceContext context) This method must be called after the client has completed writing to the contents
output stream that was obtained from getContentsOutputStream() . | public void | closeContentsOutputStream(ResourceContext context, String sContentType) | public MultiStatus | copy(ResourceContext context, String destinationURL, boolean overwrite, Vector propertiesToCopy) Copy this resource to the destination URL.
Partial results are possible, check the returned status for details.
Parameters: destinationURL - the destination Parameters: overwrite - true implies overrite the destination if it exists Parameters: propertiesToCopy - a collection of properties that must be copied orthe method will fail. | protected MultiStatus | copyProperties(Resource destination, Vector propertiesToCopy) Copy the properties of this resource to the destination resource. | public static ResourceImpl | create(URL url, String localName) Create a instance of a ResourceImpl with the given URL and localName. | public MultiStatus | createBinding(ResourceContext context, String bindName, String resourceURI) | public MultiStatus | createPropPatchMultiStatus(WebDAVException exc, Document updates) Build a multistatus property response that returns the error specified
by the given exception. | public MultiStatus | delete(ResourceContext context) Delete this resouce from the server. | protected MultiStatus | doUnlock(String lockToken) Unlock the lock identified by the lockToken on this resource. | public MultiStatus | executeSearch(ResourceContext context, SearchRequest searchReq) | public boolean | exists() See if the contents of this resource exists. | protected ActiveLock | getActiveLockFor(String scope, String type, int timeout, Element owner) Get the active lock on this resource owned by the given principal if any.
NOTE: this method cannot be reliably implemented based on version 10 of
the WebDAV spec as an activelock element in a lockdiscovery does not contain
the authorization credentials of the owner of the lock. | public List | getAllowedMethods() | public InputStream | getContentsInputStream(ResourceContext context) Get an InputStream for accessing the contents of this resource. | public OutputStream | getContentsOutputStream(ResourceContext context) Get an OutputStream for setting the contents of this resource. | public com.ibm.webdav.ResourceContext | getContext() Insert the method's description here. | public LockManager | getLockManager() | public Vector | getLocks() Get the locks that exist on this resource. | public void | getMetaInformation(ResourceContext context) This method can be used for obtaining meta-information about this resource without
actually reading the resource contents. | public String | getName() Return the local name of the resource. | public IRCollection | getParentCollection() Get the collection containing this resource. | public URL | getParentURL() Get the URL of the collection containing this resource. | public MultiStatus | getProperties(ResourceContext context) Get all the properties of this resource.
a MultiStatus of PropertyResponses. | public MultiStatus | getProperties(ResourceContext context, PropertyName[] names) Get the named properties of this resource. | public PropertyValue | getProperty(PropertyName name) Get the value of the given property for this resource. | public MultiStatus | getPropertyNames(ResourceContext context) Get the names of all properties for this resource. | public HTTPHeaders | getRequestContext() Get the request context for this resource. | public HTTPHeaders | getResponseContext() Get the response context for this resource. | public MultiStatus | getSearchSchema(ResourceContext context, SearchRequest searchReq) | public com.ibm.webdav.WebDAVStatus | getStatusCode() Insert the method's description here. | public URL | getURL() Get the name that identifies this resource. | public UserAuthenticator | getUserAuthenticator() | public MultiStatus | getVersionTreeReport(ResourceContext context, PropertyName[] names) Get the named properties for all versions of this resource. | public MultiStatus | getVersionTreeReport(ResourceContext context) Get the properties for all versions of this resource. | protected boolean | hasLock(String lockToken) | public boolean | hasValidURI() | protected void | inheritParentDeepLocks() Inherit all deep locks on the parent of this resource. | public boolean | isCollection() Returns true if this Resource is a collection. | public boolean | isLocked() See if this resource is locked. | public boolean | isLockedByMe() Is this resource locked by the current authorized user? That is, does the
current user have sufficient locking access to modify this resource. | public boolean | isSameServerAs(URL target) See if the target URL has the same host and port (e.g., the same server)
as this resource. | public Document | loadProperties() Load properties from the properties manager and update live properties. | protected MultiStatus | lock(ActiveLock activeLock) Lock this resource with the information contained in the given active lock. | public MultiStatus | lock(ResourceContext context, String scope, String type, int timeout, Element owner) Lock this resource based on the given parameters. | public static void | main(String[] args) Startup an RMI server for a ResourceImpl. | public MultiStatus | move(ResourceContext context, String destinationURL, boolean overwrite, Vector propertiesToMove) Move this resource to the destination URL.
Partial results are possible, check the returned status for details
Parameters: destinationURL - the destination Parameters: overwrite - true implies overrite the destination if it exists Parameters: propertiesToMove - a collection of properties that must be moved orthe method will fail. | public boolean | parentIsLockedWith(String lockToken) | public byte[] | performWith(ResourceContext context, String args) This method treats this resource as a method or service, and sends its parameter to
this resource where it is handled in a resource-specific way. | public MultiStatus | refreshLock(ResourceContext context, String lockToken, int timeout) Refresh the lock on this resource by resetting the lock timeout.
The context must contain the proper authorization for the requesting
principal.
Parameters: lockToken - the lock token identifying the lock. Parameters: timeout - the new timeout in seconds. | public void | removeLiveProperties(Document propertiesDocument) Remove the live DAV properties from the properties document. | public void | saveProperties(Document propertiesDocument) Save the properties after removing any live properties that don't need
to be saved. | public void | setContents(byte[] value) Set the contents of this resource. | void | setContext(com.ibm.webdav.ResourceContext newContext) Insert the method's description here. | public MultiStatus | setProperties(ResourceContext context, Document updates) Edit the properties of a resource. | public void | setRequestContext(ResourceContext newRequestContext) Insert the method's description here. | public void | setResponseContext(com.ibm.webdav.ResourceContext newResponseContext) Insert the method's description here. | void | setStatusCode(int newStatusCode) Insert the method's description here. | void | setStatusCode(com.ibm.webdav.WebDAVStatus newStatusCode) Insert the method's description here. | public String | translatePathRelativeToMe(String target) Translate the URI reference relative to this resource in order to obtain
the real path name if the URI references a resource on the same machine. | public void | uncheckout() | public MultiStatus | unlock(ResourceContext context, String lockToken) Unlock the lock identified by the lockToken on this resource
Parameters: lockToken - the lock token obtained from the ActiveLock of a previous lock() or getLocks() . | public void | updateLiveProperties(Document document) Update live properties that are supported by this server. | public void | versionControl() |
debug | public static boolean debug(Code) | | Setting debug to true causes debug information to be printed to System.err for
each method. This value can be changed by setting its value in
the dav4j.properties file and restarting the server.
|
ResourceImpl | public ResourceImpl()(Code) | | |
ResourceImpl | public ResourceImpl(URL url, String localName) throws WebDAVException(Code) | | Construct a ResourceImpl for the given URL.
Parameters: url - the URL of the resource Parameters: localName - a translation of the URL (filePortion) intoa name that has local meaning to a server. exception: com.ibm.webdav.WebDAVException - |
ResourceImpl | public ResourceImpl(URL url, String localName, TargetSelector targetSelector) throws WebDAVException(Code) | | Construct a ResourceImpl for the given URL.
Parameters: url - the URL of the resource Parameters: localName - a translation of the URL (filePortion) intoa name that has local meaning to a server. Parameters: targetSelector - the revision target selector for this Collection exception: com.ibm.webdav.WebDAVException - |
atomicMove | public MultiStatus atomicMove(ResourceContext context, String destinationURL, boolean overwrite) throws WebDAVException(Code) | | Copy this resource to the destination URL.
Partial results are possible, check the returned status for details.
Parameters: destinationURL - the destination Parameters: overwrite - true implies overrite the destination if it exists Parameters: propertiesToCopy - a collection of properties that must be copied orthe method will fail. propertiesToCopy may have one of the following values:- null - ignore properties that cannot be copied
- empty collection - all properties must be copied or the method will fail
- a collection of URIs - a list of the properties that must be copiedor the method will fail
the status of the copy operation for each resource copied exception: com.ibm.webdav.WebDAVException - |
copy | public MultiStatus copy(ResourceContext context, String destinationURL, boolean overwrite, Vector propertiesToCopy) throws WebDAVException(Code) | | Copy this resource to the destination URL.
Partial results are possible, check the returned status for details.
Parameters: destinationURL - the destination Parameters: overwrite - true implies overrite the destination if it exists Parameters: propertiesToCopy - a collection of properties that must be copied orthe method will fail. propertiesToCopy may have one of the following values:- null - ignore properties that cannot be copied
- empty collection - all properties must be copied or the method will fail
- a collection of URIs - a list of the properties that must be copiedor the method will fail
the status of the copy operation for each resource copied exception: com.ibm.webdav.WebDAVException - |
copyProperties | protected MultiStatus copyProperties(Resource destination, Vector propertiesToCopy) throws WebDAVException(Code) | | Copy the properties of this resource to the destination resource.
Follow any keepalive instructions in the propertiesToCopy vector.
Parameters: destination - the destination resource Parameters: propertiesToCopy - properties that must be kept alive at the destination- null - ignore properties that cannot be copied
- empty collection - all properties must be copied or the method will fail
- a collection of URIs - a list of the properties that must be copiedor the method will fail
a MultiStatus indicating the result of the copy operation exception: com.ibm.webdav.WebDAVException - |
create | public static ResourceImpl create(URL url, String localName) throws WebDAVException(Code) | | Create a instance of a ResourceImpl with the given URL and localName.
Parameters: url - the URL of the resource to create Parameters: localName - the name of the resource on the server machine a ResourceImpl or one of its subclasses. exception: com.ibm.webdav.WebDAVException - |
createPropPatchMultiStatus | public MultiStatus createPropPatchMultiStatus(WebDAVException exc, Document updates) throws WebDAVException(Code) | | Build a multistatus property response that returns the error specified
by the given exception. It should return this error for every property provided
in the specified document which should represent the XML of a PROPPATCH
request.
Parameters: exc - an exception that describes the error to be placed in the MultiStatus created. Parameters: updates - an XML Document containing DAV:propertyupdate elementsdescribing the edits that were request orginally requested andapparently generated the given exception. a MultiStatus indicating the status of the updates exception: com.ibm.webdav.WebDAVException - |
delete | public MultiStatus delete(ResourceContext context) throws WebDAVException(Code) | | Delete this resouce from the server. The actual effect of the delete operation is
determined by the underlying repository manager. The visible effect to WebDAV
is that the resource is no longer available.
a MultiStatus containing the status of the delete method on eacheffected resource. exception: com.ibm.webdav.WebDAVException - |
doUnlock | protected MultiStatus doUnlock(String lockToken) throws WebDAVException(Code) | | Unlock the lock identified by the lockToken on this resource. This method
is used internally to unlock resources copied or moved as well as unlocked.
Parameters: lockToken - the lock token obtained from the ActiveLock of a previous lock() or getLocks() . a MultiStatus containing any responses on resources that could notbe unlocked. exception: com.ibm.webdav.WebDAVException - |
exists | public boolean exists() throws WebDAVException(Code) | | See if the contents of this resource exists. A resource exists
if it has contents or state maintained by a server.
true if the contents exists, false otherwise exception: com.ibm.webdav.WebDAVException - |
getActiveLockFor | protected ActiveLock getActiveLockFor(String scope, String type, int timeout, Element owner) throws WebDAVException(Code) | | Get the active lock on this resource owned by the given principal if any.
NOTE: this method cannot be reliably implemented based on version 10 of
the WebDAV spec as an activelock element in a lockdiscovery does not contain
the authorization credentials of the owner of the lock. For now, this method
relies on an additional principal element in the activelock that contains
the required id. This is an IBM EXTENSTION. When WebDAV ACLs are introduced,
the principal will likely be added to the activelock element.
Parameters: principal - the authorization id of the requesting principal the active lock owned by that principal or null if the resource isnot locked by that principal. exception: com.ibm.webdav.WebDAVException - |
getContentsInputStream | public InputStream getContentsInputStream(ResourceContext context) throws WebDAVException(Code) | | Get an InputStream for accessing the contents of this resource. This method may provide
more efficient access for resources that have large contents. Clients may want to create
a Reader to perform appropriate character conversions on this stream.
an InputStream on the contents exception: com.ibm.webdav.WebDAVException - |
getContentsOutputStream | public OutputStream getContentsOutputStream(ResourceContext context) throws WebDAVException(Code) | | Get an OutputStream for setting the contents of this resource. This method may provide
more efficient access for resources that have large contents. Remember to call
closeContentsOutputStream() when all the data has been written.
an OutputStream to set the contents exception: com.ibm.webdav.WebDAVException - |
getLockManager | public LockManager getLockManager()(Code) | | Return lock manager for this resource
|
getMetaInformation | public void getMetaInformation(ResourceContext context) throws WebDAVException(Code) | | This method can be used for obtaining meta-information about this resource without
actually reading the resource contents. This meta-information is maintained by the server
in addition to the resource properties.
After this call, the resource context has been updated and
getStatusCode() , getStatusMessage() , and getResponseContext()
as well as all the ResourceContext methods return updated values based on the current
state of the resource.
This methods corresponds to the HTTP HEAD method.
Do a getContentsInputStream() to set the response context,
then just don't return the stream.
exception: com.ibm.webdav.WebDAVException - |
getName | public String getName() throws WebDAVException(Code) | | Return the local name of the resource. What this name actually is
depends on the interpretation of the resource URL by the namespace
manager servicing it. Repository implementations are free to translate
the URL any way they want for their own purposes. For example, the
file system implementation uses the doc.root property to translate
the file part of the URL into a full pathname.
the repository specific name for this resource exception: com.ibm.webdav.WebDAVException - |
getRequestContext | public HTTPHeaders getRequestContext() throws WebDAVException(Code) | | Get the request context for this resource. The context contains information
used by methods on a resource when the method is called.
the HTTPHeaders providing information that controlsmethod execution. exception: com.ibm.webdav.WebDAVException - |
getResponseContext | public HTTPHeaders getResponseContext() throws WebDAVException(Code) | | Get the response context for this resource. The context contains information
returned from invocations of methods on a resource.
the HTTPHeaders providing information thatis returned by method execution. exception: com.ibm.webdav.WebDAVException - |
getStatusCode | public com.ibm.webdav.WebDAVStatus getStatusCode()(Code) | | Insert the method's description here.
Creation date: (4/13/2000 8:53:11 PM)
com.ibm.webdav.WebDAVStatus |
isLockedByMe | public boolean isLockedByMe() throws WebDAVException(Code) | | Is this resource locked by the current authorized user? That is, does the
current user have sufficient locking access to modify this resource. The
method, like all methods that do modify the resource, must have a precondition
set in the context containing the lock token of the resource owned by this
user. The user is set in the request context using the authorization method.
true if this resource is locked by the principal in the contextsufficient to modify the resource. exception: com.ibm.webdav.WebDAVException - See Also: com.ibm.webdav.ResourceContext.authorization |
isSameServerAs | public boolean isSameServerAs(URL target)(Code) | | See if the target URL has the same host and port (e.g., the same server)
as this resource. Matches on the host name, not its Internet address.
true if the target is supported by the same server |
lock | public MultiStatus lock(ResourceContext context, String scope, String type, int timeout, Element owner) throws WebDAVException(Code) | | Lock this resource based on the given parameters. This allows control of
the lock scope (exclusive or shared) the lock type (write), owner information, etc.
Parameters: scope - the scope of the lock, exclusive or shared Parameters: type - the type of the lock, currently only write Parameters: timeout - the number of seconds before the lock times out or-1 for infinite timeout. Parameters: owner - an XML element containing useful information that can beused to identify the owner of the lock. An href to a home page, anemail address, phone number, etc. Can be null if no owner informationis provided. a MultiStatus containing a lockdiscovery property indicatingthe results of the lock operation. exception: com.ibm.webdav.WebDAVException - |
main | public static void main(String[] args)(Code) | | Startup an RMI server for a ResourceImpl. The URL would most likely be for
some root WebDAV collection corresponding to the doc.root of a typical web
server. The resource identified by the URL must exist.
Parameters: args - root URL, its local file pathname |
move | public MultiStatus move(ResourceContext context, String destinationURL, boolean overwrite, Vector propertiesToMove) throws WebDAVException(Code) | | Move this resource to the destination URL.
Partial results are possible, check the returned status for details
Parameters: destinationURL - the destination Parameters: overwrite - true implies overrite the destination if it exists Parameters: propertiesToMove - a collection of properties that must be moved orthe method will fail. propertiesToMove may have one of the following values:- null - ignore properties that cannot be moved
- empty collection - all properties must be moved or the method will fail
- a collection of URIs - a list of the properties that must be movedor the method will fail
the status of the move operation for each resource moved exception: com.ibm.webdav.WebDAVException - |
parentIsLockedWith | public boolean parentIsLockedWith(String lockToken) throws WebDAVException(Code) | | Is the parent of this resource depth locked with the given lock token?
Parameters: lockToken - the lock token to check true if the parant of this resource is locked with the lock token exception: com.ibm.webdav.WebDAVException - |
performWith | public byte[] performWith(ResourceContext context, String args) throws WebDAVException(Code) | | This method treats this resource as a method or service, and sends its parameter to
this resource where it is handled in a resource-specific way. For example,
sending data from an HTML form to a URL representing a Servlet or CGI script that processes
the form data to produce some result.
Parameters: args - a string representing the arguments to the method represented by this URL. Thearguments are in the form ?parameterName1=value1¶meterName2=value2... as specifiedfor URL queries. the results of sending the arguments to the URL exception: com.ibm.webdav.WebDAVException - |
refreshLock | public MultiStatus refreshLock(ResourceContext context, String lockToken, int timeout) throws WebDAVException(Code) | | Refresh the lock on this resource by resetting the lock timeout.
The context must contain the proper authorization for the requesting
principal.
Parameters: lockToken - the lock token identifying the lock. Parameters: timeout - the new timeout in seconds. -1 means infinite timeout. updated information about the lock status of this resource exception: com.ibm.webdav.WebDAVException - |
removeLiveProperties | public void removeLiveProperties(Document propertiesDocument)(Code) | | Remove the live DAV properties from the properties document. There is no
reason to save them as they are recalculated each time the properties are
loaded.
Parameters: propertiesDocument - an XML document containing the current resource properties |
saveProperties | public void saveProperties(Document propertiesDocument) throws WebDAVException(Code) | | Save the properties after removing any live properties that don't need
to be saved.
Parameters: propertiesDocument - an XML document containing the resource's properties exception: com.ibm.webdav.WebDAVException - |
setContents | public void setContents(byte[] value) throws WebDAVException(Code) | | Set the contents of this resource. This may create a new resource on the server,
or update the contents of an existing resource. Sufficient authorization is required
and administered by the target web server. For text/* MIME types, the caller should
be sure to convert Strings to byte codes using an acceptable charset, and to set
that charset in the request context so the server knows how to decode the byte
stream.
Parameters: value - the new contents for the resource exception: com.ibm.webdav.WebDAVException - |
setContext | void setContext(com.ibm.webdav.ResourceContext newContext)(Code) | | Insert the method's description here.
Creation date: (4/14/2000 4:14:55 PM)
Parameters: newContext - com.ibm.webdav.ResourceContext |
setProperties | public MultiStatus setProperties(ResourceContext context, Document updates) throws WebDAVException(Code) | | Edit the properties of a resource. The updates must refer to a Document containing a WebDAV
DAV:propertyupdates element as the document root.
Parameters: updates - an XML Document containing DAV:propertyupdate elementsdescribing the edits to be made a MultiStatus indicating the status of the updates exception: com.ibm.webdav.WebDAVException - |
setRequestContext | public void setRequestContext(ResourceContext newRequestContext)(Code) | | Insert the method's description here.
Creation date: (4/13/2000 8:48:11 PM)
Parameters: newRequestContext - com.ibm.webdav.ResourceContext |
setResponseContext | public void setResponseContext(com.ibm.webdav.ResourceContext newResponseContext)(Code) | | Insert the method's description here.
Creation date: (4/13/2000 8:48:11 PM)
Parameters: newResponseContext - com.ibm.webdav.ResourceContext |
setStatusCode | void setStatusCode(int newStatusCode)(Code) | | Insert the method's description here.
Creation date: (4/13/2000 8:53:11 PM)
Parameters: newStatusCode - com.ibm.webdav.WebDAVStatus |
setStatusCode | void setStatusCode(com.ibm.webdav.WebDAVStatus newStatusCode)(Code) | | Insert the method's description here.
Creation date: (4/13/2000 8:53:11 PM)
Parameters: newStatusCode - com.ibm.webdav.WebDAVStatus |
translatePathRelativeToMe | public String translatePathRelativeToMe(String target) throws WebDAVException(Code) | | Translate the URI reference relative to this resource in order to obtain
the real path name if the URI references a resource on the same machine.
Parameters: target - the URL of the path to translate the pathname to the file on this machine, or the URL if the fileis not on this machine exception: com.ibm.webdav.WebDAVException - |
updateLiveProperties | public void updateLiveProperties(Document document) throws WebDAVException(Code) | | Update live properties that are supported by this server. This method
updates those that are not unique to any repository implementation.
This is mostly the live DAV properties as defined in the WebDAV spec.
Parameters: document - an XML document containing the resource properties exception: com.ibm.webdav.WebDAVException - |
|
|