2 * Copyright (c) 2015 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
9 package org.opendaylight.controller.config.yang.config.netconf.northbound.impl;
11 import org.opendaylight.controller.config.api.JmxAttributeValidationException;
12 import org.opendaylight.netconf.mapping.api.NetconfOperationServiceFactory;
13 import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService;
14 import org.opendaylight.netconf.impl.NetconfServerDispatcherImpl;
15 import org.opendaylight.netconf.impl.NetconfServerSessionNegotiatorFactory;
16 import org.opendaylight.netconf.impl.SessionIdProvider;
17 import org.opendaylight.netconf.impl.osgi.AggregatedNetconfOperationServiceFactory;
19 public class NetconfServerDispatcherModule extends org.opendaylight.controller.config.yang.config.netconf.northbound.impl.AbstractNetconfServerDispatcherModule {
20 public NetconfServerDispatcherModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
21 super(identifier, dependencyResolver);
24 public NetconfServerDispatcherModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.config.netconf.northbound.impl.NetconfServerDispatcherModule oldModule, java.lang.AutoCloseable oldInstance) {
25 super(identifier, dependencyResolver, oldModule, oldInstance);
29 public void customValidation() {
30 JmxAttributeValidationException.checkCondition(getConnectionTimeoutMillis() > 0, "Invalid connection timeout", connectionTimeoutMillisJmxAttribute);
34 public java.lang.AutoCloseable createInstance() {
36 final AggregatedNetconfOperationServiceFactory aggregatedOpProvider = getAggregatedOpProvider();
37 final NetconfMonitoringService monitoringService = getServerMonitorDependency();
38 final NetconfServerSessionNegotiatorFactory serverNegotiatorFactory = new NetconfServerSessionNegotiatorFactory(
39 getTimerDependency(), aggregatedOpProvider, new SessionIdProvider(), getConnectionTimeoutMillis(), monitoringService);
40 final NetconfServerDispatcherImpl.ServerChannelInitializer serverChannelInitializer = new NetconfServerDispatcherImpl.ServerChannelInitializer(
41 serverNegotiatorFactory);
43 return new NetconfServerDispatcherImpl(serverChannelInitializer, getBossThreadGroupDependency(), getWorkerThreadGroupDependency()) {
47 // NOOP, close should not be present here, the deprecated method closes injected evet loop groups
53 private AggregatedNetconfOperationServiceFactory getAggregatedOpProvider() {
54 final AggregatedNetconfOperationServiceFactory netconfOperationProvider = new AggregatedNetconfOperationServiceFactory();
55 for (final NetconfOperationServiceFactory netconfOperationServiceFactory : getMappersDependency()) {
56 netconfOperationProvider.onAddNetconfOperationServiceFactory(netconfOperationServiceFactory);
58 return netconfOperationProvider;