2 * Copyright (c) 2023 PANTHEON.tech, s.r.o. 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.netconf.northbound;
10 import static java.util.Objects.requireNonNull;
12 import io.netty.channel.EventLoopGroup;
14 import org.opendaylight.netconf.server.NetconfServerDispatcherImpl;
15 import org.opendaylight.netconf.server.ServerChannelInitializer;
16 import org.opendaylight.netconf.server.api.NetconfServerDispatcher;
17 import org.osgi.service.component.annotations.Activate;
18 import org.osgi.service.component.annotations.Component;
20 @Component(factory = DefaultNetconfServerDispatcher.FACTORY_NAME, service = NetconfServerDispatcher.class)
21 public final class DefaultNetconfServerDispatcher extends NetconfServerDispatcherImpl {
22 static final String FACTORY_NAME = "org.opendaylight.netconf.impl.mdsal.DefaultNetconfServerDispatcher";
24 private static final String BOSS_PROP = ".bossGroup";
25 private static final String WORKER_PROP = ".workerGroup";
26 private static final String INITIALIZER_PROP = ".initializer";
29 public DefaultNetconfServerDispatcher(final Map<String, ?> properties) {
30 super(OSGiNetconfServer.extractProp(properties, INITIALIZER_PROP, ServerChannelInitializer.class),
31 OSGiNetconfServer.extractProp(properties, BOSS_PROP, EventLoopGroup.class),
32 OSGiNetconfServer.extractProp(properties, WORKER_PROP, EventLoopGroup.class));
35 static Map<String, ?> props(final EventLoopGroup bossGroup, final EventLoopGroup workerGroup,
36 final ServerChannelInitializer initializer) {
38 "type", "netconf-server-dispatcher",
39 BOSS_PROP, requireNonNull(bossGroup),
40 WORKER_PROP, requireNonNull(workerGroup),
41 INITIALIZER_PROP, requireNonNull(initializer));