db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r1370674 [12/12] - in /db/derby/code/trunk/java/drda/org/apache/derby: drda/ impl/drda/
Date Wed, 08 Aug 2012 06:54:47 GMT
Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/ReEncodedInputStream.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/ReEncodedInputStream.java?rev=1370674&r1=1370673&r2=1370674&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/ReEncodedInputStream.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/ReEncodedInputStream.java Wed
Aug  8 06:54:46 2012
@@ -52,118 +52,118 @@ public class ReEncodedInputStream extend
     private ByteArrayInputStream encodedInputStream_;
     
     public ReEncodedInputStream(Reader reader) 
-	throws IOException {
-	
-	reader_ = reader;
-	decodedBuffer_ = new char[BUFFERED_CHAR_LEN];
-
-	encodedOutputStream_ = new PublicBufferOutputStream( BUFFERED_CHAR_LEN * 3 );
-	encodedStreamWriter_ = new OutputStreamWriter(encodedOutputStream_,"UTF8");
-	
-	encodedInputStream_ = reEncode(reader_);
-	
+    throws IOException {
+    
+    reader_ = reader;
+    decodedBuffer_ = new char[BUFFERED_CHAR_LEN];
+
+    encodedOutputStream_ = new PublicBufferOutputStream( BUFFERED_CHAR_LEN * 3 );
+    encodedStreamWriter_ = new OutputStreamWriter(encodedOutputStream_,"UTF8");
+    
+    encodedInputStream_ = reEncode(reader_);
+    
     }
 
 
     private ByteArrayInputStream reEncode(Reader reader) 
-	throws IOException
+    throws IOException
     {
-	
-		int count;
-		do{
-			count = reader.read(decodedBuffer_, 0, BUFFERED_CHAR_LEN);
-			
-		}while(count == 0);
-			
-		if(count < 0)
-			return null;
-	
-	encodedOutputStream_.reset();
-	encodedStreamWriter_.write(decodedBuffer_,0,count);
-	encodedStreamWriter_.flush();
-
-	int encodedLength = encodedOutputStream_.size();
-	
-	return new ByteArrayInputStream(encodedOutputStream_.getBuffer(),
-					0,
-					encodedLength);
+    
+        int count;
+        do{
+            count = reader.read(decodedBuffer_, 0, BUFFERED_CHAR_LEN);
+            
+        }while(count == 0);
+            
+        if(count < 0)
+            return null;
+    
+    encodedOutputStream_.reset();
+    encodedStreamWriter_.write(decodedBuffer_,0,count);
+    encodedStreamWriter_.flush();
+
+    int encodedLength = encodedOutputStream_.size();
+    
+    return new ByteArrayInputStream(encodedOutputStream_.getBuffer(),
+                    0,
+                    encodedLength);
     }
     
     
     public int available() 
-	throws IOException {
-	
-	if(encodedInputStream_ == null){
-	    return 0;
-	}
+    throws IOException {
+    
+    if(encodedInputStream_ == null){
+        return 0;
+    }
 
-	return encodedInputStream_.available();
-	
+    return encodedInputStream_.available();
+    
     }
     
 
     public void close() 
-	throws IOException {
-	
-	if(encodedInputStream_ != null ){
-	    encodedInputStream_.close();
-	    encodedInputStream_ = null;
-	}
-
-	if(reader_ != null ){
-	    reader_.close();
-	    reader_ = null;
-	}
-
-	if(encodedStreamWriter_ != null){
-	    encodedStreamWriter_.close();
-	    encodedStreamWriter_ = null;
-	}
-	
+    throws IOException {
+    
+    if(encodedInputStream_ != null ){
+        encodedInputStream_.close();
+        encodedInputStream_ = null;
+    }
+
+    if(reader_ != null ){
+        reader_.close();
+        reader_ = null;
+    }
+
+    if(encodedStreamWriter_ != null){
+        encodedStreamWriter_.close();
+        encodedStreamWriter_ = null;
+    }
+    
     }
     
     
     public int read() 
-	throws IOException {
-	
-	if(encodedInputStream_ == null){
-	    return -1;
-	}
-	
-	int c = encodedInputStream_.read();
-
-	if(c > -1){
-	    return c;
-	    
-	}else{
-	    encodedInputStream_ = reEncode(reader_);
-	    
-	    if(encodedInputStream_ == null){
-		return -1;
-	    }
-	    
-	    return encodedInputStream_.read();
+    throws IOException {
+    
+    if(encodedInputStream_ == null){
+        return -1;
+    }
+    
+    int c = encodedInputStream_.read();
+
+    if(c > -1){
+        return c;
+        
+    }else{
+        encodedInputStream_ = reEncode(reader_);
+        
+        if(encodedInputStream_ == null){
+        return -1;
+        }
+        
+        return encodedInputStream_.read();
 
-	}
-	
+    }
+    
     }
     
     
     protected void finalize() throws IOException {
-	close();
+    close();
     }
     
     
     private static class PublicBufferOutputStream extends ByteArrayOutputStream{
-	
-	PublicBufferOutputStream(int size){
-	    super(size);
-	}
-
-	public byte[] getBuffer(){
-	    return buf;
-	}
-	
+    
+    PublicBufferOutputStream(int size){
+        super(size);
+    }
+
+    public byte[] getBuffer(){
+        return buf;
+    }
+    
     }
 
 }

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/SQLTypes.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/SQLTypes.java?rev=1370674&r1=1370673&r2=1370674&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/SQLTypes.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/SQLTypes.java Wed Aug  8 06:54:46
2012
@@ -99,9 +99,9 @@ class SQLTypes {
     case DRDAConstants.DB2_SQLTYPE_DBCLOB:  // large object character DBCS
       return java.sql.Types.CLOB;
     case DRDAConstants.DB2_SQLTYPE_BLOB:    // large object bytes
-		case DRDAConstants.DB2_SQLTYPE_BLOB_LOCATOR:
-		case DRDAConstants.DB2_SQLTYPE_CLOB_LOCATOR:
-		case DRDAConstants.DB2_SQLTYPE_DBCLOB_LOCATOR:
+        case DRDAConstants.DB2_SQLTYPE_BLOB_LOCATOR:
+        case DRDAConstants.DB2_SQLTYPE_CLOB_LOCATOR:
+        case DRDAConstants.DB2_SQLTYPE_DBCLOB_LOCATOR:
       return java.sql.Types.BLOB;
     default:
       //throw new BugCheckException ("Encountered unexpected type code");
@@ -110,17 +110,17 @@ class SQLTypes {
   }
 
 
-	/**
-	 * Map jdbc type to the DB2 DRDA SQL Types expected by jcc.
-	 *@param jdbctype  - jdbc Type to convert
-	 *@param nullable - whether the type is nullable
-	 **/
+    /**
+     * Map jdbc type to the DB2 DRDA SQL Types expected by jcc.
+     *@param jdbctype  - jdbc Type to convert
+     *@param nullable - whether the type is nullable
+     **/
 
-	
+    
  /**  Map JDBC Type to DB2 SqlType
   * @param jdbctype   JDBC Type from java.sql.Types
   * @param nullable   true if this is a nullable type
-	 * @param appRequester - state variable for the connection
+     * @param appRequester - state variable for the connection
   * @param outlen     output parameter with type length
   *
   * @return Corresponding DB2 SQL Type (See DRDA Manual FD:OCA Meta 
@@ -130,20 +130,20 @@ class SQLTypes {
   */
 
     static protected int mapJdbcTypeToDB2SqlType (int jdbctype, boolean nullable, AppRequester
appRequester,
-											   int[] outlen)
-	 throws SQLException
+                                               int[] outlen)
+     throws SQLException
   {
-	  int nullAddVal =0;
+      int nullAddVal =0;
 
-	  if (nullable) 
-		  nullAddVal =1; 
-	  
-	  // Call FdocaConstants just to get the length
-	  FdocaConstants.mapJdbcTypeToDrdaType(jdbctype,nullable,appRequester,outlen);
-
-	  switch(jdbctype)
-	  {
-		  case Types.BOOLEAN:
+      if (nullable) 
+          nullAddVal =1; 
+      
+      // Call FdocaConstants just to get the length
+      FdocaConstants.mapJdbcTypeToDrdaType(jdbctype,nullable,appRequester,outlen);
+
+      switch(jdbctype)
+      {
+          case Types.BOOLEAN:
               if ( appRequester.supportsBooleanValues() )
               {
                   return DRDAConstants.DB2_SQLTYPE_BOOLEAN + nullAddVal;
@@ -152,37 +152,37 @@ class SQLTypes {
               {
                   return DRDAConstants.DB2_SQLTYPE_SMALL + nullAddVal;
               }
-		  case java.sql.Types.BIT:
-		  case java.sql.Types.TINYINT:
-		  case java.sql.Types.SMALLINT:
-			  return DRDAConstants.DB2_SQLTYPE_SMALL + nullAddVal;
-		  case java.sql.Types.INTEGER:
-			  return DRDAConstants.DB2_SQLTYPE_INTEGER + nullAddVal;
-		  case java.sql.Types.BIGINT:
-			  return DRDAConstants.DB2_SQLTYPE_BIGINT + nullAddVal;
-		  case java.sql.Types.DOUBLE:
-		  case java.sql.Types.REAL:
-			  return DRDAConstants.DB2_SQLTYPE_FLOAT + nullAddVal;
-		  case java.sql.Types.DECIMAL:
-		  case java.sql.Types.NUMERIC:
-			  return DRDAConstants.DB2_SQLTYPE_DECIMAL + nullAddVal;
-		  case java.sql.Types.DATE:
-			  return DRDAConstants.DB2_SQLTYPE_DATE + nullAddVal;
-		  case java.sql.Types.TIME:
-			  return DRDAConstants.DB2_SQLTYPE_TIME + nullAddVal;
-		  case java.sql.Types.TIMESTAMP:
-			  return DRDAConstants.DB2_SQLTYPE_TIMESTAMP + nullAddVal;
-		  case java.sql.Types.CHAR:
-			  return  DRDAConstants.DB2_SQLTYPE_CHAR + nullAddVal;    // null terminated SBCS/Mixed
-		  case java.sql.Types.BINARY:
-			  return DRDAConstants.DB2_SQLTYPE_CHAR + nullAddVal;
-
-		  case java.sql.Types.VARCHAR:
-		  case java.sql.Types.VARBINARY:
-			  return  DRDAConstants.DB2_SQLTYPE_VARCHAR + nullAddVal;			  
-		  case java.sql.Types.LONGVARBINARY:
-			  return DRDAConstants.DB2_SQLTYPE_LONG + nullAddVal;
-		  case java.sql.Types.JAVA_OBJECT:
+          case java.sql.Types.BIT:
+          case java.sql.Types.TINYINT:
+          case java.sql.Types.SMALLINT:
+              return DRDAConstants.DB2_SQLTYPE_SMALL + nullAddVal;
+          case java.sql.Types.INTEGER:
+              return DRDAConstants.DB2_SQLTYPE_INTEGER + nullAddVal;
+          case java.sql.Types.BIGINT:
+              return DRDAConstants.DB2_SQLTYPE_BIGINT + nullAddVal;
+          case java.sql.Types.DOUBLE:
+          case java.sql.Types.REAL:
+              return DRDAConstants.DB2_SQLTYPE_FLOAT + nullAddVal;
+          case java.sql.Types.DECIMAL:
+          case java.sql.Types.NUMERIC:
+              return DRDAConstants.DB2_SQLTYPE_DECIMAL + nullAddVal;
+          case java.sql.Types.DATE:
+              return DRDAConstants.DB2_SQLTYPE_DATE + nullAddVal;
+          case java.sql.Types.TIME:
+              return DRDAConstants.DB2_SQLTYPE_TIME + nullAddVal;
+          case java.sql.Types.TIMESTAMP:
+              return DRDAConstants.DB2_SQLTYPE_TIMESTAMP + nullAddVal;
+          case java.sql.Types.CHAR:
+              return  DRDAConstants.DB2_SQLTYPE_CHAR + nullAddVal;    // null terminated
SBCS/Mixed
+          case java.sql.Types.BINARY:
+              return DRDAConstants.DB2_SQLTYPE_CHAR + nullAddVal;
+
+          case java.sql.Types.VARCHAR:
+          case java.sql.Types.VARBINARY:
+              return  DRDAConstants.DB2_SQLTYPE_VARCHAR + nullAddVal;              
+          case java.sql.Types.LONGVARBINARY:
+              return DRDAConstants.DB2_SQLTYPE_LONG + nullAddVal;
+          case java.sql.Types.JAVA_OBJECT:
               if ( appRequester.supportsUDTs() )
               {
                   return DRDAConstants.DB2_SQLTYPE_FAKE_UDT + nullAddVal;
@@ -191,32 +191,32 @@ class SQLTypes {
               {
                   return DRDAConstants.DB2_SQLTYPE_LONG + nullAddVal;
               }
-		  case java.sql.Types.BLOB:
-			  return DRDAConstants.DB2_SQLTYPE_BLOB + nullAddVal;
-		  case java.sql.Types.CLOB:
-			  return DRDAConstants.DB2_SQLTYPE_CLOB + nullAddVal;
-		  case java.sql.Types.LONGVARCHAR:
-			  return DRDAConstants.DB2_SQLTYPE_LONG + nullAddVal;
-		  case java.sql.Types.ARRAY:
-		  case java.sql.Types.DISTINCT:
-		  case java.sql.Types.NULL:
-		  case java.sql.Types.OTHER:
-		  case java.sql.Types.REF:
-		  case java.sql.Types.STRUCT:
-			  throw new SQLException("Jdbc type" + jdbctype + "not Supported yet");
-			default:
-				throw new SQLException ("unrecognized sql type: " + jdbctype);
-			  //throw new BugCheckException ("Encountered unexpected type code");
+          case java.sql.Types.BLOB:
+              return DRDAConstants.DB2_SQLTYPE_BLOB + nullAddVal;
+          case java.sql.Types.CLOB:
+              return DRDAConstants.DB2_SQLTYPE_CLOB + nullAddVal;
+          case java.sql.Types.LONGVARCHAR:
+              return DRDAConstants.DB2_SQLTYPE_LONG + nullAddVal;
+          case java.sql.Types.ARRAY:
+          case java.sql.Types.DISTINCT:
+          case java.sql.Types.NULL:
+          case java.sql.Types.OTHER:
+          case java.sql.Types.REF:
+          case java.sql.Types.STRUCT:
+              throw new SQLException("Jdbc type" + jdbctype + "not Supported yet");
+            default:
+                throw new SQLException ("unrecognized sql type: " + jdbctype);
+              //throw new BugCheckException ("Encountered unexpected type code");
 
-	  }
+      }
   }
 
-	/**
-	 * Translate DB2 SQL Type to the non-nullable type.
-	 * @param sqlType DB2 SQL Type
-	 *
-	 * @return The Non-Nullable DB2 SQL Type.
-	 */
+    /**
+     * Translate DB2 SQL Type to the non-nullable type.
+     * @param sqlType DB2 SQL Type
+     *
+     * @return The Non-Nullable DB2 SQL Type.
+     */
    protected  static int getNonNullableSqlType (int sqlType)
   {
     return sqlType & ~1;

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/Session.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/Session.java?rev=1370674&r1=1370673&r2=1370674&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/Session.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/Session.java Wed Aug  8 06:54:46
2012
@@ -31,119 +31,119 @@ import java.util.Hashtable;
 import org.apache.derby.iapi.tools.i18n.LocalizedResource;
 
 /**
-	Session stores information about the current session
-	It is used so that a DRDAConnThread can work on any session.
+    Session stores information about the current session
+    It is used so that a DRDAConnThread can work on any session.
 */
 class Session
 {
 
-	// session states	   
-	protected static final int INIT = 1;	// before exchange of server attributes
-	protected static final int ATTEXC = 2;	// after first exchange of server attributes
-	protected static final int SECACC = 3;	// after ACCSEC (Security Manager Accessed)
-	protected static final int CHKSEC = 4;	// after SECCHK  (Checked Security)
-	protected static final int CLOSED = 5;	// session has ended
-
-	// session types
-	protected static final int DRDA_SESSION = 1;
-	protected static final int CMD_SESSION = 2;
-	
-	// trace name prefix and suffix
-	private static final String TRACENAME_PREFIX = "Server";
-	private static final String TRACENAME_SUFFIX = ".trace";
-
-	// session information
-	protected Socket clientSocket;		// session socket
-	protected int connNum;				// connection number
-	protected InputStream sessionInput;	// session input stream
-	protected OutputStream sessionOutput;	// session output stream
-	protected String traceFileName;		// trace file name for session
-	protected boolean traceOn;			// whether trace is currently on for the session
-	protected int state;				// the current state of the session
-	protected int sessionType;			// type of session - DRDA or NetworkServerControl command
-	protected String drdaID;			// DRDA ID of the session
-	protected DssTrace dssTrace;		// trace object associated with the session
-	protected AppRequester appRequester;	// Application requester for this session
-	protected Database database;		// current database
-	protected int qryinsid;				// unique identifier for each query
-	protected LocalizedResource langUtil;		// localization information for command session
-										// client
+    // session states       
+    protected static final int INIT = 1;    // before exchange of server attributes
+    protected static final int ATTEXC = 2;    // after first exchange of server attributes
+    protected static final int SECACC = 3;    // after ACCSEC (Security Manager Accessed)
+    protected static final int CHKSEC = 4;    // after SECCHK  (Checked Security)
+    protected static final int CLOSED = 5;    // session has ended
+
+    // session types
+    protected static final int DRDA_SESSION = 1;
+    protected static final int CMD_SESSION = 2;
+    
+    // trace name prefix and suffix
+    private static final String TRACENAME_PREFIX = "Server";
+    private static final String TRACENAME_SUFFIX = ".trace";
+
+    // session information
+    protected Socket clientSocket;        // session socket
+    protected int connNum;                // connection number
+    protected InputStream sessionInput;    // session input stream
+    protected OutputStream sessionOutput;    // session output stream
+    protected String traceFileName;        // trace file name for session
+    protected boolean traceOn;            // whether trace is currently on for the session
+    protected int state;                // the current state of the session
+    protected int sessionType;            // type of session - DRDA or NetworkServerControl
command
+    protected String drdaID;            // DRDA ID of the session
+    protected DssTrace dssTrace;        // trace object associated with the session
+    protected AppRequester appRequester;    // Application requester for this session
+    protected Database database;        // current database
+    protected int qryinsid;                // unique identifier for each query
+    protected LocalizedResource langUtil;        // localization information for command
session
+                                        // client
 
     /** Table of databases accessed in this session. */
-    private	Hashtable<String, Database> dbtable;
-	private NetworkServerControlImpl nsctrl;        // NetworkServerControlImpl needed for logging
+    private    Hashtable<String, Database> dbtable;
+    private NetworkServerControlImpl nsctrl;        // NetworkServerControlImpl needed for
logging
                                                         // message if tracing fails.
                                                         
 
-	// constructor
-	/**
-	 * Session constructor
-	 * 
-	 * @param connNum		connection number
-	 * @param clientSocket	communications socket for this session
-	 * @param traceDirectory	location for trace files
-	 * @param traceOn		whether to start tracing this connection
-	 *
-	 * @exception throws IOException
-	 */
-	Session (NetworkServerControlImpl nsctrl, int connNum, Socket clientSocket, String traceDirectory,
-			boolean traceOn) throws Exception
-	{
+    // constructor
+    /**
+     * Session constructor
+     * 
+     * @param connNum        connection number
+     * @param clientSocket    communications socket for this session
+     * @param traceDirectory    location for trace files
+     * @param traceOn        whether to start tracing this connection
+     *
+     * @exception throws IOException
+     */
+    Session (NetworkServerControlImpl nsctrl, int connNum, Socket clientSocket, String traceDirectory,
+            boolean traceOn) throws Exception
+    {
         this.nsctrl = nsctrl;
-		this.connNum = connNum;
-		this.clientSocket = clientSocket;
-		this.traceOn = traceOn;
-		if (traceOn)
-			dssTrace = new DssTrace(); 
-		dbtable = new Hashtable<String, Database>();
-		initialize(traceDirectory);
-	}
-
-	/**
-	 * Close session - close connection sockets and set state to closed
-	 * 
-	 */
-	protected void close() throws SQLException
-	{
-		
-		try {
-			sessionInput.close();
-			sessionOutput.close();
-			clientSocket.close();
-			setTraceOff();
-			if (dbtable != null)
-				for (Enumeration e = dbtable.elements() ; e.hasMoreElements() ;) 
-				{
-					((Database) e.nextElement()).close();
-				}
-			
-		}catch (IOException e) {} // ignore IOException when we are shutting down
-		finally {
-			state = CLOSED;
-			dbtable = null;
-			database = null;
-		}
-	}
-
-	/**
-	 * initialize a server trace for the DRDA protocol
-	 * 
-	 * @param traceDirectory - directory for trace file
+        this.connNum = connNum;
+        this.clientSocket = clientSocket;
+        this.traceOn = traceOn;
+        if (traceOn)
+            dssTrace = new DssTrace(); 
+        dbtable = new Hashtable<String, Database>();
+        initialize(traceDirectory);
+    }
+
+    /**
+     * Close session - close connection sockets and set state to closed
+     * 
+     */
+    protected void close() throws SQLException
+    {
+        
+        try {
+            sessionInput.close();
+            sessionOutput.close();
+            clientSocket.close();
+            setTraceOff();
+            if (dbtable != null)
+                for (Enumeration e = dbtable.elements() ; e.hasMoreElements() ;) 
+                {
+                    ((Database) e.nextElement()).close();
+                }
+            
+        }catch (IOException e) {} // ignore IOException when we are shutting down
+        finally {
+            state = CLOSED;
+            dbtable = null;
+            database = null;
+        }
+    }
+
+    /**
+     * initialize a server trace for the DRDA protocol
+     * 
+     * @param traceDirectory - directory for trace file
      * @param throwException - true if we should throw an exception if
      *                         turning on tracing fails.  We do this
      *                         for NetworkServerControl API commands.
-	 * @throws IOException 
-	 */
-	protected void initTrace(String traceDirectory, boolean throwException)  throws Exception
-	{
-		if (traceDirectory != null)
-			traceFileName = traceDirectory + "/" + TRACENAME_PREFIX+
-				connNum+ TRACENAME_SUFFIX;
-		else
-			traceFileName = TRACENAME_PREFIX +connNum+ TRACENAME_SUFFIX;
-		
-		if (dssTrace == null)
-			dssTrace = new DssTrace();
+     * @throws IOException 
+     */
+    protected void initTrace(String traceDirectory, boolean throwException)  throws Exception
+    {
+        if (traceDirectory != null)
+            traceFileName = traceDirectory + "/" + TRACENAME_PREFIX+
+                connNum+ TRACENAME_SUFFIX;
+        else
+            traceFileName = TRACENAME_PREFIX +connNum+ TRACENAME_SUFFIX;
+        
+        if (dssTrace == null)
+            dssTrace = new DssTrace();
         try {
             dssTrace.startComBufferTrace(traceFileName);
             traceOn = true;
@@ -156,140 +156,140 @@ class Session
             // let connection continue.
             nsctrl.consoleExceptionPrintTrace(e);
         }              
-	}
+    }
 
-	/**
-	 * Set tracing on
-	 * 
-	 * @param traceDirectory 	directory for trace files
-	 * @throws Exception 
-	 */
-	protected void setTraceOn(String traceDirectory, boolean throwException) throws Exception
-	{
-		if (traceOn)
-			return;
-		initTrace(traceDirectory, throwException);    
-	}
-
-	/**
-	 * Get whether tracing is on 
-	 *
-	 * @return true if tracing is on false otherwise
-	 */
-	protected boolean isTraceOn()
-	{
-		if (traceOn)
-			return true;
-		else
-			return false;
-	}
-
-	/**
-	 * Get connection number
-	 *
-	 * @return connection number
-	 */
-	protected int getConnNum()
-	{
-		return connNum;
-	}
-
-	/**
-	 * Set tracing off
-	 * 
-	 */
-	protected void setTraceOff()
-	{
-		if (! traceOn)
-			return;
-		traceOn = false;
-		if (traceFileName != null)
-			dssTrace.stopComBufferTrace();
-	}
-	/**
-	 * Add database to session table
-	 */
-	protected void addDatabase(Database d)
-	{
-		dbtable.put(d.getDatabaseName(), d);
-	}
-
-	/**
-	 * Get database
-	 */
-	protected Database getDatabase(String dbName)
-	{
-		return (Database)dbtable.get(dbName);
-	}
-
-	/**
-	 * Get requried security checkpoint.
-	 * Used to verify EXCSAT/ACCSEC/SECCHK order.
-	 *
-	 *  @return next required Security checkpoint or -1 if 
-	 *          neither ACCSEC or SECCHK are required at this time.
-	 *
-	 */
-	protected int getRequiredSecurityCodepoint()
-	{
-		switch (state)
-		{
-			case ATTEXC:
-				// On initial exchange of attributes we require ACCSEC 
-				// to access security manager
-				return CodePoint.ACCSEC;
-			case SECACC:
-				// After security manager has been accessed successfully we
-				// require SECCHK to check security
-				return CodePoint.SECCHK;
-			default:
-				return -1;
-		}	 
-	}
-
-	/**
-	 * Check if a security codepoint is required
-	 *
-	 * @return true if ACCSEC or SECCHK are required at this time.
-	 */
-	protected boolean requiresSecurityCodepoint()
-	{
-		return (getRequiredSecurityCodepoint() != -1);
-	}
-
-	/**
-	 * Set Session state
-	 * 
-	 */
-	protected void setState(int s)
-	{
-		state = s;
-	}
-	
-	/**
-	 * Get session into initial state
-	 *
-	 * @param traceDirectory	- directory for trace files
-	 */
-	private void initialize(String traceDirectory)
-		throws Exception
-	{
-		sessionInput = clientSocket.getInputStream();
-		sessionOutput = clientSocket.getOutputStream();
-		if (traceOn)
-			initTrace(traceDirectory,false);
-		state = INIT;
-	}
-
-	protected  String buildRuntimeInfo(String indent, LocalizedResource localLangUtil)
-	{
-		String s = "";
-		s += indent +  localLangUtil.getTextMessage("DRDA_RuntimeInfoSessionNumber.I")
-			+ connNum + "\n";
-		if (database == null)
-			return s;
-		s += database.buildRuntimeInfo(indent,localLangUtil);
-		s += "\n";
-		return s;
-	}
+    /**
+     * Set tracing on
+     * 
+     * @param traceDirectory     directory for trace files
+     * @throws Exception 
+     */
+    protected void setTraceOn(String traceDirectory, boolean throwException) throws Exception
+    {
+        if (traceOn)
+            return;
+        initTrace(traceDirectory, throwException);    
+    }
+
+    /**
+     * Get whether tracing is on 
+     *
+     * @return true if tracing is on false otherwise
+     */
+    protected boolean isTraceOn()
+    {
+        if (traceOn)
+            return true;
+        else
+            return false;
+    }
+
+    /**
+     * Get connection number
+     *
+     * @return connection number
+     */
+    protected int getConnNum()
+    {
+        return connNum;
+    }
+
+    /**
+     * Set tracing off
+     * 
+     */
+    protected void setTraceOff()
+    {
+        if (! traceOn)
+            return;
+        traceOn = false;
+        if (traceFileName != null)
+            dssTrace.stopComBufferTrace();
+    }
+    /**
+     * Add database to session table
+     */
+    protected void addDatabase(Database d)
+    {
+        dbtable.put(d.getDatabaseName(), d);
+    }
+
+    /**
+     * Get database
+     */
+    protected Database getDatabase(String dbName)
+    {
+        return (Database)dbtable.get(dbName);
+    }
+
+    /**
+     * Get requried security checkpoint.
+     * Used to verify EXCSAT/ACCSEC/SECCHK order.
+     *
+     *  @return next required Security checkpoint or -1 if 
+     *          neither ACCSEC or SECCHK are required at this time.
+     *
+     */
+    protected int getRequiredSecurityCodepoint()
+    {
+        switch (state)
+        {
+            case ATTEXC:
+                // On initial exchange of attributes we require ACCSEC 
+                // to access security manager
+                return CodePoint.ACCSEC;
+            case SECACC:
+                // After security manager has been accessed successfully we
+                // require SECCHK to check security
+                return CodePoint.SECCHK;
+            default:
+                return -1;
+        }     
+    }
+
+    /**
+     * Check if a security codepoint is required
+     *
+     * @return true if ACCSEC or SECCHK are required at this time.
+     */
+    protected boolean requiresSecurityCodepoint()
+    {
+        return (getRequiredSecurityCodepoint() != -1);
+    }
+
+    /**
+     * Set Session state
+     * 
+     */
+    protected void setState(int s)
+    {
+        state = s;
+    }
+    
+    /**
+     * Get session into initial state
+     *
+     * @param traceDirectory    - directory for trace files
+     */
+    private void initialize(String traceDirectory)
+        throws Exception
+    {
+        sessionInput = clientSocket.getInputStream();
+        sessionOutput = clientSocket.getOutputStream();
+        if (traceOn)
+            initTrace(traceDirectory,false);
+        state = INIT;
+    }
+
+    protected  String buildRuntimeInfo(String indent, LocalizedResource localLangUtil)
+    {
+        String s = "";
+        s += indent +  localLangUtil.getTextMessage("DRDA_RuntimeInfoSessionNumber.I")
+            + connNum + "\n";
+        if (database == null)
+            return s;
+        s += database.buildRuntimeInfo(indent,localLangUtil);
+        s += "\n";
+        return s;
+    }
 }

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/XADatabase.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/XADatabase.java?rev=1370674&r1=1370673&r2=1370674&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/XADatabase.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/XADatabase.java Wed Aug  8 06:54:46
2012
@@ -37,82 +37,82 @@ import org.apache.derby.jdbc.EmbeddedXAD
 class XADatabase extends Database {
 
 
-	// XA Datasource used by all the XA connection requests
-	private EmbeddedXADataSource xaDataSource;
+    // XA Datasource used by all the XA connection requests
+    private EmbeddedXADataSource xaDataSource;
 
-	private XAResource xaResource;
-	private XAConnection xaConnection;
-	private ResourceAdapter ra;
-
-	
-	XADatabase (String dbName)
-	{
-		super(dbName);
-	}
-
-	/**
-	 * Make a new connection using the database name and set 
-	 * the connection in the database
-	 **/
-	synchronized void makeConnection(Properties p) throws
+    private XAResource xaResource;
+    private XAConnection xaConnection;
+    private ResourceAdapter ra;
+
+    
+    XADatabase (String dbName)
+    {
+        super(dbName);
+    }
+
+    /**
+     * Make a new connection using the database name and set 
+     * the connection in the database
+     **/
+    synchronized void makeConnection(Properties p) throws
  SQLException
-	{
-		if (xaDataSource == null)
-		{
-			xaDataSource = new EmbeddedXADataSource();
-		}
-
-		xaDataSource.setDatabaseName(getShortDbName());
-		appendAttrString(p);
-		if (attrString != null)
-			xaDataSource.setConnectionAttributes(attrString);
-		
-		EngineConnection conn = getConnection();
-		// If we have no existing connection. this is a brand new XAConnection.
-		if (conn == null)
-		{
-			xaConnection = xaDataSource.getXAConnection(userId,password);
-			ra = xaDataSource.getResourceAdapter();
-			setXAResource(xaConnection.getXAResource());
-		}
-		else // this is just a connection reset. Close the logical connection.
-		{
-			conn.close();
-		}
-		
-		// Get a new logical connection.
+    {
+        if (xaDataSource == null)
+        {
+            xaDataSource = new EmbeddedXADataSource();
+        }
+
+        xaDataSource.setDatabaseName(getShortDbName());
+        appendAttrString(p);
+        if (attrString != null)
+            xaDataSource.setConnectionAttributes(attrString);
+        
+        EngineConnection conn = getConnection();
+        // If we have no existing connection. this is a brand new XAConnection.
+        if (conn == null)
+        {
+            xaConnection = xaDataSource.getXAConnection(userId,password);
+            ra = xaDataSource.getResourceAdapter();
+            setXAResource(xaConnection.getXAResource());
+        }
+        else // this is just a connection reset. Close the logical connection.
+        {
+            conn.close();
+        }
+        
+        // Get a new logical connection.
         // Contract between network server and embedded engine
         // is that any connection returned implements EngineConnection.
- 		conn = (EngineConnection) xaConnection.getConnection();
-		// Client will always drive the commits so connection should
-		// always be autocommit false on the server. DERBY-898/DERBY-899
-		conn.setAutoCommit(false);
-		setConnection(conn);		
-	}
-
-	/** SetXAResource
-	 * @param resource XAResource for this connection
-	 */
-	protected void setXAResource (XAResource resource)
-	{
-		this.xaResource = resource;
-	}
-
-	/**
-	 * get XA Resource for this connection
-	 */
-	protected XAResource getXAResource ()
-	{
-		return this.xaResource;
-	}
-
-	/**
-	 * @return The ResourceAdapter instance for
-	 *         the underlying database.
-	 */
-	ResourceAdapter getResourceAdapter()
-	{
-		return this.ra;
-	}
+         conn = (EngineConnection) xaConnection.getConnection();
+        // Client will always drive the commits so connection should
+        // always be autocommit false on the server. DERBY-898/DERBY-899
+        conn.setAutoCommit(false);
+        setConnection(conn);        
+    }
+
+    /** SetXAResource
+     * @param resource XAResource for this connection
+     */
+    protected void setXAResource (XAResource resource)
+    {
+        this.xaResource = resource;
+    }
+
+    /**
+     * get XA Resource for this connection
+     */
+    protected XAResource getXAResource ()
+    {
+        return this.xaResource;
+    }
+
+    /**
+     * @return The ResourceAdapter instance for
+     *         the underlying database.
+     */
+    ResourceAdapter getResourceAdapter()
+    {
+        return this.ra;
+    }
 }
 

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/memCheck.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/memCheck.java?rev=1370674&r1=1370673&r2=1370674&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/memCheck.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/memCheck.java Wed Aug  8 06:54:46
2012
@@ -24,60 +24,60 @@ package org.apache.derby.impl.drda;
 import java.util.Date;
 
 public class memCheck extends Thread {
-	int delay = 200000;
-	boolean stopNow = false;
+    int delay = 200000;
+    boolean stopNow = false;
 
 public memCheck () {}
 
 public  memCheck (int num) {
-	delay = num;
+    delay = num;
 }
 
 public void run () {
-	while (stopNow == false) {
-		try {
-			showmem();
-			sleep(delay);
-		} catch (java.lang.InterruptedException ie) {
-			System.out.println("memcheck interrupted");
-			stopNow = true;
-		}
-	}
+    while (stopNow == false) {
+        try {
+            showmem();
+            sleep(delay);
+        } catch (java.lang.InterruptedException ie) {
+            System.out.println("memcheck interrupted");
+            stopNow = true;
+        }
+    }
 }
 
-	public static String getMemInfo() {
-	Runtime rt = null;
-	rt = Runtime.getRuntime();
-	rt.gc();
-	return "total memory: " 
-		+ rt.totalMemory()
-		+ " free: "
-		+ rt.freeMemory();
-	
-	}
-
-	public static long totalMemory() {
-		Runtime rt = Runtime.getRuntime();
-		return rt.totalMemory();
-	}
-
-	public static long freeMemory() {
-		
-		Runtime rt =  Runtime.getRuntime();
-		rt.gc();
-		return rt.freeMemory();
-	}
-
-	public static void showmem() {
-	Date d = null;
-	d = new Date();
-	System.out.println(getMemInfo() + " " + d.toString());
+    public static String getMemInfo() {
+    Runtime rt = null;
+    rt = Runtime.getRuntime();
+    rt.gc();
+    return "total memory: " 
+        + rt.totalMemory()
+        + " free: "
+        + rt.freeMemory();
+    
+    }
+
+    public static long totalMemory() {
+        Runtime rt = Runtime.getRuntime();
+        return rt.totalMemory();
+    }
+
+    public static long freeMemory() {
+        
+        Runtime rt =  Runtime.getRuntime();
+        rt.gc();
+        return rt.freeMemory();
+    }
+
+    public static void showmem() {
+    Date d = null;
+    d = new Date();
+    System.out.println(getMemInfo() + " " + d.toString());
 
 }
 
 public static void main (String argv[]) {
-	System.out.println("memCheck starting");
-	memCheck mc = new memCheck();
-	mc.run();
+    System.out.println("memCheck starting");
+    memCheck mc = new memCheck();
+    mc.run();
 }
 }

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/package.html
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/package.html?rev=1370674&r1=1370673&r2=1370674&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/package.html (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/package.html Wed Aug  8 06:54:46
2012
@@ -17,18 +17,18 @@
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
 <HTML>
 <HEAD>
-	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
-	<TITLE></TITLE>
-	<META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3  (Win32)">
-	<META NAME="AUTHOR" CONTENT="K M">
-	<META NAME="CREATED" CONTENT="20060113;5464555">
-	<META NAME="CHANGEDBY" CONTENT="K M">
-	<META NAME="CHANGED" CONTENT="20060113;6142329">
-	<STYLE>
-	<!--
-		@page { size: 8.5in 11in }
-	-->
-	</STYLE>
+    <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
+    <TITLE></TITLE>
+    <META NAME="GENERATOR" CONTENT="OpenOffice.org 1.1.3  (Win32)">
+    <META NAME="AUTHOR" CONTENT="K M">
+    <META NAME="CREATED" CONTENT="20060113;5464555">
+    <META NAME="CHANGEDBY" CONTENT="K M">
+    <META NAME="CHANGED" CONTENT="20060113;6142329">
+    <STYLE>
+    <!--
+        @page { size: 8.5in 11in }
+    -->
+    </STYLE>
 </HEAD>
 <BODY LANG="en-US" DIR="LTR">
 <H1>Network Server Implementation 
@@ -42,23 +42,23 @@ Summary</FONT></FONT></P>
 <P><B>NetworkServerControlImpl</B> - This class implements methods
 used by the public API and main.  It's functions include:</P>
 <UL>
-	<UL>
-		<LI><P>Launching a ConnectionThread to accept incomming
-		connections.</P>
-	</UL>
+    <UL>
+        <LI><P>Launching a ConnectionThread to accept incomming
+        connections.</P>
+    </UL>
 </UL>
 <UL>
-	<UL>
-		<LI><P>Manaintaining  a list of sessions, a queue of Sessions
-		waiting for free thread and free list of DRDAConnections which are
-		available for reuse.</P>
-	</UL>
+    <UL>
+        <LI><P>Manaintaining  a list of sessions, a queue of Sessions
+        waiting for free thread and free list of DRDAConnections which are
+        available for reuse.</P>
+    </UL>
 </UL>
 <UL>
-	<UL>
-		<LI><P>Handling non-DRDA proprietary protocol requests (e.g.
-		turning tracing on/off)</P>
-	</UL>
+    <UL>
+        <LI><P>Handling non-DRDA proprietary protocol requests (e.g.
+        turning tracing on/off)</P>
+    </UL>
 </UL>
 <P><BR><BR>
 </P>
@@ -66,14 +66,14 @@ used by the public API and main.  It's f
 to accept connections. It is responsible for 
 </P>
 <UL>
-	<UL>
-		<LI><P> accepting connections</P>
-		<LI><P>    creating a new Sessions and adding them to the session
-		table.</P>
-		<LI><P>     Starting a DRDAConnThread (either one from the free
-		list or a new one) or putting the sessions waiting for a thread if
-		maxThreads is exceeded.</P>
-	</UL>
+    <UL>
+        <LI><P> accepting connections</P>
+        <LI><P>    creating a new Sessions and adding them to the session
+        table.</P>
+        <LI><P>     Starting a DRDAConnThread (either one from the free
+        list or a new one) or putting the sessions waiting for a thread if
+        maxThreads is exceeded.</P>
+    </UL>
 </UL>
 <P><B>ApplicationRequester</B> - this contains information about a
 particular application requester(e.g, type, version, level of



Mime
View raw message