borland Packages Class Hierarchy datastore.jdbc Package
java.lang.Object +----com.borland.datastore.jdbc.DataStoreServer
Variables Constructors Properties Methods
Implements ServerStatusListener, Designable, Runnable, EventListener
DataStoreServer
listens on a given port number
for requests from the remote JDataStore JDBC driver. Upon accepting a
request, a connection is created that will service any further requests
from that remote JDBC driver. This functionality is the core of a JDataStore JDBC server.
The server creates a ServerConnection
object to represent
each new connection. Objects that implement
ServerStatusListener
may register with the server to be
notified when connections are made, connections are broken
(disconnected), and when errors occur. You can control which types of
events are reported.
Because access to a physical DataStore file is restricted to a single process, you must create your own custom DataStore server application if you want to add functionality. For example, in addition to servicing remote JDBC requests, you could have your server make backups at the same time every night. Another example would be if you want to access serialized file streams in the same DataStore file; these streams are not accessible through JDBC, but you could add that functionality through the DataStore API to your custom DataStore server.
public static final int DEFAULT_PORT = 2508The default port number for a JDBC remote driver.
public static final String SERVER_LOG_NAME = "datastoreserver_log_"The name of the JDataStore Server log.
public DataStoreServer()Creates a new
DataStoreServer
instance that will listen for
activity on the default port. After optionally changing properties and
registering listeners, start
the DataStoreServer
to
activate it.
public final boolean isAlive()Returns a boolean value indicating whether the server is "alive".
public boolean isLogStatusEvents() public void setLogStatusEvents(boolean logStatusEvents)Specify whether to save ServerStatusEvents to a log file.
Parameters:
public int getPort() public void setPort(int port)The port on which to listen for JDBC requests. If not set,
DataStoreServer.DEFAULT_PORT
is used.
public final boolean isReportConnect() public final void setReportConnect(boolean set)Determines whether connections and disconnections are reported to registered
ServerStatusListener
s or ignored.
public final boolean isReportConnectError() public final void setReportConnectError(boolean set)Determines whether errors regarding the instantiation, connection, or disconnection of
ServerConnection
objects are reported to registered
ServerStatusListener
s or ignored.
public final boolean isReportServerError() public final void setReportServerError(boolean set)Determines whether (fatal) server errors are reported to registered
ServerStatusListener
s or ignored.
public final Vector getServerConnections()Returns a list of current connections, represented by
ServerConnection
objects.
public synchronized int getSoTimeout() public synchronized void setSoTimeout(int timeout)Retrive setting for SO_TIMEOUT. 0 returns implies that the option is disabled (i.e., timeout of infinity).
See also: ServerSocket.getSoTimeout() Enable/disable SO_TIMEOUT with the specified timeout, in milliseconds. With this option set to a non-zero timeout, a call to accept() for this ServerSocket will block for only this amount of time. If the timeout expires, a java.io.InterruptedIOException is raised, though the ServerSocket is still valid. The option must be enabled prior to entering the blocking operation to have effect. The timeout must be > 0. A timeout of zero is interpreted as an infinite timeout.
See also: ServerSocket.setSoTimeout()
See also: ServerSocket.getSoTimeout()
public String getStatusLogDir() public void setStatusLogDir(String statusLogDir)Specify the location of log files.
Parameters:
public String getTempDir() public void setTempDir(String tempDir)The temporary directory for all
DataStore
connections. If null,
the current directory is used.
public final void addServerStatusListener(ServerStatusListener listener)
listener
ServerStatusListener
to be notified of status changes (like
connections and disconnections) and exceptions encountered by the server.
public final void closeConnections()Close all
ServerConnection
instances initiated by this instance
of DataStoreServer
.
public final void removeServerStatusListener(ServerStatusListener listener)
listener
ServerStatusListener
to removed from the event notification list.
public final void shutdown()Causes the
DataStoreServer
to terminate and close all
ServerConnection
instances initiated by this
DataStoreServer
instance.
public synchronized void start()Starts the
DataStoreServer
, which will accept remote connections.