Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

org.objectweb.cjdbc.controller.connection.SimpleConnectionManager Class Reference

Inheritance diagram for org.objectweb.cjdbc.controller.connection.SimpleConnectionManager:

Inheritance graph
[legend]
Collaboration diagram for org.objectweb.cjdbc.controller.connection.SimpleConnectionManager:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SimpleConnectionManager (String backendUrl, String backendName, String login, String password, String driverPath, String driverClassName)
void initializeConnections () throws SQLException
void finalizeConnections () throws SQLException
Connection getConnection () throws UnreachableBackendException
void releaseConnection (Connection connection)
void deleteConnection (Connection c)
int getCurrentNumberOfConnections ()
String getXmlImpl ()

Protected Member Functions

Object clone () throws CloneNotSupportedException

Detailed Description

This connection manager creates a new Connection every time the getConnectionmethod is called.

Author:
Emmanuel Cecchet

Nicolas Modrzyk

Version:
1.0

Definition at line 42 of file SimpleConnectionManager.java.


Constructor & Destructor Documentation

org.objectweb.cjdbc.controller.connection.SimpleConnectionManager.SimpleConnectionManager String  backendUrl,
String  backendName,
String  login,
String  password,
String  driverPath,
String  driverClassName
 

Creates a new SimpleConnectionManager instance.

Parameters:
backendUrl URL of the DatabaseBackend owning this connection manager.
backendName name of the DatabaseBackend owning this connection manager.
login backend connection login to be used by this connection manager.
password backend connection password to be used by this connection manager.
driverPath path for driver
driverClassName class name for driver

Definition at line 62 of file SimpleConnectionManager.java.

Referenced by org.objectweb.cjdbc.controller.connection.SimpleConnectionManager.clone().

00064   {
00065     super(backendUrl, backendName, login, password, driverPath, driverClassName);
00066   }


Member Function Documentation

Object org.objectweb.cjdbc.controller.connection.SimpleConnectionManager.clone  )  throws CloneNotSupportedException [protected, virtual]
 

See also:
java.lang.Object#clone()

Implements org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.

Definition at line 71 of file SimpleConnectionManager.java.

References org.objectweb.cjdbc.controller.connection.SimpleConnectionManager.SimpleConnectionManager().

00072   {
00073     return new SimpleConnectionManager(backendUrl, backendName, rLogin,
00074         rPassword, driverPath, driverClassName);
00075   }

void org.objectweb.cjdbc.controller.connection.SimpleConnectionManager.deleteConnection Connection  c  )  [virtual]
 

See also:
org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.deleteConnection(Connection)

Implements org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.

Definition at line 148 of file SimpleConnectionManager.java.

00149   {
00150   }

void org.objectweb.cjdbc.controller.connection.SimpleConnectionManager.finalizeConnections  )  throws SQLException [virtual]
 

Does nothing.

See also:
org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.finalizeConnections()

Implements org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.

Definition at line 92 of file SimpleConnectionManager.java.

00093   {
00094     initialized = false;
00095   }

Connection org.objectweb.cjdbc.controller.connection.SimpleConnectionManager.getConnection  )  throws UnreachableBackendException [virtual]
 

Gets a new connection from the underlying driver.

See also:
org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.getConnection()

Implements org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.

Definition at line 102 of file SimpleConnectionManager.java.

References org.objectweb.cjdbc.common.log.Trace.error(), and org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.getConnectionFromDriver().

00103   {
00104     if (!initialized)
00105     {
00106       logger
00107           .error("Requesting a connection from a non-initialized connection manager");
00108       return null;
00109     }
00110 
00111     addConnection();
00112     Connection c = getConnectionFromDriver();
00113     if (c == null)
00114     {
00115       removeConnection();
00116       logger.error("Unable to get connection from " + backendUrl);
00117       if (nbOfConnections == 0)
00118       {
00119         logger.error("Backend '" + backendUrl + "' is considered unreachable. "
00120             + "(No active connection and none can be opened)");
00121         throw new UnreachableBackendException();
00122       }
00123     }
00124     return c;
00125   }

int org.objectweb.cjdbc.controller.connection.SimpleConnectionManager.getCurrentNumberOfConnections  )  [virtual]
 

See also:
org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.getCurrentNumberOfConnections()

Implements org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.

Definition at line 155 of file SimpleConnectionManager.java.

00156   {
00157     return nbOfConnections;
00158   }

String org.objectweb.cjdbc.controller.connection.SimpleConnectionManager.getXmlImpl  )  [virtual]
 

See also:
org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.getXmlImpl()

Implements org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.

Definition at line 173 of file SimpleConnectionManager.java.

00174   {
00175     return "<" + DatabasesXmlTags.ELT_SimpleConnectionManager + "/>";
00176   }

void org.objectweb.cjdbc.controller.connection.SimpleConnectionManager.initializeConnections  )  throws SQLException [virtual]
 

Does nothing.

See also:
org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.initializeConnections()

Implements org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.

Definition at line 82 of file SimpleConnectionManager.java.

00083   {
00084     initialized = true;
00085   }

void org.objectweb.cjdbc.controller.connection.SimpleConnectionManager.releaseConnection Connection  connection  )  [virtual]
 

Closes the connection.

See also:
org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.releaseConnection(Connection)

Implements org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.

Definition at line 132 of file SimpleConnectionManager.java.

References org.objectweb.cjdbc.common.log.Trace.error().

00133   {
00134     removeConnection();
00135     try
00136     {
00137       connection.close();
00138     }
00139     catch (SQLException e)
00140     {
00141       logger.error("Failed to close connection for '" + backendUrl + "'", e);
00142     }
00143   }


The documentation for this class was generated from the following file:
Generated on Mon Apr 11 22:03:42 2005 for C-JDBC by  doxygen 1.3.9.1