derbyclient

16:35:11.380 INFO  jd.cli.Main - Decompiling derbyclient.jar
package org.apache.derby.client;

import java.lang.reflect.Method;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Locale;
import javax.naming.Context;
import javax.naming.Name;
import javax.naming.RefAddr;
import javax.naming.Reference;
import javax.naming.spi.ObjectFactory;

public class ClientDataSourceFactory
  implements ObjectFactory
{
  private static final Class[] STRING_ARG = { "".getClass() };
  private static final Class[] INT_ARG = { Integer.TYPE };
  private static final Class[] BOOLEAN_ARG = { Boolean.TYPE };
  private static final Class[] SHORT_ARG = { Short.TYPE };
  
  public Object getObjectInstance(Object paramObject, Name paramName, Context paramContext, Hashtable paramHashtable)
    throws Exception
  {
    Object localObject = null;
    if ((paramObject instanceof Reference))
    {
      Reference localReference = (Reference)paramObject;
      String str = localReference.getClassName();
      if ((str != null) && (str.startsWith("org.apache.derby.jdbc.Client")))
      {
        localObject = Class.forName(str).newInstance();
        setBeanProperties(localObject, localReference);
      }
    }
    return localObject;
  }
  
  private static void setBeanProperties(Object paramObject, Reference paramReference)
    throws Exception
  {
    Enumeration localEnumeration = paramReference.getAll();
    while (localEnumeration.hasMoreElements())
    {
      RefAddr localRefAddr = (RefAddr)localEnumeration.nextElement();
      String str1 = localRefAddr.getType();
      String str2 = (String)localRefAddr.getContent();
      String str3 = "set" + str1.substring(0, 1).toUpperCase(Locale.ENGLISH) + str1.substring(1);
      Method localMethod;
      Object localObject;
      try
      {
        localMethod = paramObject.getClass().getMethod(str3, STRING_ARG);
        localObject = str2;
      }
      catch (NoSuchMethodException localNoSuchMethodException1)
      {
        try
        {
          localMethod = paramObject.getClass().getMethod(str3, INT_ARG);
          localObject = Integer.valueOf(str2);
        }
        catch (NoSuchMethodException localNoSuchMethodException2)
        {
          try
          {
            localMethod = paramObject.getClass().getMethod(str3, BOOLEAN_ARG);
            localObject = Boolean.valueOf(str2);
          }
          catch (NoSuchMethodException localNoSuchMethodException3)
          {
            localMethod = paramObject.getClass().getMethod(str3, SHORT_ARG);
            localObject = Short.valueOf(str2);
          }
        }
      }
      localMethod.invoke(paramObject, new Object[] { localObject });
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.derby.client.ClientDataSourceFactory
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.derby.client;

import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Iterator;
import javax.sql.ConnectionEvent;
import javax.sql.ConnectionEventListener;
import javax.sql.PooledConnection;
import org.apache.derby.client.am.Agent;
import org.apache.derby.client.am.ClientJDBCObjectFactory;
import org.apache.derby.client.am.ClientMessageId;
import org.apache.derby.client.am.LogWriter;
import org.apache.derby.client.am.LogicalConnection;
import org.apache.derby.client.am.SqlException;
import org.apache.derby.client.am.stmtcache.JDBCStatementCache;
import org.apache.derby.client.net.NetConnection;
import org.apache.derby.client.net.NetLogWriter;
import org.apache.derby.client.net.NetXAConnection;
import org.apache.derby.jdbc.ClientBaseDataSource;
import org.apache.derby.jdbc.ClientDriver;

public class ClientPooledConnection
  implements PooledConnection
{
  private boolean newPC_ = true;
  private ArrayList listeners_ = new ArrayList();
  private int eventIterators;
  org.apache.derby.client.am.Connection physicalConnection_ = null;
  NetConnection netPhysicalConnection_ = null;
  NetXAConnection netXAPhysicalConnection_ = null;
  private final JDBCStatementCache statementCache;
  LogicalConnection logicalConnection_ = null;
  protected LogWriter logWriter_ = null;
  protected int rmId_ = 0;
  
  public ClientPooledConnection(ClientBaseDataSource paramClientBaseDataSource, LogWriter paramLogWriter, String paramString1, String paramString2)
    throws SQLException
  {
    logWriter_ = paramLogWriter;
    if (paramClientBaseDataSource.maxStatementsToPool() <= 0) {
      statementCache = null;
    } else {
      statementCache = new JDBCStatementCache(paramClientBaseDataSource.maxStatementsToPool());
    }
    try
    {
      netPhysicalConnection_ = ((NetConnection)ClientDriver.getFactory().newNetConnection((NetLogWriter)logWriter_, paramString1, paramString2, paramClientBaseDataSource, -1, false, this));
    }
    catch (SqlException localSqlException)
    {
      throw localSqlException.getSQLException();
    }
    physicalConnection_ = netPhysicalConnection_;
  }
  
  public ClientPooledConnection(ClientBaseDataSource paramClientBaseDataSource, LogWriter paramLogWriter, String paramString1, String paramString2, int paramInt)
    throws SQLException
  {
    logWriter_ = paramLogWriter;
    rmId_ = paramInt;
    if (paramClientBaseDataSource.maxStatementsToPool() <= 0) {
      statementCache = null;
    } else {
      statementCache = null;
    }
    try
    {
      netXAPhysicalConnection_ = getNetXAConnection(paramClientBaseDataSource, (NetLogWriter)logWriter_, paramString1, paramString2, paramInt);
    }
    catch (SqlException localSqlException)
    {
      throw localSqlException.getSQLException();
    }
    physicalConnection_ = netXAPhysicalConnection_.getNetConnection();
  }
  
  public boolean isStatementPoolingEnabled()
  {
    return statementCache != null;
  }
  
  protected void finalize()
    throws Throwable
  {
    if (logWriter_ != null) {
      logWriter_.traceEntry(this, "finalize");
    }
    close();
  }
  
  public synchronized void close()
    throws SQLException
  {
    try
    {
      if (logWriter_ != null) {
        logWriter_.traceEntry(this, "close");
      }
      if (logicalConnection_ != null)
      {
        logicalConnection_.nullPhysicalConnection();
        logicalConnection_ = null;
      }
      if (physicalConnection_ == null) {
        return;
      }
      physicalConnection_.closeResources();
    }
    finally
    {
      physicalConnection_ = null;
    }
  }
  
  public synchronized java.sql.Connection getConnection()
    throws SQLException
  {
    try
    {
      if (logWriter_ != null) {
        logWriter_.traceEntry(this, "getConnection");
      }
      createLogicalConnection();
      if (!newPC_) {
        physicalConnection_.reset(logWriter_);
      } else {
        physicalConnection_.lightReset();
      }
      newPC_ = false;
      if (logWriter_ != null) {
        logWriter_.traceExit(this, "getConnection", logicalConnection_);
      }
      return logicalConnection_;
    }
    catch (SqlException localSqlException)
    {
      throw localSqlException.getSQLException();
    }
  }
  
  private void createLogicalConnection()
    throws SqlException
  {
    if (physicalConnection_ == null) {
      throw new SqlException(logWriter_, new ClientMessageId("08003.C.1"));
    }
    try
    {
      if (physicalConnection_.transactionInProgress()) {
        physicalConnection_.rollback();
      }
    }
    catch (SQLException localSQLException)
    {
      throw new SqlException(localSQLException);
    }
    if (logicalConnection_ != null) {
      logicalConnection_.closeWithoutRecyclingToPool();
    }
    if (statementCache == null) {
      logicalConnection_ = ClientDriver.getFactory().newLogicalConnection(physicalConnection_, this);
    } else {
      logicalConnection_ = ClientDriver.getFactory().newCachingLogicalConnection(physicalConnection_, this, statementCache);
    }
  }
  
  public synchronized void addConnectionEventListener(ConnectionEventListener paramConnectionEventListener)
  {
    if (logWriter_ != null) {
      logWriter_.traceEntry(this, "addConnectionEventListener", paramConnectionEventListener);
    }
    if (paramConnectionEventListener == null) {
      return;
    }
    if (eventIterators > 0) {
      listeners_ = ((ArrayList)listeners_.clone());
    }
    listeners_.add(paramConnectionEventListener);
  }
  
  public synchronized void removeConnectionEventListener(ConnectionEventListener paramConnectionEventListener)
  {
    if (logWriter_ != null) {
      logWriter_.traceEntry(this, "removeConnectionEventListener", paramConnectionEventListener);
    }
    if (eventIterators > 0) {
      listeners_ = ((ArrayList)listeners_.clone());
    }
    listeners_.remove(paramConnectionEventListener);
  }
  
  public synchronized void recycleConnection()
  {
    if (physicalConnection_.agent_.loggingEnabled()) {
      physicalConnection_.agent_.logWriter_.traceEntry(this, "recycleConnection");
    }
    logicalConnection_ = null;
    fireConnectionEventListeners(null);
  }
  
  public void informListeners(SqlException paramSqlException)
  {
    if (paramSqlException.getErrorCode() < 40000) {
      return;
    }
    synchronized (this)
    {
      fireConnectionEventListeners(paramSqlException);
    }
  }
  
  private void fireConnectionEventListeners(SqlException paramSqlException)
  {
    if (!listeners_.isEmpty())
    {
      ConnectionEvent localConnectionEvent = paramSqlException == null ? new ConnectionEvent(this) : new ConnectionEvent(this, paramSqlException.getSQLException());
      eventIterators += 1;
      try
      {
        Iterator localIterator = listeners_.iterator();
        while (localIterator.hasNext())
        {
          ConnectionEventListener localConnectionEventListener = (ConnectionEventListener)localIterator.next();
          if (paramSqlException == null) {
            localConnectionEventListener.connectionClosed(localConnectionEvent);
          } else {
            localConnectionEventListener.connectionErrorOccurred(localConnectionEvent);
          }
        }
      }
      finally
      {
        eventIterators -= 1;
      }
    }
  }
  
  public synchronized void nullLogicalConnection()
  {
    logicalConnection_ = null;
  }
  
  public void onStatementClose(PreparedStatement paramPreparedStatement) {}
  
  public void onStatementErrorOccurred(PreparedStatement paramPreparedStatement, SQLException paramSQLException) {}
  
  protected NetXAConnection getNetXAConnection(ClientBaseDataSource paramClientBaseDataSource, NetLogWriter paramNetLogWriter, String paramString1, String paramString2, int paramInt)
    throws SqlException
  {
    return new NetXAConnection(paramNetLogWriter, paramString1, paramString2, paramClientBaseDataSource, paramInt, true, this);
  }
}

/* Location:
 * Qualified Name:     org.apache.derby.client.ClientPooledConnection
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.derby.client;

import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Iterator;
import java.util.concurrent.CopyOnWriteArrayList;
import javax.sql.StatementEvent;
import javax.sql.StatementEventListener;
import org.apache.derby.client.am.LogWriter;
import org.apache.derby.jdbc.ClientBaseDataSource;

public class ClientPooledConnection40
  extends ClientPooledConnection
{
  private final CopyOnWriteArrayList<StatementEventListener> statementEventListeners = new CopyOnWriteArrayList();
  
  public ClientPooledConnection40(ClientBaseDataSource paramClientBaseDataSource, LogWriter paramLogWriter, String paramString1, String paramString2)
    throws SQLException
  {
    super(paramClientBaseDataSource, paramLogWriter, paramString1, paramString2);
  }
  
  public ClientPooledConnection40(ClientBaseDataSource paramClientBaseDataSource, LogWriter paramLogWriter, String paramString1, String paramString2, int paramInt)
    throws SQLException
  {
    super(paramClientBaseDataSource, paramLogWriter, paramString1, paramString2, paramInt);
  }
  
  public void addStatementEventListener(StatementEventListener paramStatementEventListener)
  {
    if (logWriter_ != null) {
      logWriter_.traceEntry(this, "addStatementEventListener", paramStatementEventListener);
    }
    if (paramStatementEventListener != null) {
      statementEventListeners.add(paramStatementEventListener);
    }
  }
  
  public void removeStatementEventListener(StatementEventListener paramStatementEventListener)
  {
    if (logWriter_ != null) {
      logWriter_.traceEntry(this, "removeConnectionEventListener", paramStatementEventListener);
    }
    statementEventListeners.remove(paramStatementEventListener);
  }
  
  public void onStatementClose(PreparedStatement paramPreparedStatement)
  {
    if (!statementEventListeners.isEmpty())
    {
      StatementEvent localStatementEvent = new StatementEvent(this, paramPreparedStatement);
      Iterator localIterator = statementEventListeners.iterator();
      while (localIterator.hasNext())
      {
        StatementEventListener localStatementEventListener = (StatementEventListener)localIterator.next();
        localStatementEventListener.statementClosed(localStatementEvent);
      }
    }
  }
  
  public void onStatementErrorOccurred(PreparedStatement paramPreparedStatement, SQLException paramSQLException)
  {
    if (!statementEventListeners.isEmpty())
    {
      StatementEvent localStatementEvent = new StatementEvent(this, paramPreparedStatement, paramSQLException);
      Iterator localIterator = statementEventListeners.iterator();
      while (localIterator.hasNext())
      {
        StatementEventListener localStatementEventListener = (StatementEventListener)localIterator.next();
        localStatementEventListener.statementErrorOccurred(localStatementEvent);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.derby.client.ClientPooledConnection40
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.derby.client;

import java.sql.Connection;
import java.sql.SQLException;
import javax.sql.XAConnection;
import javax.transaction.xa.XAResource;
import org.apache.derby.client.am.ClientMessageId;
import org.apache.derby.client.am.LogWriter;
import org.apache.derby.client.am.SqlException;
import org.apache.derby.client.net.NetConnection;
import org.apache.derby.client.net.NetLogWriter;
import org.apache.derby.client.net.NetXAConnection;
import org.apache.derby.client.net.NetXAResource;
import org.apache.derby.jdbc.ClientDataSource;
import org.apache.derby.jdbc.ClientXADataSource;

public class ClientXAConnection
  extends ClientPooledConnection
  implements XAConnection
{
  private static int rmIdSeed_ = 95688932;
  private ClientXADataSource derbyds_ = null;
  private XAResource xares_ = null;
  private NetXAResource netXares_ = null;
  private boolean fFirstGetConnection_ = true;
  private Connection logicalCon_;
  private NetXAConnection controlCon_ = null;
  
  public ClientXAConnection(ClientXADataSource paramClientXADataSource, NetLogWriter paramNetLogWriter, String paramString1, String paramString2)
    throws SQLException
  {
    super(paramClientXADataSource, paramNetLogWriter, paramString1, paramString2, getUnigueRmId());
    derbyds_ = paramClientXADataSource;
    logicalCon_ = super.getConnection();
    netXares_ = new NetXAResource(this, rmId_, paramString1, paramString2, netXAPhysicalConnection_);
    xares_ = netXares_;
  }
  
  public Connection getConnection()
    throws SQLException
  {
    if (fFirstGetConnection_) {
      fFirstGetConnection_ = false;
    } else {
      logicalCon_ = super.getConnection();
    }
    return logicalCon_;
  }
  
  private static synchronized int getUnigueRmId()
  {
    rmIdSeed_ += 1;
    return rmIdSeed_;
  }
  
  public int getRmId()
  {
    return rmId_;
  }
  
  public XAResource getXAResource()
    throws SQLException
  {
    if (logWriter_ != null) {
      logWriter_.traceExit(this, "getXAResource", xares_);
    }
    if (physicalConnection_ == null) {
      throw new SqlException(logWriter_, new ClientMessageId("08003")).getSQLException();
    }
    return xares_;
  }
  
  public ClientXADataSource getDataSource()
    throws SqlException
  {
    if (logWriter_ != null) {
      logWriter_.traceExit(this, "getDataSource", derbyds_);
    }
    return derbyds_;
  }
  
  public NetXAConnection createControlConnection(NetLogWriter paramNetLogWriter, String paramString1, String paramString2, ClientDataSource paramClientDataSource, int paramInt, boolean paramBoolean)
    throws SQLException
  {
    try
    {
      controlCon_ = new NetXAConnection(paramNetLogWriter, paramString1, paramString2, paramClientDataSource, paramInt, paramBoolean, this);
      controlCon_.getNetConnection().setTransactionIsolation(1);
      if (logWriter_ != null) {
        logWriter_.traceExit(this, "createControlConnection", controlCon_);
      }
      return controlCon_;
    }
    catch (SqlException localSqlException)
    {
      throw localSqlException.getSQLException();
    }
  }
  
  public synchronized void close()
    throws SQLException
  {
    super.close();
  }
}

/* Location:
 * Qualified Name:     org.apache.derby.client.ClientXAConnection
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.derby.client;

import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Iterator;
import java.util.concurrent.CopyOnWriteArrayList;
import javax.sql.StatementEvent;
import javax.sql.StatementEventListener;
import org.apache.derby.client.am.LogWriter;
import org.apache.derby.client.net.NetLogWriter;
import org.apache.derby.jdbc.ClientXADataSource;

public class ClientXAConnection40
  extends ClientXAConnection
{
  private final CopyOnWriteArrayList<StatementEventListener> statementEventListeners = new CopyOnWriteArrayList();
  
  public ClientXAConnection40(ClientXADataSource paramClientXADataSource, NetLogWriter paramNetLogWriter, String paramString1, String paramString2)
    throws SQLException
  {
    super(paramClientXADataSource, paramNetLogWriter, paramString1, paramString2);
  }
  
  public void removeStatementEventListener(StatementEventListener paramStatementEventListener)
  {
    if (logWriter_ != null) {
      logWriter_.traceEntry(this, "removeConnectionEventListener", paramStatementEventListener);
    }
    statementEventListeners.remove(paramStatementEventListener);
  }
  
  public void addStatementEventListener(StatementEventListener paramStatementEventListener)
  {
    if (logWriter_ != null) {
      logWriter_.traceEntry(this, "addStatementEventListener", paramStatementEventListener);
    }
    if (paramStatementEventListener != null) {
      statementEventListeners.add(paramStatementEventListener);
    }
  }
  
  public void onStatementClose(PreparedStatement paramPreparedStatement)
  {
    if (!statementEventListeners.isEmpty())
    {
      StatementEvent localStatementEvent = new StatementEvent(this, paramPreparedStatement);
      Iterator localIterator = statementEventListeners.iterator();
      while (localIterator.hasNext())
      {
        StatementEventListener localStatementEventListener = (StatementEventListener)localIterator.next();
        localStatementEventListener.statementClosed(localStatementEvent);
      }
    }
  }
  
  public void onStatementErrorOccurred(PreparedStatement paramPreparedStatement, SQLException paramSQLException)
  {
    if (!statementEventListeners.isEmpty())
    {
      StatementEvent localStatementEvent = new StatementEvent(this, paramPreparedStatement, paramSQLException);
      Iterator localIterator = statementEventListeners.iterator();
      while (localIterator.hasNext())
      {
        StatementEventListener localStatementEventListener = (StatementEventListener)localIterator.next();
        localStatementEventListener.statementErrorOccurred(localStatementEvent);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.derby.client.ClientXAConnection40
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.derby.client;

import javax.transaction.xa.Xid;
import org.apache.derby.client.net.NetXAResource;

public class ClientXid
  implements Xid
{
  private int formatID_;
  private int gtrid_length_;
  private int bqual_length_;
  private byte[] data_;
  private static final int XidDATASIZE = 128;
  public static final int MAXGTRIDSIZE = 64;
  public static final int MAXBQUALSIZE = 64;
  private static final String hextab_ = "0123456789ABCDEF";
  
  public ClientXid()
  {
    data_ = new byte['?'];
    gtrid_length_ = 0;
    bqual_length_ = 0;
    formatID_ = -1;
  }
  
  public ClientXid(int paramInt, byte[] paramArrayOfByte1, byte[] paramArrayOfByte2)
  {
    formatID_ = paramInt;
    gtrid_length_ = paramArrayOfByte1.length;
    bqual_length_ = paramArrayOfByte2.length;
    data_ = new byte['?'];
    System.arraycopy(paramArrayOfByte1, 0, data_, 0, gtrid_length_);
    System.arraycopy(paramArrayOfByte2, 0, data_, gtrid_length_, bqual_length_);
  }
  
  public String toString()
  {
    int k = gtrid_length_ + bqual_length_;
    StringBuffer localStringBuffer = new StringBuffer(k + k);
    for (int i = 0; i < k; i++)
    {
      int j = data_[i] & 0xFF;
      localStringBuffer.append("0123456789ABCDEF".charAt(j / 16));
      localStringBuffer.append("0123456789ABCDEF".charAt(j & 0xF));
      if (((i + 1) % 4 == 0) && (i + 1 < k)) {
        localStringBuffer.append(" ");
      }
    }
    String str = "{ClientXid: formatID(" + formatID_ + "), " + "gtrid_length(" + gtrid_length_ + "), " + "bqual_length(" + bqual_length_ + "), " + "data(" + localStringBuffer.toString() + ")" + "}";
    return str;
  }
  
  public byte[] getBranchQualifier()
  {
    byte[] arrayOfByte = new byte[bqual_length_];
    System.arraycopy(data_, gtrid_length_, arrayOfByte, 0, bqual_length_);
    return arrayOfByte;
  }
  
  public void setBranchQualifier(byte[] paramArrayOfByte)
  {
    bqual_length_ = (paramArrayOfByte.length > 64 ? 64 : paramArrayOfByte.length);
    System.arraycopy(paramArrayOfByte, 0, data_, gtrid_length_, bqual_length_);
  }
  
  public int getFormatId()
  {
    return formatID_;
  }
  
  public void setFormatID(int paramInt)
  {
    formatID_ = paramInt;
  }
  
  public byte[] getGlobalTransactionId()
  {
    byte[] arrayOfByte = new byte[gtrid_length_];
    System.arraycopy(data_, 0, arrayOfByte, 0, gtrid_length_);
    return arrayOfByte;
  }
  
  public byte[] getData()
  {
    return data_;
  }
  
  public int getGtridLength()
  {
    return gtrid_length_;
  }
  
  public int getBqualLength()
  {
    return bqual_length_;
  }
  
  public int hashCode()
  {
    if (formatID_ == -1) {
      return -1;
    }
    return formatID_ + gtrid_length_ - bqual_length_;
  }
  
  public boolean equals(Object paramObject)
  {
    return NetXAResource.xidsEqual(this, (Xid)paramObject);
  }
}

/* Location:
 * Qualified Name:     org.apache.derby.client.ClientXid
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.derby.client.am;

import java.io.PrintWriter;

public abstract class Agent
{
  public SqlException accumulatedReadExceptions_ = null;
  private boolean enableBatchedExceptionTracking_;
  private int batchedExceptionLabelIndex_;
  private boolean[] batchedExceptionGenerated_;
  Connection connection_;
  public SectionManager sectionManager_ = null;
  public LogWriter logWriter_ = null;
  final CrossConverters crossConverters_;
  SqlException deferredException_;
  
  void checkForDeferredExceptions()
    throws SqlException
  {
    if (deferredException_ != null)
    {
      SqlException localSqlException = deferredException_;
      deferredException_ = null;
      throw localSqlException;
    }
  }
  
  public void accumulateDeferredException(SqlException paramSqlException)
  {
    if (deferredException_ == null) {
      deferredException_ = paramSqlException;
    } else {
      deferredException_.setNextException(paramSqlException);
    }
  }
  
  protected Agent(Connection paramConnection, LogWriter paramLogWriter)
  {
    connection_ = paramConnection;
    logWriter_ = paramLogWriter;
    crossConverters_ = new CrossConverters(this);
  }
  
  protected void resetAgent(LogWriter paramLogWriter)
  {
    accumulatedReadExceptions_ = null;
    enableBatchedExceptionTracking_ = false;
    batchedExceptionLabelIndex_ = 0;
    batchedExceptionGenerated_ = null;
    logWriter_ = paramLogWriter;
    deferredException_ = null;
  }
  
  public void resetAgent(Connection paramConnection, LogWriter paramLogWriter, int paramInt1, String paramString, int paramInt2)
    throws SqlException
  {
    resetAgent(paramLogWriter);
    resetAgent_(paramLogWriter, paramInt1, paramString, paramInt2);
  }
  
  protected abstract void resetAgent_(LogWriter paramLogWriter, int paramInt1, String paramString, int paramInt2)
    throws SqlException;
  
  public final boolean loggingEnabled()
  {
    return (!Configuration.traceSuspended__) && (logWriter_ != null);
  }
  
  public final void setLogWriter(LogWriter paramLogWriter)
  {
    synchronized (connection_)
    {
      if (logWriter_ != null) {
        logWriter_.close();
      }
      logWriter_ = paramLogWriter;
    }
  }
  
  public final PrintWriter getLogWriter()
  {
    return logWriter_ == null ? null : logWriter_.printWriter_;
  }
  
  public abstract LogWriter newLogWriter_(PrintWriter paramPrintWriter, int paramInt);
  
  public final void accumulateReadException(SqlException paramSqlException)
  {
    if (enableBatchedExceptionTracking_)
    {
      batchedExceptionGenerated_[batchedExceptionLabelIndex_] = true;
      labelAsBatchedException(paramSqlException, batchedExceptionLabelIndex_);
    }
    if (accumulatedReadExceptions_ == null) {
      accumulatedReadExceptions_ = paramSqlException;
    } else {
      accumulatedReadExceptions_.setNextException(paramSqlException);
    }
  }
  
  public final void accumulateDisconnectException(DisconnectException paramDisconnectException)
  {
    if (enableBatchedExceptionTracking_)
    {
      batchedExceptionGenerated_[batchedExceptionLabelIndex_] = true;
      labelAsBatchedException(paramDisconnectException, batchedExceptionLabelIndex_);
    }
    if (accumulatedReadExceptions_ != null) {
      paramDisconnectException.setNextException(accumulatedReadExceptions_);
    }
    accumulatedReadExceptions_ = null;
  }
  
  public final void accumulateChainBreakingReadExceptionAndThrow(DisconnectException paramDisconnectException)
    throws DisconnectException
  {
    accumulateDisconnectException(paramDisconnectException);
    markChainBreakingException_();
    throw paramDisconnectException;
  }
  
  protected abstract void markChainBreakingException_();
  
  public abstract void checkForChainBreakingException_()
    throws SqlException;
  
  private final void enableBatchedExceptionTracking(int paramInt)
  {
    enableBatchedExceptionTracking_ = true;
    batchedExceptionGenerated_ = new boolean[paramInt];
    batchedExceptionLabelIndex_ = 0;
  }
  
  final void disableBatchedExceptionTracking()
  {
    enableBatchedExceptionTracking_ = false;
  }
  
  public final void setBatchedExceptionLabelIndex(int paramInt)
  {
    batchedExceptionLabelIndex_ = paramInt;
  }
  
  private final SqlException labelAsBatchedException(SqlException paramSqlException, int paramInt)
  {
    SqlException localSqlException = paramSqlException;
    while (paramSqlException != null)
    {
      paramSqlException.setBatchPositionLabel(paramInt);
      paramSqlException = paramSqlException.getNextException();
    }
    return localSqlException;
  }
  
  protected final void checkForExceptions()
    throws SqlException
  {
    if (accumulatedReadExceptions_ != null)
    {
      SqlException localSqlException = accumulatedReadExceptions_;
      accumulatedReadExceptions_ = null;
      throw localSqlException;
    }
  }
  
  final boolean batchUpdateExceptionGenerated()
  {
    return batchedExceptionGenerated_[batchedExceptionLabelIndex_];
  }
  
  public final void flow(Statement paramStatement)
    throws SqlException
  {
    endWriteChain();
    flush_();
    beginReadChain(paramStatement);
  }
  
  public final void flowBatch(Statement paramStatement, int paramInt)
    throws SqlException
  {
    endBatchedWriteChain();
    flush_();
    beginBatchedReadChain(paramStatement, paramInt);
  }
  
  public final void flowOutsideUOW()
    throws SqlException
  {
    endWriteChain();
    flush_();
    beginReadChainOutsideUOW();
  }
  
  public abstract void flush_()
    throws DisconnectException;
  
  public abstract void close_()
    throws SqlException;
  
  public void close()
    throws SqlException
  {
    close_();
    if (logWriter_ != null) {
      logWriter_.close();
    }
  }
  
  public final void disconnectEvent()
  {
    try
    {
      close();
    }
    catch (SqlException localSqlException) {}
    connection_.completeChainBreakingDisconnect();
  }
  
  public void beginWriteChainOutsideUOW()
    throws SqlException
  {}
  
  public void beginWriteChain(Statement paramStatement)
    throws SqlException
  {
    connection_.writeTransactionStart(paramStatement);
  }
  
  public final void beginBatchedWriteChain(Statement paramStatement)
    throws SqlException
  {
    beginWriteChain(paramStatement);
  }
  
  protected void endWriteChain() {}
  
  protected final void endBatchedWriteChain() {}
  
  protected void beginReadChain(Statement paramStatement)
    throws SqlException
  {
    connection_.readTransactionStart();
  }
  
  protected final void beginBatchedReadChain(Statement paramStatement, int paramInt)
    throws SqlException
  {
    enableBatchedExceptionTracking(paramInt);
    beginReadChain(paramStatement);
  }
  
  protected void beginReadChainOutsideUOW()
    throws SqlException
  {}
  
  public void endReadChain()
    throws SqlException
  {
    checkForExceptions();
  }
  
  public final void endBatchedReadChain(int[] paramArrayOfInt, SqlException paramSqlException)
    throws BatchUpdateException
  {
    disableBatchedExceptionTracking();
    for (int i = 0; i < batchedExceptionGenerated_.length; i++) {
      if (batchedExceptionGenerated_[i] != 0) {
        paramArrayOfInt[i] = -3;
      }
    }
    if (paramSqlException == null) {
      try
      {
        endReadChain();
      }
      catch (SqlException localSqlException)
      {
        paramSqlException = localSqlException;
      }
    }
    if (paramSqlException != null) {
      throw new BatchUpdateException(logWriter_, new ClientMessageId("XJ208.S"), null, paramArrayOfInt, paramSqlException);
    }
  }
}

/* Location:
 * Qualified Name:     org.apache.derby.client.am.Agent
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.derby.client.am;

import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.io.StringReader;

public class AsciiStream
  extends InputStream
{
  private Reader reader_;
  private String materializedString_;
  private int charsRead_ = 0;
  
  public AsciiStream(String paramString)
  {
    this(paramString, new StringReader(paramString));
  }
  
  public AsciiStream(String paramString, Reader paramReader)
  {
    reader_ = paramReader;
    materializedString_ = paramString;
  }
  
  public int read()
    throws IOException
  {
    int i = reader_.read();
    charsRead_ += 1;
    if (i != -1)
    {
      if (i <= 255) {
        return i;
      }
      return 63;
    }
    return -1;
  }
  
  public int available()
  {
    return materializedString_.length() - charsRead_;
  }
}

/* Location:
 * Qualified Name:     org.apache.derby.client.am.AsciiStream
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.derby.client.am;

import org.apache.derby.shared.common.error.ExceptionUtil;
import org.apache.derby.shared.common.i18n.MessageUtil;

public class BatchUpdateException
  extends java.sql.BatchUpdateException
{
  private static final MessageUtil msgutil_ = ;
  
  public BatchUpdateException(LogWriter paramLogWriter, ClientMessageId paramClientMessageId, Object[] paramArrayOfObject, int[] paramArrayOfInt, SqlException paramSqlException)
  {
    super(msgutil_.getCompleteMessage(msgid, paramArrayOfObject), ExceptionUtil.getSQLStateFromIdentifier(msgid), ExceptionUtil.getSeverityFromIdentifier(msgid), paramArrayOfInt);
    if (paramLogWriter != null) {
      paramLogWriter.traceDiagnosable(this);
    }
    if (paramSqlException != null)
    {
      initCause(paramSqlException);
      setNextException(paramSqlException.getSQLException());
    }
  }
  
  public BatchUpdateException(LogWriter paramLogWriter, ClientMessageId paramClientMessageId, Object[] paramArrayOfObject, int[] paramArrayOfInt)
  {
    this(paramLogWriter, paramClientMessageId, paramArrayOfObject, paramArrayOfInt, null);
  }
  
  public BatchUpdateException(LogWriter paramLogWriter, ClientMessageId paramClientMessageId, int[] paramArrayOfInt)
  {
    this(paramLogWriter, paramClientMessageId, (Object[])null, paramArrayOfInt);
  }
  
  public BatchUpdateException(LogWriter paramLogWriter, ClientMessageId paramClientMessageId, Object paramObject, int[] paramArrayOfInt)
  {
    this(paramLogWriter, paramClientMessageId, new Object[] { paramObject }, paramArrayOfInt);
  }
}

/* Location:
 * Qualified Name:     org.apache.derby.client.am.BatchUpdateException
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.derby.client.am;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.sql.SQLException;

public class Blob
  extends Lob
  implements java.sql.Blob
{
  byte[] binaryString_ = null;
  InputStream binaryStream_ = null;
  int dataOffset_;
  
  public Blob(byte[] paramArrayOfByte, Agent paramAgent, int paramInt)
  {
    super(paramAgent, false);
    binaryString_ = paramArrayOfByte;
    dataType_ |= 0x40;
    setSqlLength(paramArrayOfByte.length - paramInt);
    dataOffset_ = paramInt;
  }
  
  public Blob(Agent paramAgent, InputStream paramInputStream, int paramInt)
  {
    super(paramAgent, false);
    binaryStream_ = paramInputStream;
    dataType_ |= 0x20;
    setSqlLength(paramInt);
  }
  
  public Blob(Agent paramAgent, InputStream paramInputStream)
  {
    super(paramAgent, isLayerBStreamingPossible(paramAgent));
    binaryStream_ = paramInputStream;
    dataType_ |= 0x20;
  }
  
  public Blob(Agent paramAgent, int paramInt)
  {
    super(paramAgent, false);
    locator_ = paramInt;
    dataType_ |= 0x80;
  }
  
  /* Error */
  public long length()
    throws SQLException
  {
    // Byte code:
    //   0: aload_0
    //   1: invokevirtual 9	org/apache/derby/client/am/Blob:checkValidity	()V
    //   4: aload_0
    //   5: getfield 10	org/apache/derby/client/am/Blob:agent_	Lorg/apache/derby/client/am/Agent;
    //   8: getfield 11	org/apache/derby/client/am/Agent:connection_	Lorg/apache/derby/client/am/Connection;
    //   11: dup
    //   12: astore_1
    //   13: monitorenter
    //   14: aload_0
    //   15: getfield 10	org/apache/derby/client/am/Blob:agent_	Lorg/apache/derby/client/am/Agent;
    //   18: invokevirtual 12	org/apache/derby/client/am/Agent:loggingEnabled	()Z
    //   21: ifeq +16 -> 37
    //   24: aload_0
    //   25: getfield 10	org/apache/derby/client/am/Blob:agent_	Lorg/apache/derby/client/am/Agent;
    //   28: getfield 13	org/apache/derby/client/am/Agent:logWriter_	Lorg/apache/derby/client/am/LogWriter;
    //   31: aload_0
    //   32: ldc 14
    //   34: invokevirtual 15	org/apache/derby/client/am/LogWriter:traceEntry	(Ljava/lang/Object;Ljava/lang/String;)V
    //   37: aload_0
    //   38: invokevirtual 16	org/apache/derby/client/am/Blob:checkForClosedConnection	()V
    //   41: aload_0
    //   42: invokespecial 17	org/apache/derby/client/am/Lob:sqlLength	()J
    //   45: lstore_2
    //   46: aload_0
    //   47: getfield 10	org/apache/derby/client/am/Blob:agent_	Lorg/apache/derby/client/am/Agent;
    //   50: invokevirtual 12	org/apache/derby/client/am/Agent:loggingEnabled	()Z
    //   53: ifeq +17 -> 70
    //   56: aload_0
    //   57: getfield 10	org/apache/derby/client/am/Blob:agent_	Lorg/apache/derby/client/am/Agent;
    //   60: getfield 13	org/apache/derby/client/am/Agent:logWriter_	Lorg/apache/derby/client/am/LogWriter;
    //   63: aload_0
    //   64: ldc 14
    //   66: lload_2
    //   67: invokevirtual 18	org/apache/derby/client/am/LogWriter:traceExit	(Ljava/lang/Object;Ljava/lang/String;J)V
    //   70: lload_2
    //   71: aload_1
    //   72: monitorexit
    //   73: lreturn
    //   74: astore 4
    //   76: aload_1
    //   77: monitorexit
    //   78: aload 4
    //   80: athrow
    //   81: astore_1
    //   82: aload_1
    //   83: invokevirtual 20	org/apache/derby/client/am/SqlException:getSQLException	()Ljava/sql/SQLException;
    //   86: athrow
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	87	0	this	Blob
    //   81	2	1	localSqlException	SqlException
    //   45	26	2	l	long
    //   74	5	4	localObject1	Object
    // Exception table:
    //   from	to	target	type
    //   14	73	74	finally
    //   74	78	74	finally
    //   4	73	81	org/apache/derby/client/am/SqlException
    //   74	81	81	org/apache/derby/client/am/SqlException
  }
  
  long getLocatorLength()
    throws SqlException
  {
    return agent_.connection_.locatorProcedureCall().blobGetLength(locator_);
  }
  
  /* Error */
  public byte[] getBytes(long paramLong, int paramInt)
    throws SQLException
  {
    // Byte code:
    //   0: aload_0
    //   1: invokevirtual 9	org/apache/derby/client/am/Blob:checkValidity	()V
    //   4: aload_0
    //   5: getfield 10	org/apache/derby/client/am/Blob:agent_	Lorg/apache/derby/client/am/Agent;
    //   8: getfield 11	org/apache/derby/client/am/Agent:connection_	Lorg/apache/derby/client/am/Connection;
    //   11: dup
    //   12: astore 4
    //   14: monitorenter
    //   15: aload_0
    //   16: getfield 10	org/apache/derby/client/am/Blob:agent_	Lorg/apache/derby/client/am/Agent;
    //   19: invokevirtual 12	org/apache/derby/client/am/Agent:loggingEnabled	()Z
    //   22: ifeq +19 -> 41
    //   25: aload_0
    //   26: getfield 10	org/apache/derby/client/am/Blob:agent_	Lorg/apache/derby/client/am/Agent;
    //   29: getfield 13	org/apache/derby/client/am/Agent:logWriter_	Lorg/apache/derby/client/am/LogWriter;
    //   32: aload_0
    //   33: ldc 23
    //   35: lload_1
    //   36: l2i
    //   37: iload_3
    //   38: invokevirtual 24	org/apache/derby/client/am/LogWriter:traceEntry	(Ljava/lang/Object;Ljava/lang/String;II)V
    //   41: lload_1
    //   42: lconst_0
    //   43: lcmp
    //   44: ifgt +35 -> 79
    //   47: new 19	org/apache/derby/client/am/SqlException
    //   50: dup
    //   51: aload_0
    //   52: getfield 10	org/apache/derby/client/am/Blob:agent_	Lorg/apache/derby/client/am/Agent;
    //   55: getfield 13	org/apache/derby/client/am/Agent:logWriter_	Lorg/apache/derby/client/am/LogWriter;
    //   58: new 25	org/apache/derby/client/am/ClientMessageId
    //   61: dup
    //   62: ldc 26
    //   64: invokespecial 27	org/apache/derby/client/am/ClientMessageId:<init>	(Ljava/lang/String;)V
    //   67: new 28	java/lang/Long
    //   70: dup
    //   71: lload_1
    //   72: invokespecial 29	java/lang/Long:<init>	(J)V
    //   75: invokespecial 30	org/apache/derby/client/am/SqlException:<init>	(Lorg/apache/derby/client/am/LogWriter;Lorg/apache/derby/client/am/ClientMessageId;Ljava/lang/Object;)V
    //   78: athrow
    //   79: lload_1
    //   80: aload_0
    //   81: invokevirtual 31	org/apache/derby/client/am/Blob:sqlLength	()J
    //   84: lconst_1
    //   85: ladd
    //   86: lcmp
    //   87: ifle +35 -> 122
    //   90: new 19	org/apache/derby/client/am/SqlException
    //   93: dup
    //   94: aload_0
    //   95: getfield 10	org/ap
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd