db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1475919 - in /db/derby/code/trunk/java/drda/org/apache/derby: drda/NetworkServerControl.java impl/drda/DDMReader.java impl/drda/DRDAConnThread.java impl/drda/NetworkServerControlImpl.java
Date Thu, 25 Apr 2013 19:27:00 GMT
Author: rhillegas
Date: Thu Apr 25 19:26:59 2013
New Revision: 1475919

URL: http://svn.apache.org/r1475919
Log:
DERBY-6206: Cleanup encapsulation problems in NetworkServerControlImpl.

Modified:
    db/derby/code/trunk/java/drda/org/apache/derby/drda/NetworkServerControl.java
    db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DDMReader.java
    db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
    db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java

Modified: db/derby/code/trunk/java/drda/org/apache/derby/drda/NetworkServerControl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/drda/NetworkServerControl.java?rev=1475919&r1=1475918&r2=1475919&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/drda/NetworkServerControl.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/drda/NetworkServerControl.java Thu Apr
25 19:26:59 2013
@@ -598,7 +598,7 @@ public class NetworkServerControl{
           
     protected void setClientLocale(String locale)
     {
-        serverImpl.clientLocale = locale;
+        serverImpl.setClientLocale( locale );
     }
 
     /**

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DDMReader.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DDMReader.java?rev=1475919&r1=1475918&r2=1475919&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DDMReader.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DDMReader.java Thu Apr 25 19:26:59
2013
@@ -1052,7 +1052,7 @@ class DDMReader
         try {
             return readLOBChunk(true, desiredLength);
         } catch (DRDAProtocolException e) {
-            e.printStackTrace(agent.getServer().logWriter);
+            e.printStackTrace(agent.getServer().logWriter());
             throw new IOException(e.getMessage());
         }
     }
@@ -1405,7 +1405,7 @@ class DDMReader
         catch (java.io.UnsupportedEncodingException e) {
             agent.agentError("UnsupportedEncodingException in readString, encoding = " 
                     + encoding);
-            e.printStackTrace(agent.getServer().logWriter);
+            e.printStackTrace(agent.getServer().logWriter());
         }
         
         pos += length;

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java?rev=1475919&r1=1475918&r2=1475919&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DRDAConnThread.java Thu Apr 25
19:26:59 2013
@@ -181,6 +181,9 @@ class DRDAConnThread extends Thread {
     // as part of SECMEC_USRSSBPWD security mechanism
     private byte[] myTargetSeed;
 
+    // product id as bytes
+    private static  byte[]  prdIdBytes;
+
     // Some byte[] constants that are frequently written into messages. It is more efficient
to 
     // use these constants than to convert from a String each time 
     // (This replaces the qryscraft_ and notQryscraft_ static exception objects.)
@@ -366,6 +369,13 @@ class DRDAConnThread extends Thread {
         return sockos;
     }
 
+    /** Get product id as bytes */
+    private static  byte[]  getProductIDBytes()
+    {
+        if ( prdIdBytes == null ) { prdIdBytes = NetworkServerControlImpl.prdIdBytes(); }
+        return prdIdBytes;
+    }
+
     /**
      *  get DDMReader
      * @return DDMReader for this thread
@@ -1790,17 +1800,17 @@ class DRDAConnThread extends Thread {
         writer.createDssReply();
         writer.startDdm(CodePoint.EXCSATRD);
         writer.writeScalarString(CodePoint.EXTNAM,
-                                 NetworkServerControlImpl.att_extnam);
+                                 NetworkServerControlImpl.att_extnam());
         //only reply with manager levels if we got sent some
         if (knownManagers != null && knownManagers.size() > 0) {
             writeMGRLEVELS();
         }
         writer.writeScalarString(CodePoint.SRVCLSNM,
-                                 NetworkServerControlImpl.att_srvclsnm);
+                                 NetworkServerControlImpl.att_srvclsnm());
         writer.writeScalarString(CodePoint.SRVNAM,
                                  NetworkServerControlImpl.ATT_SRVNAM);
         writer.writeScalarString(CodePoint.SRVRLSLV,
-                                 NetworkServerControlImpl.att_srvrlslv);
+                                 NetworkServerControlImpl.att_srvrlslv());
         writer.endDdmAndDss();
     }
     /**
@@ -3669,7 +3679,7 @@ class DRDAConnThread extends Thread {
         writer.startDdm(CodePoint.ACCRDBRM);
         writer.writeScalar2Bytes(CodePoint.SVRCOD, svrcod);
         writer.writeScalarString(CodePoint.PRDID,
-                                 NetworkServerControlImpl.prdId);
+                                 NetworkServerControlImpl.prdId());
         //TYPDEFNAM -required - JCC doesn't support QTDSQLJVM so for now we
         // just use ASCII, though we should eventually be able to use QTDSQLJVM
         // at level 7
@@ -6304,7 +6314,7 @@ class DRDAConnThread extends Thread {
             return;
         }
             
-        if (SanityManager.DEBUG && server.debugOutput && sqlcode < 0)
{
+        if (SanityManager.DEBUG && server.debugOutput() && sqlcode < 0)
{
             trace("handle SQLException here");
             trace("reason is: "+e.getMessage());
             trace("SQLState is: "+e.getSQLState());
@@ -6325,7 +6335,7 @@ class DRDAConnThread extends Thread {
 
         // SQLERRPROC
         // Write the byte[] constant rather than the string, for efficiency
-        writer.writeBytes(NetworkServerControlImpl.prdIdBytes_);
+        writer.writeBytes( getProductIDBytes() );
 
         // SQLCAXGRP
         writeSQLCAXGRP(updateCount, rowCount, buildSqlerrmc(e), e.getNextException());
@@ -6378,7 +6388,7 @@ class DRDAConnThread extends Thread {
         writer.writeBytes(sqlState);
 
         // SQLERRPROC
-        writer.writeBytes(NetworkServerControlImpl.prdIdBytes_);
+        writer.writeBytes( getProductIDBytes() );
 
         // SQLCAXGRP (Uses null as sqlerrmc since there is no error)
         writeSQLCAXGRP(updateCount, rowCount, null, null);
@@ -8843,7 +8853,7 @@ class DRDAConnThread extends Thread {
      */
     protected  void trace(String value)
     {
-        if (SanityManager.DEBUG && server.debugOutput == true) {
+        if (SanityManager.DEBUG && server.debugOutput() == true) {
             server.consoleMessage(value, true);
         }
     }
@@ -8863,7 +8873,7 @@ class DRDAConnThread extends Thread {
     private void traceEXTDTARead(int drdaType, int index,
                                  EXTDTAReaderInputStream stream,
                                  boolean streamLOB, String encoding) {
-        if (SanityManager.DEBUG && server.debugOutput == true) {
+        if (SanityManager.DEBUG && server.debugOutput() == true) {
             StringBuilder sb = new StringBuilder("Reading/setting EXTDTA: ");
             // Data: t<type>/i<ob_index>/<streamLOB>/<encoding>/
             //       <statusByteExpected>/b<byteLength>

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java?rev=1475919&r1=1475918&r2=1475919&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
(original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/NetworkServerControlImpl.java
Thu Apr 25 19:26:59 2013
@@ -111,7 +111,7 @@ public final class NetworkServerControlI
     public final static int COMMAND_TIMESLICE = 9;
     public final static int COMMAND_PROPERTIES = 10;
     public final static int COMMAND_UNKNOWN = -1;
-    public final static String [] DASHARGS =
+    private final static String [] DASHARGS =
     {"p", "d", "user", "password", "ld", "ea", "ep", "b", "h", "s",
          "noSecurityManager", "ssl"};
     public final static int DASHARG_PORT = 0;
@@ -171,13 +171,13 @@ public final class NetworkServerControlI
     private final static int MAXREPLY = 32767;
 
     // Application Server Attributes.
-    protected static String att_srvclsnm;
+    private static String att_srvclsnm;
     protected final static String ATT_SRVNAM = "NetworkServerControl";
 
-    protected static String att_extnam;
-    protected static String att_srvrlslv; 
-    protected static String prdId;
-    protected static byte[] prdIdBytes_;
+    private static String att_extnam;
+    private static String att_srvrlslv; 
+    private static String prdId;
+    private static byte[] prdIdBytes_;
     
     private static String buildNumber;
     private static String versionString;
@@ -195,7 +195,7 @@ public final class NetworkServerControlI
 
     // Application Server manager levels - this needs to be in sync
     // with CodePoint.MGR_CODEPOINTS
-    protected final static int [] MGR_LEVELS = { 7, // AGENT
+    private final static int [] MGR_LEVELS = { 7, // AGENT
                                                  4, // CCSID Manager
                                                  0, // CNMAPPC not implemented
                                                  0, // CMNSYNCPT not implemented
@@ -212,8 +212,8 @@ public final class NetworkServerControlI
                                                 };
                                             
     
-    protected PrintWriter logWriter;                        // console
-    protected PrintWriter cloudscapeLogWriter;              // derby.log
+    private PrintWriter logWriter;                        // console
+    private PrintWriter cloudscapeLogWriter;              // derby.log
     private static Driver cloudscapeDriver;
 
     // error types
@@ -276,7 +276,7 @@ public final class NetworkServerControlI
     private int maxPoolSize;            //maximum pool size for pooled connections
     private Object poolSync = new Object(); // object to use for syning reading
 
-    protected boolean debugOutput = false;
+    private boolean debugOutput = false;
     private boolean cleanupOnStart = false; // Should we clean up when starting the server?
     private boolean restartFlag = false;
 
@@ -300,7 +300,7 @@ public final class NetworkServerControlI
     private ServerSocket serverSocket;
     private NetworkServerControlImpl serverInstance;
     private LocalizedResource langUtil;
-    public String clientLocale;
+    private String clientLocale;
     /** List of local addresses for checking admin commands. */
     ArrayList<InetAddress> localAddresses;
 
@@ -372,6 +372,9 @@ public final class NetworkServerControlI
         }
     }
 
+    /** Get the log writer we're using */
+    public  PrintWriter logWriter() { return logWriter; }
+
     /**
      * Get the host where we listen for connections.
      */
@@ -548,6 +551,24 @@ public final class NetworkServerControlI
         throw new Exception(msg);
     }
 
+    /** Return the debug state */
+    public  boolean debugOutput()   { return debugOutput; }
+
+    /** Return the att_extnam server attribute */
+    public  static  String  att_extnam()    { return att_extnam; }
+    
+    /** Return the att_srvclsnm server attribute */
+    public  static  String  att_srvclsnm()    { return att_srvclsnm; }
+    
+    /** Return the att_srvrlslv server attribute */
+    public  static  String  att_srvrlslv()    { return att_srvrlslv; }
+    
+    /** Return the product id */
+    public  static  String  prdId()    { return prdId; }
+
+    /** Return the bytes of the product id */
+    public  static  byte[]  prdIdBytes() { return (byte[]) prdIdBytes_.clone(); }
+    
     /**
      * Write an exception to console output stream,
      * but only if debugOutput is true.
@@ -4091,7 +4112,7 @@ public final class NetworkServerControlI
         return connNum;
     }
 
-    protected void setClientLocale(String locale)
+    public void setClientLocale(String locale)
     {
         clientLocale = locale;
     }



Mime
View raw message