|
| Services |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||
java.lang.Object | +--com.sas.services.webdav.DAVResource
A DAVResource represents a WEBDAV (Distributed Authoring and Versioning) resource as specified in IETF RFC 2518. To create a DAVResource, use a ConnectionInfo object passed to the constructor. ConnectionInfo includes the url of the resource (containing the host, port and path), userid, password, proxy host, proxy port, proxy userid, proxy password. The DAVResource object can then be manipulated using the various methods defined in the Resource interface. After any operation on a resource, check the status on the object using getStatusCode() and getStatusMessage(). For example,
try {
ConnectionInfo c = new ConnectionInfo( "http://http-server/path-to-resource", "user", "pwd" );
// proxy information, if required
c.setProxyHost( "myproxy.com" );
c.setProxyPort( 3100 );
DAVResource r1 = new DAVResource( c, logger );
r1.setProperty(...);
if ( r1.getStatusCode() != 200 ) out.println( r1.getStatusMessage() );
} catch (DAVException e) { e.printStackTrace(); }
In order to create a collection use the longer form of the constructor. For example,
DAVResource r2 = new DAVResource( c, true, logger );this will ensure that r2 is a collection resource (it may contain other resources). Alternatively do this in two steps
DAVResource r2 = new DAVResource( c, logger ); r2.makeCollection();
| Field Summary | |
static int |
DONT_CARE
|
static int |
MUST_EXIST
|
static int |
MUST_NOT_EXIST
|
| Constructor Summary | |
DAVResource(ConnectionInfo cInfo,
boolean createCollection,
LoggerInterface logger)
Create a DAVResource using the connection information. |
|
DAVResource(ConnectionInfo cInfo,
LoggerInterface logger)
Create a DAVResource using the connection information. |
|
DAVResource(String url)
Create a DAVResource using a string URL |
|
DAVResource(String url,
boolean createCollection)
Create a DAVResource using a string URL and boolean flag to indicate whether a collection should be created or not |
|
DAVResource(String url,
boolean createCollection,
String userName,
String password)
Create a DAVResource using a string URL. |
|
DAVResource(String url,
boolean createCollection,
String userName,
String password,
LoggerInterface logger)
Create a DAVResource using a string URL. |
|
DAVResource(String url,
LoggerInterface logger)
Create a DAVResource using a string URL. |
|
DAVResource(String url,
String userName,
String password)
Create a DAVResource using a string URL, userName and password |
|
DAVResource(String url,
String userName,
String password,
LoggerInterface logger)
Create a DAVResource using a string URL, userName and password. |
|
DAVResource(URL url)
Create a DAVResource using a Java URL |
|
| Method Summary | |
void |
close()
Close the connection used by this DAVResource |
DAVResource |
copy(String targetPath)
Copy resource to the target path on the same host as the source |
void |
delete()
Deletes the current resource |
void |
doCheckin()
Check in this resource. |
void |
doCheckout()
Checks out this resource. |
void |
doControl()
Puts the resource until version control. |
void |
doLabel(int labelAction,
String label)
Modify the version label on the resource (if this is supported by the server). |
Properties |
doOptions()
|
void |
doUncheckout()
Uncheckout this resource, cancelling a previous checkout. |
boolean |
exists()
Returns whether the resource exists or not |
String |
getACL()
Get the Access Control List for this resource. |
org.apache.webdav.lib.Lock |
getActiveLockFor(String owner)
Get an active lock, if it exists, for the owner |
String[] |
getAllowedMethods()
Returns a list of methods allowed on this resource. |
Version |
getCheckedIn()
Retrieves the currently checked in resource. |
Version |
getCheckedOut()
Retrieves the currently checked out resource. |
byte[] |
getContents()
Returns the contents of the resource as a byte array. |
void |
getContents(File fileData)
Returns the contents of the resource into the supplied file |
String |
getContentsAsString()
Return the contents of the resource as a String |
InputStream |
getContentsInputStream()
Returns the contents of the resource as an InputStream |
String |
getContentType()
Return the content type of the content for this resource |
String[] |
getDavCapabilities()
Returns a list of DAV capabilties. |
int |
getDepth()
Get the value for depth. |
int |
getExistsRequirement()
|
LoggerInterface |
getLogger()
Returns the logger currently being used by DAVResource. |
Map |
getMultiStatus()
Return the multistatus information for the last operation. |
boolean |
getOverwrite()
Get value for overWrite |
String |
getPath()
Get the path for the WebDAV resource that is currently represented by this DAVResource |
List |
getPreviousVersionNames()
Gets a list of previous version names for this resource. |
org.apache.webdav.lib.Property[] |
getProperties()
Returns all the properties on the DAV resource |
org.apache.webdav.lib.Property[] |
getProperties(Element[] propNames)
Returns all the properties specified in the parameter on the DAV resource |
org.apache.webdav.lib.Property[] |
getProperties(PropertyName[] propNames)
Returns all the properties specified in the parameter on the DAV resource |
org.apache.webdav.lib.Property[] |
getProperties(String propNames)
Returns properties for a given set of property names. |
org.apache.webdav.lib.Property[] |
getProperty(Element propName)
Returns the property specified in the parameter on the DAV resource |
org.apache.webdav.lib.Property[] |
getProperty(PropertyName propName)
Returns a property for a given property name. |
org.apache.webdav.lib.Property[] |
getProperty(String propName)
Returns a property for a given property name. |
org.apache.webdav.lib.Property[] |
getPropertyNames()
Returns a list of property names for the resource |
int |
getStatusCode()
Returns the status code for the last operation |
String |
getStatusMessage()
Returns the status message for the last operation. |
String |
getTempDir()
Gets the current value of the directory used for temporary files. |
URL |
getURL()
Returns the URL that this DAV Resource represents |
Version |
getVersion(String versionName)
Gets a particular version of this resource |
protected boolean |
isAuthReqd()
Returns whether a password is required to connect to this server |
boolean |
isCollection()
Returns whether this resource is a collection or not |
boolean |
isLocked()
Returns whether this resource is locked or not |
String |
lock()
Locks the resource |
boolean |
makeCollection()
Make a collection. |
DAVResource |
move(String targetPath)
Move this resource to another location (path) on the same server as the source. |
void |
removeProperties(Element[] props)
Remove/delete properties from a resource |
void |
removeProperties(PropertyName[] props)
Remove/delete properties from a resource |
void |
removeProperty(Element prop)
Remove/delete properties from a resource |
void |
removeProperty(PropertyName prop)
Remove/delete a property from a resource |
void |
removeProperty(String prop)
Remove/delete properties from a resource |
org.apache.webdav.lib.Property[] |
report(String body)
Run a report on the current resource. |
org.apache.webdav.lib.Property[] |
search(Element searchQuery)
The SEARCH method invokes one of the implemented search grammars on the server to evaluate the query. |
org.apache.webdav.lib.Property[] |
search(String searchString)
The SEARCH method invokes one of the implemented search grammars on the server to evaluate the query. |
String |
setACL(String acl)
Set/Update the Access Control List for this resource. |
void |
setContents(byte[] contents)
Provide content for the resource. |
void |
setContents(InputStream is)
Set the content from an InputStream. |
void |
setContents(String content)
Set the contents of the resource, passing in a URL |
void |
setContents(URL url)
Set the content for the resource from an URL |
void |
setContentType(String contentType)
Set the contents type for the content of the resource |
void |
setDebug(int debug)
Set the value for debug. |
void |
setDepth(int depth)
Set the value for depth. |
void |
setExistsRequirement(int requirement)
|
void |
setLogger(LoggerInterface logger)
Set the logger to be used by DAVResource. |
void |
setOverwrite(boolean overwrite)
Set the value for overWrite |
void |
setPassword(String password)
Set the value for password. |
void |
setPath(String path)
Set the path for this resource. |
void |
setPathNoAction(String path)
Set the path for this resource. |
void |
setProperties(DocumentFragment doc)
Set properties on the resource |
void |
setProperties(Element[] elems)
Set properties on the resource |
void |
setProperties(PropertyName[] props,
String[] propValues)
Set properties on the resource |
void |
setProperty(Element elem)
Set a property on the resource |
void |
setProperty(PropertyName prop,
String propValue)
Set a property on the resource |
void |
setSessionContext(SessionContextInterface sessionContext)
Set the session context for this DAVResource. |
void |
setTempDir(String tempDir)
Sets the temp directory used for storing files. |
void |
setUserName(String userName)
Set the value for userName. |
boolean |
SUCCEEDED()
Returns whether the last method was successful or not. |
protected static boolean |
SUCCEEDED(int statusCode)
Returns whether the statusCode parameter represents success or not. |
void |
unlock()
Unlock a resource |
void |
unlock(String lockToken)
Unlock a resource |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int DONT_CARE
public static final int MUST_EXIST
public static final int MUST_NOT_EXIST
| Constructor Detail |
public DAVResource(String url)
throws DAVException
url - URL for the resource
public DAVResource(String url,
LoggerInterface logger)
throws DAVException
url - URL for the resourcelogger - LoggerInterface to be used for logging
public DAVResource(String url,
String userName,
String password)
throws DAVException
url - URL for the resourceuserName - authentication user namepassword - password for authentication
public DAVResource(String url,
String userName,
String password,
LoggerInterface logger)
throws DAVException
url - URL for the resourceuserName - authentication user namepassword - password for authenticationlogger - The logger to be used by DAVResource
public DAVResource(URL url)
throws DAVException
url - URL for the resource
public DAVResource(String url,
boolean createCollection)
throws DAVException
url - URL for the resourcecreateCollection - The URL indicates a collection resource
public DAVResource(String url,
boolean createCollection,
String userName,
String password)
throws DAVException
url - URL for the resourcecreateCollection - create a DAV collection if trueuserName - authentication user namepassword - password for authentication
public DAVResource(String url,
boolean createCollection,
String userName,
String password,
LoggerInterface logger)
throws DAVException
url - URL for the resourcecreateCollection - create a DAV collection if trueuserName - authentication user namepassword - password for authenticationlogger - The logger to be used
public DAVResource(ConnectionInfo cInfo,
LoggerInterface logger)
throws DAVException
cInfo - The connection information for the resourcelogger - The logger to be used
public DAVResource(ConnectionInfo cInfo,
boolean createCollection,
LoggerInterface logger)
throws DAVException
cInfo - The connection information for the resourcecreateCollection - create a DAV collection if truelogger - The logger to be used| Method Detail |
public boolean makeCollection()
throws DAVException,
RemoteException
makeCollection in interface DAVResourceInterfacecom.sas.services.webdav.DAVResourceInterfaceDAVException - in the case of a WebDAV error
public DAVResource copy(String targetPath)
throws DAVException,
RemoteException
copy in interface DAVResourceInterfacetargetPath - The path to which current resource is to be copied.
public void delete()
throws DAVException,
RemoteException
delete in interface DAVResourceInterfacecom.sas.services.webdav.DAVResourceInterfaceDAVException - in the event of a WebDAV failure.RemoteException - in the event of network failure.
public org.apache.webdav.lib.Lock getActiveLockFor(String owner)
throws DAVException
DAVResourceInterfacegetActiveLockFor in interface DAVResourceInterfacecom.sas.services.webdav.DAVResourceInterfaceowner - The owner for which the lock is being soughtDAVException - in the event of a WebDAV failure.RemoteException - in the event of network failure.
public byte[] getContents()
throws DAVException,
RemoteException
getContents in interface DAVResourceInterfaceDAVException - in the event of WebDAV errorsRemoteException - in the case of network errors
public String getContentsAsString()
throws DAVException,
RemoteException
getContentsAsString in interface DAVResourceInterfaceDAVException - in the event of a WebDAV failure.RemoteException - in the event of network failure.
public void getContents(File fileData)
throws DAVException,
RemoteException
getContents in interface DAVResourceInterfacefileData - The file to which the contents of the resource should be writtenDAVException - in the case of a WebDAV errorRemoteException - in the case of a network failure
public InputStream getContentsInputStream()
throws DAVException,
RemoteException
getContentsInputStream in interface DAVResourceInterfaceDAVException - in the case of a WebDAV errorRemoteException - in the case of a network failure
public String getContentType()
throws DAVException,
RemoteException
getContentType in interface DAVResourceInterfaceDAVException - in the event of a WebDAV failure.RemoteException - in the event of network failure.
public org.apache.webdav.lib.Property[] getProperties()
throws DAVException,
RemoteException
getProperties in interface DAVResourceInterface
public org.apache.webdav.lib.Property[] getProperty(Element propName)
throws DAVException,
RemoteException
getProperty in interface DAVResourceInterfacepropName - property name elements - specifying which property value should be returned
public org.apache.webdav.lib.Property[] getProperties(Element[] propNames)
throws DAVException,
RemoteException
getProperties in interface DAVResourceInterfacepropNames - Array of property name elements - specifying which property values should be returned
public org.apache.webdav.lib.Property[] getProperty(PropertyName propName)
throws DAVException,
RemoteException
getProperty in interface DAVResourceInterfacepropName - name of property for which value should be returned
public org.apache.webdav.lib.Property[] getProperties(PropertyName[] propNames)
throws DAVException,
RemoteException
getProperties in interface DAVResourceInterfacepropNames - Array of property names, specifying which property values should be returned
public org.apache.webdav.lib.Property[] getProperty(String propName)
throws DAVException,
RemoteException
getProperty in interface DAVResourceInterfacepropName - name of property for which value should be returned
public org.apache.webdav.lib.Property[] getProperties(String propNames)
throws DAVException,
RemoteException
getProperties in interface DAVResourceInterfacepropNames - names of properties for which values should be returned
public org.apache.webdav.lib.Property[] getPropertyNames()
throws DAVException,
RemoteException
getPropertyNames in interface DAVResourceInterface
public int getStatusCode()
throws DAVException,
RemoteException
getStatusCode in interface DAVResourceInterfacepublic String getStatusMessage()
getStatusMessage in interface DAVResourceInterface
public URL getURL()
throws DAVException,
RemoteException
getURL in interface DAVResourceInterfacepublic boolean isCollection()
isCollection in interface DAVResourceInterface
public boolean isLocked()
throws DAVException,
RemoteException
isLocked in interface DAVResourceInterface
public String lock()
throws DAVException,
RemoteException
lock in interface DAVResourceInterface
public DAVResource move(String targetPath)
throws DAVException,
RemoteException
move in interface DAVResourceInterfacetargetPath - The target path where the resource will be moved
public void removeProperties(PropertyName[] props)
throws DAVException,
RemoteException
removeProperties in interface DAVResourceInterfaceprops - names of the properties to remove
public void removeProperties(Element[] props)
throws DAVException,
RemoteException
removeProperties in interface DAVResourceInterfaceprops - names of the properties to remove
public void removeProperty(Element prop)
throws DAVException,
RemoteException
removeProperty in interface DAVResourceInterfaceprop - property to remove
public void removeProperty(String prop)
throws DAVException,
RemoteException
removeProperty in interface DAVResourceInterfaceprop - property to remove
public void removeProperty(PropertyName prop)
throws DAVException,
RemoteException
removeProperty in interface DAVResourceInterfaceprop - name of the property to remove
public org.apache.webdav.lib.Property[] search(String searchString)
throws DAVException,
RemoteException
search in interface DAVResourceInterfacesearchString - A string in the correct format for the grammar selected. This will be passed to the
server in the body of the of the SEARCH method.
public org.apache.webdav.lib.Property[] search(Element searchQuery)
throws DAVException,
RemoteException
search in interface DAVResourceInterfacesearchQuery - An XML representation of the query
public void setContents(byte[] contents)
throws DAVException,
RemoteException
setContents in interface DAVResourceInterfacecontents - byte array for the resource contents
public void setContents(URL url)
throws DAVException,
RemoteException
setContents in interface DAVResourceInterfaceurl - The URL for the contents to be PUT to this resource
public void setContents(String content)
throws DAVException,
RemoteException
setContents in interface DAVResourceInterfacecontent - The string containing the content for this resourceDAVException - in the event of a WebDAV failure.RemoteException - in the event of network failure.
public void setContents(InputStream is)
throws DAVException,
RemoteException
InputStreamAdaptersetContents in interface DAVResourceInterfaceis - The input stream that contains the content.DAVException - in the case of a WebDAV errorRemoteException - in the case of a network failure
public void setContentType(String contentType)
throws DAVException,
RemoteException
setContentType in interface DAVResourceInterfacecontentType - The content type for this resourceDAVException - in the event of a WebDAV failure.RemoteException - in the event of network failure.
public void setProperties(Element[] elems)
throws DAVException,
RemoteException
setProperties in interface DAVResourceInterfaceelems - an array of DOM2 elements that identify the properties to set on the resource
public void setProperties(PropertyName[] props,
String[] propValues)
throws DAVException,
RemoteException
setProperties in interface DAVResourceInterfaceprops - property namespropValues - property values (which will be escaped unless it is a CDATA section)
public void setProperties(DocumentFragment doc)
throws DAVException,
RemoteException
setProperties in interface DAVResourceInterfacedoc - document fragment containing elements that represent the properties to be set on the resource
public void setProperty(PropertyName prop,
String propValue)
throws DAVException,
RemoteException
setProperty in interface DAVResourceInterfaceprop - name of the propertypropValue - value of the property (which will be escaped unless it is a CDATA section)
public void setProperty(Element elem)
throws DAVException,
RemoteException
setProperty in interface DAVResourceInterfaceelem - an XML element that represents the property name and value
public void unlock()
throws DAVException,
RemoteException
unlock in interface DAVResourceInterfacecom.sas.services.webdav.DAVResourceInterfaceDAVException - in the event of a WebDAV failure.RemoteException - in the event of network failure.
public void unlock(String lockToken)
throws DAVException,
RemoteException
unlock in interface DAVResourceInterfacecom.sas.services.webdav.DAVResourceInterfacelockToken - The lock token for this resourceDAVException - in the event of a WebDAV failure.RemoteException - in the event of network failure.public boolean getOverwrite()
getOverwrite in interface DAVResourceInterfacepublic void setOverwrite(boolean overwrite)
setOverwrite in interface DAVResourceInterfaceoverwrite - public void setUserName(String userName)
userName - user namepublic void setPassword(String password)
password - passwordpublic void setDebug(int debug)
debug -
public void setDepth(int depth)
throws DAVException,
RemoteException
setDepth in interface DAVResourceInterfacedepth - org.apache.webdav.lib.methods.DepthSupportpublic int getDepth()
getDepth in interface DAVResourceInterface
public Properties doOptions()
throws DAVException,
RemoteException
public String[] getAllowedMethods()
public String[] getDavCapabilities()
protected boolean isAuthReqd()
public boolean SUCCEEDED()
SUCCEEDED in interface DAVResourceInterfaceprotected static boolean SUCCEEDED(int statusCode)
statusCode - A status code to be checked for success or failurestatusCode is successful, false otherwisepublic void setLogger(LoggerInterface logger)
logger - The logger.public LoggerInterface getLogger()
LoggerInterface The logger that is currently being usedpublic Map getMultiStatus()
public void close()
throws RemoteException
close in interface DAVResourceInterfacecom.sas.services.webdav.DAVResourceInterfaceRemoteException - in the event of network failure.
public void setTempDir(String tempDir)
throws RemoteException
java.io.tmpdir, but if required can be
changed for a particular instance using this method.setTempDir in interface DAVResourceInterfacetempDir - The directory to be used for temporary files
public String getTempDir()
throws RemoteException
java.io.tmpdir, but may have been changed.getTempDir in interface DAVResourceInterface
public boolean exists()
throws RemoteException
exists in interface DAVResourceInterface
public org.apache.webdav.lib.Property[] report(String body)
throws DAVException,
RemoteException
report in interface DAVResourceInterfacebody - An XML document string that represents the report
requestDAVException - in the case of server failuresRemoteException - in the case of network failures
public String getACL()
throws DAVException,
RemoteException
getACL in interface DAVResourceInterfaceDAVException - in the case of server failuresRemoteException - in the case of network failures
public String setACL(String acl)
throws DAVException,
RemoteException
setACL in interface DAVResourceInterfaceacl - An XML serialized document describing the ACL for this resourceDAVException - in the case of server failuresRemoteException - in the case of network failures
public void setSessionContext(SessionContextInterface sessionContext)
throws RemoteException
DAVResourceInterfacesetSessionContext in interface DAVResourceInterfacecom.sas.services.webdav.DAVResourceInterfacesessionContext - The session context for this DAVResourceRemoteException - in the event of network failure.public void setPath(String path)
DAVResourceInterfacesetPath in interface DAVResourceInterfacecom.sas.services.webdav.DAVResourceInterfacepath - The new path for the WebDAV resourceRemoteException - in the event of a network failurepublic void setPathNoAction(String path)
DAVResourceInterfacesetPathNoAction in interface DAVResourceInterfacecom.sas.services.webdav.DAVResourceInterfacepath - The new path for the WebDAV resourceRemoteException - in the event of a network failurepublic String getPath()
DAVResourceInterfacegetPath in interface DAVResourceInterfacecom.sas.services.webdav.DAVResourceInterfaceRemoteException - in the event of a network failure
public void doControl()
throws DAVException,
RemoteException
doControl in interface DAVResourceInterfaceDAVException - in the case of a WebDAV errorRemoteException - in the case of network failures
public List getPreviousVersionNames()
throws DAVException,
RemoteException
getPreviousVersionNames in interface DAVResourceInterfaceDAVException - in the case of a WebDAV errorRemoteException - in the case of network failures
public void doCheckout()
throws DAVException,
RemoteException
doCheckout in interface DAVResourceInterfaceDAVException - in the case of a WebDAV errorRemoteException - in the case of network failures
public void doLabel(int labelAction,
String label)
throws DAVException,
RemoteException
doLabel in interface DAVResourceInterfacelabelAction - Specify whether the label should be set (specify 1), added (specify 2), removed (specify 3)label - The value of the labelDAVException - in the case of a WebDAV errorRemoteException - in the case of network failures
public void doCheckin()
throws DAVException,
RemoteException
doCheckin in interface DAVResourceInterfaceDAVException - in the case of a WebDAV errorRemoteException - in the case of network failures
public void doUncheckout()
throws DAVException,
RemoteException
doUncheckout in interface DAVResourceInterfaceDAVException - in the case of a WebDAV errorRemoteException - in the case of network failures
public Version getCheckedIn()
throws DAVException,
RemoteException
getCheckedIn in interface DAVResourceInterfaceDAVException - in the case of a WebDAV errorRemoteException - in the case of network failures
public Version getCheckedOut()
throws DAVException,
RemoteException
getCheckedOut in interface DAVResourceInterfaceDAVException - in the case of a WebDAV errorRemoteException - in the case of network failures
public Version getVersion(String versionName)
throws DAVException,
RemoteException
getVersion in interface DAVResourceInterfaceversionName - Which version to retrieve for this resourceDAVException - in the case of a WebDAV errorRemoteException - in the case of network failurespublic void setExistsRequirement(int requirement)
setExistsRequirement in interface DAVResourceInterfacepublic int getExistsRequirement()
getExistsRequirement in interface DAVResourceInterface
|
| Services |
|
| |||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||||