directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r165589 - in /directory/network/trunk/src: examples/org/apache/mina/examples/echoserver/ examples/org/apache/mina/examples/reverser/ java/org/apache/mina/io/filter/ java/org/apache/mina/protocol/filter/ java/org/apache/mina/util/
Date Mon, 02 May 2005 06:49:48 GMT
Author: trustin
Date: Sun May  1 23:49:46 2005
New Revision: 165589

URL: http://svn.apache.org/viewcvs?rev=165589&view=rev
Log:
* Fixed: ambiguous LoggingFilter name
* Fixed: SessionLog key names

Added:
    directory/network/trunk/src/java/org/apache/mina/io/filter/IoLoggingFilter.java   (with
props)
    directory/network/trunk/src/java/org/apache/mina/protocol/filter/ProtocolLoggingFilter.java
  (with props)
Removed:
    directory/network/trunk/src/java/org/apache/mina/io/filter/LoggingFilter.java
    directory/network/trunk/src/java/org/apache/mina/protocol/filter/LoggingFilter.java
Modified:
    directory/network/trunk/src/examples/org/apache/mina/examples/echoserver/Main.java
    directory/network/trunk/src/examples/org/apache/mina/examples/reverser/Main.java
    directory/network/trunk/src/java/org/apache/mina/util/SessionLog.java

Modified: directory/network/trunk/src/examples/org/apache/mina/examples/echoserver/Main.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/examples/org/apache/mina/examples/echoserver/Main.java?rev=165589&r1=165588&r2=165589&view=diff
==============================================================================
--- directory/network/trunk/src/examples/org/apache/mina/examples/echoserver/Main.java (original)
+++ directory/network/trunk/src/examples/org/apache/mina/examples/echoserver/Main.java Sun
May  1 23:49:46 2005
@@ -21,7 +21,7 @@
 import org.apache.mina.common.TransportType;
 import org.apache.mina.examples.echoserver.ssl.BogusSSLContextFactory;
 import org.apache.mina.io.IoAcceptor;
-import org.apache.mina.io.filter.LoggingFilter;
+import org.apache.mina.io.filter.IoLoggingFilter;
 import org.apache.mina.io.filter.SSLFilter;
 import org.apache.mina.registry.Service;
 import org.apache.mina.registry.ServiceRegistry;
@@ -73,7 +73,7 @@
     private static void addLogger( ServiceRegistry registry )
     {
         IoAcceptor acceptor = registry.getIoAcceptor( TransportType.SOCKET );
-        acceptor.getFilterChain().addLast( "logger", new LoggingFilter() );
+        acceptor.getFilterChain().addLast( "logger", new IoLoggingFilter() );
         System.out.println( "Logging ON" );
     }
 }

Modified: directory/network/trunk/src/examples/org/apache/mina/examples/reverser/Main.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/examples/org/apache/mina/examples/reverser/Main.java?rev=165589&r1=165588&r2=165589&view=diff
==============================================================================
--- directory/network/trunk/src/examples/org/apache/mina/examples/reverser/Main.java (original)
+++ directory/network/trunk/src/examples/org/apache/mina/examples/reverser/Main.java Sun May
 1 23:49:46 2005
@@ -20,7 +20,7 @@
 
 import org.apache.mina.common.TransportType;
 import org.apache.mina.protocol.ProtocolAcceptor;
-import org.apache.mina.protocol.filter.LoggingFilter;
+import org.apache.mina.protocol.filter.ProtocolLoggingFilter;
 import org.apache.mina.registry.Service;
 import org.apache.mina.registry.ServiceRegistry;
 import org.apache.mina.registry.SimpleServiceRegistry;
@@ -51,7 +51,7 @@
     private static void addLogger( ServiceRegistry registry )
     {
         ProtocolAcceptor acceptor = registry.getProtocolAcceptor( TransportType.SOCKET );
-        acceptor.getFilterChain().addLast( "logger", new LoggingFilter() );
+        acceptor.getFilterChain().addLast( "logger", new ProtocolLoggingFilter() );
         System.out.println( "Logging ON" );
     }
 }

Added: directory/network/trunk/src/java/org/apache/mina/io/filter/IoLoggingFilter.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/io/filter/IoLoggingFilter.java?rev=165589&view=auto
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/io/filter/IoLoggingFilter.java (added)
+++ directory/network/trunk/src/java/org/apache/mina/io/filter/IoLoggingFilter.java Sun May
 1 23:49:46 2005
@@ -0,0 +1,97 @@
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.mina.io.filter;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.mina.common.ByteBuffer;
+import org.apache.mina.common.IdleStatus;
+import org.apache.mina.io.IoFilter;
+import org.apache.mina.io.IoSession;
+import org.apache.mina.util.SessionLog;
+
+/**
+ * Logs all MINA I/O events to {@link Logger}.
+ * 
+ * @author The Apache Directory Project (dev@directory.apache.org)
+ * @author Trustin Lee (trustin@apache.org)
+ * @version $Rev$, $Date$
+ * 
+ * @see SessionLog
+ */
+public class IoLoggingFilter implements IoFilter
+{
+    /**
+     * Session attribute key: prefix string
+     */
+    public static final String PREFIX = SessionLog.PREFIX;
+
+    /**
+     * Session attribute key: {@link Logger}
+     */
+    public static final String LOGGER = SessionLog.LOGGER;
+    
+    /**
+     * Session attribute key: {@link Level}
+     */
+    public static final String LEVEL = SessionLog.LEVEL;
+    
+    public void sessionOpened( NextFilter nextFilter, IoSession session )
+    {
+        SessionLog.log( session, "OPENED" );
+        nextFilter.sessionOpened( session );
+    }
+
+    public void sessionClosed( NextFilter nextFilter, IoSession session )
+    {
+        SessionLog.log( session, "CLOSED" );
+        nextFilter.sessionClosed( session );
+    }
+
+    public void sessionIdle( NextFilter nextFilter, IoSession session, IdleStatus status
)
+    {
+        SessionLog.log( session, "IDLE: " + status );
+        nextFilter.sessionIdle( session, status );
+    }
+
+    public void exceptionCaught( NextFilter nextFilter, IoSession session, Throwable cause
)
+    {
+        SessionLog.log( session, "EXCEPTION:", cause );
+        nextFilter.exceptionCaught( session, cause );
+    }
+
+    public void dataRead( NextFilter nextFilter, IoSession session, ByteBuffer buf)
+    {
+        SessionLog.log( session, "READ: " + buf.getHexDump() );
+        nextFilter.dataRead( session, buf );
+    }
+
+    public void dataWritten( NextFilter nextFilter, IoSession session, Object marker)
+    {
+        SessionLog.log( session, "WRITTEN: " + marker );
+        nextFilter.dataWritten( session, marker );
+    }
+
+    public void filterWrite( NextFilter nextFilter, IoSession session, ByteBuffer buf, Object
marker)
+    {
+        SessionLog.log( session, "WRITE:" + marker + ", " + buf.getHexDump() );
+        nextFilter.filterWrite( session, buf, marker );
+    }
+}

Propchange: directory/network/trunk/src/java/org/apache/mina/io/filter/IoLoggingFilter.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Added: directory/network/trunk/src/java/org/apache/mina/protocol/filter/ProtocolLoggingFilter.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/protocol/filter/ProtocolLoggingFilter.java?rev=165589&view=auto
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/protocol/filter/ProtocolLoggingFilter.java
(added)
+++ directory/network/trunk/src/java/org/apache/mina/protocol/filter/ProtocolLoggingFilter.java
Sun May  1 23:49:46 2005
@@ -0,0 +1,96 @@
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.mina.protocol.filter;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.mina.common.IdleStatus;
+import org.apache.mina.protocol.ProtocolFilter;
+import org.apache.mina.protocol.ProtocolSession;
+import org.apache.mina.util.SessionLog;
+
+/**
+ * Logs all MINA protocol events to {@link Logger}.
+ * 
+ * @author The Apache Directory Project (dev@directory.apache.org)
+ * @author Trustin Lee (trustin@apache.org)
+ * @version $Rev$, $Date$
+ * 
+ * @see SessionLog
+ */
+public class ProtocolLoggingFilter implements ProtocolFilter
+{
+    /**
+     * Session attribute key: prefix string
+     */
+    public static final String PREFIX = SessionLog.PREFIX;
+
+    /**
+     * Session attribute key: {@link Logger}
+     */
+    public static final String LOGGER = SessionLog.LOGGER;
+    
+    /**
+     * Session attribute key: {@link Level}
+     */
+    public static final String LEVEL = SessionLog.LEVEL;
+    
+    public void sessionOpened( NextFilter nextFilter, ProtocolSession session )
+    {
+        SessionLog.log( session, "OPENED" );
+        nextFilter.sessionOpened( session );
+    }
+
+    public void sessionClosed( NextFilter nextFilter, ProtocolSession session )
+    {
+        SessionLog.log( session, "CLOSED" );
+        nextFilter.sessionClosed( session );
+    }
+
+    public void sessionIdle( NextFilter nextFilter, ProtocolSession session, IdleStatus status
)
+    {
+        SessionLog.log( session, "IDLE: " + status );
+        nextFilter.sessionIdle( session, status );
+    }
+
+    public void exceptionCaught( NextFilter nextFilter, ProtocolSession session, Throwable
cause )
+    {
+        SessionLog.log( session, "EXCEPTION:", cause );
+        nextFilter.exceptionCaught( session, cause );
+    }
+
+    public void messageReceived( NextFilter nextFilter, ProtocolSession session, Object message
)
+    {
+        SessionLog.log( session, "RECEIVED: " + message );
+        nextFilter.messageReceived( session, message );
+    }
+
+    public void messageSent( NextFilter nextFilter, ProtocolSession session, Object message
)
+    {
+        SessionLog.log( session, "SENT: " + message );
+        nextFilter.messageSent( session, message );
+    }
+
+    public void filterWrite( NextFilter nextFilter, ProtocolSession session, Object message)
+    {
+        SessionLog.log( session, "WRITE: " + message );
+        nextFilter.filterWrite( session, message );
+    }
+}

Propchange: directory/network/trunk/src/java/org/apache/mina/protocol/filter/ProtocolLoggingFilter.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Modified: directory/network/trunk/src/java/org/apache/mina/util/SessionLog.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/util/SessionLog.java?rev=165589&r1=165588&r2=165589&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/util/SessionLog.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/util/SessionLog.java Sun May  1 23:49:46
2005
@@ -5,7 +5,6 @@
 
 import org.apache.mina.common.Session;
 import org.apache.mina.io.IoSession;
-import org.apache.mina.io.filter.LoggingFilter;
 import org.apache.mina.protocol.ProtocolSession;
 
 /**
@@ -24,17 +23,17 @@
     /**
      * Session attribute key: prefix string
      */
-    public static final String PREFIX = LoggingFilter.class.getName() + ".prefix";
+    public static final String PREFIX = SessionLog.class.getName() + ".prefix";
 
     /**
      * Session attribute key: {@link Logger}
      */
-    public static final String LOGGER = LoggingFilter.class.getName() + ".logger";
+    public static final String LOGGER = SessionLog.class.getName() + ".logger";
     
     /**
      * Session attribute key: {@link Level}
      */
-    public static final String LEVEL = LoggingFilter.class.getName() + ".level";
+    public static final String LEVEL = SessionLog.class.getName() + ".level";
 
     public static Logger getLogger( Session session )
     {



Mime
View raw message