From b918272653a8b032c3b6dcef339d3fd1fe02d059 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Tue, 10 Jul 2018 19:41:28 +0200 Subject: [PATCH] Remove sal.core.api.BrokerService This interface has been long deprecated and it is not really used anywhere. Remove it. Change-Id: I8dcee98f19d80df4532891f73776dc4c268ef025 Signed-off-by: Robert Varga --- .../binding/test/util/BindingTestContext.java | 6 -- .../md/sal/dom/api/DOMDataBroker.java | 5 +- .../md/sal/dom/api/DOMMountPointService.java | 4 +- .../api/DOMNotificationPublishService.java | 3 +- .../sal/dom/api/DOMNotificationService.java | 3 +- .../controller/md/sal/dom/api/DOMService.java | 9 +-- .../sal/core/api/BrokerService.java | 19 ----- .../controller/sal/core/api/package-info.java | 11 --- opendaylight/md-sal/sal-dom-broker/pom.xml | 1 - .../osgi/AbstractBrokerServiceProxy.java | 80 ------------------- .../dom/broker/osgi/DOMDataBrokerProxy.java | 51 ------------ .../osgi/DOMMountPointServiceProxy.java | 41 ---------- .../sal/dom/broker/osgi/ProxyFactory.java | 55 ------------- 13 files changed, 7 insertions(+), 281 deletions(-) delete mode 100644 opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/BrokerService.java delete mode 100644 opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/package-info.java delete mode 100644 opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/AbstractBrokerServiceProxy.java delete mode 100644 opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/DOMDataBrokerProxy.java delete mode 100644 opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/DOMMountPointServiceProxy.java delete mode 100644 opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/ProxyFactory.java diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/util/BindingTestContext.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/util/BindingTestContext.java index a5d0b261f1..99385b0325 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/util/BindingTestContext.java +++ b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/util/BindingTestContext.java @@ -10,10 +10,8 @@ package org.opendaylight.controller.sal.binding.test.util; import static com.google.common.base.Preconditions.checkState; import com.google.common.annotations.Beta; -import com.google.common.collect.ClassToInstanceMap; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; -import com.google.common.collect.MutableClassToInstanceMap; import com.google.common.util.concurrent.ListeningExecutorService; import com.google.common.util.concurrent.MoreExecutors; import javassist.ClassPool; @@ -45,7 +43,6 @@ import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore; import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry; import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; import org.opendaylight.controller.sal.binding.impl.RootBindingAwareBroker; -import org.opendaylight.controller.sal.core.api.BrokerService; import org.opendaylight.controller.sal.core.spi.data.DOMStore; import org.opendaylight.mdsal.binding.dom.codec.gen.impl.DataObjectSerializerGenerator; import org.opendaylight.mdsal.binding.dom.codec.gen.impl.StreamWriterGenerator; @@ -208,9 +205,6 @@ public class BindingTestContext implements AutoCloseable { org.opendaylight.mdsal.dom.broker.DOMRpcRouter delegate = org.opendaylight.mdsal.dom.broker.DOMRpcRouter.newInstance(mockSchemaService); this.domRouter = new DOMRpcRouter(delegate, delegate); - - final ClassToInstanceMap services = MutableClassToInstanceMap.create(); - services.put(DOMRpcService.class, this.domRouter); } public void startBindingNotificationBroker() { diff --git a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMDataBroker.java b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMDataBroker.java index b841509490..9507ac5d4b 100644 --- a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMDataBroker.java +++ b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMDataBroker.java @@ -5,13 +5,11 @@ * 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.dom.api; import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker; import org.opendaylight.controller.md.sal.common.api.data.TransactionChainFactory; import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener; -import org.opendaylight.controller.sal.core.api.BrokerService; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; @@ -22,11 +20,10 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; *

* This interface is type capture of generic interfaces and returns type captures * of results for client-code convenience. - * */ public interface DOMDataBroker extends AsyncDataBroker>, - TransactionChainFactory>, BrokerService, + TransactionChainFactory>, DOMExtensibleService { @Override diff --git a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMMountPointService.java b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMMountPointService.java index 8880ae0171..19eea457cc 100644 --- a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMMountPointService.java +++ b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMMountPointService.java @@ -5,18 +5,16 @@ * 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.dom.api; import com.google.common.base.Optional; -import org.opendaylight.controller.sal.core.api.BrokerService; import org.opendaylight.controller.sal.core.api.mount.MountProvisionListener; import org.opendaylight.yangtools.concepts.ListenerRegistration; import org.opendaylight.yangtools.concepts.ObjectRegistration; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.model.api.SchemaContext; -public interface DOMMountPointService extends BrokerService { +public interface DOMMountPointService extends DOMService { Optional getMountPoint(YangInstanceIdentifier path); diff --git a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMNotificationPublishService.java b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMNotificationPublishService.java index 3b6a88fe91..0233446427 100644 --- a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMNotificationPublishService.java +++ b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMNotificationPublishService.java @@ -12,7 +12,6 @@ import com.google.common.util.concurrent.ListenableFuture; import java.util.concurrent.TimeUnit; import javax.annotation.Nonnegative; import javax.annotation.Nonnull; -import org.opendaylight.controller.sal.core.api.BrokerService; /** * A {@link DOMService} which allows its user to send {@link DOMNotification}s. It @@ -24,7 +23,7 @@ import org.opendaylight.controller.sal.core.api.BrokerService; * the caller to specify that it should never wait, or put an upper bound on how * long it is going to wait. */ -public interface DOMNotificationPublishService extends DOMService, BrokerService { +public interface DOMNotificationPublishService extends DOMService { /** * Well-known value indicating that the implementation is currently not * able to accept a notification. diff --git a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMNotificationService.java b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMNotificationService.java index 158d9e88c6..3edde3c8cd 100644 --- a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMNotificationService.java +++ b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMNotificationService.java @@ -9,7 +9,6 @@ package org.opendaylight.controller.md.sal.dom.api; import java.util.Collection; import javax.annotation.Nonnull; -import org.opendaylight.controller.sal.core.api.BrokerService; import org.opendaylight.yangtools.concepts.ListenerRegistration; import org.opendaylight.yangtools.yang.model.api.SchemaPath; @@ -17,7 +16,7 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath; * A {@link DOMService} which allows its users to subscribe to receive * {@link DOMNotification}s. */ -public interface DOMNotificationService extends DOMService, BrokerService { +public interface DOMNotificationService extends DOMService { /** * Register a {@link DOMNotificationListener} to receive a set of notifications. As with * other ListenerRegistration-based interfaces, registering an instance multiple times diff --git a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMService.java b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMService.java index 0b6ce7a55f..74f4634413 100644 --- a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMService.java +++ b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/md/sal/dom/api/DOMService.java @@ -5,15 +5,12 @@ * 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.dom.api; -import org.opendaylight.controller.sal.core.api.BrokerService; - /** - * Marker interface for services which can be obtained from a {@link DOMMountPoint} - * instance. No further semantics are implied. + * Marker interface for services which can be obtained from a {@link DOMMountPoint} instance. No further semantics are + * implied. */ -public interface DOMService extends BrokerService { +public interface DOMService { } diff --git a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/BrokerService.java b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/BrokerService.java deleted file mode 100644 index 655d5fb871..0000000000 --- a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/BrokerService.java +++ /dev/null @@ -1,19 +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.core.api; - -/** - * Session-specific instance of the broker functionality. BrokerService is marker interface for infrastructure services - * provided by the SAL. - * - * @deprecated Use blueprint instead for code wiring. - */ -@Deprecated -public interface BrokerService { - -} diff --git a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/package-info.java b/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/package-info.java deleted file mode 100644 index 395c09a40f..0000000000 --- a/opendaylight/md-sal/sal-dom-api/src/main/java/org/opendaylight/controller/sal/core/api/package-info.java +++ /dev/null @@ -1,11 +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 - */ -/** - * Core binding-independent SAL contracts and components - */ -package org.opendaylight.controller.sal.core.api; diff --git a/opendaylight/md-sal/sal-dom-broker/pom.xml b/opendaylight/md-sal/sal-dom-broker/pom.xml index dd4253cc86..5361abe9d0 100644 --- a/opendaylight/md-sal/sal-dom-broker/pom.xml +++ b/opendaylight/md-sal/sal-dom-broker/pom.xml @@ -95,7 +95,6 @@ org.opendaylight.controller.sal.dom.broker, org.opendaylight.controller.sal.dom.broker.impl, - org.opendaylight.controller.sal.dom.broker.osgi, org.opendaylight.controller.sal.dom.broker.util, org.opendaylight.controller.sal.dom.broker.spi, diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/AbstractBrokerServiceProxy.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/AbstractBrokerServiceProxy.java deleted file mode 100644 index 42997d96fa..0000000000 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/AbstractBrokerServiceProxy.java +++ /dev/null @@ -1,80 +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.dom.broker.osgi; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Preconditions.checkState; - -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -import javax.annotation.Nullable; - -import org.opendaylight.controller.sal.core.api.BrokerService; -import org.opendaylight.yangtools.concepts.Registration; -import org.osgi.framework.ServiceReference; - -public abstract class AbstractBrokerServiceProxy implements AutoCloseable, BrokerService { - - private T delegate; - private final ServiceReference reference; - - public AbstractBrokerServiceProxy(final @Nullable ServiceReference ref, final T delegate) { - this.delegate = checkNotNull(delegate, "Delegate should not be null."); - this.reference = ref; - } - - protected final T getDelegate() { - checkState(delegate != null, "Proxy was closed and unregistered."); - return delegate; - } - - protected final ServiceReference getReference() { - return reference; - } - - private final Set registrations = Collections.synchronizedSet(new HashSet()); - - protected R addRegistration(final R registration) { - if (registration != null) { - registrations.add(registration); - } - return registration; - } - - protected void closeBeforeUnregistrations() { - // NOOP - } - - protected void closeAfterUnregistrations() { - // NOOP - } - - @Override - @SuppressWarnings("checkstyle:IllegalCatch") - public void close() { - if (delegate != null) { - delegate = null; - RuntimeException potentialException = new RuntimeException( - "Uncaught exceptions occured during unregistration"); - boolean hasSuppressed = false; - for (Registration registration : registrations) { - try { - registration.close(); - } catch (Exception e) { - potentialException.addSuppressed(e); - hasSuppressed = true; - } - } - if (hasSuppressed) { - throw potentialException; - } - } - } -} diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/DOMDataBrokerProxy.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/DOMDataBrokerProxy.java deleted file mode 100644 index e65976b2a9..0000000000 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/DOMDataBrokerProxy.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2014, 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.sal.dom.broker.osgi; - -import java.util.Map; -import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener; -import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; -import org.opendaylight.controller.md.sal.dom.api.DOMDataBrokerExtension; -import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction; -import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction; -import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction; -import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain; -import org.osgi.framework.ServiceReference; - -public class DOMDataBrokerProxy extends AbstractBrokerServiceProxy implements DOMDataBroker { - - public DOMDataBrokerProxy(final ServiceReference ref, final DOMDataBroker delegate) { - super(ref, delegate); - } - - @Override - public DOMDataReadOnlyTransaction newReadOnlyTransaction() { - return getDelegate().newReadOnlyTransaction(); - } - - @Override - public DOMDataReadWriteTransaction newReadWriteTransaction() { - return getDelegate().newReadWriteTransaction(); - } - - @Override - public DOMDataWriteTransaction newWriteOnlyTransaction() { - return getDelegate().newWriteOnlyTransaction(); - } - - @Override - public DOMTransactionChain createTransactionChain(final TransactionChainListener listener) { - return getDelegate().createTransactionChain(listener); - } - - @Override - public Map, DOMDataBrokerExtension> getSupportedExtensions() { - return getDelegate().getSupportedExtensions(); - } -} diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/DOMMountPointServiceProxy.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/DOMMountPointServiceProxy.java deleted file mode 100644 index 716decd937..0000000000 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/DOMMountPointServiceProxy.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.dom.broker.osgi; - -import com.google.common.base.Optional; -import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint; -import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService; -import org.opendaylight.controller.sal.core.api.mount.MountProvisionListener; -import org.opendaylight.yangtools.concepts.ListenerRegistration; -import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; -import org.osgi.framework.ServiceReference; - -public class DOMMountPointServiceProxy extends AbstractBrokerServiceProxy implements - DOMMountPointService { - - public DOMMountPointServiceProxy(final ServiceReference ref, - final DOMMountPointService delegate) { - super(ref, delegate); - } - - @Override - public Optional getMountPoint(final YangInstanceIdentifier path) { - return getDelegate().getMountPoint(path); - } - - @Override - public DOMMountPointBuilder createMountPoint(final YangInstanceIdentifier path) { - return getDelegate().createMountPoint(path); - } - - public ListenerRegistration registerProvisionListener( - final MountProvisionListener listener) { - return getDelegate().registerProvisionListener(listener); - } -} diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/ProxyFactory.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/ProxyFactory.java deleted file mode 100644 index 250ef7d463..0000000000 --- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/sal/dom/broker/osgi/ProxyFactory.java +++ /dev/null @@ -1,55 +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.dom.broker.osgi; - -import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; -import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService; -import org.opendaylight.controller.sal.core.api.BrokerService; -import org.osgi.framework.ServiceReference; - -@SuppressWarnings("unchecked") -public final class ProxyFactory { - - private ProxyFactory() { - } - - public static T createProxy(final ServiceReference serviceRef, final T service) { - - Object createProxyImpl = ProxyFactory.createProxyImpl(serviceRef, service); - return (T) createProxyImpl; - } - - private static Object createProxyImpl(final ServiceReference ref, final DOMMountPointService service) { - - return new DOMMountPointServiceProxy((ServiceReference) ref, service); - } - - private static DOMDataBrokerProxy createProxyImpl(final ServiceReference ref, final DOMDataBroker service) { - - return new DOMDataBrokerProxy((ServiceReference) ref, service); - } - - private static Object createProxyImpl(final ServiceReference ref, final BrokerService service) { - if (service == null) { - throw new IllegalArgumentException("service can't be null"); - } - - if (service instanceof DOMDataBroker) { - return createProxyImpl(ref, (DOMDataBroker) service); - } else if (service instanceof DOMMountPointService) { - return createProxyImpl(ref, (DOMMountPointService) service); - } - - return createProxyImplFallback(ref, service); - } - - private static Object createProxyImplFallback(final ServiceReference reference, final BrokerService service) { - - return service; - } -} -- 2.36.6