gov.virginia.dcjs.server
Class TCPdbServer

java.lang.Object
  extended byjava.rmi.server.RemoteObject
      extended byjava.rmi.server.RemoteServer
          extended byjava.rmi.server.UnicastRemoteObject
              extended bygov.virginia.dcjs.jini.service.GenericService
                  extended bygov.virginia.dcjs.server.TCPServer
                      extended bygov.virginia.dcjs.server.TCPdbServer
All Implemented Interfaces:
net.jini.admin.Administrable, AdministrableRMI, java.lang.Cloneable, com.sun.jini.admin.DestroyAdmin, java.util.EventListener, java.rmi.Remote, java.lang.Runnable, java.io.Serializable, ServiceAdmin, net.jini.lookup.ServiceIDListener, TCPService, TCPServiceRMI

public class TCPdbServer
extends TCPServer

See Also:
Serialized Form

Field Summary
static int ACCESS
          Constant for MS Access data sources
static int FOXPRO
          Constant for MS FoxPro data sources
static int SQL
          Constant for MS SQL Server data sources
static int UNKNOWN
          Constant for unknown data sources
 
Fields inherited from class gov.virginia.dcjs.jini.service.GenericService
r_name
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
TCPdbServer(int port, TCPMain main, java.lang.String dbRead, java.lang.String dbWrite, int dbType)
          Build a server connected to the specified data source of the * specified database type and listenning on the specified port * @param port Port this server will listen on * @param main Control interface object for this server * @param dbRead Read Only ODBC datasource name * @param dbWrite Read/Write ODBC datasource name * @param dbType One of the class constants {ACCESS, FOXPRO, SQL}
 
Method Summary
 java.sql.Connection getConnection()
          Used by SQLRequest classes to access the database * @return Established JDBC Write connection * @deprecated Explicitly call getReadConnection() or * getWriteConnection() instead.
 java.lang.String getCurrentDate(boolean andTime)
          Provides the appropriate RDBMS function name for the current date/datetime * @param andTime True to return date and time function (not just date).
 int getRDBMS()
          Obtain the type of database engine being used * @return One of the class constants {ACCESS, FOXPRO}
 java.sql.Connection getReadConnection()
          Used by SQLRequest classes to access the Read Only data source * @return Established JDBC Read Only connection
 java.sql.Connection getWriteConnection()
          Used by SQLRequest classes to access the Writable data source * @return Established JDBC Write connection
static void odbcQueue(SQLRequest sql)
          Synchronizing method for multiple JDBC requests over the single connection
 void setDbSources(java.lang.String dbRead, java.lang.String dbWrite)
          Specify the ODBC datasource name for this server * @param dbRead Read Only ODBC datasource name * @param dbWrite Read/Write ODBC datasource name
 void setRDBMS(int dbType)
          Provide the database engine type this server uses * @param dbType One of the class constants {ACCESS, FOXPRO}
 void startServer()
          Initialized socket listenning and JDBC communication
 void stopServer()
          Halts the server processing
 
Methods inherited from class gov.virginia.dcjs.server.TCPServer
finalize, getConfiguration, getPort, getSocket, logWrite, run, serveClient, start, stop
 
Methods inherited from class gov.virginia.dcjs.jini.service.GenericService
destroy, getAdmin, initializeServiceName, serviceIDNotify
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.jini.admin.Administrable
getAdmin
 

Field Detail

UNKNOWN

public static final int UNKNOWN
Constant for unknown data sources

See Also:
Constant Field Values

ACCESS

public static final int ACCESS
Constant for MS Access data sources

See Also:
Constant Field Values

FOXPRO

public static final int FOXPRO
Constant for MS FoxPro data sources

See Also:
Constant Field Values

SQL

public static final int SQL
Constant for MS SQL Server data sources

See Also:
Constant Field Values
Constructor Detail

TCPdbServer

public TCPdbServer(int port,
                   TCPMain main,
                   java.lang.String dbRead,
                   java.lang.String dbWrite,
                   int dbType)
Build a server connected to the specified data source of the * specified database type and listenning on the specified port * @param port Port this server will listen on * @param main Control interface object for this server * @param dbRead Read Only ODBC datasource name * @param dbWrite Read/Write ODBC datasource name * @param dbType One of the class constants {ACCESS, FOXPRO, SQL}

Method Detail

setDbSources

public void setDbSources(java.lang.String dbRead,
                         java.lang.String dbWrite)
Specify the ODBC datasource name for this server * @param dbRead Read Only ODBC datasource name * @param dbWrite Read/Write ODBC datasource name


getRDBMS

public int getRDBMS()
Obtain the type of database engine being used * @return One of the class constants {ACCESS, FOXPRO}


setRDBMS

public void setRDBMS(int dbType)
Provide the database engine type this server uses * @param dbType One of the class constants {ACCESS, FOXPRO}


getCurrentDate

public java.lang.String getCurrentDate(boolean andTime)
Provides the appropriate RDBMS function name for the current date/datetime * @param andTime True to return date and time function (not just date). * This parameter only makes a difference in Foxpro at present. * @return present RDBMS current date / datetime function name


startServer

public void startServer()
                 throws java.io.IOException
Initialized socket listenning and JDBC communication

Throws:
java.io.IOException

getConnection

public java.sql.Connection getConnection()
Used by SQLRequest classes to access the database * @return Established JDBC Write connection * @deprecated Explicitly call getReadConnection() or * getWriteConnection() instead.


getReadConnection

public java.sql.Connection getReadConnection()
Used by SQLRequest classes to access the Read Only data source * @return Established JDBC Read Only connection


getWriteConnection

public java.sql.Connection getWriteConnection()
Used by SQLRequest classes to access the Writable data source * @return Established JDBC Write connection


odbcQueue

public static void odbcQueue(SQLRequest sql)
                      throws java.sql.SQLException
Synchronizing method for multiple JDBC requests over the single connection

Parameters:
sql - One of the SQLRequest objects under the 'See Also' section
Throws:
java.sql.SQLException
See Also:
SQLSelectRequest, SQLInsertRequest, SQLUpdateRequest, SQLDeleteRequest

stopServer

public void stopServer()
Halts the server processing