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
8 package org.opendaylight.controller.config.yang.rsvp.spi;
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.rsvp.parser.spi.RSVPExtensionProviderContext;
15 import org.osgi.framework.BundleContext;
18 * @deprecated Replaced by blueprint wiring
21 public class SimpleRSVPExtensionProviderContextModule extends org.opendaylight.controller.config.yang.rsvp.spi.AbstractSimpleRSVPExtensionProviderContextModule {
22 private BundleContext bundleContext;
24 public SimpleRSVPExtensionProviderContextModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
25 super(identifier, dependencyResolver);
28 public SimpleRSVPExtensionProviderContextModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.rsvp.spi.SimpleRSVPExtensionProviderContextModule oldModule, java.lang.AutoCloseable oldInstance) {
29 super(identifier, dependencyResolver, oldModule, oldInstance);
33 public void customValidation() {
34 // add custom validation form module attributes here.
38 public java.lang.AutoCloseable createInstance() {
39 final WaitingServiceTracker<RSVPExtensionProviderContext> tracker =
40 WaitingServiceTracker.create(RSVPExtensionProviderContext.class, bundleContext);
41 final RSVPExtensionProviderContext service = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
43 return Reflection.newProxy(AutoCloseableRSVPExtensionProviderContext.class, new AbstractInvocationHandler() {
45 protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable {
46 if (method.getName().equals("close")) {
50 return method.invoke(service, args);
56 void setBundleContext(BundleContext bundleContext) {
57 this.bundleContext = bundleContext;
60 private static interface AutoCloseableRSVPExtensionProviderContext extends RSVPExtensionProviderContext, AutoCloseable {