1. Corrected Ip Protocol match field.
[controller.git] / opendaylight / netconf / netconf-impl / src / main / java / org / opendaylight / controller / netconf / impl / NetconfServerSessionListenerFactory.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
9 package org.opendaylight.controller.netconf.impl;
10
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.protocol.framework.SessionListenerFactory;
16
17 public class NetconfServerSessionListenerFactory implements SessionListenerFactory<NetconfServerSessionListener> {
18
19     private final NetconfOperationServiceFactoryListener factoriesListener;
20
21     private final DefaultCommitNotificationProducer commitNotifier;
22
23     private final SessionIdProvider idProvider;
24
25     public NetconfServerSessionListenerFactory(NetconfOperationServiceFactoryListener factoriesListener,
26             DefaultCommitNotificationProducer commitNotifier,
27             SessionIdProvider idProvider) {
28         this.factoriesListener = factoriesListener;
29         this.commitNotifier = commitNotifier;
30         this.idProvider = idProvider;
31     }
32
33     @Override
34     public NetconfServerSessionListener getSessionListener() {
35         NetconfOperationServiceSnapshot netconfOperationServiceSnapshot = factoriesListener.getSnapshot(idProvider
36                 .getCurrentSessionId());
37
38         CapabilityProvider capabilityProvider = new CapabilityProviderImpl(netconfOperationServiceSnapshot);
39
40         NetconfOperationRouterImpl operationRouter = new NetconfOperationRouterImpl(
41                 netconfOperationServiceSnapshot, capabilityProvider,
42                 commitNotifier);
43
44         return new NetconfServerSessionListener(operationRouter);
45     }
46 }