EMMA Coverage Report (generated Wed Jun 08 12:10:57 KST 2005)
[all classes][org.apache.mina.protocol.vmpipe]

COVERAGE SUMMARY FOR SOURCE FILE [VmPipeAcceptor.java]

nameclass, %method, %block, %line, %
VmPipeAcceptor.java33%  (1/3)50%  (3/6)19%  (24/129)20%  (6/30)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class VmPipeAcceptor$10%   (0/1)100% (0/0)100% (0/0)100% (0/0)
     
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)60%  (3/5)21%  (24/114)25%  (6/24)
bind (SocketAddress, ProtocolProvider): void 0%   (0/1)0%   (0/66)0%   (0/12)
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)

1/*
2 * @(#) $Id: VmPipeAcceptor.java 165586 2005-05-02 06:27:27Z 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;
16 
17/**
18 * Binds the specified {@link ProtocolProvider} to the specified
19 * {@link VmPipeAddress}.
20 * 
21 * @author Trustin Lee (trustin@apache.org)
22 * @version $Rev: 165586 $, $Date: 2005-05-02 15:27:27 +0900 $
23 */
24public class VmPipeAcceptor extends BaseSessionManager implements ProtocolAcceptor
25{
26    static final Map boundHandlers = new HashMap();
27 
28    private final VmPipeSessionManagerFilterChain filterChain =
29        new VmPipeSessionManagerFilterChain( this );
30 
31    /**
32     * Creates a new instance.
33     */
34    public VmPipeAcceptor()
35    {
36        filterChain.addFirst( "VMPipe", new VmPipeFilter() );
37    }
38    
39    public void bind( SocketAddress address, ProtocolProvider protocolProvider ) throws IOException
40    {
41        if( address == null )
42            throw new NullPointerException( "address" );
43        if( protocolProvider == null )
44            throw new NullPointerException( "protocolProvider" );
45        if( !( address instanceof VmPipeAddress ) )
46            throw new IllegalArgumentException(
47                    "address must be VmPipeAddress." );
48 
49        synchronized( boundHandlers )
50        {
51            if( boundHandlers.containsKey( address ) )
52            {
53                throw new IOException( "Address already bound: " + address );
54            }
55 
56            boundHandlers.put( address, 
57                               new Entry( this,
58                                          ( VmPipeAddress ) address,
59                                          filterChain,
60                                          protocolProvider.getHandler() ) );
61        }
62    }
63 
64    public void unbind( SocketAddress address )
65    {
66        if( address == null )
67            throw new NullPointerException( "address" );
68 
69        synchronized( boundHandlers )
70        {
71            boundHandlers.remove( address );
72        }
73    }
74    
75    public ProtocolFilterChain getFilterChain()
76    {
77        return filterChain;
78    }
79 
80    static class Entry
81    {
82        final VmPipeAcceptor acceptor;
83        
84        final VmPipeAddress address;
85 
86        final VmPipeSessionManagerFilterChain managerFilterChain;
87 
88        final ProtocolHandler handler;
89        
90        private Entry( VmPipeAcceptor acceptor,
91                       VmPipeAddress address,
92                       VmPipeSessionManagerFilterChain managerFilterChain,
93                       ProtocolHandler handler )
94        {
95            this.acceptor = acceptor;
96            this.address = address;
97            this.managerFilterChain = managerFilterChain;
98            this.handler = handler;
99        }
100    }
101}

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