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