Resolve Bug:707 - ConfigPusher should wait for netconf-impl to register JMX bean.
[controller.git] / opendaylight / netconf / netconf-impl / src / main / java / org / opendaylight / controller / netconf / impl / osgi / NetconfOperationServiceFactoryListenerImpl.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 package org.opendaylight.controller.netconf.impl.osgi;
9
10 import org.opendaylight.controller.netconf.mapping.api.NetconfOperationProvider;
11 import org.opendaylight.controller.netconf.mapping.api.NetconfOperationServiceFactory;
12
13 import java.util.HashSet;
14 import java.util.Set;
15
16 public class NetconfOperationServiceFactoryListenerImpl implements NetconfOperationServiceFactoryListener,
17         NetconfOperationProvider {
18     private final Set<NetconfOperationServiceFactory> allFactories = new HashSet<>();
19
20     @Override
21     public synchronized void onAddNetconfOperationServiceFactory(NetconfOperationServiceFactory service) {
22         allFactories.add(service);
23     }
24
25     @Override
26     public synchronized void onRemoveNetconfOperationServiceFactory(NetconfOperationServiceFactory service) {
27         allFactories.remove(service);
28     }
29
30     @Override
31     public synchronized NetconfOperationServiceSnapshotImpl getSnapshot(String sessionIdForReporting) {
32         return new NetconfOperationServiceSnapshotImpl(allFactories, sessionIdForReporting);
33     }
34
35 }