X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fbinding%2Fcompat%2FHydrogenMountInstanceAdapter.java;fp=opendaylight%2Fmd-sal%2Fsal-binding-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fbinding%2Fcompat%2FHydrogenMountInstanceAdapter.java;h=0000000000000000000000000000000000000000;hb=e294b955eb9f5d2111ff09a56a1e8caf3533403b;hp=3a4d785b923b980b27ed9d23c5e972b3e0bd7e0f;hpb=ad5299f05589b508b89f40c97b62016ed1806ae8;p=controller.git diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/HydrogenMountInstanceAdapter.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/HydrogenMountInstanceAdapter.java deleted file mode 100644 index 3a4d785b92..0000000000 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/HydrogenMountInstanceAdapter.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.md.sal.binding.compat; - -import com.google.common.base.Optional; -import com.google.common.base.Preconditions; -import com.google.common.collect.ClassToInstanceMap; -import com.google.common.collect.ImmutableClassToInstanceMap; -import java.util.concurrent.ExecutorService; -import org.opendaylight.controller.md.sal.binding.api.MountPoint; -import org.opendaylight.controller.md.sal.common.api.routing.RouteChangeListener; -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration; -import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration; -import org.opendaylight.controller.sal.binding.api.BindingAwareService; -import org.opendaylight.controller.sal.binding.api.NotificationListener; -import org.opendaylight.controller.sal.binding.api.NotificationProviderService; -import org.opendaylight.controller.sal.binding.api.NotificationService; -import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry; -import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; -import org.opendaylight.controller.sal.binding.api.mount.MountProviderInstance; -import org.opendaylight.controller.sal.binding.api.rpc.RpcContextIdentifier; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import org.opendaylight.yangtools.yang.binding.Notification; -import org.opendaylight.yangtools.yang.binding.RpcService; - -@Deprecated -public class HydrogenMountInstanceAdapter implements MountProviderInstance { - - private final ClassToInstanceMap services; - private final InstanceIdentifier identifier; - - - public HydrogenMountInstanceAdapter(final MountPoint key) { - this.identifier = key.getIdentifier(); - final ImmutableClassToInstanceMap.Builder builder = ImmutableClassToInstanceMap.builder(); - - final Optional notificationService = key.getService(org.opendaylight.controller.md.sal.binding.api.NotificationService.class); - if(notificationService.isPresent()) { - builder.put(NotificationService.class, new HeliumNotificationServiceAdapter(notificationService.get())); - } - final Optional rpcRegistry = key.getService(RpcConsumerRegistry.class); - if(rpcRegistry.isPresent()) { - builder.put(RpcConsumerRegistry.class, rpcRegistry.get()); - } - services = builder.build(); - } - - - private T service(final Class service) { - final T potential = services.getInstance(service); - Preconditions.checkState(potential != null, "Service %s is not supported by mount point %s",service,this.getIdentifier()); - return potential; - } - - @Override - public T getRpcService(final Class serviceInterface) { - return service(RpcConsumerRegistry.class).getRpcService(serviceInterface); - } - - @Override - public InstanceIdentifier getIdentifier() { - return identifier; - } - - @Override - public ListenerRegistration> registerNotificationListener( - final Class notificationType, final NotificationListener listener) { - return service(NotificationService.class).registerNotificationListener(notificationType, listener); - } - - @Override - public ListenerRegistration registerNotificationListener( - final org.opendaylight.yangtools.yang.binding.NotificationListener listener) { - return service(NotificationService.class).registerNotificationListener(listener); - } - - @Override - public RoutedRpcRegistration addRoutedRpcImplementation(final Class serviceInterface, - final T implementation) throws IllegalStateException { - return service(RpcProviderRegistry.class).addRoutedRpcImplementation(serviceInterface, implementation); - } - - @Override - public RpcRegistration addRpcImplementation(final Class serviceInterface, final T implementation) - throws IllegalStateException { - return service(RpcProviderRegistry.class).addRpcImplementation(serviceInterface, implementation); - } - - @Override - public void publish(final Notification notification) { - service(NotificationProviderService.class).publish(notification); - } - - @Override - public void publish(final Notification notification, final ExecutorService executor) { - service(NotificationProviderService.class).publish(notification); - } - - @Override - public ListenerRegistration registerInterestListener( - final NotificationInterestListener interestListener) { - return service(NotificationProviderService.class).registerInterestListener(interestListener); - } - - @Override - public >> ListenerRegistration registerRouteChangeListener( - final L arg0) { - return service(RpcProviderRegistry.class).registerRouteChangeListener(arg0); - } - -}