org.hsqldb
Class HsqlSocketFactorySecure

java.lang.Object
  extended byorg.hsqldb.HsqlSocketFactory
      extended byorg.hsqldb.HsqlSocketFactorySecure
All Implemented Interfaces:
EventListener, HandshakeCompletedListener

public final class HsqlSocketFactorySecure
extends HsqlSocketFactory
implements HandshakeCompletedListener

The default secure socket factory implementation.

Since:
HSQLDB 1.7.2
Version:
1.7.2
Author:
unsaved@users.sourceforge.net, boucherb@users.sourceforge.net

Field Summary
protected  Object server_socket_factory_mutex
          Monitor object to guard against concurrent modification of the underlying server socket factory implementation member.
protected  Object serverSocketFactory
          The underlying server socket factory implementation.
protected  Object socket_factory_mutex
          Monitor object to guard against conncurrent modification of the underlying socket factory implementation member.
protected  Object socketFactory
          The underlying socket factory implementation.
 
Constructor Summary
protected HsqlSocketFactorySecure()
          External construction disabled.
 
Method Summary
 void configureSocket(Socket socket)
           
 ServerSocket createServerSocket(int port)
          Creates a secure server socket bound to the specified port.
 ServerSocket createServerSocket(int port, String address)
          Creates a secure server socket bound to the specified port.
 Socket createSocket(String host, int port)
          Creates a secure Socket and connects it to the specified remote host at the specified remote port.
protected  SSLServerSocketFactory getServerSocketFactoryImpl()
          Retrieves the underlying javax.net.ssl.SSLServerSocketFactory.
protected  SSLSocketFactory getSocketFactoryImpl()
          Retrieves the underlying javax.net.ssl.SSLSocketFactory.
 void handshakeCompleted(HandshakeCompletedEvent evt)
           
 boolean isSecure()
          Retrieves whether this factory produces secure sockets.
protected  void verify(String host, SSLSession session)
          Verifyies the certificate chain presented by the server to which a secure Socket has just connected.
 
Methods inherited from class org.hsqldb.HsqlSocketFactory
getInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

socketFactory

protected Object socketFactory
The underlying socket factory implementation.


serverSocketFactory

protected Object serverSocketFactory
The underlying server socket factory implementation.


socket_factory_mutex

protected final Object socket_factory_mutex
Monitor object to guard against conncurrent modification of the underlying socket factory implementation member.


server_socket_factory_mutex

protected final Object server_socket_factory_mutex
Monitor object to guard against concurrent modification of the underlying server socket factory implementation member.

Constructor Detail

HsqlSocketFactorySecure

protected HsqlSocketFactorySecure()
                           throws Exception
External construction disabled. New factory instances are retreived through the newHsqlSocketFactory method instead.

Method Detail

configureSocket

public void configureSocket(Socket socket)
Overrides:
configureSocket in class HsqlSocketFactory

createServerSocket

public ServerSocket createServerSocket(int port)
                                throws Exception
Creates a secure server socket bound to the specified port. The socket is configured with the socket options given to this factory.

Overrides:
createServerSocket in class HsqlSocketFactory
Parameters:
port - the port to which to bind the secure ServerSocket
Returns:
the secure ServerSocket
Throws:
Exception - if a network or security provider error occurs

createServerSocket

public ServerSocket createServerSocket(int port,
                                       String address)
                                throws Exception
Creates a secure server socket bound to the specified port. The socket is configured with the socket options given to this factory.

Overrides:
createServerSocket in class HsqlSocketFactory
Parameters:
port - the port to which to bind the secure ServerSocket
Returns:
the secure ServerSocket
Throws:
Exception - if a network or security provider error occurs

createSocket

public Socket createSocket(String host,
                           int port)
                    throws Exception
Creates a secure Socket and connects it to the specified remote host at the specified remote port. This socket is configured using the socket options established for this factory.

Overrides:
createSocket in class HsqlSocketFactory
Parameters:
host - the server host
port - the server port
Returns:
the socket
Throws:
Exception - if a network or security provider error occurs

isSecure

public boolean isSecure()
Retrieves whether this factory produces secure sockets.

Overrides:
isSecure in class HsqlSocketFactory
Returns:
true iff this factory creates secure sockets

getServerSocketFactoryImpl

protected SSLServerSocketFactory getServerSocketFactoryImpl()
                                                     throws Exception
Retrieves the underlying javax.net.ssl.SSLServerSocketFactory.

Returns:
the underlying javax.net.ssl.SSLServerSocketFactory
Throws:
Exception - if there is a problem retrieving the underlying factory

getSocketFactoryImpl

protected SSLSocketFactory getSocketFactoryImpl()
                                         throws Exception
Retrieves the underlying javax.net.ssl.SSLSocketFactory.

Returns:
the underlying javax.net.ssl.SSLSocketFactory
Throws:
Exception - if there is a problem retrieving the underlying factory

verify

protected void verify(String host,
                      SSLSession session)
               throws Exception
Verifyies the certificate chain presented by the server to which a secure Socket has just connected. Specifically, the provided host name is checked against the Common Name of the server certificate; additional checks may or may not be performed.

Parameters:
host - the requested host name
session - SSLSession used on the connection to host
Throws:
Exception - if the certificate chain cannot be verified

handshakeCompleted

public void handshakeCompleted(HandshakeCompletedEvent evt)
Specified by:
handshakeCompleted in interface HandshakeCompletedListener


Copyright © 2001 - 2004 HSQL Development Group. All Rights Reserved.