FileDocCategorySizeDatePackage
ManagedConnectionMetaData.javaAPI DocGlassfish v2 API5555Fri May 04 22:36:04 BST 2007com.sun.gjc.spi

ManagedConnectionMetaData

public class ManagedConnectionMetaData extends Object implements javax.resource.spi.ManagedConnectionMetaData
ManagedConnectionMetaData implementation for Generic JDBC Connector.
author
Evani Sai Surya Kiran
version
1.0, 02/08/03

Fields Summary
private DatabaseMetaData
dmd
private com.sun.gjc.spi.ManagedConnection
mc
private static Logger
_logger
private boolean
debug
Constructors Summary
public ManagedConnectionMetaData(com.sun.gjc.spi.ManagedConnection mc)
Constructor for ManagedConnectionMetaData

param
mc ManagedConnection
throws
ResourceException if getting the DatabaseMetaData object fails


                       
         
        try {
            this.mc = mc;
            dmd = mc.getActualConnection().getMetaData();
        } catch (SQLException sqle) {
            _logger.log(Level.SEVERE, "jdbc.exc_md", sqle);
            throw new ResourceException(sqle.getMessage());
        }
    
Methods Summary
public java.lang.StringgetEISProductName()
Returns product name of the underlying EIS instance connected through the ManagedConnection.

return
Product name of the EIS instance
throws
ResourceException

        try {
            return dmd.getDatabaseProductName();
        } catch (SQLException sqle) {
            _logger.log(Level.SEVERE, "jdbc.exc_eis_prodname", sqle);
            throw new ResourceException(sqle.getMessage());
        }
    
public java.lang.StringgetEISProductVersion()
Returns product version of the underlying EIS instance connected through the ManagedConnection.

return
Product version of the EIS instance
throws
ResourceException

        try {
            return dmd.getDatabaseProductVersion();
        } catch (SQLException sqle) {
            _logger.log(Level.SEVERE, "jdbc.exc_eis_prodvers", sqle);
            throw new ResourceException(sqle.getMessage(), sqle.getMessage());
        }
    
public intgetMaxConnections()
Returns maximum limit on number of active concurrent connections that an EIS instance can support across client processes.

return
Maximum limit for number of active concurrent connections
throws
ResourceException

        try {
            return dmd.getMaxConnections();
        } catch (SQLException sqle) {
            _logger.log(Level.SEVERE, "jdbc.exc_eis_maxconn");
            throw new ResourceException(sqle.getMessage());
        }
    
public java.lang.StringgetUserName()
Returns name of the user associated with the ManagedConnection instance. The name corresponds to the resource principal under whose whose security context, a connection to the EIS instance has been established.

return
name of the user
throws
ResourceException

        javax.resource.spi.security.PasswordCredential pc = mc.getPasswordCredential();
        if (pc != null) {
            return pc.getUserName();
        }

        return mc.getManagedConnectionFactory().getUser();