Move netconf-dom-api
[netconf.git] / protocol / netconf-impl / src / main / java / org / opendaylight / netconf / impl / NetconfServerDispatcherImpl.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.netconf.impl;
9
10 import io.netty.channel.ChannelFuture;
11 import io.netty.channel.EventLoopGroup;
12 import io.netty.channel.local.LocalAddress;
13 import io.netty.channel.local.LocalServerChannel;
14 import java.net.InetSocketAddress;
15 import org.opendaylight.netconf.api.NetconfServerDispatcher;
16 import org.opendaylight.netconf.nettyutil.AbstractNetconfDispatcher;
17
18 public class NetconfServerDispatcherImpl extends AbstractNetconfDispatcher<NetconfServerSession,
19         NetconfServerSessionListener> implements NetconfServerDispatcher {
20
21     private final ServerChannelInitializer initializer;
22
23     public NetconfServerDispatcherImpl(ServerChannelInitializer serverChannelInitializer, EventLoopGroup bossGroup,
24                                        EventLoopGroup workerGroup) {
25         super(bossGroup, workerGroup);
26         this.initializer = serverChannelInitializer;
27     }
28
29     @Override
30     public ChannelFuture createServer(InetSocketAddress address) {
31         return super.createServer(address, initializer::initialize);
32     }
33
34     @Override
35     public ChannelFuture createLocalServer(LocalAddress address) {
36         return super.createServer(address, LocalServerChannel.class, initializer::initialize);
37     }
38 }