Top Description Fields Constructors Methods
org.hsqldb.server

public Class HsqlSocketFactory

extends Object
Class Inheritance
Known Direct Subclasses
org.hsqldb.server.HsqlSocketFactorySecure
Imports
java.lang.reflect.Constructor, .InvocationTargetException, java.net.InetAddress, .ServerSocket, .Socket

Base class for producing the Socket objects used by HSQLDB.
Authors
Blaine Simpson (blaine dot simpson at admc dot com), Campbell Burnet (campbell-burnet@users dot sourceforge.net)
Since
1.7.2
Version
2.3.0

Field Summary

Modifier and TypeField and Description
private static HsqlSocketFactory
private static HsqlSocketFactory

Constructor Summary

AccessConstructor and Description
protected
HsqlSocketFactory()

External construction disabled.

Method Summary

Modifier and TypeMethod and Description
public void
public ServerSocket

Returns:

the ServerSocket
createServerSocket
(int
the port to which to bind the ServerSocket
port
)

Returns a server socket bound to the specified port.

public ServerSocket

Returns:

the ServerSocket
createServerSocket
(int
the port to which to bind the ServerSocket
port
,
String
String
address
)

Returns a server socket bound to the specified port.

public Socket

Returns:

the socket
createSocket
(Socket
the existing socket, can be null
socket
,
String
the server host
host
,
int
the server port
port
)

If socket argument is not null, returns it.

public Socket

Returns:

the socket
createSocket
(String
the server host
host
,
int
the server port
port
)

Creates a socket and connects it to the specified remote host at the specified remote port.

public static HsqlSocketFactory

Returns:

a new factory
getInstance
(boolean
whether to retrieve a factory producing SSL sockets
tls
)

Retrieves an HsqlSocketFactory whose subclass and attributes are determined by the specified argument, tls.

private static HsqlSocketFactory
private static HsqlSocketFactory
public boolean

Returns:

true if this factory produces secure sockets
isSecure
()

Retrieves whether this factory produces secure sockets.

private static HsqlSocketFactory

Returns:

a new secure socket factory
newFactory
(String
the fully qualified name of the desired class to construct
implClass
)

Retrieves a new HsqlSocketFactory whose class is determined by the implClass argument.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

plainImplback to summary
private static HsqlSocketFactory plainImpl
sslImplback to summary
private static HsqlSocketFactory sslImpl

Constructor Detail

HsqlSocketFactoryback to summary
protected HsqlSocketFactory()

External construction disabled. New factory instances are retrieved through the newHsqlSocketFactory method instead.

Method Detail

configureSocketback to summary
public void configureSocket(Socket socket)
createServerSocketback to summary
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:int

the port to which to bind the ServerSocket

Returns:ServerSocket

the ServerSocket

Exceptions
Exception:
if a network error occurs
createServerSocketback to summary
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:int

the port to which to bind the ServerSocket

address:String

String

Returns:ServerSocket

the ServerSocket

Exceptions
Exception:
if a network error occurs
createSocketback to summary
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:Socket

the existing socket, can be null

host:String

the server host

port:int

the server port

Returns:Socket

the socket

Exceptions
Exception:
if a network error occurs
createSocketback to summary
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:String

the server host

port:int

the server port

Returns:Socket

the socket

Exceptions
Exception:
if a network error occurs
getInstanceback to summary
public static HsqlSocketFactory getInstance(boolean tls) throws Exception

Retrieves an HsqlSocketFactory whose subclass and attributes are determined by the specified argument, tls.

Parameters
tls:boolean

whether to retrieve a factory producing SSL sockets

Returns:HsqlSocketFactory

a new factory

Exceptions
Exception:
if the new factory cannot be constructed or is of the wrong type
getPlainImplback to summary
private static HsqlSocketFactory getPlainImpl()
getSSLImplback to summary
private static HsqlSocketFactory getSSLImpl() throws Exception
isSecureback to summary
public boolean isSecure()

Retrieves whether this factory produces secure sockets.

Returns:boolean

true if this factory produces secure sockets

newFactoryback to summary
private static HsqlSocketFactory newFactory(String implClass) throws Exception

Retrieves a new HsqlSocketFactory whose class is determined by the implClass argument. The basic contract here is that implementations constructed by this method should return true upon calling isSecure() iff they actually create secure sockets. There is no way to guarantee this directly here, so it is simply trusted that an implementation is secure if it returns true for calls to isSecure();

Parameters
implClass:String

the fully qualified name of the desired class to construct

Returns:HsqlSocketFactory

a new secure socket factory

Exceptions
Exception:
if a new secure socket factory cannot be constructed