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.netconf.northbound.notification.impl;
11 import com.google.common.reflect.AbstractInvocationHandler;
12 import com.google.common.reflect.Reflection;
13 import java.lang.reflect.Method;
14 import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
15 import org.opendaylight.netconf.notifications.NetconfNotificationCollector;
16 import org.opendaylight.netconf.notifications.NetconfNotificationRegistry;
17 import org.osgi.framework.BundleContext;
20 * @deprecated Replaced by blueprint wiring
23 public class NetconfNotificationManagerModule extends AbstractNetconfNotificationManagerModule {
25 private BundleContext bundleContext;
27 public NetconfNotificationManagerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
28 super(identifier, dependencyResolver);
31 public NetconfNotificationManagerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.netconf.northbound.notification.impl.NetconfNotificationManagerModule oldModule, java.lang.AutoCloseable oldInstance) {
32 super(identifier, dependencyResolver, oldModule, oldInstance);
36 public void customValidation() {
37 // add custom validation form module attributes here.
41 public java.lang.AutoCloseable createInstance() {
43 final WaitingServiceTracker<NetconfNotificationCollector> tracker =
44 WaitingServiceTracker.create(NetconfNotificationCollector.class, bundleContext, "(type=netconf-notification-manager)");
45 final NetconfNotificationCollector service = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
47 return Reflection.newProxy(AutoCloseableNetconfNotification.class, new AbstractInvocationHandler() {
49 protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable {
50 if (method.getName().equals("close")) {
54 return method.invoke(service, args);
60 void setBundleContext(BundleContext bundleContext) {
61 this.bundleContext = bundleContext;
64 private static interface AutoCloseableNetconfNotification extends NetconfNotificationCollector, NetconfNotificationRegistry, AutoCloseable {