uk.ac.rdg.resc.jstyx.messages
Class TwalkMessage

java.lang.Object
  extended by uk.ac.rdg.resc.jstyx.messages.StyxMessage
      extended by uk.ac.rdg.resc.jstyx.messages.TwalkMessage

public class TwalkMessage
extends StyxMessage

Message sent to traverse a directory tree

Author:
Jon Blower $Revision: 146 $ $Date: 2005-03-15 09:01:48 +0000 (Tue, 15 Mar 2005) $ $Log$ Revision 1.4 2005/03/15 09:01:48 jonblower Message type now stored as short, not int Revision 1.3 2005/03/11 14:02:16 jonblower Merged MINA-Test_20059309 into main line of development Revision 1.2.2.1 2005/03/10 11:50:59 jonblower Changed to fit with MINA framework Revision 1.2 2005/02/24 07:44:44 jonblower Added getFriendlyString() Revision 1.1.1.1 2005/02/16 18:58:29 jonblower Initial import

Field Summary
 
Fields inherited from class uk.ac.rdg.resc.jstyx.messages.StyxMessage
buf, length, lock, name, tag, type
 
Constructor Summary
TwalkMessage(int length, short type, int tag)
          Creates a new TwalkMessage.
TwalkMessage(long fid, long newFid, java.lang.String path)
          This constructor should be called when constructing a TwalkMessage from scratch
 
Method Summary
 void addPathElement(java.lang.String s)
          Add an element to the array of path elements
protected  void decodeBody(StyxBuffer buf)
          Called when a complete message has arrived; signals that we are ready to interpret the raw bytes in the buffer and turn them into meaningful information.
protected  void encodeBody(StyxBuffer buf)
          Encode the body of the message into bytes in the underlying buffer
protected  java.lang.String getElements()
           
 long getFid()
           
 long getNewFid()
           
 int getNumPathElements()
           
 java.lang.String getPath()
           
 java.lang.String[] getPathElements()
           
 void setFid(long fid)
           
 void setNewFid(long newFid)
           
 void setPath(java.lang.String path)
           
 java.lang.String toFriendlyString()
           
 
Methods inherited from class uk.ac.rdg.resc.jstyx.messages.StyxMessage
createStyxMessage, dispose, encode, getBuffer, getLength, getName, getTag, getType, readBytesFrom, setTag, toString, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TwalkMessage

public TwalkMessage(int length,
                    short type,
                    int tag)
Creates a new TwalkMessage. This constructor will be called by the MessageRecognizer.

Parameters:
length - The total length of the message (including all header info)
type - The type of the message (a number between 100 and 127)
tag - The tag that identifies this message

TwalkMessage

public TwalkMessage(long fid,
                    long newFid,
                    java.lang.String path)
This constructor should be called when constructing a TwalkMessage from scratch

Parameters:
fid - The fid representing the start point of the traversal
newFid - The fid that will represent the end point of the traversal
path - The /-delimited path
Method Detail

decodeBody

protected final void decodeBody(StyxBuffer buf)
Description copied from class: StyxMessage
Called when a complete message has arrived; signals that we are ready to interpret the raw bytes in the buffer and turn them into meaningful information. Subclasses should make sure that the buffer is no longer needed once this method has finished, as the underlying buffer will be reused.

Specified by:
decodeBody in class StyxMessage

encodeBody

protected final void encodeBody(StyxBuffer buf)
Description copied from class: StyxMessage
Encode the body of the message into bytes in the underlying buffer

Specified by:
encodeBody in class StyxMessage

getFid

public long getFid()
Overrides:
getFid in class StyxMessage
Returns:
the fid associated with this message. This default implementation returns StyxUtils.NOFID; subclasses should override this. This method only exists in this superclass as a convenience for the StyxMon application.

setFid

public void setFid(long fid)

getNewFid

public long getNewFid()

setNewFid

public void setNewFid(long newFid)

getPath

public java.lang.String getPath()
Returns:
the path of this TwalkMessage as a string

setPath

public void setPath(java.lang.String path)
Parameters:
path - The /-delimited path (if this starts with a / it is an absolute path, otherwise it is a relative path (relative to the file represented by fid)

getNumPathElements

public int getNumPathElements()
Returns:
the number of elements in the path

getPathElements

public java.lang.String[] getPathElements()
Returns:
the path elements as a String array

addPathElement

public void addPathElement(java.lang.String s)
Add an element to the array of path elements


getElements

protected java.lang.String getElements()
Specified by:
getElements in class StyxMessage
Returns:
the body elements of this message as a string

toFriendlyString

public java.lang.String toFriendlyString()
Overrides:
toFriendlyString in class StyxMessage
Returns:
a human-readable string that displays the contents of the message, without the header info. This default implementation simply calls this.getElements(): subclasses should override this behaviour


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