Initial framework migration to netty.
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / BGPSessionFactory.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 io.netty.channel.ChannelHandlerContext;
11
12 import java.util.Timer;
13
14 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPConnection;
15 import org.opendaylight.protocol.framework.ProtocolConnection;
16 import org.opendaylight.protocol.framework.ProtocolMessageFactory;
17 import org.opendaylight.protocol.framework.ProtocolSession;
18 import org.opendaylight.protocol.framework.ProtocolSessionFactory;
19 import org.opendaylight.protocol.framework.SessionParent;
20
21 /**
22  *
23  */
24 public final class BGPSessionFactory implements ProtocolSessionFactory {
25
26         private final ProtocolMessageFactory parser;
27
28         public BGPSessionFactory(final ProtocolMessageFactory parser) {
29                 this.parser = parser;
30         }
31
32         @Override
33         public ProtocolSession getProtocolSession(final SessionParent parent, final Timer timer, final ProtocolConnection connection,
34                         final int sessionId, final ChannelHandlerContext ctx) {
35                 return new BGPSessionImpl(parent, timer, (BGPConnection) connection, sessionId, this.parser, ctx);
36         }
37 }