- java.lang.Object
-
- org.hsqldb.server.ServerConfiguration
-
- All Implemented Interfaces:
ServerConstants
public final class ServerConfiguration extends java.lang.Object implements ServerConstants
Assists with Server and WebServer configuration tasks.- Since:
- 1.7.2
- Author:
- Campbell Burnet (campbell-burnet@users dot sourceforge.net)
-
-
Field Summary
-
Fields inherited from interface org.hsqldb.server.ServerConstants
SC_DEFAULT_ADDRESS, SC_DEFAULT_BER_SERVER_PORT, SC_DEFAULT_DATABASE, SC_DEFAULT_HSQL_SERVER_PORT, SC_DEFAULT_HSQLS_SERVER_PORT, SC_DEFAULT_HTTP_SERVER_PORT, SC_DEFAULT_HTTPS_SERVER_PORT, SC_DEFAULT_MAX_DATABASES, SC_DEFAULT_MAX_WAIT, SC_DEFAULT_NO_SYSTEM_EXIT, SC_DEFAULT_REMOTE_OPEN_DB, SC_DEFAULT_SERVER_AUTORESTART, SC_DEFAULT_SILENT, SC_DEFAULT_TLS, SC_DEFAULT_TRACE, SC_DEFAULT_WEB_MIME, SC_DEFAULT_WEB_PAGE, SC_DEFAULT_WEB_ROOT, SC_PROTOCOL_BER, SC_PROTOCOL_HSQL, SC_PROTOCOL_HTTP, SERVER_STATE_CLOSING, SERVER_STATE_ONLINE, SERVER_STATE_OPENING, SERVER_STATE_SHUTDOWN
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
getDefaultPort(int protocol, boolean isTls)
Retrieves the default port that a Server will try to use in the absence of an explicitly specified one, given the specified value for whether or not to use secure sockets.static ServerProperties
getPropertiesFromFile(int protocol, java.lang.String path, java.lang.String extension)
Retrieves a new HsqlProperties object, if possible, loaded from the specified file.static java.lang.String[]
listLocalInetAddressNames()
Retrieves an array of Strings naming the distinct, known to be valid local InetAddress names for this machine.static ServerProperties
newDefaultProperties(int protocol)
Retrieves a new default properties object for a server of the specified protocolstatic void
translateAddressProperty(org.hsqldb.persist.HsqlProperties p)
Translates null or zero length value for address key to the special value ServerConstants.SC_DEFAULT_ADDRESS which causes ServerSockets to be constructed without specifying an InetAddress.static void
translateDefaultDatabaseProperty(org.hsqldb.persist.HsqlProperties p)
Translates the legacy default database form: database=...static void
translateDefaultNoSystemExitProperty(org.hsqldb.persist.HsqlProperties p)
Translates unspecified no_system_exit property to false, the default typically required when a Server is started from the command line.
-
-
-
Method Detail
-
getDefaultPort
public static int getDefaultPort(int protocol, boolean isTls)
Retrieves the default port that a Server will try to use in the absence of an explicitly specified one, given the specified value for whether or not to use secure sockets.- Parameters:
protocol
- the protocol specifier code of the ServerisTls
- if true, retrieve the default port when using secure sockets, else the default port when using plain sockets- Returns:
- the default port used in the absence of an explicit specification.
-
getPropertiesFromFile
public static ServerProperties getPropertiesFromFile(int protocol, java.lang.String path, java.lang.String extension)
Retrieves a new HsqlProperties object, if possible, loaded from the specified file.- Parameters:
protocol
- intpath
- the file's path, without the .properties extension (which is added automatically)extension
- String- Returns:
- a new properties object loaded from the specified file
-
listLocalInetAddressNames
public static java.lang.String[] listLocalInetAddressNames()
Retrieves an array of Strings naming the distinct, known to be valid local InetAddress names for this machine. The process is to collect and return the union of the following sets:- InetAddress.getAllByName(InetAddress.getLocalHost().getHostAddress())
- InetAddress.getAllByName(InetAddress.getLocalHost().getHostName())
- InetAddress.getAllByName(InetAddress.getByName(null).getHostAddress())
- InetAddress.getAllByName(InetAddress.getByName(null).getHostName())
- InetAddress.getByName("loopback").getHostAddress()
- InetAddress.getByName("loopback").getHostname()
- Returns:
- the distinct, known to be valid local InetAddress names for this machine
-
newDefaultProperties
public static ServerProperties newDefaultProperties(int protocol)
Retrieves a new default properties object for a server of the specified protocol- Parameters:
protocol
- int- Returns:
- a new default properties object
-
translateAddressProperty
public static void translateAddressProperty(org.hsqldb.persist.HsqlProperties p)
Translates null or zero length value for address key to the special value ServerConstants.SC_DEFAULT_ADDRESS which causes ServerSockets to be constructed without specifying an InetAddress.- Parameters:
p
- The properties object upon which to perform the translation
-
translateDefaultDatabaseProperty
public static void translateDefaultDatabaseProperty(org.hsqldb.persist.HsqlProperties p)
Translates the legacy default database form: database=... to the 1.7.2 form: database.0=...- Parameters:
p
- The properties object upon which to perform the translation
-
translateDefaultNoSystemExitProperty
public static void translateDefaultNoSystemExitProperty(org.hsqldb.persist.HsqlProperties p)
Translates unspecified no_system_exit property to false, the default typically required when a Server is started from the command line.- Parameters:
p
- The properties object upon which to perform the translation
-
-