org.w3c.tools.jdbc
Class JdbcServer

java.lang.Object
  extended by org.w3c.tools.jdbc.JdbcServer

public class JdbcServer
extends java.lang.Object


Field Summary
static boolean debug
           
protected static java.util.Properties defaultProps
          Default properties
protected static java.util.Vector drivers
          the drivers loaded
protected static java.util.HashMap servers
          The cached servers, index is the jdbc URI
 
Constructor Summary
protected JdbcServer(java.lang.String uri, java.lang.String user, java.lang.String password, ConnectionManager manager)
          Constructor
 
Method Summary
 void deleteConnection(JdbcConnection conn)
           
 java.sql.DatabaseMetaData getMetaData()
          Get the MetaData of the tables.
static JdbcServer getServer(java.lang.String uri, java.util.Properties props)
          Get the Server object from the cache, if it is not present, try to create one.
static JdbcServer getServer(java.lang.String uri, java.lang.String user, java.lang.String password)
          Get the Server object from the cache, if it is not present, try to create one.
static JdbcServer getServer(java.lang.String uri, java.lang.String user, java.lang.String password, java.lang.String driver)
          Get the Server object from the cache, if it is not present, try to create one.
static JdbcServer getServer(java.lang.String uri, java.lang.String user, java.lang.String password, java.lang.String driver, java.util.Properties props)
          Get the Server object from the cache, if it is not present, try to create one.
protected  org.w3c.tools.jdbc.JdbcServerState getState()
          Get our server state (used to store things)
 java.sql.ResultSet runQuery(java.lang.String command, boolean close)
           
 java.sql.ResultSet runRequest(java.lang.String command, boolean close)
           
 int runUpdate(java.lang.String command, boolean close)
           
 java.lang.String toString()
           
 void unregisterConnection(JdbcConnection conn)
          Unregister a connection from the idle list.
protected  void updateProperties(java.util.Properties props)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

debug

public static final boolean debug
See Also:
Constant Field Values

servers

protected static java.util.HashMap servers
The cached servers, index is the jdbc URI


drivers

protected static java.util.Vector drivers
the drivers loaded


defaultProps

protected static java.util.Properties defaultProps
Default properties

Constructor Detail

JdbcServer

protected JdbcServer(java.lang.String uri,
                     java.lang.String user,
                     java.lang.String password,
                     ConnectionManager manager)
Constructor

Parameters:
uri - the jdbc URI of the DB server
user - the user name
password - the password
manager - the connection manager
Method Detail

getState

protected final org.w3c.tools.jdbc.JdbcServerState getState()
Get our server state (used to store things)

Returns:
a JdbcServerState instance.

getServer

public static JdbcServer getServer(java.lang.String uri,
                                   java.lang.String user,
                                   java.lang.String password)
Get the Server object from the cache, if it is not present, try to create one. A driver must have been selected.

Parameters:
uri - the jdbc URI of the DB server
user - the user name
password - the password
Returns:
an instance of JdbcServer

getServer

public static JdbcServer getServer(java.lang.String uri,
                                   java.util.Properties props)
Get the Server object from the cache, if it is not present, try to create one.

Parameters:
uri - the jdbc URI of the DB server
props - the Jdbc properties
Returns:
an instance of JdbcServer

getServer

public static JdbcServer getServer(java.lang.String uri,
                                   java.lang.String user,
                                   java.lang.String password,
                                   java.lang.String driver)
Get the Server object from the cache, if it is not present, try to create one.

Parameters:
uri - the jdbc URI of the DB server
user - the user name
password - the password
driver - the JDBC driver name
Returns:
an instance of JdbcServer

getServer

public static JdbcServer getServer(java.lang.String uri,
                                   java.lang.String user,
                                   java.lang.String password,
                                   java.lang.String driver,
                                   java.util.Properties props)
Get the Server object from the cache, if it is not present, try to create one.

Parameters:
uri - the jdbc URI of the DB server
user - the user name
password - the password
driver - the JDBC driver name
props - the Jdbc properties
Returns:
an instance of JdbcServer

updateProperties

protected void updateProperties(java.util.Properties props)

unregisterConnection

public void unregisterConnection(JdbcConnection conn)
Unregister a connection from the idle list. Unregistering a connection means that the server shouldn't keep track of it any more. This can happen in two situations:

deleteConnection

public void deleteConnection(JdbcConnection conn)

runRequest

public java.sql.ResultSet runRequest(java.lang.String command,
                                     boolean close)
                              throws java.sql.SQLException
Throws:
java.sql.SQLException

runQuery

public java.sql.ResultSet runQuery(java.lang.String command,
                                   boolean close)
                            throws java.sql.SQLException
Throws:
java.sql.SQLException

runUpdate

public int runUpdate(java.lang.String command,
                     boolean close)
              throws java.sql.SQLException
Throws:
java.sql.SQLException

getMetaData

public java.sql.DatabaseMetaData getMetaData()
                                      throws java.sql.SQLException
Get the MetaData of the tables.

Returns:
a DatabaseMetaData instance
Throws:
java.sql.SQLException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object