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
11 * Generated from: yang module name: config-bgp-rib-spi yang module local name: bgp-rib-extensions-impl
12 * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
13 * Generated at: Wed Nov 27 12:38:57 CET 2013
15 * Do not modify this file unless it is present under src/main directory
17 package org.opendaylight.controller.config.yang.bgp.rib.spi;
19 import com.google.common.reflect.AbstractInvocationHandler;
20 import com.google.common.reflect.Reflection;
21 import java.lang.reflect.Method;
22 import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
23 import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderContext;
24 import org.osgi.framework.BundleContext;
27 * @deprecated Replaced by blueprint wiring but remains for backwards compatibility until downstream users
28 * of the provided config system service are converted to blueprint.
31 public final class RIBExtensionsImplModule extends org.opendaylight.controller.config.yang.bgp.rib.spi.AbstractRIBExtensionsImplModule {
32 private BundleContext bundleContext;
34 public RIBExtensionsImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
35 final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
36 super(identifier, dependencyResolver);
39 public RIBExtensionsImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
40 final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final RIBExtensionsImplModule oldModule,
41 final java.lang.AutoCloseable oldInstance) {
42 super(identifier, dependencyResolver, oldModule, oldInstance);
46 protected void customValidation() {
47 // Add custom validation for module attributes here.
51 public AutoCloseable createInstance() {
52 // The RIBExtensionProviderContext instance is created and advertised as an OSGi service via blueprint
53 // so obtain it here (waiting if necessary).
54 final WaitingServiceTracker<RIBExtensionProviderContext> tracker =
55 WaitingServiceTracker.create(RIBExtensionProviderContext.class, this.bundleContext);
56 final RIBExtensionProviderContext service = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
58 // Create a proxy to override close to close the ServiceTracker. The actual RIBExtensionProviderContext
59 // instance will be closed via blueprint.
60 return Reflection.newProxy(AutoCloseableRIBExtensionProviderContext.class, new AbstractInvocationHandler() {
62 protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable {
63 if (method.getName().equals("close")) {
67 return method.invoke(service, args);
73 void setBundleContext(BundleContext bundleContext) {
74 this.bundleContext = bundleContext;
77 private static interface AutoCloseableRIBExtensionProviderContext extends RIBExtensionProviderContext, AutoCloseable {