public class DataTransmitter
extends java.lang.Object
implements java.lang.Runnable
DataTransmitter is responsible for scheduling transfer of flow databases
(FDB files) to the server. | Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
clientId
Identifier of the client.
|
private java.lang.Thread |
dataTransmitterThread
Thread used by this class.
|
private java.lang.String |
defaultFDBdirectory
Directory containing FDB files, which should be transferred to the server.
|
private boolean |
isStarted
Flag used to determine if the thread is fully started.
|
private static org.apache.log4j.Logger |
log
Used to log different events.
|
private FileTransferClient |
myTransferClient
Object responsible for transferring a particular file to the server.
|
private boolean |
runFlag
Flag used to stop the thread.
|
private int |
serverFileTransmitPort
TCP port on the server on which the file transmission occurs.
|
private java.lang.String |
serverIP
IP address of the server.
|
| Constructor and Description |
|---|
DataTransmitter(java.lang.String defaultFDBdirectory)
Constructs the object.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
isAlive()
Checks if
DataTransmitter is alive. |
private boolean |
isConfigured()
Creates new instance of class responsible for transferring a particular file to the server.
|
void |
run()
Loops and transfers all unsent flow record files to the server.
|
void |
setClientId(java.lang.String clientId)
Sets the identifier of the client.
|
void |
setServerFileTransmitPort(int serverFileTransmitPort)
Sets TCP port on the server on which the file transmission occurs.
|
void |
setServerIP(java.lang.String serverIP)
Sets IP address of the server.
|
void |
start()
Starts the thread.
|
void |
stop()
Stops the thread.
|
private void |
transmitUnsentFiles()
Transmits all flow databases (FDB files) to the server.
|
private static org.apache.log4j.Logger log
private java.lang.Thread dataTransmitterThread
private java.lang.String clientId
private FileTransferClient myTransferClient
private java.lang.String serverIP
private int serverFileTransmitPort
private boolean runFlag
private boolean isStarted
private java.lang.String defaultFDBdirectory
public DataTransmitter(java.lang.String defaultFDBdirectory)
defaultFDBdirectory - directory containing FDB files, which should be transferred to the serverpublic void start()
public void stop()
public boolean isAlive()
DataTransmitter is alive. It means that: isStarted equals true).
This condition is used to check if the thread is fully started or if it needs more time to start.true if the thread is fully started and operational, false otherwisepublic void run()
run in interface java.lang.Runnableprivate boolean isConfigured()
true if the instance was created, false otherwisepublic void setClientId(java.lang.String clientId)
clientId - identifier of the clientpublic void setServerIP(java.lang.String serverIP)
serverIP - IP address of the serverpublic void setServerFileTransmitPort(int serverFileTransmitPort)
serverFileTransmitPort - TCP port on the server for file transmissionsprivate void transmitUnsentFiles()