janus.net
Class FileTransferServer

java.lang.Object
  extended by janus.net.ServerBase
      extended by janus.net.FileTransferServer
All Implemented Interfaces:
Runnable

public class FileTransferServer
extends ServerBase

Diese Klasse implementiert einen File-Transfer-Server. Der Server empfängt eine Datei und startet danach die Verarbeitung der Datei. Dies ist eine Basisklasse mit leerer process(long)-Funktion.


Field Summary
protected  File file
          Datei, die empfangen wird
protected  FileOutputStream stream
          Stream zur Datei
protected  long timeout
          Timeout der process(long)-Methode in Millisekunden
protected  long total
          Statitistik
 
Fields inherited from class janus.net.ServerBase
conn, debug, debugStream, exceptionListener, name, replyPending, serverSet, success_hi, success_lo, thread, transaction_type, ums_alias, ums_buffer, ums_length, UMS_MAXLENGTH, ums_reply_len, ums_terminal, umsConn, umsThread, userObject
 
Constructor Summary
FileTransferServer()
          Konstruktor - Setzt einen Standardnamen
 
Method Summary
protected  void handleData()
          Verarbeite eine eingehende Daten-Nachricht.
protected  void handleInit()
          Die Init-Nachricht enthät den Dateinamen und den Timeout
static void main(String[] args)
          Test-Hauptprogramm
protected  byte[] process(long timeout)
          Folgeverarbeitung.
 
Methods inherited from class janus.net.ServerBase
beginTransaction, endTransaction, getConnection, getDebugStream, getName, getNextUms, getUmsConnection, getUserObject, handleAccept, handleAwaitIo, handleCancel, handleExit, handleMessage, handleTransaction, handleUms, handleUmsException, isDebug, logException, rollbackTransaction, run, sendAck, sendAck, sendError, sendError, sendError, sendReply, sendReply, sendReply, setConnection, setDebug, setDebugStream, setDebugStream, setExceptionListener, setName, setUserObject, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

file

protected File file
Datei, die empfangen wird


stream

protected FileOutputStream stream
Stream zur Datei


timeout

protected long timeout
Timeout der process(long)-Methode in Millisekunden


total

protected long total
Statitistik

Constructor Detail

FileTransferServer

public FileTransferServer()
Konstruktor - Setzt einen Standardnamen

Method Detail

handleData

protected void handleData()
                   throws Exception
Verarbeite eine eingehende Daten-Nachricht. Die Connection enthält die Daten und Flags.

Overrides:
handleData in class ServerBase
Throws:
Exception
See Also:
ServerConnection

handleInit

protected void handleInit()
                   throws Exception
Die Init-Nachricht enthät den Dateinamen und den Timeout

Overrides:
handleInit in class ServerBase
Throws:
Exception

main

public static void main(String[] args)
                 throws Exception
Test-Hauptprogramm

Throws:
Exception

process

protected byte[] process(long timeout)
Folgeverarbeitung. Kann überschrieben werden. Diese hier tut nichts.

Parameters:
timeout - Maximal gewünschte Verarbeitungszeit in ms
Returns:
Byte-Array mit den Antwortdaten.


Copyright © 2008 MvC Systemsoftware.