EMMA Coverage Report (generated Fri Oct 21 16:16:13 KST 2005)
[all classes][org.apache.mina.protocol.vmpipe]

COVERAGE SUMMARY FOR SOURCE FILE [VmPipeAcceptor.java]

nameclass, %method, %block, %line, %
VmPipeAcceptor.java33%  (1/3)43%  (3/7)18%  (24/133)19%  (6/31)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class VmPipeAcceptor$Entry0%   (0/1)0%   (0/1)0%   (0/15)0%   (0/6)
VmPipeAcceptor$Entry (VmPipeAcceptor, VmPipeAddress, VmPipeSessionManagerFilt... 0%   (0/1)0%   (0/15)0%   (0/6)
     
class VmPipeAcceptor100% (1/1)50%  (3/6)20%  (24/118)24%  (6/25)
bind (SocketAddress, ProtocolProvider): void 0%   (0/1)0%   (0/66)0%   (0/12)
newSession (SocketAddress, SocketAddress): ProtocolSession 0%   (0/1)0%   (0/4)0%   (0/1)
unbind (SocketAddress): void 0%   (0/1)0%   (0/24)0%   (0/6)
<static initializer> 100% (1/1)100% (5/5)100% (1/1)
VmPipeAcceptor (): void 100% (1/1)100% (16/16)100% (4/4)
getFilterChain (): ProtocolFilterChain 100% (1/1)100% (3/3)100% (1/1)
     
class VmPipeAcceptor$10%   (0/1)100% (0/0)100% (0/0)100% (0/0)

1/*
2 * @(#) $Id: VmPipeAcceptor.java 327113 2005-10-21 06:59:15Z trustin $
3 */
4package org.apache.mina.protocol.vmpipe;
5 
6import java.io.IOException;
7import java.net.SocketAddress;
8import java.util.HashMap;
9import java.util.Map;
10 
11import org.apache.mina.common.BaseSessionManager;
12import org.apache.mina.protocol.ProtocolAcceptor;
13import org.apache.mina.protocol.ProtocolFilterChain;
14import org.apache.mina.protocol.ProtocolHandler;
15import org.apache.mina.protocol.ProtocolProvider;
16import org.apache.mina.protocol.ProtocolSession;
17 
18/**
19 * Binds the specified {@link ProtocolProvider} to the specified
20 * {@link VmPipeAddress}.
21 * 
22 * @author The Apache Directory Project (dev@directory.apache.org)
23 * @version $Rev: 327113 $, $Date: 2005-10-21 15:59:15 +0900 $
24 */
25public class VmPipeAcceptor extends BaseSessionManager implements ProtocolAcceptor
26{
27    static final Map boundHandlers = new HashMap();
28 
29    private final VmPipeSessionManagerFilterChain filterChain =
30        new VmPipeSessionManagerFilterChain( this );
31 
32    /**
33     * Creates a new instance.
34     */
35    public VmPipeAcceptor()
36    {
37        filterChain.addFirst( "VMPipe", new VmPipeFilter() );
38    }
39    
40    public void bind( SocketAddress address, ProtocolProvider protocolProvider ) throws IOException
41    {
42        if( address == null )
43            throw new NullPointerException( "address" );
44        if( protocolProvider == null )
45            throw new NullPointerException( "protocolProvider" );
46        if( !( address instanceof VmPipeAddress ) )
47            throw new IllegalArgumentException(
48                    "address must be VmPipeAddress." );
49 
50        synchronized( boundHandlers )
51        {
52            if( boundHandlers.containsKey( address ) )
53            {
54                throw new IOException( "Address already bound: " + address );
55            }
56 
57            boundHandlers.put( address, 
58                               new Entry( this,
59                                          ( VmPipeAddress ) address,
60                                          filterChain,
61                                          protocolProvider.getHandler() ) );
62        }
63    }
64 
65    public void unbind( SocketAddress address )
66    {
67        if( address == null )
68            throw new NullPointerException( "address" );
69 
70        synchronized( boundHandlers )
71        {
72            boundHandlers.remove( address );
73        }
74    }
75    
76    public ProtocolFilterChain getFilterChain()
77    {
78        return filterChain;
79    }
80 
81    static class Entry
82    {
83        final VmPipeAcceptor acceptor;
84        
85        final VmPipeAddress address;
86 
87        final VmPipeSessionManagerFilterChain managerFilterChain;
88 
89        final ProtocolHandler handler;
90        
91        private Entry( VmPipeAcceptor acceptor,
92                       VmPipeAddress address,
93                       VmPipeSessionManagerFilterChain managerFilterChain,
94                       ProtocolHandler handler )
95        {
96            this.acceptor = acceptor;
97            this.address = address;
98            this.managerFilterChain = managerFilterChain;
99            this.handler = handler;
100        }
101    }
102 
103    public ProtocolSession newSession( SocketAddress remoteAddress, SocketAddress localAddress )
104    {
105        throw new UnsupportedOperationException();
106    }
107}

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