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: pcep-impl yang module local name: pcep-dispatcher-impl
12 * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
13 * Generated at: Wed Nov 06 13:16:39 CET 2013
15 * Do not modify this file unless it is present under src/main directory
17 package org.opendaylight.controller.config.yang.pcep.impl;
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.pcep.PCEPDispatcher;
24 import org.osgi.framework.BundleContext;
27 * @deprecated Replaced by blueprint wiring
30 public final class PCEPDispatcherImplModule extends AbstractPCEPDispatcherImplModule {
31 private BundleContext bundleContext;
33 public PCEPDispatcherImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier name,
34 final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
35 super(name, dependencyResolver);
38 public PCEPDispatcherImplModule(final org.opendaylight.controller.config.api.ModuleIdentifier name,
39 final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final PCEPDispatcherImplModule oldModule,
40 final java.lang.AutoCloseable oldInstance) {
41 super(name, dependencyResolver, oldModule, oldInstance);
45 public AutoCloseable createInstance() {
46 final WaitingServiceTracker<PCEPDispatcher> tracker =
47 WaitingServiceTracker.create(PCEPDispatcher.class, this.bundleContext);
48 final PCEPDispatcher service = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
50 return Reflection.newProxy(AutoCloseablePCEPDispatcher.class, new AbstractInvocationHandler() {
52 protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable {
53 if (method.getName().equals("close")) {
57 return method.invoke(service, args);
63 void setBundleContext(BundleContext bundleContext) {
64 this.bundleContext = bundleContext;
67 private static interface AutoCloseablePCEPDispatcher extends PCEPDispatcher, AutoCloseable {