uk.ac.rdg.resc.jstyx.client
Class CStyxFileChangeAdapter

java.lang.Object
  extended by uk.ac.rdg.resc.jstyx.client.CStyxFileChangeAdapter
All Implemented Interfaces:
CStyxFileChangeListener
Direct Known Subclasses:
SGSClient, SGSInstanceClient, StyxGet, TestClient

public class CStyxFileChangeAdapter
extends java.lang.Object
implements CStyxFileChangeListener

Convenience class that provides empty implementations for all the methods in CStyxFileChangeListener.

Author:
Jon Blower $Revision: 373 $ $Date: 2005-08-31 09:15:57 +0100 (Wed, 31 Aug 2005) $ $Log$ Revision 1.9 2005/08/31 08:15:57 jonblower Corrections to comments Revision 1.8 2005/07/28 16:38:58 jonblower Added material to comments Revision 1.7 2005/06/20 17:20:43 jonblower Added download() and downloadAsync() to CStyxFile Revision 1.6 2005/05/25 16:57:07 jonblower Added fileCreated() event Revision 1.5 2005/05/12 14:20:55 jonblower Changed dataSent() method to dataWritten() (more accurate name) Revision 1.4 2005/05/12 08:00:34 jonblower Added getChildrenAsync() to CStyxFile and childrenFound() to CStyxFileChangeListener 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:17 jonblower Initial import

Constructor Summary
CStyxFileChangeAdapter()
           
 
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CStyxFileChangeAdapter

public CStyxFileChangeAdapter()
Method Detail

fileOpen

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

Specified by:
fileOpen in interface CStyxFileChangeListener
Parameters:
file - The file that has been opened
mode - The mode with which the file was opened

fileCreated

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

Specified by:
fileCreated in interface CStyxFileChangeListener
Parameters:
file - The file that has been created
mode - The mode with which the file was created

dataArrived

public 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().

Specified by:
dataArrived in interface CStyxFileChangeListener
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

public 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())).

Specified by:
dataWritten in interface CStyxFileChangeListener
Parameters:
file - The CStyxFile containing the data
tWriteMsg - The TwriteMessage that caused this event to be fired

error

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

Specified by:
error in interface CStyxFileChangeListener
Parameters:
file - the CStyxFile from which the error originated
message - the error message

statChanged

public 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.

Specified by:
statChanged in interface CStyxFileChangeListener

childrenFound

public 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.

Specified by:
childrenFound in interface CStyxFileChangeListener

uploadComplete

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

Specified by:
uploadComplete in interface CStyxFileChangeListener
Parameters:
targetFile - The file to which we have written

downloadComplete

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

Specified by:
downloadComplete in interface CStyxFileChangeListener
Parameters:
sourceFile - The file from which the data have been downloaded.


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