Package pyGlobus :: Module ftpClient :: Class EasyFtpClient
[show private | hide private]
[frames | no frames]

Class EasyFtpClient

BaseFtpClient --+
                |
               EasyFtpClient


A class to wrap the ftp client functions.

Each operation in this class blocks until the operation has completed

There is currently no way to abort an operation

If you must abort an operation use the FtpClient class
Method Summary
  __init__(self, handleAttr, handle)
Constructs an instance.
  __del__(self)
Destroy an instance.
  delete(self, url, attr)
Delete a file from a ftp server.
  done_cb(self, cv, handle, error)
Callback that has the signature function(arg, handle, error) where arg is the argument passed into this call, handle is a SWIGized pointer to a ftp client handle object, and error is a tuple (error_code, error_description).
  done_cb_exists(self, arglist, handle, error)
This callback is for the exists method It is called after the existence check has returned from the ftp Server
  exists(self, url, attr)
Determines whether a file exists on a ftp server
  get(self, dest_file, url, attr, marker)
Get a file from an ftp server.
  list(self, url, attr)
Get a file listing from an ftp server.
  mkdir(self, url, attr)
Make a directory on a ftp server.
  modification_time(self, url, attr)
Retrieves the size of a file on a ftp server
  move(self, srcUrl, destUrl, attr)
Move a file on a ftp server.
  partial_get(self, dest_file, url, offset, endOffset, attr, marker)
Get part of a file from a ftp server.
  partial_put(self, src_file, url, offset, endOffset, attr, marker)
Put part of a file onto a ftp server.
  partial_third_party_transfer(self, srcUrl, destUrl, offset, endOffset, srcAttr, destAttr, marker)
Transfer part of a file between two ftp servers.
  put(self, src_file, url, attr, marker)
Store a file on an ftp server.
  read_cb(self, fd, handle, buffer, bufHandle, bufLen, offset, eof, error)
This is a callback function that is for the register_read method It is called when a the buffer is full with data that has arrived to the handle It is used as a data callback for the *get methods
  rmdir(self, url, attr)
Remove a directory on a ftp server.
  size(self, url, attr)
Retrieves the size of a file on a ftp server
  small_read_cb(self, arg, handle, buffer, bufHandle, bufLen, offset, eof, error)
This function is for doing small reads such as a verbose_list.
  third_party_transfer(self, srcUrl, destUrl, srcAttr, destAttr, marker)
Transfer a file between two ftp servers.
  verbose_list(self, url, attr)
Get a file listing from an ftp server.
  write_cb(self, fd, handle, buffer, bufHandle, bufLen, offset, eof, error)
This is a callback function for the register_write method.
  write_cb_partial(self, args, handle, buffer, bufHandle, bufLen, offset, eof, error)
This is a callback function for register writes that need to keep track of offsets It is used in the partial_put method
    Inherited from BaseFtpClient
  abort(self)
Abort the current operation.
  add_plugin(self, plugin)
Add a plugin to an FTP client handle.
  cache_url_state(self, url)
Cache the connection to the FTP server.
  flush_url_state(self, url)
Remove the url from the connection cache.
  get_handle(self)
Return the underlying ftp client handle.
  get_user_data(self)
Returns the user data associated with the handle.
  remove_plugin(self, plugin)
Remove a plugin to an FTP client handle.
  set_user_data(self, data)
Associate some data with the handle.

Method Details

__init__(self, handleAttr=None, handle=None)
(Constructor)

Constructs an instance.

Create a new FtpClient instance. This will init the ftp client module and create a new ftp client handle if none is passed in.
Parameters:
handleAttr - A HandleAttr object with the attributes set for this object.
handle - If a SWIG'ized pointer to a globus ftp client handle object is passed in, create a new instance around this handle. The class then owns the underlying pointer, and will delete it when the instance is destroyed.
Raises:
FtpClientException - A FtpClientException is thrown if unable to init the module or create the underlying handle.
Overrides:
pyGlobus.ftpClient.BaseFtpClient.__init__

__del__(self)
(Destructor)

Destroy an instance.

Free's any remaining callbacks, destroyes the underlying handle, and deactivates the module.
Raises:
FtpClientException - A FtpClientException is thrown if unable to destroy the handle or deactivate the module.

delete(self, url, attr=None)

Delete a file from a ftp server.

This method blocks until the file has been deleted
Parameters:
url - The URL to delete.
attr - An OperationAttr object containing the attributes for this delete.
Returns:
Nothing is returned
Raises:
FtpClientException - A FtpClientException is thrown if unable to initiate the delete.
Overrides:
pyGlobus.ftpClient.BaseFtpClient.delete

done_cb(self, cv, handle, error)

Callback that has the signature function(arg, handle, error) where arg is the argument passed into this call, handle is a SWIGized pointer to a ftp client handle object, and error is a tuple (error_code, error_description). If there is no error, the error_code is 0 and the error description is a None object.

This function handles these types of callbacks in the EasyFtpClient class

done_cb_exists(self, arglist, handle, error)

This callback is for the exists method It is called after the existence check has returned from the ftp Server

exists(self, url, attr=None)

Determines whether a file exists on a ftp server

When the existence has been determined the complete callback is called
Parameters:
url -

the location of the file

the default OperationAttr is created and used
Returns:
a boolean indicating whether the file exists
Raises:
FtpClientException - A FtpClientException if the existence cannot be determined
Overrides:
pyGlobus.ftpClient.BaseFtpClient.exists

get(self, dest_file, url, attr=None, marker=None)

Get a file from an ftp server.

After calling this method, register_read can be called to begin retrieving the data. When all of the data associated with this URL is retrieved, and all of the data callbacks have completed, or if the get request is aborted, the complete callback will be called with the final status of the get.
Parameters:
url - The url to download.
attr - An OperationAttr object containing the attributes for this get.
marker - A RestartMarker object.
Returns:
Nothing is returned
Raises:
FtpClientException - A FtpClientException is thrown if unable to initiate the get.
Overrides:
pyGlobus.ftpClient.BaseFtpClient.get

list(self, url, attr=None)

Get a file listing from an ftp server.

This method starts a 'NLIST' transfer from an ftp server. The client may begin calling register_read to retrieve the listing, after this method returns. When all of the data associated with the listing is returned, and all of the data callbacks executed, the callback will be called with the final status of the list.
Parameters:
url - The url to list.
attr - An OperationAttr object containing the attributes for the listing.
Returns:
A string of the 'NLIST' transfer is returned
Raises:
FtpClientException - A FtpClientException is thrown if unable to initiate the list.
Overrides:
pyGlobus.ftpClient.BaseFtpClient.list

mkdir(self, url, attr=None)

Make a directory on a ftp server.

The callback will be called with the final status of the mkdir.
Parameters:
url - The URL to make.
attr - An OperationAttr object containing the attributes for this mkdir.
Returns:
Nothing is returned
Raises:
FtpClientException - A FtpClientException is thrown if unable to initiate the mkdir.
Overrides:
pyGlobus.ftpClient.BaseFtpClient.mkdir

modification_time(self, url, attr=None)

Retrieves the size of a file on a ftp server

When the modification time is retrieved the complete callback is called
Parameters:
url -

the location of the file

the default OperationAttr is created and used
Returns:
the string of the modification time
Raises:
FtpClientException - A FtpClientException if the modification time cannot be retrieved
Overrides:
pyGlobus.ftpClient.BaseFtpClient.modification_time

move(self, srcUrl, destUrl, attr=None)

Move a file on a ftp server.

The complete callback will be called when the move is completed.
Parameters:
srcUrl - The url to move.
destUrl - The url to move to.
attr - An OperationAttr object containing the attributes for the listing.
Returns:
Nothing is returned
Raises:
FtpClientException - A FtpClientException is thrown if unable to initiate the move.
Overrides:
pyGlobus.ftpClient.BaseFtpClient.move

partial_get(self, dest_file, url, offset, endOffset, attr=None, marker=None)

Get part of a file from a ftp server.

After calling this method, register_read can be called to begin retrieving the data. When all of the data associated with this URL is retrieved, and all of the data callbacks have completed, or if the get request is aborted, the complete callback will be called with the final status of the get.
Parameters:
url - The url to download.
offset - An int or long offset to begin the transfer at.
endOffset - An int or long offset to end the transfer at.
attr - An OperationAttr object containing the attributes for this get.
marker - A RestartMarker object.
Returns:
Nothing is returned
Raises:
FtpClientException - A FtpClientException is thrown if unable to initiate the partial get.
Overrides:
pyGlobus.ftpClient.BaseFtpClient.partial_get

partial_put(self, src_file, url, offset, endOffset, attr=None, marker=None)

Put part of a file onto a ftp server.

After calling this method, register_write can be called to begin writing the data. When all of the data associated with this URL is sent, and all of the data callbacks have completed, or if the partial_put request is aborted, the complete callback will be called with the final status of the partial_put.
Parameters:
url - The url to download.
offset - An int representing the byte offset to begin the transfer at.
endOffset - An int representing the byte offset to end the transfer at.
attr - An OperationAttr object containing the attributes for this partial_put.
marker - A RestartMarker object.
Returns:
Nothing is returned
Raises:
FtpClientException - A FtpClientException is thrown if unable to initiate the partial put.
Overrides:
pyGlobus.ftpClient.BaseFtpClient.partial_put

partial_third_party_transfer(self, srcUrl, destUrl, offset, endOffset, srcAttr=None, destAttr=None, marker=None)

Transfer part of a file between two ftp servers.

When the transfer is complete, the complete callback will be called with the final status of the transfer.
Parameters:
srcUrl - The url to transfer.
destUrl - The url to store the data to.
offset - An int or long offset to start the transfer from.
endOffset - An int or long offset to end the transfer at.
srcAttr - An OperationAttr object containing the attributes for the source.
destAttr - An OperationAttr object containing the attributes for the destination.
marker - A RestartMarker object.
Returns:
Nothing is returned
Raises:
FtpClientException - A FtpClientException is thrown if unable to initiate the transfer.
Overrides:
pyGlobus.ftpClient.BaseFtpClient.partial_third_party_transfer

put(self, src_file, url, attr=None, marker=None)

Store a file on an ftp server.

After calling this method, register_write can be called to begin writing the data. When all of the data associated with this URL is sent, and all of the data callbacks have completed, or if the put request is aborted, the complete callback will be called with the final status of the put.
Parameters:
url - The url to store the data to.
attr - An OperationAttr object containing the attributes for this put.
marker - A RestartMarker object.
Returns:
Nothing is returned
Raises:
FtpClientException - A FtpClientException is thrown if unable to initiate the put.
Overrides:
pyGlobus.ftpClient.BaseFtpClient.put

read_cb(self, fd, handle, buffer, bufHandle, bufLen, offset, eof, error)

This is a callback function that is for the register_read method It is called when a the buffer is full with data that has arrived to the handle It is used as a data callback for the *get methods

rmdir(self, url, attr=None)

Remove a directory on a ftp server.

The callback will be called with the final status of the rmdir.
Parameters:
url - The URL to remove.
attr - An OperationAttr object containing the attributes for this rmdir.
Returns:
Nothing is returned
Raises:
FtpClientException - A FtpClientException is thrown if unable to initiate the rmdir.
Overrides:
pyGlobus.ftpClient.BaseFtpClient.rmdir

size(self, url, attr=None)

Retrieves the size of a file on a ftp server

When the size is retrieved the complete callback is called
Parameters:
url -

the location of the file

the default OperationAttr is created and used
Returns:
the size of the file
Raises:
FtpClientException - A FtpClientException if the size cannont be retrieved
Overrides:
pyGlobus.ftpClient.BaseFtpClient.size

small_read_cb(self, arg, handle, buffer, bufHandle, bufLen, offset, eof, error)

This function is for doing small reads such as a verbose_list. The result is stored in a string, instead of being written to a file

third_party_transfer(self, srcUrl, destUrl, srcAttr=None, destAttr=None, marker=None)

Transfer a file between two ftp servers.

When the transfer is complete, the complete callback will be called with the final status of the transfer.
Parameters:
srcUrl - The url to transfer.
destUrl - The url to store the data to.
srcAttr - An OperationAttr object containing the attributes for the source.
destAttr - An OperationAttr object containing the attributes for the destination.
marker - A RestartMarker object
Returns:
Nothing is returned
Raises:
FtpClientException - A FtpClientException is thrown if unable to initiate the transfer.
Overrides:
pyGlobus.ftpClient.BaseFtpClient.third_party_transfer

verbose_list(self, url, attr=None)

Get a file listing from an ftp server.

This method blocks until the list of the url is retrieved

This method starts a ' LIST' transfer from an ftp server. The client may begin calling register_read to retrieve the listing, after this method returns. When all of the data associated with the listing is returned, and all of the data callbacks executed, the callback will be called with the final status of the list.
Parameters:
url - The url to list.
attr - An OperationAttr object containing the attributes for the listing.
Returns:
A string of the 'LIST' transfer is returned
Raises:
FtpClientException - A FtpClientException is thrown if unable to initiate the list.
Overrides:
pyGlobus.ftpClient.BaseFtpClient.verbose_list

write_cb(self, fd, handle, buffer, bufHandle, bufLen, offset, eof, error)

This is a callback function for the register_write method. It is called when the handle has recieved the buffer It is used as a data callback for the *put methods

write_cb_partial(self, args, handle, buffer, bufHandle, bufLen, offset, eof, error)

This is a callback function for register writes that need to keep track of offsets It is used in the partial_put method

Generated by Epydoc 2.1 on Tue Apr 4 14:32:54 2006 http://epydoc.sf.net