2 * Copyright (c) 2016 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
8 package org.opendaylight.controller.config.yang.bgp.rib.impl;
10 import com.google.common.reflect.AbstractInvocationHandler;
11 import com.google.common.reflect.Reflection;
12 import java.lang.reflect.Method;
13 import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
14 import org.opendaylight.protocol.bgp.rib.impl.spi.BGPPeerRegistry;
15 import org.osgi.framework.BundleContext;
18 * Registry of BGP peers that allows only one connection per 2 peers
20 * @deprecated Replaced by blueprint wiring
23 public class StrictBgpPeerRegistryModule extends org.opendaylight.controller.config.yang.bgp.rib.impl.AbstractStrictBgpPeerRegistryModule {
24 private BundleContext bundleContext;
26 public StrictBgpPeerRegistryModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
27 super(identifier, dependencyResolver);
30 public StrictBgpPeerRegistryModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final org.opendaylight.controller.config.yang.bgp.rib.impl.StrictBgpPeerRegistryModule oldModule, final java.lang.AutoCloseable oldInstance) {
31 super(identifier, dependencyResolver, oldModule, oldInstance);
35 public void customValidation() {
36 // add custom validation form module attributes here.
40 public java.lang.AutoCloseable createInstance() {
41 final WaitingServiceTracker<BGPPeerRegistry> tracker =
42 WaitingServiceTracker.create(BGPPeerRegistry.class, this.bundleContext);
43 final BGPPeerRegistry service = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
45 return Reflection.newProxy(BGPPeerRegistry.class, new AbstractInvocationHandler() {
47 protected Object handleInvocation(final Object proxy, final Method method, final Object[] args) throws Throwable {
48 if (method.getName().equals("close")) {
53 return method.invoke(service, args);
58 void setBundleContext(final BundleContext bundleContext) {
59 this.bundleContext = bundleContext;