CVS: beepcore-java/src/org/beepcore/beep/core Session.java,1.31,1.32

Huston Franklin <[email protected]> Sat, 05 Oct 2002 08:29:26 -0700
Newsgroups gmane.network.beep.beepcore.java.cvs
Message-ID <[email protected]>
Update of /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core
In directory usw-pr-cvs1:/tmp/cvs-serv6792/src/org/beepcore/beep/core

Modified Files:
	Session.java 
Log Message:
changed to use commons-logging

Index: Session.java
===================================================================
RCS file: /cvsroot/beepcore-java/beepcore-java/src/org/beepcore/beep/core/Session.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -r1.31 -r1.32
*** Session.java	7 Sep 2002 14:58:09 -0000	1.31
--- Session.java	5 Oct 2002 15:29:24 -0000	1.32
***************
*** 32,35 ****
--- 32,38 ----
  import javax.xml.parsers.*;
  
+ import org.apache.commons.logging.Log;
+ import org.apache.commons.logging.LogFactory;
+ 
  import org.w3c.dom.*;
  
***************
*** 40,44 ****
  import org.beepcore.beep.core.event.SessionEvent;
  import org.beepcore.beep.core.event.SessionListener;
- import org.beepcore.beep.util.Log;
  import org.beepcore.beep.util.StringUtil;
  
--- 43,46 ----
***************
*** 89,93 ****
       new ABORTED_SessionOperations()};
  
-     private static final String CORE = "core";
      private static final int DEFAULT_CHANNELS_SIZE = 4;
      private static final int DEFAULT_PROPERTIES_SIZE = 4;
--- 91,94 ----
***************
*** 109,112 ****
--- 110,115 ----
  
      // Instance Data
+     private Log log = LogFactory.getLog(this.getClass());
+ 
      private int state;
      private long nextChannelNumber = 0;
***************
*** 222,226 ****
      protected void tuningInit() throws BEEPException
      {
!         Log.logEntry(Log.SEV_DEBUG, CORE, "Session.tuningInit");
  
          this.peerSupportedProfiles = null;
--- 225,229 ----
      protected void tuningInit() throws BEEPException
      {
!         log.debug("Session.tuningInit");
  
          this.peerSupportedProfiles = null;
***************
*** 274,279 ****
      public void close() throws BEEPException
      {
!         Log.logEntry(Log.SEV_DEBUG,
!                      "Closing Session with " + channels.size() + " channels");
  
          changeState(SESSION_STATE_CLOSE_PENDING);
--- 277,283 ----
      public void close() throws BEEPException
      {
!         if (log.isDebugEnabled()) {
!             log.debug("Closing Session with " + channels.size() + " channels");
!         }
  
          changeState(SESSION_STATE_CLOSE_PENDING);
***************
*** 318,322 ****
          } catch (BEEPException e) {
              terminate(e.getMessage());
!             Log.logEntry(Log.SEV_ERROR, e);
              throw e;
          }
--- 322,326 ----
          } catch (BEEPException e) {
              terminate(e.getMessage());
!             log.error("Error sending close", e);
              throw e;
          }
***************
*** 588,592 ****
                  reply.wait();
              } catch (InterruptedException e) {
!                 Log.logEntry(Log.SEV_ERROR, e);
                  throw new BEEPException("Interrupted waiting for reply");
              }
--- 592,596 ----
                  reply.wait();
              } catch (InterruptedException e) {
!                 log.error("Interrupted waiting for reply", e);
                  throw new BEEPException("Interrupted waiting for reply");
              }
***************
*** 622,626 ****
      public void terminate(String reason)
      {
!         Log.logEntry(Log.SEV_ERROR, reason);
  
          try {
--- 626,630 ----
      public void terminate(String reason)
      {
!         log.error(reason);
  
          try {
***************
*** 646,650 ****
          }
  
!         Log.logEntry(Log.SEV_DEBUG, CORE, "State changed to " + newState);
      }
  
--- 650,656 ----
          }
  
!         if (log.isDebugEnabled()) {
!             log.debug("State changed to " + newState);
!         }
      }
  
***************
*** 908,912 ****
                  reply.wait();
              } catch (InterruptedException e) {
!                 Log.logEntry(Log.SEV_ERROR, e);
                  throw new BEEPException("Interrupted waiting for reply");
              }
--- 914,918 ----
                  reply.wait();
              } catch (InterruptedException e) {
!                 log.error("Error waiting for reply", e);
                  throw new BEEPException("Interrupted waiting for reply");
              }
***************
*** 1093,1098 ****
          // @todo fireEvent(SESSION_STATE_CLOSING);
  
!         Log.logEntry(Log.SEV_DEBUG,
!                      "Closing Session with " + channels.size() + " channels");
  
          try {
--- 1099,1105 ----
          // @todo fireEvent(SESSION_STATE_CLOSING);
  
!         if (log.isDebugEnabled()) {
!             log.debug("Closing Session with " + channels.size() + " channels");
!         }
  
          try {
***************
*** 1153,1157 ****
              this.changeState(SESSION_STATE_CLOSED);
          } catch (BEEPException e) {
!             Log.logEntry(Log.SEV_ERROR, e);
          }
  
--- 1160,1164 ----
              this.changeState(SESSION_STATE_CLOSED);
          } catch (BEEPException e) {
!             log.error("Error changing state", e);
          }
  
***************
*** 1225,1230 ****
                  scl.startChannel(ch, encoding, p.data);
              } catch (TuningResetException e) {
!                 Log.logEntry(Log.SEV_DEBUG, CORE,
!                              "Leaving profile response to Tuning Profile CCL");
  
                  fireChannelStarted(ch);
--- 1232,1236 ----
                  scl.startChannel(ch, encoding, p.data);
              } catch (TuningResetException e) {
!                 log.debug("Leaving profile response to Tuning Profile CCL");
  
                  fireChannelStarted(ch);
***************
*** 1297,1301 ****
      private void sendGreeting() throws BEEPException
      {
!         Log.logEntry(Log.SEV_DEBUG, CORE, "sendGreeting");
  
          // get the greeting from the session
--- 1303,1307 ----
      private void sendGreeting() throws BEEPException
      {
!         log.debug("sendGreeting");
  
          // get the greeting from the session
***************
*** 1334,1339 ****
              // is this MSG a <start>
              if (elementName.equals("start")) {
!                 Log.logEntry(Log.SEV_DEBUG, CORE,
!                              "Received a start channel request");
  
                  String channelNumber = topElement.getAttribute("number");
--- 1340,1344 ----
              // is this MSG a <start>
              if (elementName.equals("start")) {
!                 log.debug("Received a start channel request");
  
                  String channelNumber = topElement.getAttribute("number");
***************
*** 1401,1406 ****
              // is this MSG a <close>
              else if (elementName.equals("close")) {
!                 Log.logEntry(Log.SEV_DEBUG, CORE,
!                              "Received a channel close request");
  
                  String channelNumber = topElement.getAttribute("number");
--- 1406,1410 ----
              // is this MSG a <close>
              else if (elementName.equals("close")) {
!                 log.debug("Received a channel close request");
  
                  String channelNumber = topElement.getAttribute("number");
***************
*** 1459,1463 ****
                  }
  
!                 Log.logEntry(Log.SEV_DEBUG, CORE, "Received a greeting");
  
                  // this attribute is implied
--- 1463,1467 ----
                  }
  
!                 log.debug("Received a greeting");
  
                  // this attribute is implied
***************
*** 1630,1637 ****
              }
  
!             Log.logEntry(Log.SEV_ERROR, CORE,
!                          "Received an error in response to a start. code="
!                          + err.getCode() + " diagnostic="
!                          + err.getDiagnostic());
  
              this.error = err;
--- 1634,1639 ----
              }
  
!             log.error("Received an error in response to a start. code="
!                       + err.getCode() + " diagnostic=" + err.getDiagnostic());
  
              this.error = err;
***************
*** 1688,1693 ****
                      // channel close)
                  } else if (elementName.equals("ok")) {
!                     Log.logEntry(Log.SEV_DEBUG, CORE,
!                                  "Received an OK for channel close");
  
                      // @todo we should fire an event instead.
--- 1690,1694 ----
                      // channel close)
                  } else if (elementName.equals("ok")) {
!                     log.debug("Received an OK for channel close");
  
                      // @todo we should fire an event instead.
***************
*** 1722,1729 ****
              }
  
!             Log.logEntry(Log.SEV_DEBUG, CORE,
!                          "Received an error in response to a close. code="
!                          + err.getCode() + " diagnostic="
!                          + err.getDiagnostic());
  
              this.error = err;
--- 1723,1728 ----
              }
  
!             log.debug("Received an error in response to a close. code="
!                       + err.getCode() + " diagnostic=" + err.getDiagnostic());
  
              this.error = err;
***************
*** 1781,1785 ****
                  return;
              } catch (Throwable e) {
!                 Log.logEntry(Log.SEV_ERROR, e);
                  s.terminate("Uncaught exception, terminating session");
  
--- 1780,1784 ----
                  return;
              } catch (Throwable e) {
!                 log.error("Error posting frame", e);
                  s.terminate("Uncaught exception, terminating session");
  
***************
*** 1787,1790 ****
--- 1786,1791 ----
              }
          }
+ 
+         private Log log = LogFactory.getLog(this.getClass());
      }
  
***************
*** 1815,1819 ****
                  return;
              } catch (Throwable e) {
!                 Log.logEntry(Log.SEV_ERROR, e);
                  s.terminate("Uncaught exception, terminating session");
  
--- 1816,1820 ----
                  return;
              } catch (Throwable e) {
!                 log.error("Error posting frame", e);
                  s.terminate("Uncaught exception, terminating session");
  
***************
*** 1821,1824 ****
--- 1822,1827 ----
              }
          }
+ 
+         private Log log = LogFactory.getLog(this.getClass());
      }
  
***************
*** 1843,1847 ****
                  return;
              } catch (Throwable e) {
!                 Log.logEntry(Log.SEV_ERROR, e);
                  s.terminate("Uncaught exception, terminating session");
  
--- 1846,1850 ----
                  return;
              } catch (Throwable e) {
!                 log.error("Error posting frame", e);
                  s.terminate("Uncaught exception, terminating session");
  
***************
*** 1849,1852 ****
--- 1852,1857 ----
              }
          }
+ 
+         private Log log = LogFactory.getLog(this.getClass());
      }
  
***************
*** 1874,1878 ****
                  return;
              } catch (Throwable e) {
!                 Log.logEntry(Log.SEV_ERROR, e);
                  s.terminate("Uncaught exception, terminating session");
  
--- 1879,1883 ----
                  return;
              } catch (Throwable e) {
!                 log.error("Error posting frame", e);
                  s.terminate("Uncaught exception, terminating session");
  
***************
*** 1880,1883 ****
--- 1885,1890 ----
              }
          }
+ 
+         private Log log = LogFactory.getLog(this.getClass());
      }
  
***************
*** 1902,1906 ****
                  return;
              } catch (Throwable e) {
!                 Log.logEntry(Log.SEV_ERROR, e);
                  s.terminate("Uncaught exception, terminating session");
  
--- 1909,1913 ----
                  return;
              } catch (Throwable e) {
!                 log.error("Error posting frame", e);
                  s.terminate("Uncaught exception, terminating session");
  
***************
*** 1908,1911 ****
--- 1915,1920 ----
              }
          }
+ 
+         private Log log = LogFactory.getLog(this.getClass());
      }
  
***************
*** 1924,1931 ****
          public void postFrame(Session s, Frame f) throws BEEPException {
              // If we're in an error state
!             Log.logEntry(Log.SEV_DEBUG,
!                          "Dropping a frame because the Session state is " +
!                          "no longer active.");
          }
      }
  
--- 1933,1941 ----
          public void postFrame(Session s, Frame f) throws BEEPException {
              // If we're in an error state
!             log.debug("Dropping a frame because the Session state is " +
!                       "no longer active.");
          }
+ 
+         private Log log = LogFactory.getLog(this.getClass());
      }
  
***************
*** 1949,1953 ****
                  return;
              } catch (Throwable e) {
!                 Log.logEntry(Log.SEV_ERROR, e);
                  s.terminate("Uncaught exception, terminating session");
  
--- 1959,1963 ----
                  return;
              } catch (Throwable e) {
!                 log.error("Error posting frame", e);
                  s.terminate("Uncaught exception, terminating session");
  
***************
*** 1955,1958 ****
--- 1965,1970 ----
              }
          }
+ 
+         private Log log = LogFactory.getLog(this.getClass());
      }
  
***************
*** 1964,1971 ****
          public void postFrame(Session s, Frame f) throws BEEPException {
              // If we're in an error state
!             Log.logEntry(Log.SEV_DEBUG,
!                          "Dropping a frame because the Session state is " +
!                          "no longer active.");
          }
      }
  
--- 1976,1984 ----
          public void postFrame(Session s, Frame f) throws BEEPException {
              // If we're in an error state
!             log.debug("Dropping a frame because the Session state is " +
!                       "no longer active.");
          }
+ 
+         private Log log = LogFactory.getLog(this.getClass());
      }
  
***************
*** 1977,1984 ****
          public void postFrame(Session s, Frame f) throws BEEPException {
              // If we're in an error state
!             Log.logEntry(Log.SEV_DEBUG,
!                          "Dropping a frame because the Session state is " +
!                          "no longer active.");
          }
      }
  }
--- 1990,1998 ----
          public void postFrame(Session s, Frame f) throws BEEPException {
              // If we're in an error state
!             log.debug("Dropping a frame because the Session state is " +
!                       "no longer active.");
          }
+ 
+         private Log log = LogFactory.getLog(this.getClass());
      }
  }



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf