2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.protocol.bgp.rib.impl;
10 import com.google.common.base.Preconditions;
12 import io.netty.channel.Channel;
13 import io.netty.util.Timer;
14 import io.netty.util.concurrent.Promise;
16 import org.opendaylight.protocol.bgp.parser.BGPSessionListener;
17 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry;
18 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPSessionValidator;
19 import org.opendaylight.protocol.framework.SessionListenerFactory;
20 import org.opendaylight.protocol.framework.SessionNegotiator;
21 import org.opendaylight.protocol.framework.SessionNegotiatorFactory;
22 import org.opendaylight.yangtools.yang.binding.Notification;
24 public final class BGPServerSessionNegotiatorFactory implements SessionNegotiatorFactory<Notification, BGPSessionImpl, BGPSessionListener> {
25 private final Timer timer;
26 private final BGPSessionValidator validator;
27 private final BGPPeerRegistry registry;
29 public BGPServerSessionNegotiatorFactory(final Timer timer, final BGPSessionValidator sessionValidator, final BGPPeerRegistry registry) {
30 this.registry = registry;
31 this.timer = Preconditions.checkNotNull(timer);
32 this.validator = Preconditions.checkNotNull(sessionValidator);
36 public SessionNegotiator<BGPSessionImpl> getSessionNegotiator(final SessionListenerFactory<BGPSessionListener> factory,
37 final Channel channel, final Promise<BGPSessionImpl> promise) {
38 return new BGPServerSessionNegotiator(this.timer, promise, channel, registry, validator);