public class VbsServer
extends java.lang.Object
implements java.lang.Runnable
VbsServer is the primary class of the server application.
It starts a RegisterServer to allow clients to register and retrieve a clientId.
It starts a FileTransferServer for transferring FDB files.
It starts an UpgradeServer for upgrading clients, and it starts a
DataExtracter for importing content of the FDB files into the database. ServerAppShutdown is run as a shutdown hook, to shut down nicely. | Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
DEFAULT_FOLDER
Folder used to store FDB files received from clients.
|
private int |
DEFAULT_PACKET_SIZE_LIMIT
Flows containing less than
DEFAULT_PACKET_SIZE_LIMIT packets will not be stored in the database. |
private int |
fdbServerPort
Port on which the file transfer server listens to incoming request from clients.
|
private static org.apache.log4j.Logger |
log
Used to log different events.
|
private DataExtracter |
myDataExtracter
DataExtracter module of the VBS server. |
private FileTransferServer |
myFdbServer
FileTransferServer module of the VBS server. |
private RegisterServer |
myRegisterServer
RegisterServer module of the VBS server. |
private VbsServerShutdown |
myShutdownHandler
VbsServerShutdown module of the VBS server. |
private UpgradeServer |
myUpgradeServer
UpgradeServer module of the VBS server. |
private int |
registerServerPort
Port on which the registration server listens to incoming request from clients.
|
private java.lang.String |
UPGRADE_FOLDER
Folder containing files needed to upgrade clients.
|
private int |
upgradeServerPort
Port on which the upgrade server listens to incoming request from clients.
|
static int |
VBS_SERVER_VERSION
Version of the VBS server.
|
| Constructor and Description |
|---|
VbsServer() |
| Modifier and Type | Method and Description |
|---|---|
private boolean |
areThreadsAlive()
Checks if at least one module of the VBS server is alive.
|
private boolean |
loadHardSettings()
Loads settings from the external XML file.
|
static void |
main(java.lang.String[] args)
Starts the server application.
|
void |
run()
Runs the thread.
|
void |
setup()
Prepares all the modules of the VBS server.
|
private void |
setupDataExtracter()
Prepares the
DataExtracter module of the VBS server. |
private void |
setupDefaultFolders()
Prepares folders needed by the VBS server.
|
private void |
setupFDBServer()
Prepares the
FileTransferServer module of the VBS server. |
private void |
setupRegisterServer()
Prepares the
RegisterServer module of the VBS server. |
private void |
setupShutdownHandler()
Prepares the shutdown handler.
|
private void |
setupUpgradeServer()
Prepares the
UpgradeServer module of the VBS server. |
void |
startSystem()
Starts all the modules of the system.
|
private static org.apache.log4j.Logger log
public static final int VBS_SERVER_VERSION
private final java.lang.String DEFAULT_FOLDER
private final java.lang.String UPGRADE_FOLDER
private final int DEFAULT_PACKET_SIZE_LIMIT
DEFAULT_PACKET_SIZE_LIMIT packets will not be stored in the database. 0 = limit is disabled.private int fdbServerPort
private int registerServerPort
private int upgradeServerPort
private RegisterServer myRegisterServer
RegisterServer module of the VBS server.private UpgradeServer myUpgradeServer
UpgradeServer module of the VBS server.private FileTransferServer myFdbServer
FileTransferServer module of the VBS server.private DataExtracter myDataExtracter
DataExtracter module of the VBS server.private VbsServerShutdown myShutdownHandler
VbsServerShutdown module of the VBS server.public void run()
run in interface java.lang.Runnableprivate boolean loadHardSettings()
true if the settings were successfully loaded, false otherwisepublic void setup()
throws java.io.IOException
java.io.IOException - when an IOException is thrown by any method invoked in this functionprivate void setupDefaultFolders()
throws java.io.IOException
java.io.IOException - when any problem with operation of files or directories occurprivate void setupRegisterServer()
throws java.io.IOException
RegisterServer module of the VBS server.java.io.IOException - if an IOException is thrown by the moduleprivate void setupUpgradeServer()
throws java.io.IOException
UpgradeServer module of the VBS server.java.io.IOException - if an IOException is thrown by the moduleprivate void setupFDBServer()
throws java.io.IOException
FileTransferServer module of the VBS server.java.io.IOException - if an IOException is thrown by the moduleprivate void setupDataExtracter()
throws java.io.IOException
DataExtracter module of the VBS server.java.io.IOException - if an IOException is thrown by the moduleprivate void setupShutdownHandler()
public void startSystem()
private boolean areThreadsAlive()
true if at least one module of the VBS server is alive, false otherwisepublic static void main(java.lang.String[] args)