2 * Copyright (c) 2013 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.netconf.impl;
11 import org.opendaylight.controller.netconf.impl.mapping.CapabilityProvider;
12 import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationRouterImpl;
13 import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListener;
14 import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceSnapshot;
15 import org.opendaylight.controller.netconf.impl.osgi.SessionMonitoringService;
16 import org.opendaylight.protocol.framework.SessionListenerFactory;
18 public class NetconfServerSessionListenerFactory implements SessionListenerFactory<NetconfServerSessionListener> {
20 private final NetconfOperationServiceFactoryListener factoriesListener;
22 private final DefaultCommitNotificationProducer commitNotifier;
24 private final SessionIdProvider idProvider;
26 private final SessionMonitoringService monitor;
28 public NetconfServerSessionListenerFactory(NetconfOperationServiceFactoryListener factoriesListener,
29 DefaultCommitNotificationProducer commitNotifier,
30 SessionIdProvider idProvider, SessionMonitoringService monitor) {
31 this.factoriesListener = factoriesListener;
32 this.commitNotifier = commitNotifier;
33 this.idProvider = idProvider;
34 this.monitor = monitor;
38 public NetconfServerSessionListener getSessionListener() {
39 NetconfOperationServiceSnapshot netconfOperationServiceSnapshot = factoriesListener.getSnapshot(idProvider
40 .getCurrentSessionId());
42 CapabilityProvider capabilityProvider = new CapabilityProviderImpl(netconfOperationServiceSnapshot);
44 NetconfOperationRouterImpl operationRouter = new NetconfOperationRouterImpl(
45 netconfOperationServiceSnapshot, capabilityProvider,
48 return new NetconfServerSessionListener(operationRouter, monitor);