openr66.protocol.localhandler.packet
Class RequestPacket

java.lang.Object
  extended by openr66.protocol.localhandler.packet.AbstractLocalPacket
      extended by openr66.protocol.localhandler.packet.RequestPacket

public class RequestPacket
extends AbstractLocalPacket

Request class header = "rulename MODETRANS" middle = way+"FILENAME BLOCKSIZE RANK specialId code" end = "fileInformation"

Author:
frederic bregier

Nested Class Summary
static class RequestPacket.TRANSFERMODE
           
 
Field Summary
 
Fields inherited from class openr66.protocol.localhandler.packet.AbstractLocalPacket
end, header, middle
 
Constructor Summary
RequestPacket(String rulename, int mode, String filename, int blocksize, int rank, long specialId, String fileInformation)
           
 
Method Summary
 void createEnd()
          Prepare the End buffer
static RequestPacket createFromBuffer(int headerLength, int middleLength, int endLength, org.jboss.netty.buffer.ChannelBuffer buf)
           
 void createHeader()
          Prepare the Header buffer
 void createMiddle()
          Prepare the Middle buffer
 int getBlocksize()
           
 char getCode()
           
 String getFileInformation()
           
 String getFilename()
           
 int getMode()
           
static int getModeMD5(int mode)
           
 int getRank()
           
 String getRulename()
           
 long getSpecialId()
           
 byte getType()
           
static boolean isCompatibleMode(int mode1, int mode2)
           
static boolean isMD5Mode(int mode)
           
static boolean isRecvMode(int mode)
           
static boolean isRecvThroughMode(int mode)
           
static boolean isRecvThroughMode(int mode, boolean isRequested)
           
 boolean isRetrieve()
           
static boolean isSendThroughMode(int mode)
           
static boolean isSendThroughMode(int mode, boolean isRequested)
           
static boolean isThroughMode(int mode)
           
 boolean isToValidate()
           
 void setCode(char code)
           
 void setFilename(String filename)
           
 void setRank(int rank)
           
 void setSpecialId(long specialId)
           
 String toString()
           
 void validate()
          Validate the request
 
Methods inherited from class openr66.protocol.localhandler.packet.AbstractLocalPacket
getLocalPacket
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RequestPacket

public RequestPacket(String rulename,
                     int mode,
                     String filename,
                     int blocksize,
                     int rank,
                     long specialId,
                     String fileInformation)
Parameters:
rulename -
mode -
filename -
blocksize -
rank -
specialId -
fileInformation -
Method Detail

getModeMD5

public static int getModeMD5(int mode)
Parameters:
mode -
Returns:
the same mode (RECV or SEND) in MD5 version

isRecvMode

public static boolean isRecvMode(int mode)
Parameters:
mode -
Returns:
true if this mode is a RECV(MD5) mode

isSendThroughMode

public static boolean isSendThroughMode(int mode,
                                        boolean isRequested)
Parameters:
mode -
isRequested -
Returns:
True if this mode is a THROUGH (MD5) mode

isSendThroughMode

public static boolean isSendThroughMode(int mode)
Parameters:
mode -
Returns:
True if this mode is a SEND THROUGH (MD5) mode

isRecvThroughMode

public static boolean isRecvThroughMode(int mode,
                                        boolean isRequested)
Parameters:
mode -
isRequested -
Returns:
True if this mode is a THROUGH (MD5) mode

isRecvThroughMode

public static boolean isRecvThroughMode(int mode)
Parameters:
mode -
Returns:
True if this mode is a RECV THROUGH (MD5) mode

isThroughMode

public static boolean isThroughMode(int mode)
Parameters:
mode -
Returns:
True if this mode is a THROUGH mode (with or without MD5)

isMD5Mode

public static boolean isMD5Mode(int mode)
Parameters:
mode -
Returns:
true if this mode is a MD5 mode

isCompatibleMode

public static boolean isCompatibleMode(int mode1,
                                       int mode2)
Parameters:
mode1 -
mode2 -
Returns:
true if both modes are compatible (both send, or both recv)

createFromBuffer

public static RequestPacket createFromBuffer(int headerLength,
                                             int middleLength,
                                             int endLength,
                                             org.jboss.netty.buffer.ChannelBuffer buf)
                                      throws OpenR66ProtocolPacketException
Parameters:
headerLength -
middleLength -
endLength -
buf -
Returns:
the new RequestPacket from buffer
Throws:
OpenR66ProtocolPacketException

createEnd

public void createEnd()
               throws OpenR66ProtocolPacketException
Description copied from class: AbstractLocalPacket
Prepare the End buffer

Specified by:
createEnd in class AbstractLocalPacket
Throws:
OpenR66ProtocolPacketException

createHeader

public void createHeader()
                  throws OpenR66ProtocolPacketException
Description copied from class: AbstractLocalPacket
Prepare the Header buffer

Specified by:
createHeader in class AbstractLocalPacket
Throws:
OpenR66ProtocolPacketException

createMiddle

public void createMiddle()
                  throws OpenR66ProtocolPacketException
Description copied from class: AbstractLocalPacket
Prepare the Middle buffer

Specified by:
createMiddle in class AbstractLocalPacket
Throws:
OpenR66ProtocolPacketException

getType

public byte getType()
Specified by:
getType in class AbstractLocalPacket
Returns:
the type of Packet

toString

public String toString()
Specified by:
toString in class AbstractLocalPacket

getRulename

public String getRulename()
Returns:
the rulename

getFilename

public String getFilename()
Returns:
the filename

getMode

public int getMode()
Returns:
the mode

isRetrieve

public boolean isRetrieve()
Returns:
True if this packet concerns a Retrieve operation

getFileInformation

public String getFileInformation()
Returns:
the fileInformation

getBlocksize

public int getBlocksize()
Returns:
the blocksize

getRank

public int getRank()
Returns:
the rank

setRank

public void setRank(int rank)
Parameters:
rank - the rank to set

setSpecialId

public void setSpecialId(long specialId)
Parameters:
specialId - the specialId to set

getSpecialId

public long getSpecialId()
Returns:
the specialId

isToValidate

public boolean isToValidate()
Returns:
True if this packet is to be validated

validate

public void validate()
Validate the request


setFilename

public void setFilename(String filename)
Parameters:
filename - the filename to set

getCode

public char getCode()
Returns:
the code

setCode

public void setCode(char code)
Parameters:
code - the code to set


Copyright © 2009-2012 Frederic Bregier. All Rights Reserved.