User: patriot1burke
Date: 01/07/03 15:56:19
Modified:src/main/org/jboss/pool/jdbc/xa XAPoolDataSource.java
XAConnectionFactory.java
Log:
added support for setting transaction isolation and setting the PS cache size.
Revision ChangesPath
1.3 +215 -208 jbosspool/src/main/org/jboss/pool/jdbc/xa/XAPoolDataSource.java
Index: XAPoolDataSource.java
===
RCS file:
/cvsroot/jboss/jbosspool/src/main/org/jboss/pool/jdbc/xa/XAPoolDataSource.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XAPoolDataSource.java 2001/07/02 03:20:08 1.2
+++ XAPoolDataSource.java 2001/07/03 22:56:19 1.3
@@ -23,217 +23,224 @@
*
* @author Aaron Mulder ([EMAIL PROTECTED])
* @author a href=mailto:[EMAIL PROTECTED];danch (Dan Christopherson)/a
+ * @author a href=mailto:[EMAIL PROTECTED];Bill Burke/a
*
* Revision:
* 20010701 danch added code for timeout in blocking.
+ * 20010703 bill added code for transaction isolation and setting the ps cache size
*/
public class XAPoolDataSource implements DataSource, Referenceable, ObjectFactory {
-private static HashMap sources = new HashMap();
-/**
- * Gets all the current JDBC pool data sources.
- */
-public static Collection getDataSources() {
-return new HashSet(sources.values());
-}
-/**
- * Gets a specific JDBC pool data source by pool name.
- */
-public static XAPoolDataSource getDataSource(String poolName) {
-return (XAPoolDataSource)sources.get(poolName);
-}
-
-
-private ObjectPool pool;
-private XAConnectionFactory factory;
-private PrintWriter logWriter;
-private int timeout;
-private boolean initialized = false;
-private String jndiName;
-
-/**
- * Creates a new XA pool data source. Be sure to configure it and then
- * call initialize before you try to use it.
- */
-public XAPoolDataSource() {
-pool = new ObjectPool();
-try {
-factory = new XAConnectionFactory();
-} catch(NamingException e) {
-e.printStackTrace();
-}
-XAPoolDriver.instance();
-}
-
-// Unique properties
-/**
- * If you use this to set a JNDI name, this pool will be bound to that name
- * using the default InitialContext. You can also do this manually if you
- * have additional requirements.
- */
-public void setJNDIName(String name) throws NamingException {
-InitialContext ctx = new InitialContext();
-if(jndiName != null !jndiName.equals(name))
-ctx.unbind(jndiName);
-if(name != null)
-ctx.bind(name, this);
-jndiName = name;
-}
-
-/**
- * Gets the JNDI name this pool is bound to. Only valid if you used
- * setJNDIName to bind it.
- * @see #setJNDIName
- */
-public String getJNDIName() {return jndiName;}
-
-// XA properties
-public void setDataSource(XADataSource ds) {factory.setDataSource(ds);}
-public XADataSource getDataSource() {return factory.getDataSource();}
-public void setTransactionManagerJNDIName(String name)
{factory.setTransactionManagerJNDIName(name);}
-public String getTransactionManagerJNDIName() {return
factory.getTransactionManagerJNDIName();}
-public void setJDBCUser(String user) {factory.setUser(user);}
-public String getJDBCUser() {return factory.getUser();}
-public void setJDBCPassword(String password) {factory.setPassword(password);}
-public String getJDBCPassword() {return factory.getPassword();}
-// Pool properties
-public void setPoolName(String name) {
-pool.setName(name);
-sources.put(pool.getName(), this);
-}
-public String getPoolName() {return pool.getName();}
-public void setMinSize(int size) {pool.setMinSize(size);}
-public int getMinSize() {return pool.getMinSize();}
-public void setMaxSize(int size) {pool.setMaxSize(size);}
-public int getMaxSize() {return pool.getMaxSize();}
-public void setBlocking(boolean blocking) {pool.setBlocking(blocking);}
-public boolean isBlocking() {return pool.isBlocking();}
-public void setBlockingTimeout(int blockingTimeout)
{pool.setBlockingTimeout(blockingTimeout);}
-public int getBlockingTimeout() {return pool.getBlockingTimeout();}
-public void setIdleTimeoutEnabled(boolean allowShrinking)
{pool.setIdleTimeoutEnabled(allowShrinking);}
-public boolean isIdleTimeoutEnabled() {return pool.isIdleTimeoutEnabled();}
-public void setGCEnabled(boolean allowGC) {pool.setGCEnabled(allowGC);}
-public boolean isGCEnabled() {return pool.isGCEnabled();}
-public void