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;
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;
org.opendaylight.mdsal.dom.broker.DOMRpcRouter delegate =
org.opendaylight.mdsal.dom.broker.DOMRpcRouter.newInstance(mockSchemaService);
this.domRouter = new DOMRpcRouter(delegate, delegate);
-
- final ClassToInstanceMap<BrokerService> services = MutableClassToInstanceMap.create();
- services.put(DOMRpcService.class, this.domRouter);
}
public void startBindingNotificationBroker() {
* 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;
* <p>
* This interface is type capture of generic interfaces and returns type captures
* of results for client-code convenience.
- *
*/
public interface DOMDataBroker extends
AsyncDataBroker<YangInstanceIdentifier, NormalizedNode<?, ?>>,
- TransactionChainFactory<YangInstanceIdentifier, NormalizedNode<?, ?>>, BrokerService,
+ TransactionChainFactory<YangInstanceIdentifier, NormalizedNode<?, ?>>,
DOMExtensibleService<DOMDataBroker, DOMDataBrokerExtension> {
@Override
* 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<DOMMountPoint> getMountPoint(YangInstanceIdentifier path);
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
* 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.
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;
* 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
* 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 {
}
+++ /dev/null
-/*
- * 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 {
-
-}
+++ /dev/null
-/*
- * 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;
<!-- Legacy code -->
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,
<!--sal.broker.impl is exported for sal-netconf-connector to use SchemaAwareRpcRegistry.-->
+++ /dev/null
-/*
- * 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<T extends BrokerService> implements AutoCloseable, BrokerService {
-
- private T delegate;
- private final ServiceReference<T> reference;
-
- public AbstractBrokerServiceProxy(final @Nullable ServiceReference<T> 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<T> getReference() {
- return reference;
- }
-
- private final Set<Registration> registrations = Collections.synchronizedSet(new HashSet<Registration>());
-
- protected <R extends Registration> 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;
- }
- }
- }
-}
+++ /dev/null
-/*
- * 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<DOMDataBroker> implements DOMDataBroker {
-
- public DOMDataBrokerProxy(final ServiceReference<DOMDataBroker> 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<Class<? extends DOMDataBrokerExtension>, DOMDataBrokerExtension> getSupportedExtensions() {
- return getDelegate().getSupportedExtensions();
- }
-}
+++ /dev/null
-/*
- * 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<DOMMountPointService> implements
- DOMMountPointService {
-
- public DOMMountPointServiceProxy(final ServiceReference<DOMMountPointService> ref,
- final DOMMountPointService delegate) {
- super(ref, delegate);
- }
-
- @Override
- public Optional<DOMMountPoint> getMountPoint(final YangInstanceIdentifier path) {
- return getDelegate().getMountPoint(path);
- }
-
- @Override
- public DOMMountPointBuilder createMountPoint(final YangInstanceIdentifier path) {
- return getDelegate().createMountPoint(path);
- }
-
- public ListenerRegistration<MountProvisionListener> registerProvisionListener(
- final MountProvisionListener listener) {
- return getDelegate().registerProvisionListener(listener);
- }
-}
+++ /dev/null
-/*
- * 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 extends BrokerService> T createProxy(final ServiceReference<T> 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<DOMMountPointService>) ref, service);
- }
-
- private static DOMDataBrokerProxy createProxyImpl(final ServiceReference<?> ref, final DOMDataBroker service) {
-
- return new DOMDataBrokerProxy((ServiceReference<DOMDataBroker>) 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;
- }
-}