BUG-47 : unfinished PCEP migration to generated DTOs.
[bgpcep.git] / pcep / impl / src / main / java / org / opendaylight / protocol / pcep / impl / DefaultPCEPSessionNegotiatorFactory.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.pcep.impl;
9
10 import io.netty.channel.Channel;
11 import io.netty.util.Timer;
12 import io.netty.util.concurrent.Promise;
13
14 import org.opendaylight.protocol.pcep.PCEPSessionListener;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.OpenObject;
16
17 import com.google.common.base.Preconditions;
18
19 public final class DefaultPCEPSessionNegotiatorFactory extends AbstractPCEPSessionNegotiatorFactory {
20         private final OpenObject localPrefs;
21         private final int maxUnknownMessages;
22         private final Timer timer;
23
24         public DefaultPCEPSessionNegotiatorFactory(final Timer timer, final OpenObject localPrefs, final int maxUnknownMessages) {
25                 this.timer = Preconditions.checkNotNull(timer);
26                 this.localPrefs = Preconditions.checkNotNull(localPrefs);
27                 this.maxUnknownMessages = maxUnknownMessages;
28         }
29
30         @Override
31         protected AbstractPCEPSessionNegotiator createNegotiator(final Promise<PCEPSessionImpl> promise, final PCEPSessionListener listener,
32                         final Channel channel, final short sessionId) {
33                 return new DefaultPCEPSessionNegotiator(this.timer, promise, channel, listener, sessionId, this.maxUnknownMessages, this.localPrefs);
34         }
35 }