4 * Generated from: yang module name: openflow-switch-connection-provider-impl yang module local name: openflow-switch-connection-provider-impl
5 * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
6 * Generated at: Fri Mar 28 17:50:58 PDT 2014
8 * Do not modify this file unless it is present under src/main directory
10 package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow._switch.connection.provider.impl.rev140328;
12 import com.google.common.reflect.AbstractInvocationHandler;
13 import com.google.common.reflect.Reflection;
14 import java.lang.reflect.Method;
15 import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
16 import org.opendaylight.openflowjava.protocol.spi.connection.SwitchConnectionProvider;
17 import org.osgi.framework.BundleContext;
20 * @deprecated Replaced by blueprint wiring
23 public final class SwitchConnectionProviderModule extends AbstractSwitchConnectionProviderModule {
24 private BundleContext bundleContext;
28 * @param dependencyResolver
30 public SwitchConnectionProviderModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
31 super(identifier, dependencyResolver);
36 * @param dependencyResolver
40 public SwitchConnectionProviderModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier, final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
41 final SwitchConnectionProviderModule oldModule, final java.lang.AutoCloseable oldInstance) {
42 super(identifier, dependencyResolver, oldModule, oldInstance);
46 public AutoCloseable createInstance() {
47 // The service is provided via blueprint so wait for and return it here for backwards compatibility.
48 String typeFilter = String.format("(type=%s)", getIdentifier().getInstanceName());
49 final WaitingServiceTracker<SwitchConnectionProvider> tracker = WaitingServiceTracker.create(
50 SwitchConnectionProvider.class, bundleContext, typeFilter);
51 final SwitchConnectionProvider actualService = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
53 // We don't want to call close on the actual service as its life cycle is controlled by blueprint but
54 // we do want to close the tracker so create a proxy to override close appropriately.
55 return Reflection.newProxy(SwitchConnectionProvider.class, new AbstractInvocationHandler() {
57 protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable {
58 if (method.getName().equals("close")) {
62 return method.invoke(actualService, args);
68 public void setBundleContext(BundleContext bundleContext) {
69 this.bundleContext = bundleContext;
73 public boolean canReuseInstance(AbstractSwitchConnectionProviderModule oldModule) {