Class CMFileEvent
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The event ID for the cancellation of receiving a file.static final int
The event ID for the response to the cancellation of receiving a file.static final int
The event ID for the cancellation of pushing (or sending) a file.static final int
The event ID for the response to the cancellation of sending a file.static final int
The event ID for the cancellation of pushing (or sending) a file.static final int
The event ID for the response to the cancellation of sending a file.static final int
The event ID for transferring each file block.static final int
static final int
The event ID for notifying the receiver of the end of file-transfer.static final int
The event ID for the response to the notification of the end of file-transfer.static final int
The event ID for notifying the receiver of the end of file-transfer.static final int
The event ID for the response to the notification of the end of file-transfer.static final int
static final int
static final int
The event ID for the response to the file request.static final int
The event ID for the response to the permit-request of pushing a file.static final int
static final int
The event ID for requesting a file.static final int
The event ID for requesting a permit to push a file.static final int
The event ID for notifying the receiver of the start of file-transfer.static final int
The event ID for the response to the notification of the start of file-transfer.static final int
The event ID for notifying the receiver of the start of file-transfer.static final int
The event ID for the response to the notification of the start of file-transfer.Fields inherited from class kr.ac.konkuk.ccslab.cm.event.CMEvent
m_bytes, m_nByteNum, m_nID, m_strDistributionGroup, m_strDistributionSession, m_strHandlerGroup, m_strHandlerSession, m_strReceiver, m_strSender
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the size of file block.protected int
int
Returns the identifier of SNS content that attaches a file.byte
Returns the file transfer mode.byte[]
Returns the file block.Returns the file name.Returns the file path.Returns the receiver name of a file.Returns the sender name of a file.long
Returns the file size.long
Returns the size of a file that already has been received.int
Returns the return code.int
Returns the port number of (client) file receiver.protected void
void
setBlockSize
(int bSize) void
setContentID
(int id) void
setFileAppendFlag
(byte flag) void
setFileBlock
(byte[] fBlock) void
setFileName
(String fName) void
setFilePath
(String fPath) void
setFileReceiver
(String uName) void
setFileSender
(String sName) void
setFileSize
(long fSize) void
setReceivedFileSize
(long fSize) void
setReturnCode
(int code) void
setSSCPort
(int nPort) toString()
protected void
unmarshallBody
(ByteBuffer msg) Methods inherited from class kr.ac.konkuk.ccslab.cm.event.CMEvent
allocate, equals, getDistributionGroup, getDistributionSession, getHandlerGroup, getHandlerSession, getID, getInt2BytesFromByteBuffer, getReceiver, getSender, getStringFromByteBuffer, marshall, marshallHeader, putInt2BytesToByteBuffer, putStringToByteBuffer, setByteNum, setDistributionGroup, setDistributionSession, setHandlerGroup, setHandlerSession, setID, setReceiver, setSender, unmarshall, unmarshallHeader
-
Field Details
-
REQUEST_PERMIT_PULL_FILE
public static final int REQUEST_PERMIT_PULL_FILEThe event ID for requesting a file.event direction: receiver (requester) -> sender (file owner)
This event is sent when the receiver calls
CMStub.requestFile(String, String)
orCMStub.requestFile(String, String, byte)
.
The following fields are used for this event:- file sender:
getFileSender()
- file receiver:
getFileReceiver()
- file name:
getFileName()
- content ID:
getContentID()
>= 0: the requested file is an attachment of SNS content ID
-1: the file is no attachment of SNS content - append mode:
getFileAppendFlag()
0: overwrite mode
1: append mode - port number of file receiver (client):
getSSCPort()
- See Also:
- file sender:
-
REPLY_PERMIT_PULL_FILE
public static final int REPLY_PERMIT_PULL_FILEThe event ID for the response to the file request.event direction: sender -> receiver
The file owner sends this event as the response to the
REQUEST_PERMIT_PULL_FILE
event.
The following fields are used for this event:- file sender:
getFileSender()
- file receiver:
getFileReceiver()
- file name:
getFileName()
- return code:
getReturnCode()
-1: the requested file does not exist.
0: the request is denied.
1: the request is accepted. - content ID:
getContentID()
>= 0: the requested file is an attachment of SNS content ID
-1: the file is no attachment of SNS content
- See Also:
- file sender:
-
REQUEST_PERMIT_PUSH_FILE
public static final int REQUEST_PERMIT_PUSH_FILEThe event ID for requesting a permit to push a file.event direction: sender (requester) -> receiver (file owner)
This event is sent when the sender calls
CMStub.pushFile(String, String)
.
The following fields are used for this event:- file sender:
getFileSender()
- file receiver:
getFileReceiver()
- file path:
getFilePath()
- file size:
getFileSize()
- append mode:
getFileAppendFlag()
- content ID:
getContentID()
>= 0: the requested file is an attachment of SNS content ID
-1: the file is no attachment of SNS content
- See Also:
- file sender:
-
REPLY_PERMIT_PUSH_FILE
public static final int REPLY_PERMIT_PUSH_FILEThe event ID for the response to the permit-request of pushing a file.event direction: receiver -> sender
The file receiver sends this event as the response to the
REQUEST_PERMIT_PUSH_FILE
event.
The following fields are used for this event:- file sender:
getFileSender()
- file receiver:
getFileReceiver()
- file path:
getFilePath()
- file size:
getFileSize()
- append mode:
getFileAppendFlag()
- content ID:
getContentID()
>= 0: the requested file is an attachment of SNS content ID
-1: the file is no attachment of SNS content - port number of file receiver (client):
getSSCPort()
- return code:
getReturnCode()
0: the request is denied.
1: the request is accepted.
- See Also:
- file sender:
-
START_FILE_TRANSFER
public static final int START_FILE_TRANSFERThe event ID for notifying the receiver of the start of file-transfer.event direction: sender -> receiver
The file owner sends this event right after it sends the
REPLY_PERMIT_PULL_FILE
event, or receives theREPLY_PERMIT_PUSH_FILE
event with the granted permit, and if the FILE_TRANSFER_SCHEME field of the configuration file of the CM server (cm-server.conf) is set to 0.
The following fields are used for this event:- file sender:
getFileSender()
- file receiver:
getFileReceiver()
- file name:
getFileName()
- file size:
getFileSize()
- content ID:
getContentID()
>= 0: the file is an attachment of SNS content ID
-1: the file is no attachment of SNS content - append mode:
getFileAppendFlag()
0: overwrite mode, 1: append mode
- See Also:
- file sender:
-
START_FILE_TRANSFER_ACK
public static final int START_FILE_TRANSFER_ACKThe event ID for the response to the notification of the start of file-transfer.event direction: receiver -> sender
The file receiver sends this event as the response to the
START_FILE_TRANSFER
event.
The following fields are used for this event:- file sender:
getFileSender()
- file receiver:
getFileReceiver()
- file name:
getFileName()
- content ID:
getContentID()
>= 0: the file is an attachment of SNS content ID
-1: the file is no attachment of SNS content - received file size:
getReceivedFileSize()
> 0: the receiver has already received some bytes of the file.
0: the receiver has no byte of the file.
- See Also:
- file sender:
-
CONTINUE_FILE_TRANSFER
public static final int CONTINUE_FILE_TRANSFERThe event ID for transferring each file block.event direction: sender -> receiver
The file owner starts to send this event when it receives the
START_FILE_TRANSFER_ACK
event. This event is repeatedly sent for each file block until all file blocks are sent to the receiver.
The following fields are used for this event:- file sender:
getFileSender()
- file receiver:
getFileReceiver()
- file name:
getFileName()
- content ID:
getContentID()
>= 0: the file is an attachment of SNS content ID
-1: the file is no attachment of SNS content - file block size:
getBlockSize()
- file block:
getFileBlock()
- See Also:
- file sender:
-
CONTINUE_FILE_TRANSFER_ACK
public static final int CONTINUE_FILE_TRANSFER_ACK- See Also:
-
END_FILE_TRANSFER
public static final int END_FILE_TRANSFERThe event ID for notifying the receiver of the end of file-transfer.event direction: sender -> receiver
The file owner sends this event after it sends the last
CONTINUE_FILE_TRANSFER
event.
The following fields are used for this event:- file sender:
getFileSender()
- file receiver:
getFileReceiver()
- file name:
getFileName()
- file size:
getFileSize()
- content ID:
getContentID()
>= 0: the file is an attachment of SNS content ID
-1: the file is no attachment of SNS content
- See Also:
- file sender:
-
END_FILE_TRANSFER_ACK
public static final int END_FILE_TRANSFER_ACKThe event ID for the response to the notification of the end of file-transfer.event direction: receiver -> sender
The file receiver sends this event as the response to the
END_FILE_TRANSFER
event.
The following fields are used for this event:- file sender:
getFileSender()
- file receiver:
getFileReceiver()
- file name:
getFileName()
- file size:
getFileSize()
- return code:
getReturnCode()
1: success
0: failure - content ID:
getContentID()
>= 0: the file is an attachment of SNS content ID
-1: the file is no attachment of SNS content
- See Also:
- file sender:
-
REQUEST_DIST_FILE_PROC
public static final int REQUEST_DIST_FILE_PROC- See Also:
-
CANCEL_FILE_SEND
public static final int CANCEL_FILE_SENDThe event ID for the cancellation of pushing (or sending) a file.event direction: sender -> receiver
The file sender sends this event when it calls
CMStub.cancelPushFile(String)
, and if the FILE_TRANSFER_SCHEME field of the configuration file of the CM server (cm-server.conf) is set to 0.
The following fields are used for this event:- file sender:
getFileSender()
- file receiver:
getFileReceiver()
- See Also:
- file sender:
-
CANCEL_FILE_SEND_ACK
public static final int CANCEL_FILE_SEND_ACKThe event ID for the response to the cancellation of sending a file.event direction: receiver -> sender
The receiver sends this event as the response to the
CANCEL_FILE_SEND
event.
The following fields are used for this event:- file sender:
getFileSender()
- file receiver:
getFileReceiver()
- return code:
getReturnCode()
1: cancellation success
0: cancellation failure
- See Also:
- file sender:
-
START_FILE_TRANSFER_CHAN
public static final int START_FILE_TRANSFER_CHANThe event ID for notifying the receiver of the start of file-transfer.event direction: sender -> receiver
The file owner sends this event right after it sends the
REPLY_PERMIT_PULL_FILE
event, or receives theREPLY_PERMIT_PUSH_FILE
event with the granted permit and if the FILE_TRANSFER_SCHEME field of the configuration file of the CM server (cm-server.conf) is set to 1.
The following fields are used for this event:- file sender:
getFileSender()
- file receiver:
getFileReceiver()
- file name:
getFileName()
- file size:
getFileSize()
- content ID:
getContentID()
>= 0: the file is an attachment of SNS content ID
-1: the file is no attachment of SNS content - append mode:
getFileAppendFlag()
0: overwrite mode, 1: append mode
- See Also:
- file sender:
-
START_FILE_TRANSFER_CHAN_ACK
public static final int START_FILE_TRANSFER_CHAN_ACKThe event ID for the response to the notification of the start of file-transfer.event direction: receiver -> sender
The file receiver sends this event as the response to the
START_FILE_TRANSFER_CHAN
event.
The following fields are used for this event:- file sender:
getFileSender()
- file receiver:
getFileReceiver()
- file name:
getFileName()
- content ID:
getContentID()
>= 0: the file is an attachment of SNS content ID
-1: the file is no attachment of SNS content - received file size:
getReceivedFileSize()
> 0: the receiver has already received some bytes of the file.
0: the receiver has no byte of the file.
- See Also:
- file sender:
-
END_FILE_TRANSFER_CHAN
public static final int END_FILE_TRANSFER_CHANThe event ID for notifying the receiver of the end of file-transfer.event direction: sender -> receiver
The file owner sends this event after it sends the last file block, and if the FILE_TRANSFER_SCHEME field of the configuration file of the CM server (cm-server.conf) is set to 1.
The following fields are used for this event:- file sender:
getFileSender()
- file receiver:
getFileReceiver()
- file name:
getFileName()
- file size:
getFileSize()
- content ID:
getContentID()
>= 0: the file is an attachment of SNS content ID
-1: the file is no attachment of SNS content
- See Also:
- file sender:
-
END_FILE_TRANSFER_CHAN_ACK
public static final int END_FILE_TRANSFER_CHAN_ACKThe event ID for the response to the notification of the end of file-transfer.event direction: receiver -> sender
The file receiver sends this event as the response to the
END_FILE_TRANSFER_CHAN
event.
The following fields are used for this event:- file sender:
getFileSender()
- file receiver:
getFileReceiver()
- file name:
getFileName()
- file size:
getFileSize()
- return code:
getReturnCode()
1: success
0: failure - content ID:
getContentID()
>= 0: the file is an attachment of SNS content ID
-1: the file is no attachment of SNS content
- See Also:
- file sender:
-
CANCEL_FILE_SEND_CHAN
public static final int CANCEL_FILE_SEND_CHANThe event ID for the cancellation of pushing (or sending) a file.event direction: sender -> receiver
The file sender sends this event when it calls
CMStub.cancelPushFile(String)
, and if the FILE_TRANSFER_SCHEME field of the configuration file of the CM server (cm-server.conf) is set to 1.
The following fields are used for this event:- file sender:
getFileSender()
- file receiver:
getFileReceiver()
- See Also:
- file sender:
-
CANCEL_FILE_SEND_CHAN_ACK
public static final int CANCEL_FILE_SEND_CHAN_ACKThe event ID for the response to the cancellation of sending a file.event direction: receiver -> sender
The receiver sends this event as the response to the
CANCEL_FILE_SEND_CHAN
event.
The following fields are used for this event:- file sender:
getFileSender()
- file receiver:
getFileReceiver()
- return code:
getReturnCode()
1: cancellation success
0: cancellation failure
- See Also:
- file sender:
-
CANCEL_FILE_RECV_CHAN
public static final int CANCEL_FILE_RECV_CHANThe event ID for the cancellation of receiving a file.event direction: receiver -> sender
The file receiver sends this event when it calls
CMStub.cancelPullFile(String)
, and if the FILE_TRANSFER_SCHEME field of the configuration file of the CM server (cm-server.conf) is set to 1.
The following fields are used for this event:- file sender:
getFileSender()
- file receiver:
getFileReceiver()
- See Also:
- file sender:
-
CANCEL_FILE_RECV_CHAN_ACK
public static final int CANCEL_FILE_RECV_CHAN_ACKThe event ID for the response to the cancellation of receiving a file.event direction: sender -> receiver
The file sender sends this event as the response to the
CANCEL_FILE_RECV_CHAN
event.
The following fields are used for this event:- file sender:
getFileSender()
- file receiver:
getFileReceiver()
- return code:
getReturnCode()
1: cancellation success
0: cancellation failure
- See Also:
- file sender:
-
ERR_SEND_FILE_CHAN
public static final int ERR_SEND_FILE_CHAN- See Also:
-
ERR_RECV_FILE_CHAN
public static final int ERR_RECV_FILE_CHAN- See Also:
-
-
Constructor Details
-
CMFileEvent
public CMFileEvent() -
CMFileEvent
-
-
Method Details
-
setFileReceiver
-
getFileReceiver
Returns the receiver name of a file.- Returns:
- receiver name
-
setFileSender
-
getFileSender
Returns the sender name of a file.- Returns:
- sender name
-
setFileName
-
getFileName
Returns the file name.- Returns:
- file name
-
setFilePath
-
getFilePath
Returns the file path.- Returns:
- file path at the sender node
-
setFileSize
public void setFileSize(long fSize) -
getFileSize
public long getFileSize()Returns the file size.- Returns:
- file size (number of bytes)
-
setReceivedFileSize
public void setReceivedFileSize(long fSize) -
getReceivedFileSize
public long getReceivedFileSize()Returns the size of a file that already has been received.- Returns:
- received size of a file (number of bytes)
-
setReturnCode
public void setReturnCode(int code) -
getReturnCode
public int getReturnCode()Returns the return code.- Returns:
- 1 if a corresponding request is successfully processed; 0 otherwise.
-
setFileBlock
public void setFileBlock(byte[] fBlock) -
getFileBlock
public byte[] getFileBlock()Returns the file block.- Returns:
- file block (bytes)
-
setBlockSize
public void setBlockSize(int bSize) -
getBlockSize
public int getBlockSize()Returns the size of file block.- Returns:
- size of file block (number of bytes)
-
setContentID
public void setContentID(int id) -
getContentID
public int getContentID()Returns the identifier of SNS content that attaches a file.- Returns:
- SNS content ID
-
setFileAppendFlag
public void setFileAppendFlag(byte flag) -
getFileAppendFlag
public byte getFileAppendFlag()Returns the file transfer mode.- Returns:
- 1 if the append mode is on; 0 if overwrite mode is on.
-
setSSCPort
public void setSSCPort(int nPort) -
getSSCPort
public int getSSCPort()Returns the port number of (client) file receiver.If the FILE_TRANSFER_SCHEME of the server CM configuration file (cm-server.conf) is 1 and both the file sender and receiver are the client type (P2P file-transfer), the file sender connects to the receiver by opening a blocking socket channel with the IP address and this port number of the receiver.
- Returns:
- port number of file receiver.
-
getByteNum
protected int getByteNum()- Overrides:
getByteNum
in classCMEvent
-
marshallBody
protected void marshallBody()- Specified by:
marshallBody
in classCMEvent
-
unmarshallBody
- Specified by:
unmarshallBody
in classCMEvent
-
toString
-