uk.ac.rdg.resc.jstyx.tutorial
Class WhoAmIFile

java.lang.Object
  extended by uk.ac.rdg.resc.jstyx.server.StyxFile
      extended by uk.ac.rdg.resc.jstyx.tutorial.WhoAmIFile

public class WhoAmIFile
extends StyxFile

Simple custom Styx file that, when read, returns the IP address and local port of the client that is connected.

Author:
Jon Blower $Revision: 391 $ $Date: 2005-09-05 08:21:14 +0100 (Mon, 05 Sep 2005) $ $Log$ Revision 1.3 2005/09/05 07:21:14 jonblower Set permissions of file to 0444 Revision 1.2 2005/08/30 16:27:49 jonblower Continued to develop website and tutorial Revision 1.1 2005/08/30 09:50:48 jonblower Renamed "WhoAmI" to "WhoAmIFile" Revision 1.1 2005/08/30 08:01:48 jonblower Continuing development of tutorial

Field Summary
 
Fields inherited from class uk.ac.rdg.resc.jstyx.server.StyxFile
auth, directory, lastModifiedTime, name, parent
 
Constructor Summary
WhoAmIFile()
          Creates a new instance of WhoAmIFile
 
Method Summary
static void main(java.lang.String[] args)
          Simple test function: sets up a StyxServer that serves up a WhoAmIFile
 void read(StyxFileClient client, long offset, int count, int tag)
          Reads data from this file.
 
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, getLength, 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

WhoAmIFile

public WhoAmIFile()
           throws StyxException
Creates a new instance of WhoAmIFile

Throws:
StyxException
Method Detail

read

public void read(StyxFileClient client,
                 long offset,
                 int count,
                 int tag)
          throws StyxException
Reads data from this file. Gets the IP address of the remote client and returns it.

Overrides:
read in class StyxFile
Parameters:
client - The client that is performing the read
offset - The index of the first byte of data to return
count - The maximum number of bytes to read
tag - The tag of the incoming read message (this is needed when calling readReply())
Throws:
StyxException

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Simple test function: sets up a StyxServer that serves up a WhoAmIFile

Throws:
java.lang.Exception


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