EMMA Coverage Report (generated Sat Sep 03 11:42:34 KST 2005)
[all classes][org.apache.mina.protocol.filter]

COVERAGE SUMMARY FOR SOURCE FILE [ProtocolLoggingFilter.java]

nameclass, %method, %block, %line, %
ProtocolLoggingFilter.java0%   (0/1)0%   (0/11)0%   (0/119)0%   (0/31)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ProtocolLoggingFilter0%   (0/1)0%   (0/11)0%   (0/119)0%   (0/31)
<static initializer> 0%   (0/1)0%   (0/5)0%   (0/2)
ProtocolLoggingFilter (): void 0%   (0/1)0%   (0/6)0%   (0/3)
exceptionCaught (ProtocolFilter$NextFilter, ProtocolSession, Throwable): void 0%   (0/1)0%   (0/11)0%   (0/3)
filterWrite (ProtocolFilter$NextFilter, ProtocolSession, Object): void 0%   (0/1)0%   (0/17)0%   (0/3)
getDefaultLevel (): Level 0%   (0/1)0%   (0/3)0%   (0/1)
messageReceived (ProtocolFilter$NextFilter, ProtocolSession, Object): void 0%   (0/1)0%   (0/17)0%   (0/3)
messageSent (ProtocolFilter$NextFilter, ProtocolSession, Object): void 0%   (0/1)0%   (0/17)0%   (0/3)
sessionClosed (ProtocolFilter$NextFilter, ProtocolSession): void 0%   (0/1)0%   (0/9)0%   (0/3)
sessionIdle (ProtocolFilter$NextFilter, ProtocolSession, IdleStatus): void 0%   (0/1)0%   (0/17)0%   (0/3)
sessionOpened (ProtocolFilter$NextFilter, ProtocolSession): void 0%   (0/1)0%   (0/9)0%   (0/3)
setDefaultLevel (Level): void 0%   (0/1)0%   (0/8)0%   (0/4)

1/*
2 *   @(#) $Id: ProtocolLoggingFilter.java 264677 2005-08-30 02:44:35Z trustin $
3 *
4 *   Copyright 2004 The Apache Software Foundation
5 *
6 *   Licensed under the Apache License, Version 2.0 (the "License");
7 *   you may not use this file except in compliance with the License.
8 *   You may obtain a copy of the License at
9 *
10 *       http://www.apache.org/licenses/LICENSE-2.0
11 *
12 *   Unless required by applicable law or agreed to in writing, software
13 *   distributed under the License is distributed on an "AS IS" BASIS,
14 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 *   See the License for the specific language governing permissions and
16 *   limitations under the License.
17 *
18 */
19package org.apache.mina.protocol.filter;
20 
21import java.util.logging.Level;
22import java.util.logging.Logger;
23 
24import org.apache.mina.common.IdleStatus;
25import org.apache.mina.protocol.ProtocolFilter;
26import org.apache.mina.protocol.ProtocolSession;
27import org.apache.mina.util.SessionLog;
28 
29/**
30 * Logs all MINA protocol events to {@link Logger}.
31 * 
32 * @author The Apache Directory Project (dev@directory.apache.org)
33 * @author Trustin Lee (trustin@apache.org)
34 * @version $Rev: 264677 $, $Date: 2005-08-30 11:44:35 +0900 $
35 * 
36 * @see SessionLog
37 */
38public class ProtocolLoggingFilter implements ProtocolFilter
39{
40    /**
41     * Session attribute key: prefix string
42     */
43    public static final String PREFIX = SessionLog.PREFIX;
44 
45    /**
46     * Session attribute key: {@link Logger}
47     */
48    public static final String LOGGER = SessionLog.LOGGER;
49    
50    private Level defaultLevel = Level.INFO;
51    
52    /**
53     * Creates a new instance.
54     */
55    public ProtocolLoggingFilter()
56    {
57    }
58    
59    
60    /**
61     * Returns the default level of log entry this filter logs. 
62     */
63    public Level getDefaultLevel() {
64        return defaultLevel;
65    }
66    
67    /**
68     * Sets the default level of log entry this filter logs. 
69     */
70    public void setDefaultLevel(Level defaultLevel) {
71        if( defaultLevel == null )
72        {
73            defaultLevel = Level.INFO;
74        }
75        this.defaultLevel = defaultLevel;
76    }
77    
78    public void sessionOpened( NextFilter nextFilter, ProtocolSession session )
79    {
80        SessionLog.log( defaultLevel, session, "OPENED" );
81        nextFilter.sessionOpened( session );
82    }
83 
84    public void sessionClosed( NextFilter nextFilter, ProtocolSession session )
85    {
86        SessionLog.log( defaultLevel, session, "CLOSED" );
87        nextFilter.sessionClosed( session );
88    }
89 
90    public void sessionIdle( NextFilter nextFilter, ProtocolSession session, IdleStatus status )
91    {
92        SessionLog.log( defaultLevel, session, "IDLE: " + status );
93        nextFilter.sessionIdle( session, status );
94    }
95 
96    public void exceptionCaught( NextFilter nextFilter, ProtocolSession session, Throwable cause )
97    {
98        SessionLog.log( defaultLevel, session, "EXCEPTION:", cause );
99        nextFilter.exceptionCaught( session, cause );
100    }
101 
102    public void messageReceived( NextFilter nextFilter, ProtocolSession session, Object message )
103    {
104        SessionLog.log( defaultLevel, session, "RECEIVED: " + message );
105        nextFilter.messageReceived( session, message );
106    }
107 
108    public void messageSent( NextFilter nextFilter, ProtocolSession session, Object message )
109    {
110        SessionLog.log( defaultLevel, session, "SENT: " + message );
111        nextFilter.messageSent( session, message );
112    }
113 
114    public void filterWrite( NextFilter nextFilter, ProtocolSession session, Object message)
115    {
116        SessionLog.log( defaultLevel, session, "WRITE: " + message );
117        nextFilter.filterWrite( session, message );
118    }
119}

[all classes][org.apache.mina.protocol.filter]
EMMA 2.0.4217 (C) Vladimir Roubtsov