DSManagedConnectionFactorypublic class DSManagedConnectionFactory extends ManagedConnectionFactory Data Source ManagedConnectionFactory implementation for Generic JDBC Connector. |
Fields Summary |
---|
private transient DataSource | dataSourceObj | private static Logger | _logger |
Methods Summary |
---|
public javax.resource.spi.ManagedConnection | createManagedConnection(javax.security.auth.Subject subject, javax.resource.spi.ConnectionRequestInfo cxRequestInfo)Creates a new physical connection to the underlying EIS resource
manager.
_logger = LogDomains.getLogger(LogDomains.RSR_LOGGER);
if (logWriter != null) {
logWriter.println("In createManagedConnection");
}
PasswordCredential pc = SecurityUtils.getPasswordCredential(this, subject, cxRequestInfo);
javax.sql.DataSource dataSource = getDataSource();
java.sql.Connection dsConn = null;
try {
/* For the case where the user/passwd of the connection pool is
* equal to the PasswordCredential for the connection request
* get a connection from this pool directly.
* for all other conditions go create a new connection
*/
if (isEqual(pc, getUser(), getPassword())) {
dsConn = dataSource.getConnection();
} else {
dsConn = dataSource.getConnection(pc.getUserName(),
new String(pc.getPassword()));
}
} catch (java.sql.SQLException sqle) {
//_logger.log(Level.WARNING, "jdbc.exc_create_conn", sqle.getMessage());
_logger.log(Level.FINE, "jdbc.exc_create_conn", sqle.getMessage());
StringManager localStrings =
StringManager.getManager(DataSourceObjectBuilder.class);
String msg = localStrings.getString("jdbc.cannot_allocate_connection"
, sqle.getMessage());
ResourceAllocationException rae = new ResourceAllocationException(msg);
rae.initCause(sqle);
throw rae;
}
com.sun.gjc.spi.ManagedConnection mc = constructManagedConnection(
null, dsConn, pc, this);
//GJCINT
validateAndSetIsolation(mc);
return mc;
| public boolean | equals(java.lang.Object other)Check if this ManagedConnectionFactory is equal to
another ManagedConnectionFactory .
if (logWriter != null) {
logWriter.println("In equals");
}
/**
* The check below means that two ManagedConnectionFactory objects are equal
* if and only if their properties are the same.
*/
if (other instanceof com.sun.gjc.spi.DSManagedConnectionFactory) {
com.sun.gjc.spi.DSManagedConnectionFactory otherMCF =
(com.sun.gjc.spi.DSManagedConnectionFactory) other;
return this.spec.equals(otherMCF.spec);
}
return false;
| public javax.sql.DataSource | getDataSource()Returns the underlying datasource
if (dataSourceObj == null) {
try {
dataSourceObj = (javax.sql.DataSource) super.getDataSource();
} catch (ClassCastException cce) {
_logger.log(Level.SEVERE, "jdbc.exc_cce", cce);
throw new ResourceException(cce.getMessage());
}
}
return dataSourceObj;
|
|