/** * @see javax.sql.ConnectionPoolDataSource#getPooledConnection() */ public PooledConnection getPooledConnection () throws SQLException { checkSetup (); PooledConnection ret = null; XAConnection xaconn = xads_.getXAConnection (); ret = new ExternalXAPooledConnectionImp ( xaconn, getTransactionalResource (), getLogWriter () ); return ret; }
checkSetup ( true ); String query = getValidatingQuery (); if ( query == null || query.equals ( "" ) ) return; LOGGER.logWarning ( "Error in validating query for resource " + getUniqueResourceName (), e ); } finally { if ( c != null )
ds_ = JtaDataSourceImp.getInstance ( getUniqueResourceName () ); return; if ( xads_ == null && ( getXaDataSourceClassName () == null || getXaDataSourceClassName ().length() == 0 ) ) throw new SQLException ( "SimpleDataSourceBean: xaDataSourceClassName not set." ); Class xadsClass = ClassLoadingHelper.loadClass ( getXaDataSourceClassName() ); xads_ = (XADataSource) xadsClass.newInstance (); BeanInspector inspector = new BeanInspector ( xads_ ); Properties p = parseProperties (); Enumeration names = p.propertyNames (); while ( names.hasMoreElements () ) { LOGGER.logWarning ( "SimpleDataSourceBean: could not configure XADataSource of class " + getXaDataSourceClassName (), e ); throw new SQLException ( "Could not configure XADataSource: " + e.getMessage () + " " + e.getClass ().getName () );
/** * Init method to setup the bean for recovery * and other init stuff. * @throws SQLException * */ public void init() throws SQLException { checkSetup ( false ); }
private synchronized void checkSetup () throws SQLException { checkSetup ( false ); }
/** * @see javax.sql.ConnectionPoolDataSource#getPooledConnection(java.lang.String, * java.lang.String) */ public PooledConnection getPooledConnection ( String user , String pw ) throws SQLException { PooledConnection ret = null; checkSetup (); XAConnection xaconn = xads_.getXAConnection ( user, pw ); ret = new ExternalXAPooledConnectionImp ( xaconn, getTransactionalResource (), getLogWriter () ); return ret; }
/** * @see com.atomikos.jdbc.HeuristicDataSource */ public Connection getConnection () throws SQLException { checkSetup (); return ds_.getConnection (); }
/** * @see com.atomikos.jdbc.HeuristicDataSource */ public void setLoginTimeout ( int seconds ) throws SQLException { checkSetup (); ds_.setLoginTimeout ( seconds ); }
/** * @see com.atomikos.jdbc.HeuristicDataSource */ public int getLoginTimeout () throws SQLException { checkSetup (); return ds_.getLoginTimeout (); }
/** * @see com.atomikos.jdbc.HeuristicDataSource */ public Connection getConnection ( String user , String pw ) throws SQLException { checkSetup (); return ds_.getConnection ( user, pw ); }
/** * @see com.atomikos.jdbc.HeuristicDataSource */ public Connection getConnection ( HeuristicMessage msg ) throws SQLException { checkSetup (); return ds_.getConnection ( msg ); }
/** * @see com.atomikos.jdbc.HeuristicDataSource */ public Connection getConnection ( String user , String pw , HeuristicMessage msg ) throws SQLException { checkSetup (); return ds_.getConnection ( user, pw, msg ); }
/** * @see com.atomikos.jdbc.HeuristicDataSource */ public void setLogWriter ( PrintWriter out ) throws SQLException { checkSetup (); ds_.setLogWriter ( out ); }
/** * @see com.atomikos.jdbc.HeuristicDataSource */ public Connection getConnection ( String msg ) throws SQLException { checkSetup (); return ds_.getConnection ( msg ); }
/** * @see com.atomikos.jdbc.HeuristicDataSource */ public Connection getConnection ( String user , String passwd , String msg ) throws SQLException { checkSetup (); return ds_.getConnection ( user, passwd, msg ); }
/** * @see com.atomikos.jdbc.HeuristicDataSource */ public PrintWriter getLogWriter () throws SQLException { checkSetup (); return ds_.getLogWriter (); }
/** * Get the transactional resource. * * @return TransactionalResource The resource as it is used by the * transaction service during recovery. */ protected TransactionalResource getTransactionalResource () { try { checkSetup (); } catch ( SQLException err ) { err.printStackTrace (); throw new RuntimeException ( err.getMessage () ); } return ds_.getTransactionalResource (); }