From e294b955eb9f5d2111ff09a56a1e8caf3533403b Mon Sep 17 00:00:00 2001 From: Tom Pantelis Date: Wed, 31 May 2017 13:48:34 -0400 Subject: [PATCH 1/1] Bug 8568: Remove deprecated MountProviderService APIs Removed the MountProviderService and associated APIs and implementations. Change-Id: I0cfde4f9d6204c4bcee1b1fc7028402b9290c6e4 Signed-off-by: Tom Pantelis --- .../sal/binding/api/mount/MountInstance.java | 21 ---- .../api/mount/MountProviderInstance.java | 27 ---- .../api/mount/MountProviderService.java | 41 ------ .../sal/binding/api/mount/MountService.java | 17 --- .../compat/HydrogenMountInstanceAdapter.java | 117 ------------------ .../HydrogenMountPointServiceAdapter.java | 49 -------- .../HydrogenMountProvisionServiceAdapter.java | 47 ------- 7 files changed, 319 deletions(-) delete mode 100644 opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountInstance.java delete mode 100644 opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountProviderInstance.java delete mode 100644 opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountProviderService.java delete mode 100644 opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountService.java delete mode 100644 opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/HydrogenMountInstanceAdapter.java delete mode 100644 opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/HydrogenMountPointServiceAdapter.java delete mode 100644 opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/HydrogenMountProvisionServiceAdapter.java diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountInstance.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountInstance.java deleted file mode 100644 index 8d12725319..0000000000 --- a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountInstance.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright (c) 2013 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.sal.binding.api.mount; - -import org.opendaylight.controller.sal.binding.api.NotificationService; -import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry; -import org.opendaylight.yangtools.concepts.Identifiable; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; - -public interface MountInstance // - extends // - RpcConsumerRegistry, // - Identifiable>, // - NotificationService { - -} diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountProviderInstance.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountProviderInstance.java deleted file mode 100644 index d883495ff3..0000000000 --- a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountProviderInstance.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2014 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.sal.binding.api.mount; - -import org.opendaylight.controller.sal.binding.api.NotificationProviderService; -import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; - -/** - * Provider's version of Mount Point, this version allows access to MD-SAL - * services specific for this mountpoint and registration / provision of - * interfaces for mount point. - * - * @author ttkacik - * - */ -public interface MountProviderInstance // - extends // - MountInstance, // - RpcProviderRegistry, // - NotificationProviderService { - -} diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountProviderService.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountProviderService.java deleted file mode 100644 index 9eb704f19f..0000000000 --- a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountProviderService.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2014 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.sal.binding.api.mount; - -import java.util.EventListener; - -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; - -/** - * Provider MountProviderService, this version allows access to MD-SAL services - * specific for this mountpoint and registration / provision of interfaces for - * mount point. - * - * @author ttkacik - * - */ -public interface MountProviderService extends MountService { - - @Override - MountProviderInstance getMountPoint(InstanceIdentifier path); - - MountProviderInstance createMountPoint(InstanceIdentifier path); - - MountProviderInstance createOrGetMountPoint(InstanceIdentifier path); - - ListenerRegistration registerProvisionListener(MountProvisionListener listener); - - interface MountProvisionListener extends EventListener { - - void onMountPointCreated(InstanceIdentifier path); - - void onMountPointRemoved(InstanceIdentifier path); - - } -} diff --git a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountService.java b/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountService.java deleted file mode 100644 index 1644c4029b..0000000000 --- a/opendaylight/md-sal/sal-binding-api/src/main/java/org/opendaylight/controller/sal/binding/api/mount/MountService.java +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2013 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.sal.binding.api.mount; - -import org.opendaylight.controller.sal.binding.api.BindingAwareService; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; - -public interface MountService extends BindingAwareService { - - MountInstance getMountPoint(InstanceIdentifier path); - -} 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); - } - -} diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/HydrogenMountPointServiceAdapter.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/HydrogenMountPointServiceAdapter.java deleted file mode 100644 index cecd4618d1..0000000000 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/HydrogenMountPointServiceAdapter.java +++ /dev/null @@ -1,49 +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.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; -import org.opendaylight.controller.md.sal.binding.api.MountPoint; -import org.opendaylight.controller.md.sal.binding.api.MountPointService; -import org.opendaylight.controller.sal.binding.api.mount.MountService; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; - -@Deprecated -public class HydrogenMountPointServiceAdapter implements MountService { - - private final MountPointService delegate; - - public HydrogenMountPointServiceAdapter(final MountPointService mountService) { - delegate = mountService; - } - - private final LoadingCache mountAdapters = CacheBuilder.newBuilder().weakKeys() - .build(new CacheLoader() { - - @Override - public HydrogenMountInstanceAdapter load(final MountPoint key) throws Exception { - return new HydrogenMountInstanceAdapter(key); - } - }); - - @Override - public HydrogenMountInstanceAdapter getMountPoint(final InstanceIdentifier path) { - final Optional mount = delegate.getMountPoint(path); - if (mount.isPresent()) { - return mountAdapters.getUnchecked(mount.get()); - } - return null; - } - - MountPointService getDelegate() { - return delegate; - } -} diff --git a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/HydrogenMountProvisionServiceAdapter.java b/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/HydrogenMountProvisionServiceAdapter.java deleted file mode 100644 index b2ee1a5f8d..0000000000 --- a/opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/compat/HydrogenMountProvisionServiceAdapter.java +++ /dev/null @@ -1,47 +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 org.opendaylight.controller.md.sal.binding.api.MountPointService; -import org.opendaylight.controller.sal.binding.api.mount.MountProviderInstance; -import org.opendaylight.controller.sal.binding.api.mount.MountProviderService; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -@Deprecated -public class HydrogenMountProvisionServiceAdapter extends HydrogenMountPointServiceAdapter implements MountProviderService { - - public HydrogenMountProvisionServiceAdapter(final MountPointService mountService) { - super(mountService); - } - - @Override - public MountProviderInstance createMountPoint(final InstanceIdentifier path) { - throw new UnsupportedOperationException("Not implemented"); - } - - @Override - public MountProviderInstance createOrGetMountPoint(final InstanceIdentifier path) { - return getMountPoint(path); - } - - @Override - public ListenerRegistration registerProvisionListener(final MountProvisionListener listener) { - return new ListenerRegistration() { - - @Override - public MountProvisionListener getInstance() { - return listener; - } - - @Override - public void close() { - } - }; - } - -} -- 2.36.6