Bug 8568: Remove deprecated MountProviderService APIs
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / main / java / org / opendaylight / controller / md / sal / binding / compat / HydrogenMountInstanceAdapter.java
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 (file)
index 3a4d785..0000000
+++ /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<BindingAwareService> services;
-    private final InstanceIdentifier<?> identifier;
-
-
-    public HydrogenMountInstanceAdapter(final MountPoint key) {
-        this.identifier = key.getIdentifier();
-        final ImmutableClassToInstanceMap.Builder<BindingAwareService> builder = ImmutableClassToInstanceMap.builder();
-
-        final Optional<org.opendaylight.controller.md.sal.binding.api.NotificationService> 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<RpcConsumerRegistry> rpcRegistry = key.getService(RpcConsumerRegistry.class);
-        if(rpcRegistry.isPresent()) {
-            builder.put(RpcConsumerRegistry.class, rpcRegistry.get());
-        }
-        services = builder.build();
-    }
-
-
-    private <T extends BindingAwareService> T service(final Class<T> 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 extends RpcService> T getRpcService(final Class<T> serviceInterface) {
-        return service(RpcConsumerRegistry.class).getRpcService(serviceInterface);
-    }
-
-    @Override
-    public InstanceIdentifier<?> getIdentifier() {
-        return identifier;
-    }
-
-    @Override
-    public <T extends Notification> ListenerRegistration<NotificationListener<T>> registerNotificationListener(
-            final Class<T> notificationType, final NotificationListener<T> listener) {
-        return service(NotificationService.class).registerNotificationListener(notificationType, listener);
-    }
-
-    @Override
-    public ListenerRegistration<org.opendaylight.yangtools.yang.binding.NotificationListener> registerNotificationListener(
-            final org.opendaylight.yangtools.yang.binding.NotificationListener listener) {
-        return service(NotificationService.class).registerNotificationListener(listener);
-    }
-
-    @Override
-    public <T extends RpcService> RoutedRpcRegistration<T> addRoutedRpcImplementation(final Class<T> serviceInterface,
-            final T implementation) throws IllegalStateException {
-        return service(RpcProviderRegistry.class).addRoutedRpcImplementation(serviceInterface, implementation);
-    }
-
-    @Override
-    public <T extends RpcService> RpcRegistration<T> addRpcImplementation(final Class<T> 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<NotificationInterestListener> registerInterestListener(
-            final NotificationInterestListener interestListener) {
-        return service(NotificationProviderService.class).registerInterestListener(interestListener);
-    }
-
-    @Override
-    public <L extends RouteChangeListener<RpcContextIdentifier, InstanceIdentifier<?>>> ListenerRegistration<L> registerRouteChangeListener(
-            final L arg0) {
-        return service(RpcProviderRegistry.class).registerRouteChangeListener(arg0);
-    }
-
-}