1 21 22 package org.apache.derby.jdbc; 23 24 import java.sql.SQLException ; 25 import javax.sql.DataSource ; 26 import javax.sql.XAConnection ; 27 import org.apache.derby.client.ClientXAConnection40; 28 import org.apache.derby.client.am.ClientMessageId; 29 import org.apache.derby.client.am.SqlException; 30 import org.apache.derby.client.net.NetLogWriter; 31 import org.apache.derby.shared.common.reference.SQLState; 32 33 53 public class ClientXADataSource40 extends ClientXADataSource { 54 55 61 public XAConnection getXAConnection(String user, String password) throws SQLException { 62 try { 63 NetLogWriter dncLogWriter = (NetLogWriter) 64 super.computeDncLogWriterForNewConnection("_xads"); 65 return new ClientXAConnection40 (this, dncLogWriter, user, password); 66 } catch ( SqlException se ) { 67 throw se.getSQLException(); 68 } 69 } 70 71 82 public boolean isWrapperFor(Class <?> interfaces) throws SQLException { 83 return interfaces.isInstance(this); 84 } 85 86 94 public <T> T unwrap(java.lang.Class <T> interfaces) 95 throws SQLException { 96 try { 97 return interfaces.cast(this); 98 } catch (ClassCastException cce) { 99 throw new SqlException(null,new ClientMessageId( 100 SQLState.UNABLE_TO_UNWRAP), interfaces).getSQLException(); 101 } 102 } 103 } 104 | Popular Tags |