uk.ac.rdg.resc.jstyx.client
Interface CStyxFileChangeListener

All Known Implementing Classes:
CStyxFileChangeAdapter, SGSClient, SGSInstanceClient, StyxGet, TestClient

public interface CStyxFileChangeListener

Interface defining methods that will be fired when messages pertaining to a StyxFile arrive at the client (e.g. data has been read, permissions changed etc)

Author:
Jon Blower $Revision: 373 $ $Date: 2005-08-31 09:15:57 +0100 (Wed, 31 Aug 2005) $ $Log$ Revision 1.10 2005/08/31 08:15:57 jonblower Corrections to comments Revision 1.9 2005/07/28 16:38:58 jonblower Added material to comments Revision 1.8 2005/06/20 17:20:43 jonblower Added download() and downloadAsync() to CStyxFile Revision 1.7 2005/05/25 16:57:07 jonblower Added fileCreated() event Revision 1.6 2005/05/12 14:20:55 jonblower Changed dataSent() method to dataWritten() (more accurate name) Revision 1.5 2005/05/12 08:00:34 jonblower Added getChildrenAsync() to CStyxFile and childrenFound() to CStyxFileChangeListener Revision 1.4 2005/05/05 07:08:37 jonblower Improved handling of buffers in change listeners Revision 1.3 2005/03/19 21:46:58 jonblower Further fixes relating to releasing ByteBuffers Revision 1.2 2005/03/16 17:55:52 jonblower Replaced use of java.nio.ByteBuffer with MINA's ByteBuffer to minimise copying of buffers Revision 1.1.1.1 2005/02/16 18:58:18 jonblower Initial import

Method Summary
 void childrenFound(CStyxFile file, CStyxFile[] children)
          Called after a successful read on a directory.
 void dataArrived(CStyxFile file, TreadMessage tReadMsg, org.apache.mina.common.ByteBuffer data)
          Called when new data have been read from the file (after the Rread message arrives).
 void dataWritten(CStyxFile file, TwriteMessage tWriteMsg)
          Called when data have been written to the file (after the Rwrite message arrives).
 void downloadComplete(CStyxFile sourceFile)
          Called after a file has been successfully downloaded
 void error(CStyxFile file, java.lang.String message)
          Called when an Rerror message arrives
 void fileCreated(CStyxFile file, int mode)
          Called when the file has been created.
 void fileOpen(CStyxFile file, int mode)
          Called when the file has been opened.
 void statChanged(CStyxFile file, DirEntry newDirEntry)
          Called after the stat of a file (permissions etc) has been changed.
 void uploadComplete(CStyxFile targetFile)
          Called after a file has been successfully uploaded
 

Method Detail

fileOpen

void fileOpen(CStyxFile file,
              int mode)
Called when the file has been opened.

Parameters:
file - The file that has been opened
mode - The mode with which the file was opened

fileCreated

void fileCreated(CStyxFile file,
                 int mode)
Called when the file has been created.

Parameters:
file - The file that has been created
mode - The mode with which the file was created

dataArrived

void dataArrived(CStyxFile file,
                 TreadMessage tReadMsg,
                 org.apache.mina.common.ByteBuffer data)
Called when new data have been read from the file (after the Rread message arrives). Note that the offset of the file (i.e. the file position) will not have changed before this method is called. It is up to clients to update the offset of the file if required (e.g. file.setOffset(offset + data.remaining())). After this method is finished, the ByteBuffer will automatically be returned to the pool. If you want to delay this happening, call data.acquire() within this method. Then when you no longer need the data in the buffer, call data.release().

Parameters:
file - The CStyxFile containing the data
tReadMsg - The original TreadMessage that was sent (contains the offset, tag etc of the message)
data - The new data that have been read from the file

dataWritten

void dataWritten(CStyxFile file,
                 TwriteMessage tWriteMsg)
Called when data have been written to the file (after the Rwrite message arrives). Note that the offset of the file (i.e. the file position) will not have changed before this method is called. It is up to clients to update the offset of the file if required (e.g. file.setOffset(offset + data.remaining())).

Parameters:
file - The CStyxFile containing the data
tWriteMsg - The TwriteMessage that caused this event to be fired

error

void error(CStyxFile file,
           java.lang.String message)
Called when an Rerror message arrives

Parameters:
file - the CStyxFile from which the error originated
message - the error message

statChanged

void statChanged(CStyxFile file,
                 DirEntry newDirEntry)
Called after the stat of a file (permissions etc) has been changed. Actually, this is called after an Rstat message arrives; it does not necessarily mean that the stat has changed.


childrenFound

void childrenFound(CStyxFile file,
                   CStyxFile[] children)
Called after a successful read on a directory. (Result of a call to CStyxFile.getChildrenAsync()). All the dirEntries of the children will have been set, so it is safe to call getDirEntry() on any of the children without worrying about the method blocking.


uploadComplete

void uploadComplete(CStyxFile targetFile)
Called after a file has been successfully uploaded

Parameters:
targetFile - The file to which we have written

downloadComplete

void downloadComplete(CStyxFile sourceFile)
Called after a file has been successfully downloaded

Parameters:
sourceFile - The file from which the data have been downloaded.


Copyright © 2004-2006 Reading e-Science Centre. All Rights Reserved.