|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.lang.Thread
networking.base.ForkedThread
networking.base.SocketThread
networking.server.Server
networking.server.FileServer
networking.server.FileUploadServer
class FileUploadServer
FileUploadServer - this class represents a server which provides an opportinity to upload files
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary | |
|---|---|
static int |
ASK
ASK state constant - asking clients |
static int |
ERROR
ERROR state constant - file transfer failed |
private int |
m_activeCount
Active recipients count, i.e. those who accepted the file |
private int |
m_count
Recipients count |
private int |
m_state
Current state |
static int |
READY
READY state constant - file transfer completed |
static int |
RECV
RECV state constant - receiving file |
| Fields inherited from class networking.server.FileServer |
|---|
m_file, m_master, m_msg |
| Fields inherited from class networking.base.SocketThread |
|---|
s_timeSleep |
| Fields inherited from class networking.base.ForkedThread |
|---|
CHILD, m_fork, NONE, PARENT |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
FileUploadServer(FileServer s)
Construct new FileUploadServer object from parent server |
|
| Method Summary | |
|---|---|
void |
acceptFile()
Target client indicated accept of the file |
void |
ackFile()
FileDownloadServer acknowledges file object receipt |
void |
ackFileTransfer()
FileDownloadServer acknowledges file transfer |
private void |
checkEnd()
Check if all clients are served |
private void |
checkFile()
Check if all active clients are served and delete the file |
protected void |
error(java.lang.Exception e)
Report error |
int |
getServState()
Get current state |
protected void |
processMessage(Message msg)
Process a message |
void |
rejectFile()
Target client indicated reject of the file |
void |
run()
|
private void |
setServState(int state)
Switch to the new state |
protected int |
translateMessageType(Message msg)
Translate message type for sending it to clients |
| Methods inherited from class networking.server.FileServer |
|---|
getFile, getMessage |
| Methods inherited from class networking.server.Server |
|---|
circulateMessage, getClient, getId, getSignature, log, stop1 |
| Methods inherited from class networking.base.SocketThread |
|---|
deinit, enque, exit, getIn, getOut, init, recv, run1, send, setSocket, setTimeOut, wait |
| Methods inherited from class java.lang.Thread |
|---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int ASK
public static final int RECV
public static final int READY
public static final int ERROR
private int m_state
private int m_count
private int m_activeCount
| Constructor Detail |
|---|
public FileUploadServer(FileServer s)
s - parent server| Method Detail |
|---|
public void acceptFile()
throws java.lang.Exception
java.lang.Exception
public void rejectFile()
throws java.lang.Exception
java.lang.Exception
public void ackFile()
throws java.lang.Exception
java.lang.Exceptionpublic void ackFileTransfer()
private void checkFile()
private void checkEnd()
throws java.lang.Exception
java.lang.Exceptionprivate void setServState(int state)
state - new statepublic final int getServState()
protected int translateMessageType(Message msg)
Server
translateMessageType in class Servermsg - message
protected void processMessage(Message msg)
throws java.lang.Exception
SocketThread
processMessage in class FileServermsg - message
java.lang.Exceptionpublic void run()
run in interface java.lang.Runnablerun in class ForkedThreadprotected void error(java.lang.Exception e)
SocketThread
error in class Servere - exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright © 2009 Alexey Veremenko. All rights reserved.