Initial framework migration to netty.
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / BGPDispatcherImpl.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.protocol.bgp.rib.impl;
9
10 import java.io.Closeable;
11 import java.io.IOException;
12
13 import org.opendaylight.protocol.bgp.parser.BGPSession;
14 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPConnection;
15 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPDispatcher;
16 import org.opendaylight.protocol.framework.Dispatcher;
17 import org.opendaylight.protocol.framework.ProtocolMessageFactory;
18
19 /**
20  * Implementation of BGPDispatcher.
21  */
22 public final class BGPDispatcherImpl implements BGPDispatcher, Closeable {
23
24         private final Dispatcher dispatcher;
25
26         public BGPDispatcherImpl(final Dispatcher dispatcher) throws IOException {
27                 this.dispatcher = dispatcher;
28         }
29
30         @Override
31         public BGPSession createClient(final BGPConnection connection, final ProtocolMessageFactory parser) throws IOException {
32                 return (BGPSession) this.dispatcher.createClient(connection, new BGPSessionFactory(parser));
33         }
34
35         public Dispatcher getDispatcher() {
36                 return this.dispatcher;
37         }
38
39         @Override
40         public void close() {
41                 // This is only necessary for configuration interaction
42         }
43 }