de.karb.hitcryptoproxy
Class HitCryptoProxyServer

java.lang.Object
  extended by de.karb.hitcryptoproxy.HitCryptoProxyServer
All Implemented Interfaces:
org.apache.commons.daemon.Daemon

public class HitCryptoProxyServer
extends java.lang.Object
implements org.apache.commons.daemon.Daemon

This class provides a proxy for encrypted communication between the HIT database and its clients The proxy can be run as Windows service via main(String[]) and Procrun or as Linux daemon via the org.apache.commons.daemon.Daemon interface and Jsvc

Author:
Schildmann@karb.de

Nested Class Summary
 class HitCryptoProxyServer.ProxyWorker
          Listens for connections to its server socket to start a new ClientWorker thread This class implements Runnable.
 
Field Summary
static java.lang.String START
           
static java.lang.String STOP
           
 
Constructor Summary
HitCryptoProxyServer()
          Implementors of org.apache.commons.daemon.Daemon must provide a public constructor with no arguments so that instances can be created in an automated fashion.
 
Method Summary
 void destroy()
          Closes the server sockets
 void init(org.apache.commons.daemon.DaemonContext context)
          Calls init(String[])
 void init(java.lang.String[] args)
          Intializes logger, random generator, configuration, the server sockets, the proxy workers and the thread pool
 boolean isStopped()
          Returns whether HitCryptoProxyServer has been stopped, used by HitCryptoProxyServer.ProxyWorker.run()
static void main(java.lang.String[] args)
          This main method is called for the Windows service, while for the Linux daemon the methods of the Daemon interface are used.
 void start()
          Starts both proxy workers
 void stop()
          Sets isStopped and shuts down the thread pool and terminate it
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STOP

public static final java.lang.String STOP
See Also:
Constant Field Values

START

public static final java.lang.String START
See Also:
Constant Field Values
Constructor Detail

HitCryptoProxyServer

public HitCryptoProxyServer()
Implementors of org.apache.commons.daemon.Daemon must provide a public constructor with no arguments so that instances can be created in an automated fashion.

Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
This main method is called for the Windows service, while for the Linux daemon the methods of the Daemon interface are used. After an instance of HitCryptoProxyServer is started with parameter "start" it runs until the serviceInstance is stopped (with another call with parameter "stop")

Parameters:
args - the arguments start/stop <property-file>?
Throws:
java.io.IOException

isStopped

public boolean isStopped()
Returns whether HitCryptoProxyServer has been stopped, used by HitCryptoProxyServer.ProxyWorker.run()

Returns:
true, if stopped

destroy

public void destroy()
Closes the server sockets

Specified by:
destroy in interface org.apache.commons.daemon.Daemon
See Also:
Daemon.destroy()

init

public void init(java.lang.String[] args)
          throws java.lang.Exception
Intializes logger, random generator, configuration, the server sockets, the proxy workers and the thread pool

Throws:
java.lang.Exception - Any exception preventing a successful initialization.

init

public void init(org.apache.commons.daemon.DaemonContext context)
          throws java.lang.Exception
Calls init(String[])

Specified by:
init in interface org.apache.commons.daemon.Daemon
Throws:
java.lang.Exception - Any exception preventing a successful initialization.
See Also:
Daemon.init(DaemonContext)

start

public void start()
           throws java.lang.Exception
Starts both proxy workers

Specified by:
start in interface org.apache.commons.daemon.Daemon
Throws:
java.lang.Exception
See Also:
Daemon.start()

stop

public void stop()
          throws java.io.IOException,
                 java.lang.InterruptedException
Sets isStopped and shuts down the thread pool and terminate it

Specified by:
stop in interface org.apache.commons.daemon.Daemon
Throws:
java.io.IOException
java.lang.InterruptedException
See Also:
Daemon.stop()