public class DataExtracter
extends java.lang.Object
implements java.lang.Runnable
DataExtracter is used to parse stored FDB files
and extract their content into the MySQL database. | Modifier and Type | Field and Description |
|---|---|
private java.lang.Thread |
dataExtracterThread
Thread used by the class.
|
private static java.lang.String |
defaultDirectoryName
Folder storing the FDB files received from clients.
|
private static org.apache.log4j.Logger |
log
Used to log different events.
|
private int |
packetSizeLimit
Flows containing less than
packetSizeLimit packets will not be stored in the database. |
private boolean |
runFlag
The thread will stop when this flag is
false. |
private int |
samplingInterval
Interval between searching for FDB files in the folder.
|
| Constructor and Description |
|---|
DataExtracter()
Constructs the object.
|
| Modifier and Type | Method and Description |
|---|---|
private boolean |
deleteShortFlowsFromDatabase(java.sql.Statement stmt)
Deletes from the database flows having less than
packetSizeLimit packets. |
boolean |
isAlive()
Checks if the thread is alive.
|
private boolean |
mergeFlowsInDatabase(java.sql.Statement stmt,
java.sql.ResultSet rs,
java.sql.Statement stmt2,
java.sql.ResultSet rs2)
Merges flows being split on the client side due to their length.
|
private boolean |
processSQLiteDb(java.sql.Statement stmt,
java.sql.ResultSet rs)
Looks for FDB files in the data directory and extracts their content into the MySQL database.
|
void |
run()
Runs the thread.
|
void |
setPacketSizeLimit(int packetSizeLimit)
Sets limit for the flows.
|
void |
start()
Starts the thread.
|
void |
stop()
Stops the thread.
|
private static final java.lang.String defaultDirectoryName
private int samplingInterval
private static org.apache.log4j.Logger log
private java.lang.Thread dataExtracterThread
private int packetSizeLimit
packetSizeLimit packets will not be stored in the database. 0 = limit is disabled.private boolean runFlag
false.public void start()
public void stop()
public boolean isAlive()
true if the thread is alive, false otherwisepublic void run()
processSQLiteDb function looks for FDB files in the data directory
and extracts their content to the MySQL database. Then, the mergeFlowsInDatabase
function merges flows being split on the client side because of their length. Lastly, flows
having less than packetSizeLimit packets are deleted from the MySQL database
by the deleteShortFlowsFromDatabase function.run in interface java.lang.Runnableprivate boolean processSQLiteDb(java.sql.Statement stmt,
java.sql.ResultSet rs)
stmt - SQL statementrs - SQL result settrue if the FDB files were successfully found and extracted, false otherwiseprivate boolean mergeFlowsInDatabase(java.sql.Statement stmt,
java.sql.ResultSet rs,
java.sql.Statement stmt2,
java.sql.ResultSet rs2)
stmt - SQL statementrs - SQL result setstmt2 - SQL statementrs2 - SQL result settrue if the flows were successfully merged, false otherwiseprivate boolean deleteShortFlowsFromDatabase(java.sql.Statement stmt)
packetSizeLimit packets.stmt - SQL statementtrue if the flows having less than packetSizeLimit packets were successfully deleted, false otherwisepublic void setPacketSizeLimit(int packetSizeLimit)
packetSizeLimit packets will be deleted from the MySQL database.packetSizeLimit - the limit