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.api.NetconfOperationRouter;
12 import org.opendaylight.controller.netconf.impl.mapping.CapabilityProvider;
13 import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationRouterImpl;
14 import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListener;
15 import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceSnapshot;
16 import org.opendaylight.controller.netconf.impl.osgi.SessionMonitoringService;
17 import org.opendaylight.protocol.framework.SessionListenerFactory;
19 public class NetconfServerSessionListenerFactory implements SessionListenerFactory<NetconfServerSessionListener> {
21 private final NetconfOperationServiceFactoryListener factoriesListener;
23 private final DefaultCommitNotificationProducer commitNotifier;
25 private final SessionIdProvider idProvider;
27 private final SessionMonitoringService monitor;
29 public NetconfServerSessionListenerFactory(NetconfOperationServiceFactoryListener factoriesListener,
30 DefaultCommitNotificationProducer commitNotifier,
31 SessionIdProvider idProvider, SessionMonitoringService monitor) {
32 this.factoriesListener = factoriesListener;
33 this.commitNotifier = commitNotifier;
34 this.idProvider = idProvider;
35 this.monitor = monitor;
39 public NetconfServerSessionListener getSessionListener() {
40 NetconfOperationServiceSnapshot netconfOperationServiceSnapshot = factoriesListener.getSnapshot(idProvider
41 .getCurrentSessionId());
43 CapabilityProvider capabilityProvider = new CapabilityProviderImpl(netconfOperationServiceSnapshot);
45 NetconfOperationRouter operationRouter = NetconfOperationRouterImpl.createOperationRouter(
46 netconfOperationServiceSnapshot, capabilityProvider,
49 return new NetconfServerSessionListener(operationRouter, monitor);