uk.ac.rdg.resc.jstyx.gridservice.server
Class SGSOutputFile

java.lang.Object
  extended by uk.ac.rdg.resc.jstyx.server.StyxFile
      extended by uk.ac.rdg.resc.jstyx.gridservice.server.SGSOutputFile
All Implemented Interfaces:
SGSInstanceChangeListener

public class SGSOutputFile
extends StyxFile
implements SGSInstanceChangeListener

A file that can be read to obtain data from a file that is put out by an executable in a Styx Grid Service

Author:
Jon Blower $Revision: 579 $ $Date: 2006-02-17 09:26:08 +0000 (Fri, 17 Feb 2006) $ $Log$ Revision 1.3 2006/02/17 09:26:08 jonblower Removed reference to SGSParamFile Revision 1.2 2005/11/11 21:57:21 jonblower Implemented passing of URLs to input files Revision 1.1 2005/11/10 19:50:43 jonblower Added code to handle output files

Field Summary
 
Fields inherited from class uk.ac.rdg.resc.jstyx.server.StyxFile
auth, directory, lastModifiedTime, name, parent
 
Constructor Summary
SGSOutputFile(java.io.File file, uk.ac.rdg.resc.jstyx.gridservice.server.StyxGridServiceInstance instance)
          Creates a new instance of SGSOutputFile
 
Method Summary
 ULong getLength()
           
 void read(StyxFileClient client, long offset, int count, int tag)
          Reads data from this file.
 void statusChanged(StatusCode newStatus)
          Called automatically when the status of the Styx Grid Service instance changes.
 
Methods inherited from class uk.ac.rdg.resc.jstyx.server.StyxFile
addChangeListener, addClient, checkSetLastModifiedTime, checkSetLength, checkSetMode, checkSetName, clientConnected, clientDisconnected, contentsChanged, delete, fireContentsChanged, getClient, getDirEntry, getFullPath, getGroup, getName, getNumClients, getOwner, getParent, getPermissions, getQid, getVersion, incrementVersion, isAppendOnly, isAuth, isDirectory, isExclusive, processAndReplyRead, processAndReplyRead, processAndReplyRead, refresh, remove, removeChangeListener, removeClient, rename, replyRead, replyRead, replyRead, replyRead, replyRead, replyWrite, setLastAccessTime, setLastModified, setLength, setMode, setName, setPermissions, setReadOnly, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SGSOutputFile

public SGSOutputFile(java.io.File file,
                     uk.ac.rdg.resc.jstyx.gridservice.server.StyxGridServiceInstance instance)
              throws StyxException
Creates a new instance of SGSOutputFile

Throws:
StyxException
Method Detail

read

public void read(StyxFileClient client,
                 long offset,
                 int count,
                 int tag)
          throws StyxException
Description copied from class: StyxFile
Reads data from this file. This method could be synchronized in subclasses, but watch out for blocks if the read is expected to take some time to complete. Subclasses must make sure they reply to the read request by creating a java.nio.ByteBuffer or byte array of data, then calling the appropriate readReply() (this can be done at any time; it does not have to be done within the read() method). This default implementation simply throws a StyxException, which will result in an Rerror message being sent back to the client. Subclasses should override this to provide the desired behaviour when the file is read.

Overrides:
read in class StyxFile
Parameters:
client - The client that is performing the read
offset - The point in the file at which to start reading
count - The maximum number of bytes to read
tag - The tag of the incoming Tread message (this is needed when calling readReply())
Throws:
StyxException

getLength

public ULong getLength()
Overrides:
getLength in class StyxFile
Returns:
the length of the file. This default implementation returns zero; subclasses should override this method

statusChanged

public void statusChanged(StatusCode newStatus)
Called automatically when the status of the Styx Grid Service instance changes.

Specified by:
statusChanged in interface SGSInstanceChangeListener


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