org.guvnor.tools.utils.webdav
Class WebDavClient

java.lang.Object
  extended by org.guvnor.tools.utils.webdav.WebDavClient
All Implemented Interfaces:
IWebDavClient

public class WebDavClient
extends Object
implements IWebDavClient

WebDav wrapper client.


Method Summary
 IContext createContext()
          Convenience method for creating a request IContext.
 boolean createResource(String resource, InputStream is)
          Same as createResource(resource, is, true)
 boolean createResource(String resource, InputStream is, boolean overwrite)
          Creates a file in Guvnor through WebDav.
 void deleteResource(String resource)
          Deletes a resource in the repository.
 RemoteDAVClient getClient()
          Provides access to the underlying RemoteDAVClient.
 String getResourceContents(String resource)
          Get the contents of a resource from Guvnor through WebDav.
 IResponse getResourceInputStream(String resource)
          Get the InputStream of a resource from Guvnor through WebDav.
 String getResourceVersionContents(String resource, String version)
          Get the contents for a specific version of a resource from a Guvnor repository.
 IResponse getResourceVersionInputStream(String resource, String version)
          Get the InputStream for a specific version of a resource from Guvnor through WebDav.
 IResponse getResourceVersions(String resource)
          Gets all the version information for a resource
 Map<String,ResourceProperties> listDirectory(String path)
          Lists a directory (collection) in Guvnor through WebDav.
 void putResource(String resource, InputStream is)
          Write a file to Guvnor through WebDav.
 ResourceProperties queryProperties(String resource)
          Queries the server for properties of a given resource.
 void setSessionAuthenticator(IAuthenticator sessionAuthen)
          Tell the client to use the supplied authenticator, instead of one tied to the platform key ring.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setSessionAuthenticator

public void setSessionAuthenticator(IAuthenticator sessionAuthen)
Description copied from interface: IWebDavClient
Tell the client to use the supplied authenticator, instead of one tied to the platform key ring. If the authenticator is null, the client defaults back to the platform key ring authenticator.

Specified by:
setSessionAuthenticator in interface IWebDavClient
Parameters:
sessionAuthen - The authenticator

getClient

public RemoteDAVClient getClient()
Description copied from interface: IWebDavClient
Provides access to the underlying RemoteDAVClient.

Specified by:
getClient in interface IWebDavClient
Returns:
The client associated with the current repository connection.

createContext

public IContext createContext()
Description copied from interface: IWebDavClient
Convenience method for creating a request IContext.

Specified by:
createContext in interface IWebDavClient
Returns:
An instance of IContext

listDirectory

public Map<String,ResourceProperties> listDirectory(String path)
                                             throws Exception
Description copied from interface: IWebDavClient
Lists a directory (collection) in Guvnor through WebDav.

Specified by:
listDirectory in interface IWebDavClient
Parameters:
path - The directory (collection) to list
Returns:
An association of directory content names and their properties
Throws:
Exception - Various WebDav errors can occur (See IResponse for details)

queryProperties

public ResourceProperties queryProperties(String resource)
                                   throws Exception
Description copied from interface: IWebDavClient
Queries the server for properties of a given resource.

Specified by:
queryProperties in interface IWebDavClient
Parameters:
resource - The resource to get properties for
Returns:
The resource properties
Throws:
Exception - Various WebDav errors can occur (See IResponse for details)

getResourceContents

public String getResourceContents(String resource)
                           throws Exception
Description copied from interface: IWebDavClient
Get the contents of a resource from Guvnor through WebDav.

Specified by:
getResourceContents in interface IWebDavClient
Parameters:
resource - The address of the resource
Returns:
The contents of the resource
Throws:
Exception - Various WebDav errors can occur (See IResponse for details)

getResourceVersionContents

public String getResourceVersionContents(String resource,
                                         String version)
                                  throws Exception
Description copied from interface: IWebDavClient
Get the contents for a specific version of a resource from a Guvnor repository.

Specified by:
getResourceVersionContents in interface IWebDavClient
Parameters:
resource - The address of the resource
version - The version number of the resource
Returns:
The contents of the resource
Throws:
Exception - Various WebDav errors can occur (See IResponse for details)

getResourceInputStream

public IResponse getResourceInputStream(String resource)
                                 throws Exception
Description copied from interface: IWebDavClient
Get the InputStream of a resource from Guvnor through WebDav.

Specified by:
getResourceInputStream in interface IWebDavClient
Parameters:
resource - The address of the resource
Returns:
The IResponse object, which the client must close
Throws:
Exception - Various WebDav errors can occur (See IResponse for details)

getResourceVersionInputStream

public IResponse getResourceVersionInputStream(String resource,
                                               String version)
                                        throws Exception
Description copied from interface: IWebDavClient
Get the InputStream for a specific version of a resource from Guvnor through WebDav.

Specified by:
getResourceVersionInputStream in interface IWebDavClient
Parameters:
resource - The address of the resource
version - The version number of the resource
Returns:
The IResponse object, which the client must close
Throws:
Exception - Various WebDav errors can occur (See IResponse for details)

createResource

public boolean createResource(String resource,
                              InputStream is)
                       throws Exception
Description copied from interface: IWebDavClient
Same as createResource(resource, is, true)

Specified by:
createResource in interface IWebDavClient
Throws:
Exception

createResource

public boolean createResource(String resource,
                              InputStream is,
                              boolean overwrite)
                       throws Exception
Description copied from interface: IWebDavClient
Creates a file in Guvnor through WebDav.

Specified by:
createResource in interface IWebDavClient
Parameters:
resource - The path and name of the resource
is - A stream to the file contents
overwrite - Whether to overwrite the file if it already exists
Returns:
false if the file exists and overwrite = false
Throws:
Exception - Various WebDav errors can occur (See IResponse for details)

putResource

public void putResource(String resource,
                        InputStream is)
                 throws Exception
Description copied from interface: IWebDavClient
Write a file to Guvnor through WebDav.

Specified by:
putResource in interface IWebDavClient
Parameters:
resource - The path and name of the resource
is - A stream to the file contents
Throws:
Exception - Various WebDav errors can occur (See IResponse for details)

getResourceVersions

public IResponse getResourceVersions(String resource)
                              throws Exception
Description copied from interface: IWebDavClient
Gets all the version information for a resource

Specified by:
getResourceVersions in interface IWebDavClient
Parameters:
resource - The file to get version information about
Returns:
The IResponse object, which the client must close
Throws:
Exception - Various WebDav errors can occur (See IResponse for details)

deleteResource

public void deleteResource(String resource)
                    throws Exception
Description copied from interface: IWebDavClient
Deletes a resource in the repository.

Specified by:
deleteResource in interface IWebDavClient
Parameters:
resource - The resource to delete
Throws:
Exception - Various WebDav errors can occur (See IResponse for details)


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