Module org.hsqldb

Class HsqlSocketFactory

java.lang.Object
org.hsqldb.server.HsqlSocketFactory
Direct Known Subclasses:
HsqlSocketFactorySecure

public class HsqlSocketFactory extends Object
Base class for producing the Socket objects used by HSQLDB.
Since:
1.7.2
Author:
Blaine Simpson (blaine dot simpson at admc dot com), Campbell Burnet (campbell-burnet@users dot sourceforge.net)
  • Method Details

    • getInstance

      public static HsqlSocketFactory getInstance(boolean tls) throws Exception
      Retrieves an HsqlSocketFactory whose subclass and attributes are determined by the specified argument, tls.
      Parameters:
      tls - whether to retrieve a factory producing SSL sockets
      Returns:
      a new factory
      Throws:
      Exception - if the new factory cannot be constructed or is of the wrong type
    • configureSocket

      public void configureSocket(Socket socket)
    • createServerSocket

      public ServerSocket createServerSocket(int port) throws Exception
      Returns a server socket bound to the specified port. The socket is configured with the socket options given to this factory.
      Parameters:
      port - the port to which to bind the ServerSocket
      Returns:
      the ServerSocket
      Throws:
      Exception - if a network error occurs
    • createServerSocket

      public ServerSocket createServerSocket(int port, String address) throws Exception
      Returns a server socket bound to the specified port. The socket is configured with the socket options given to this factory.
      Parameters:
      port - the port to which to bind the ServerSocket
      address - String
      Returns:
      the ServerSocket
      Throws:
      Exception - if a network error occurs
    • createSocket

      public Socket createSocket(Socket socket, String host, int port) throws Exception
      If socket argument is not null, returns it. If it is null, creates a 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.
      Parameters:
      socket - the existing socket, can be null
      host - the server host
      port - the server port
      Returns:
      the socket
      Throws:
      Exception - if a network error occurs
    • createSocket

      public Socket createSocket(String host, int port) throws Exception
      Creates a 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.
      Parameters:
      host - the server host
      port - the server port
      Returns:
      the socket
      Throws:
      Exception - if a network error occurs
    • isSecure

      public boolean isSecure()
      Retrieves whether this factory produces secure sockets.
      Returns:
      true if this factory produces secure sockets