import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope;
import org.opendaylight.controller.md.sal.common.api.data.AsyncDataChangeEvent;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.sal.core.api.model.SchemaService;
import org.opendaylight.yangtools.concepts.AbstractListenerRegistration;
import org.opendaylight.yangtools.concepts.Delegator;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
private final BindingToNormalizedNodeCodec codec;
- protected AbstractForwardedDataBroker(final DOMDataBroker domDataBroker, final BindingToNormalizedNodeCodec codec,
- final SchemaService schemaService) {
- this.domDataBroker = domDataBroker;
- this.codec = codec;
- }
-
protected AbstractForwardedDataBroker(final DOMDataBroker domDataBroker, final BindingToNormalizedNodeCodec codec) {
this.domDataBroker = domDataBroker;
this.codec = codec;
*/
package org.opendaylight.mdsal.binding.dom.adapter;
-import org.opendaylight.mdsal.dom.api.DOMMountPointService;
-
-import org.opendaylight.mdsal.binding.api.MountPointService.MountPointListener;
import com.google.common.base.Optional;
-import org.opendaylight.controller.sal.core.api.mount.MountProvisionListener;
+import org.opendaylight.mdsal.binding.api.MountPointService.MountPointListener;
+import org.opendaylight.mdsal.dom.api.DOMMountPointListener;
+import org.opendaylight.mdsal.dom.api.DOMMountPointService;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.impl.codec.DeserializationException;
-final class BindingDOMMountPointListenerAdapter<T extends MountPointListener> implements ListenerRegistration<T>, MountProvisionListener {
+final class BindingDOMMountPointListenerAdapter<T extends MountPointListener> implements ListenerRegistration<T>, DOMMountPointListener {
private final T listener;
- private final ListenerRegistration<MountProvisionListener> registration;
+ private final ListenerRegistration<DOMMountPointListener> registration;
private final BindingToNormalizedNodeCodec codec;
public BindingDOMMountPointListenerAdapter(final T listener, final BindingToNormalizedNodeCodec codec, final DOMMountPointService mountService) {
*/
package org.opendaylight.mdsal.binding.dom.adapter.test;
-import org.opendaylight.mdsal.dom.broker.DOMNotificationRouter;
-import org.opendaylight.mdsal.dom.broker.SerializedDOMDataBroker;
-
-import org.opendaylight.mdsal.dom.api.DOMDataBroker;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.NotificationPublishService;
-import org.opendaylight.mdsal.binding.api.NotificationService;
-import org.opendaylight.mdsal.binding.dom.adapter.test.util.MockSchemaService;
-import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMDataBrokerAdapter;
-import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMNotificationPublishServiceAdapter;
-import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMNotificationServiceAdapter;
-import org.opendaylight.mdsal.binding.dom.adapter.BindingToNormalizedNodeCodec;
import com.google.common.collect.ImmutableMap;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import javassist.ClassPool;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
-import org.opendaylight.controller.sal.core.api.model.SchemaService;
import org.opendaylight.controller.sal.core.spi.data.DOMStore;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.NotificationPublishService;
+import org.opendaylight.mdsal.binding.api.NotificationService;
+import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMDataBrokerAdapter;
+import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMNotificationPublishServiceAdapter;
+import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMNotificationServiceAdapter;
+import org.opendaylight.mdsal.binding.dom.adapter.BindingToNormalizedNodeCodec;
+import org.opendaylight.mdsal.binding.dom.adapter.test.util.MockSchemaService;
+import org.opendaylight.mdsal.dom.api.DOMDataBroker;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
+import org.opendaylight.mdsal.dom.broker.DOMNotificationRouter;
+import org.opendaylight.mdsal.dom.broker.SerializedDOMDataBroker;
import org.opendaylight.yangtools.binding.data.codec.gen.impl.DataObjectSerializerGenerator;
import org.opendaylight.yangtools.binding.data.codec.gen.impl.StreamWriterGenerator;
import org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry;
return bindingToNormalized;
}
- public SchemaService getSchemaService() {
+ public DOMSchemaService getSchemaService() {
return schemaService;
}
import static com.google.common.base.Preconditions.checkState;
-import org.opendaylight.mdsal.dom.broker.DOMMountPointServiceImpl;
-
-import org.opendaylight.mdsal.dom.broker.DOMNotificationRouter;
-import org.opendaylight.mdsal.dom.broker.DOMRpcRouter;
-import org.opendaylight.mdsal.dom.broker.SerializedDOMDataBroker;
-import org.opendaylight.mdsal.dom.api.DOMDataBroker;
-import org.opendaylight.mdsal.dom.api.DOMMountPointService;
-import org.opendaylight.mdsal.dom.api.DOMNotificationPublishService;
-import org.opendaylight.mdsal.dom.api.DOMNotificationService;
-import org.opendaylight.mdsal.dom.api.DOMRpcProviderService;
-import org.opendaylight.mdsal.dom.api.DOMRpcService;
-import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.MountPointService;
-import org.opendaylight.mdsal.binding.api.NotificationPublishService;
-import org.opendaylight.mdsal.binding.api.NotificationService;
-import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMDataBrokerAdapter;
-import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMMountPointServiceAdapter;
-import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMNotificationPublishServiceAdapter;
-import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMNotificationServiceAdapter;
-import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMRpcProviderServiceAdapter;
-import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMRpcServiceAdapter;
-import org.opendaylight.mdsal.binding.dom.adapter.BindingToNormalizedNodeCodec;
import com.google.common.annotations.Beta;
-import com.google.common.collect.ClassToInstanceMap;
import com.google.common.collect.ImmutableClassToInstanceMap;
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.BindingAwareService;
import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
import org.opendaylight.controller.sal.binding.impl.RootBindingAwareBroker;
-import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
-import org.opendaylight.controller.sal.core.api.BrokerService;
import org.opendaylight.controller.sal.core.spi.data.DOMStore;
-import org.opendaylight.controller.sal.dom.broker.BrokerImpl;
+import org.opendaylight.mdsal.binding.api.DataBroker;
+import org.opendaylight.mdsal.binding.api.MountPointService;
+import org.opendaylight.mdsal.binding.api.NotificationPublishService;
+import org.opendaylight.mdsal.binding.api.NotificationService;
+import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry;
+import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMDataBrokerAdapter;
+import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMMountPointServiceAdapter;
+import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMNotificationPublishServiceAdapter;
+import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMNotificationServiceAdapter;
+import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMRpcProviderServiceAdapter;
+import org.opendaylight.mdsal.binding.dom.adapter.BindingDOMRpcServiceAdapter;
+import org.opendaylight.mdsal.binding.dom.adapter.BindingToNormalizedNodeCodec;
+import org.opendaylight.mdsal.dom.api.DOMDataBroker;
+import org.opendaylight.mdsal.dom.api.DOMMountPointService;
+import org.opendaylight.mdsal.dom.api.DOMNotificationPublishService;
+import org.opendaylight.mdsal.dom.api.DOMNotificationService;
+import org.opendaylight.mdsal.dom.api.DOMRpcProviderService;
+import org.opendaylight.mdsal.dom.api.DOMRpcService;
+import org.opendaylight.mdsal.dom.broker.DOMMountPointServiceImpl;
+import org.opendaylight.mdsal.dom.broker.DOMNotificationRouter;
+import org.opendaylight.mdsal.dom.broker.DOMRpcRouter;
+import org.opendaylight.mdsal.dom.broker.SerializedDOMDataBroker;
import org.opendaylight.yangtools.binding.data.codec.gen.impl.DataObjectSerializerGenerator;
import org.opendaylight.yangtools.binding.data.codec.gen.impl.StreamWriterGenerator;
import org.opendaylight.yangtools.binding.data.codec.impl.BindingNormalizedNodeCodecRegistry;
private RootBindingAwareBroker baBrokerImpl;
- private BrokerImpl biBrokerImpl;
-
private final ListeningExecutorService executor;
private final ClassPool classPool;
}
- private ProviderSession createMockContext() {
-
- final ClassToInstanceMap<BrokerService> domBrokerServices = ImmutableClassToInstanceMap
- .<BrokerService> builder()
- //
- .put(DOMRpcRouter.class, biBrokerImpl.getRouter()) //
- .put(DOMMountPointService.class, biMountImpl)
- .build();
-
- return new ProviderSession() {
-
- @Override
- public <T extends BrokerService> T getService(final Class<T> service) {
- return domBrokerServices.getInstance(service);
- }
-
- @Override
- public boolean isClosed() {
- return false;
- }
-
- @Override
- public void close() {
- }
- };
- }
-
public void startBindingToDomMappingService() {
checkState(classPool != null, "ClassPool needs to be present");
private void startDomBroker() {
checkState(executor != null);
-
domRouter = new DOMRpcRouter();
mockSchemaService.registerSchemaContextListener(domRouter);
-
- final ClassToInstanceMap<BrokerService> services = MutableClassToInstanceMap.create();
- services.put(DOMRpcService.class, domRouter);
-
- biBrokerImpl = new BrokerImpl(domRouter,services);
-
}
public void startBindingNotificationBroker() {
*/
package org.opendaylight.mdsal.binding.dom.adapter.test.util;
-import org.opendaylight.controller.sal.core.api.model.SchemaService;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.util.ListenerRegistry;
-import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
import org.opendaylight.yangtools.yang.model.api.SchemaContextProvider;
-public final class MockSchemaService implements SchemaService, SchemaContextProvider {
+public final class MockSchemaService implements DOMSchemaService, SchemaContextProvider {
private SchemaContext schemaContext;
ListenerRegistry<SchemaContextListener> listeners = ListenerRegistry.create();
- @Override
- public void addModule(final Module module) {
- throw new UnsupportedOperationException();
- }
-
@Override
public synchronized SchemaContext getGlobalContext() {
return schemaContext;
return listeners.register(listener);
}
- @Override
- public void removeModule(final Module module) {
- throw new UnsupportedOperationException();
- }
-
@Override
public synchronized SchemaContext getSchemaContext() {
return schemaContext;
+++ /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;
-
-import org.osgi.framework.BundleContext;
-
-/**
- * Core component of the SAL layer responsible for wiring the SAL consumers.
- *
- * The responsibility of the broker is to maintain registration of SAL
- * functionality {@link Consumer}s and {@link Provider}s, store provider and
- * consumer specific context and functionality registration via
- * {@link ConsumerSession} and provide access to infrastructure services, which
- * removes direct dependencies between providers and consumers.
- *
- *
- * The services are exposed via session.
- *
- * <h3>Session-based access</h3>
- *
- * The providers and consumers needs to register in order to use the
- * binding-independent SAL layer and to expose functionality via SAL layer.
- *
- * For more information about session-based access see {@link ConsumerSession}
- * and {@link ProviderSession}
- *
- *
- *
- */
-public interface Broker {
-
- /**
- * Registers the {@link Consumer}, which will use the SAL layer.
- *
- * <p>
- * Note that consumer could register additional functionality at later point
- * by using service and functionality specific APIs.
- *
- * <p>
- * The consumer is required to use returned session for all communication
- * with broker or one of the broker services. The session is announced to
- * the consumer by invoking
- * {@link Consumer#onSessionInitiated(ConsumerSession)}.
- *
- * @param cons
- * Consumer to be registered.
- * @return a session specific to consumer registration
- * @throws IllegalArgumentException
- * If the consumer is <code>null</code>.
- * @throws IllegalStateException
- * If the consumer is already registered.
- */
- ConsumerSession registerConsumer(Consumer cons);
-
- /*
- * @deprecated Use registerConsumer(Consumer cons) instead (BundleContext is no longer used)
- */
- @Deprecated
- ConsumerSession registerConsumer(Consumer cons, BundleContext context);
-
- /**
- * Registers the {@link Provider}, which will use the SAL layer.
- *
- * <p>
- * The consumer is <b>required to use</b> returned session for all
- * communication with broker or one of the broker services. The session is
- * announced to the consumer by invoking
- * {@link Provider#onSessionInitiated(ProviderSession)}.
- *
- *
- * @param prov
- * Provider to be registered.
- * @return a session unique to the provider registration.
- * @throws IllegalArgumentException
- * If the provider is <code>null</code>.
- * @throws IllegalStateException
- * If the consumer is already registered.
- */
- ProviderSession registerProvider(Provider prov);
-
- /*
- * @deprecated Use registerProvider(Provider cons) instead (BundleContext is no longer used)
- */
- @Deprecated
- ProviderSession registerProvider(Provider prov, BundleContext context);
-
- /**
- * {@link Consumer} specific access to the SAL functionality.
- *
- * <p>
- * ConsumerSession is {@link Consumer}-specific access to the SAL
- * functionality and infrastructure services.
- *
- * <p>
- * The session serves to store SAL context (e.g. registration of
- * functionality) for the consumer and provides access to the SAL
- * infrastructure services and other functionality provided by
- * {@link Provider}s.
- *
- *
- *
- */
- public interface ConsumerSession {
-
- boolean isClosed();
-
- /**
- * Returns a session specific instance (implementation) of requested
- * service
- *
- * @param service
- * Broker service
- * @return Session specific implementation of service
- */
- <T extends BrokerService> T getService(Class<T> service);
-
- /**
- * Closes a session between consumer and broker.
- *
- * <p>
- * The close operation unregisters a consumer and remove all registered
- * functionality of the consumer from the system.
- *
- */
- void close();
- }
-
- /**
- * {@link Provider} specific access to the SAL functionality.
- *
- * <p>
- * ProviderSession is {@link Provider}-specific access to the SAL
- * functionality and infrastructure services, which also allows for exposing
- * the provider's functionality to the other {@link Consumer}s.
- *
- * <p>
- * The session serves to store SAL context (e.g. registration of
- * functionality) for the providers and exposes access to the SAL
- * infrastructure services, dynamic functionality registration and any other
- * functionality provided by other {@link Provider}s.
- *
- */
- public interface ProviderSession extends ConsumerSession {
- /**
- * Closes a session between provider and SAL.
- *
- * <p>
- * The close operation unregisters a provider and remove all registered
- * functionality of the provider from the system.
- */
- @Override
- void close();
-
- @Override
- boolean isClosed();
- }
-}
+++ /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.
- *
- * <p>
- * BrokerService is marker interface for infrastructure services provided by the
- * SAL. These services are session-specific, each {@link Provider} and
- * {@link Consumer} usually has own instance of the service with it's own
- * context.
- *
- * <p>
- * The consumer's (or provider's) instance of specific service could be obtained
- * by invoking {@link org.opendaylight.controller.sal.core.api.Broker.ConsumerSession#getService(Class)} method on session
- * assigned to the consumer.
- *
- * <p>
- * {@link BrokerService} and {@link Provider} may seem similar, but provider
- * provides YANG model-based functionality and {@link BrokerService} exposes the
- * necessary supporting functionality to implement specific functionality of
- * YANG and to reuse it in the development of {@link Consumer}s and
- * {@link Provider}s.
- *
- *
- */
-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
- */
-package org.opendaylight.controller.sal.core.api;
-
-import java.util.Collection;
-
-import org.opendaylight.controller.sal.core.api.Broker.ConsumerSession;
-
-/**
- *
- * Defines the component of controller and supplies additional metadata. A
- * component of the controller or application supplies a concrete implementation
- * of this interface.
- *
- * A user-implemented component (application) which facilitates the SAL and SAL
- * services to access infrastructure services or providers' functionality.
- *
- *
- */
-public interface Consumer {
-
- /**
- * Callback signaling initialization of the consumer session to the SAL.
- *
- * The consumer MUST use the session for all communication with SAL or
- * retrieving SAL infrastructure services.
- *
- * This method is invoked by {@link Broker#registerConsumer(Consumer)}
- *
- * @param session
- * Unique session between consumer and SAL.
- */
- public void onSessionInitiated(ConsumerSession session);
-
-}
+++ /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;
-
-import java.util.Collection;
-
-import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
-
-/**
- *
- * Defines the component of controller and supplies additional metadata. A
- * component of the controller or application supplies a concrete implementation
- * of this interface.
- *
- * <p>
- * A user-implemented component (application) which facilitates the SAL and SAL
- * services to access infrastructure services and to provide functionality to
- * {@link Consumer}s and other providers.
- *
- *
- */
-public interface Provider {
-
- /**
- * Callback signaling initialization of the provider session to the SAL.
- *
- * <p>
- * The provider <b>MUST use the session</b> for all communication with SAL
- * or retrieving SAL infrastructure services.
- *
- * <p>
- * This method is invoked by {@link Broker#registerConsumer(Consumer)}
- *
- * @param session
- * Unique session between provider and SAL.
- */
- public void onSessionInitiated(ProviderSession session);
-}
+++ /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;
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;
*/
public interface DOMDataBroker extends
AsyncDataBroker<YangInstanceIdentifier, NormalizedNode<?, ?>, DOMDataChangeListener>,
- TransactionChainFactory<YangInstanceIdentifier, NormalizedNode<?, ?>>, BrokerService, DOMExtensibleService<DOMDataBroker, DOMDataBrokerExtension> {
+ TransactionChainFactory<YangInstanceIdentifier, NormalizedNode<?, ?>>,
+ DOMExtensibleService<DOMDataBroker, DOMDataBrokerExtension> {
/**
* {@inheritDoc}
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.controller.sal.core.api.mount;
+package org.opendaylight.mdsal.dom.api;
import java.util.EventListener;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-public interface MountProvisionListener extends EventListener {
+public interface DOMMountPointListener extends EventListener {
void onMountPointCreated(YangInstanceIdentifier path);
package org.opendaylight.mdsal.dom.api;
-import org.opendaylight.controller.sal.core.api.BrokerService;
-import org.opendaylight.controller.sal.core.api.mount.MountProvisionListener;
+import com.google.common.base.Optional;
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;
-import com.google.common.base.Optional;
-
-public interface DOMMountPointService extends BrokerService {
+public interface DOMMountPointService extends DOMService {
Optional<DOMMountPoint> getMountPoint(YangInstanceIdentifier path);
DOMMountPointBuilder createMountPoint(YangInstanceIdentifier path);
- ListenerRegistration<MountProvisionListener> registerProvisionListener(MountProvisionListener listener);
+ ListenerRegistration<DOMMountPointListener> registerProvisionListener(DOMMountPointListener listener);
public interface DOMMountPointBuilder {
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 results in
* 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.model;
+package org.opendaylight.mdsal.dom.api;
-import org.opendaylight.controller.sal.core.api.BrokerService;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
-public interface SchemaService extends BrokerService {
-
- /**
- * Registers a YANG module to session and global context
- *
- * @param module
- */
- void addModule(Module module);
-
- /**
- * Unregisters a YANG module from session context
- *
- * @param module
- */
- void removeModule(Module module);
+public interface DOMSchemaService extends DOMService {
/**
* Returns session specific YANG schema context
package org.opendaylight.mdsal.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.
*/
-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.dom.broker;
-
-import org.opendaylight.mdsal.dom.broker.DOMRpcRouter;
-
-import org.opendaylight.mdsal.dom.api.DOMRpcAvailabilityListener;
-import org.opendaylight.mdsal.dom.api.DOMRpcException;
-import org.opendaylight.mdsal.dom.api.DOMRpcIdentifier;
-import org.opendaylight.mdsal.dom.api.DOMRpcImplementation;
-import org.opendaylight.mdsal.dom.api.DOMRpcImplementationRegistration;
-import org.opendaylight.mdsal.dom.api.DOMRpcProviderService;
-import org.opendaylight.mdsal.dom.api.DOMRpcResult;
-import org.opendaylight.mdsal.dom.api.DOMRpcService;
-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 com.google.common.util.concurrent.CheckedFuture;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import org.opendaylight.controller.sal.core.api.Broker;
-import org.opendaylight.controller.sal.core.api.BrokerService;
-import org.opendaylight.controller.sal.core.api.Consumer;
-import org.opendaylight.controller.sal.core.api.Provider;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class BrokerImpl implements Broker, DOMRpcProviderService, DOMRpcService, AutoCloseable {
- private final static Logger log = LoggerFactory.getLogger(BrokerImpl.class);
-
- // Broker Generic Context
- private final Set<ConsumerContextImpl> sessions = Collections
- .synchronizedSet(new HashSet<ConsumerContextImpl>());
- private final Set<ProviderContextImpl> providerSessions = Collections
- .synchronizedSet(new HashSet<ProviderContextImpl>());
-
- private AutoCloseable deactivator = null;
-
- private DOMRpcRouter router = null;
-
- private final ClassToInstanceMap<BrokerService> services;
-
- public BrokerImpl(final DOMRpcRouter router,final ClassToInstanceMap<BrokerService> services) {
- this.router = Preconditions.checkNotNull(router, "RPC Router must not be null");
- this.services = ImmutableClassToInstanceMap.copyOf(services);
- }
-
-
- @Override
- public ConsumerSession registerConsumer(final Consumer consumer,
- final BundleContext ctx) {
- return registerConsumer(consumer);
- }
-
- @Override
- public ProviderSession registerProvider(final Provider provider,
- final BundleContext ctx) {
- return registerProvider(provider);
- }
-
- // Validation
- private void checkPredicates(final Provider prov) {
- Preconditions.checkNotNull(prov, "Provider should not be null.");
- for (final ProviderContextImpl session : providerSessions) {
- if (prov.equals(session.getProvider())) {
- throw new IllegalStateException("Provider already registered");
- }
- }
-
- }
-
- private void checkPredicates(final Consumer cons) {
- Preconditions.checkNotNull(cons, "Consumer should not be null.");
- for (final ConsumerContextImpl session : sessions) {
- if (cons.equals(session.getConsumer())) {
- throw new IllegalStateException("Consumer already registered");
- }
- }
- }
-
- // Private Factory methods
- private ConsumerContextImpl newSessionFor(final Consumer provider) {
- final ConsumerContextImpl ret = new ConsumerContextImpl(provider, this);
- return ret;
- }
-
- private ProviderContextImpl newSessionFor(final Provider provider) {
- final ProviderContextImpl ret = new ProviderContextImpl(provider, this);
- return ret;
- }
-
- protected void consumerSessionClosed(
- final ConsumerContextImpl consumerContextImpl) {
- sessions.remove(consumerContextImpl);
- providerSessions.remove(consumerContextImpl);
- }
-
- @Override
- public void close() throws Exception {
- if (deactivator != null) {
- deactivator.close();
- deactivator = null;
- }
- }
-
- /**
- * @return the deactivator
- */
- public AutoCloseable getDeactivator() {
- return deactivator;
- }
-
- /**
- * @param deactivator
- * the deactivator to set
- */
- public void setDeactivator(final AutoCloseable deactivator) {
- this.deactivator = deactivator;
- }
-
- /**
- * @return the router
- */
- public DOMRpcRouter getRouter() {
- return router;
- }
-
- /**
- * @param router
- * the router to set
- */
- public void setRouter(final DOMRpcRouter router) {
- this.router = router;
- }
-
- protected <T extends BrokerService> Optional<T> getGlobalService(final Class<T> service) {
- return Optional.fromNullable(services.getInstance(service));
- }
-
-
- @Override
- public ConsumerSession registerConsumer(final Consumer consumer) {
- checkPredicates(consumer);
- log.trace("Registering consumer {}", consumer);
- final ConsumerContextImpl session = newSessionFor(consumer);
- consumer.onSessionInitiated(session);
- sessions.add(session);
- return session;
- }
-
-
- @Override
- public ProviderSession registerProvider(final Provider provider) {
- checkPredicates(provider);
- final ProviderContextImpl session = newSessionFor(provider);
- provider.onSessionInitiated(session);
- providerSessions.add(session);
- return session;
- }
-
-
- @Nonnull
- @Override
- public <T extends DOMRpcImplementation> DOMRpcImplementationRegistration<T> registerRpcImplementation(@Nonnull final T implementation, @Nonnull final DOMRpcIdentifier... rpcs) {
- return router.registerRpcImplementation(implementation, rpcs);
- }
-
- @Nonnull
- @Override
- public <T extends DOMRpcImplementation> DOMRpcImplementationRegistration<T> registerRpcImplementation(@Nonnull final T implementation, @Nonnull final Set<DOMRpcIdentifier> rpcs) {
- return router.registerRpcImplementation(implementation, rpcs);
- }
-
- @Nonnull
- @Override
- public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(@Nonnull final SchemaPath type, @Nullable final NormalizedNode<?, ?> input) {
- return router.invokeRpc(type, input);
- }
-
- @Nonnull
- @Override
- public <T extends DOMRpcAvailabilityListener> ListenerRegistration<T> registerRpcListener(@Nonnull final T listener) {
- return router.registerRpcListener(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;
-
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ClassToInstanceMap;
-import com.google.common.collect.MutableClassToInstanceMap;
-import org.opendaylight.controller.sal.core.api.Broker.ConsumerSession;
-import org.opendaylight.controller.sal.core.api.BrokerService;
-import org.opendaylight.controller.sal.core.api.Consumer;
-import org.opendaylight.controller.sal.dom.broker.osgi.AbstractBrokerServiceProxy;
-import org.opendaylight.controller.sal.dom.broker.osgi.ProxyFactory;
-
-import javax.annotation.concurrent.GuardedBy;
-import java.util.Collection;
-
-class ConsumerContextImpl implements ConsumerSession {
-
- private final ClassToInstanceMap<BrokerService> instantiatedServices = MutableClassToInstanceMap
- .create();
- private final Consumer consumer;
-
- private BrokerImpl broker = null;
- @GuardedBy("this")
- private boolean closed = false;
-
- public ConsumerContextImpl(final Consumer provider, final BrokerImpl brokerImpl) {
- broker = brokerImpl;
- consumer = provider;
- }
-
- @Override
- public <T extends BrokerService> T getService(final Class<T> service) {
- checkNotClosed();
- final T localProxy = instantiatedServices.getInstance(service);
- if (localProxy != null) {
- return localProxy;
- }
- final Optional<T> serviceImpl = broker.getGlobalService(service);
- if(serviceImpl.isPresent()) {
- final T ret = ProxyFactory.createProxy(null,serviceImpl.get());
- instantiatedServices.putInstance(service, ret);
- return ret;
- } else {
- return null;
- }
- }
-
- @Override
- public void close() {
- synchronized (this) {
- if (closed) {
- return;
- }
- this.closed = true;
- }
-
- Collection<BrokerService> toStop = instantiatedServices.values();
- for (BrokerService brokerService : toStop) {
- if (brokerService instanceof AbstractBrokerServiceProxy<?>) {
- ((AbstractBrokerServiceProxy<?>) brokerService).close();
- }
- }
- broker.consumerSessionClosed(this);
- broker = null;
- }
-
-
- @Override
- public synchronized boolean isClosed() {
- return closed;
- }
-
- /**
- * @return the broker
- */
- protected final BrokerImpl getBrokerChecked() {
- checkNotClosed();
- return broker;
- }
-
- /**
- * @return the _consumer
- */
- public Consumer getConsumer() {
- return consumer;
- }
-
- protected final void checkNotClosed() {
- Preconditions.checkState(!closed, "Session is closed.");
- }
-}
+++ /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;
-
-import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
-import org.opendaylight.controller.sal.core.api.Provider;
-
-class ProviderContextImpl extends ConsumerContextImpl implements ProviderSession {
- private final Provider provider;
-
- public ProviderContextImpl(final Provider provider, final BrokerImpl broker) {
- super(null, broker);
- this.provider = provider;
- }
-
- @Override
- public void close() {
- }
-
- /**
- * @return the provider
- */
- public Provider getProvider() {
- return provider;
- }
-
- /**
- * @param provider
- * the provider to set
- */
-}
+++ /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.dom.broker.impl;
-
-import org.opendaylight.controller.sal.core.api.model.SchemaService;
-import org.opendaylight.yangtools.concepts.Delegator;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaContextProvider;
-
-public class SchemaContextProviders {
-
- private SchemaContextProviders() {
- throw new UnsupportedOperationException("Utility class.");
- }
-
- public static final SchemaContextProvider fromSchemaService(final SchemaService schemaService) {
- if (schemaService instanceof SchemaContextProvider) {
- return (SchemaContextProvider) schemaService;
- }
- return new SchemaServiceAdapter(schemaService);
- }
-
- private static final class SchemaServiceAdapter implements SchemaContextProvider, Delegator<SchemaService> {
-
- private final SchemaService service;
-
- public SchemaServiceAdapter(final SchemaService service) {
- super();
- this.service = service;
- }
-
- @Override
- public SchemaContext getSchemaContext() {
- return service.getGlobalContext();
- }
-
- @Override
- public SchemaService getDelegate() {
- return service;
- }
-
- @Override
- public String toString() {
- return "SchemaServiceAdapter [service=" + service + "]";
- }
- }
-}
+++ /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
- 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 org.opendaylight.mdsal.dom.api.DOMDataBroker;
-import org.opendaylight.mdsal.dom.api.DOMDataBrokerExtension;
-import org.opendaylight.mdsal.dom.api.DOMDataChangeListener;
-import org.opendaylight.mdsal.dom.api.DOMDataReadOnlyTransaction;
-import org.opendaylight.mdsal.dom.api.DOMDataReadWriteTransaction;
-import org.opendaylight.mdsal.dom.api.DOMDataWriteTransaction;
-import org.opendaylight.mdsal.dom.api.DOMTransactionChain;
-
-import java.util.Map;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-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 ListenerRegistration<DOMDataChangeListener> registerDataChangeListener(final LogicalDatastoreType store,
- final YangInstanceIdentifier path, final DOMDataChangeListener listener,
- final org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker.DataChangeScope triggeringScope) {
- return getDelegate().registerDataChangeListener(store, path, listener, triggeringScope);
- }
-
- @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 org.opendaylight.mdsal.dom.api.DOMMountPoint;
-import org.opendaylight.mdsal.dom.api.DOMMountPointService;
-
-import com.google.common.base.Optional;
-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.mdsal.dom.api.DOMDataBroker;
-import org.opendaylight.mdsal.dom.api.DOMMountPointService;
-
-import org.opendaylight.controller.sal.core.api.BrokerService;
-import org.opendaylight.controller.sal.core.api.model.SchemaService;
-import org.osgi.framework.ServiceReference;
-import java.util.Arrays;
-
-@SuppressWarnings("unchecked")
-public class 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 Object createProxyImpl(final ServiceReference<?> ref,
- final SchemaService service) {
-
- return new SchemaServiceProxy(((ServiceReference<SchemaService>) ref),
- service);
- }
-
- private static DOMDataBrokerProxy createProxyImpl(
- final ServiceReference<?> ref, final DOMDataBroker service) {
-
- return new DOMDataBrokerProxy(((ServiceReference<DOMDataBroker>) ref),
- service);
- }
-
- private static Object createProxyImplFallback(final ServiceReference<?> reference,
- final BrokerService service) {
-
- return service;
- }
-
- private static Object createProxyImpl(final ServiceReference<?> ref,
- final BrokerService service) {
-
- if (service instanceof DOMDataBroker) {
- return createProxyImpl(ref, (DOMDataBroker) service);
- } else if (service instanceof SchemaService) {
- return createProxyImpl(ref, (SchemaService) service);
- } else if (service instanceof DOMMountPointService) {
- return createProxyImpl(ref, (DOMMountPointService) service);
- } else if (service != null) {
- return createProxyImplFallback(ref, service);
- } else {
- throw new IllegalArgumentException("Unhandled parameter types: "
- + Arrays.<Object> asList(ref, service).toString());
- }
- }
-}
\ No newline at end of file
+++ /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.sal.core.api.model.SchemaService;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
-import org.osgi.framework.ServiceReference;
-
-public class SchemaServiceProxy extends AbstractBrokerServiceProxy<SchemaService> implements SchemaService {
-
- public SchemaServiceProxy(ServiceReference<SchemaService> ref, SchemaService delegate) {
- super(ref, delegate);
- }
-
- @Override
- public void addModule(Module module) {
- getDelegate().addModule(module);
- }
-
- @Override
- public void removeModule(Module module) {
- getDelegate().removeModule(module);
- }
-
- @Override
- public SchemaContext getSessionContext() {
- return null;
- }
-
- @Override
- public SchemaContext getGlobalContext() {
- return getDelegate().getGlobalContext();
- }
-
- @Override
- public ListenerRegistration<SchemaContextListener> registerSchemaContextListener(SchemaContextListener listener) {
- ListenerRegistration<SchemaContextListener> registration = getDelegate().registerSchemaContextListener(listener);
- addRegistration(registration);
- return registration;
- }
-}
+++ /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.dom.broker;
\ No newline at end of file
+++ /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.util;
-
-import java.net.URI;
-import java.util.Collection;
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
-
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ExtensionDefinition;
-import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.ModuleIdentifier;
-import org.opendaylight.yangtools.yang.model.api.NotificationDefinition;
-import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaContextProvider;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.UsesNode;
-
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-
-/**
- * ProxySchema Context for SchemaContextProviders
- */
-public class ProxySchemaContext implements SchemaContext {
-
- private final SchemaContextProvider schemaProvider;
-
- public ProxySchemaContext(final SchemaContextProvider schemaProvider) {
- this.schemaProvider = schemaProvider;
- }
-
- private SchemaContext getCurrentSchema() {
- Preconditions.checkState(schemaProvider.getSchemaContext() != null, "Schema context unavailable from %s", schemaProvider);
- return schemaProvider.getSchemaContext();
- }
-
- @Override
- public Set<DataSchemaNode> getDataDefinitions() {
- return getCurrentSchema().getDataDefinitions();
- }
-
- @Override
- public Set<Module> getModules() {
- return getCurrentSchema().getModules();
- }
-
- @Override
- public Set<NotificationDefinition> getNotifications() {
- return getCurrentSchema().getNotifications();
- }
-
- @Override
- public Set<RpcDefinition> getOperations() {
- return getCurrentSchema().getOperations();
- }
-
- @Override
- public Set<ExtensionDefinition> getExtensions() {
- return getCurrentSchema().getExtensions();
- }
-
- @Override
- public Module findModuleByName(final String s, final Date date) {
- return getCurrentSchema().findModuleByName(s, date);
- }
-
- @Override
- public Set<Module> findModuleByNamespace(final URI uri) {
- return getCurrentSchema().findModuleByNamespace(uri);
- }
-
- @Override
- public Module findModuleByNamespaceAndRevision(final URI uri, final Date date) {
- return getCurrentSchema().findModuleByNamespaceAndRevision(uri, date);
- }
-
- @Override
- public Optional<String> getModuleSource(final ModuleIdentifier moduleIdentifier) {
- return getCurrentSchema().getModuleSource(moduleIdentifier);
- }
-
- @Override
- public Set<ModuleIdentifier> getAllModuleIdentifiers() {
- return getCurrentSchema().getAllModuleIdentifiers();
- }
-
- @Override
- public boolean isPresenceContainer() {
- return getCurrentSchema().isPresenceContainer();
- }
-
- @Override
- public Set<TypeDefinition<?>> getTypeDefinitions() {
- return getCurrentSchema().getTypeDefinitions();
- }
-
- @Override
- public Collection<DataSchemaNode> getChildNodes() {
- return getCurrentSchema().getChildNodes();
- }
-
- @Override
- public Set<GroupingDefinition> getGroupings() {
- return getCurrentSchema().getGroupings();
- }
-
- @Override
- public DataSchemaNode getDataChildByName(final QName qName) {
- return getCurrentSchema().getDataChildByName(qName);
- }
-
- @Override
- public DataSchemaNode getDataChildByName(final String s) {
- return getCurrentSchema().getDataChildByName(s);
- }
-
- @Override
- public Set<UsesNode> getUses() {
- return getCurrentSchema().getUses();
- }
-
- @Override
- public Set<AugmentationSchema> getAvailableAugmentations() {
- return getCurrentSchema().getAvailableAugmentations();
- }
-
- @Override
- public boolean isAugmenting() {
- return getCurrentSchema().isAugmenting();
- }
-
- @Override
- public boolean isAddedByUses() {
- return getCurrentSchema().isAddedByUses();
- }
-
- @Override
- public boolean isConfiguration() {
- return getCurrentSchema().isConfiguration();
- }
-
- @Override
- public ConstraintDefinition getConstraints() {
- return getCurrentSchema().getConstraints();
- }
-
- @Override
- public QName getQName() {
- return getCurrentSchema().getQName();
- }
-
- @Override
- public SchemaPath getPath() {
- return getCurrentSchema().getPath();
- }
-
- @Override
- public List<UnknownSchemaNode> getUnknownSchemaNodes() {
- return getCurrentSchema().getUnknownSchemaNodes();
- }
-
- @Override
- public String getDescription() {
- return getCurrentSchema().getDescription();
- }
-
- @Override
- public String getReference() {
- return getCurrentSchema().getReference();
- }
-
- @Override
- public Status getStatus() {
- return getCurrentSchema().getStatus();
- }
-}
+++ /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.util;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkState;
-
-import com.google.common.base.Function;
-import com.google.common.collect.FluentIterable;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
-import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
-import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
-import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
-import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.UsesNode;
-
-public final class YangSchemaUtils {
-
- private static final Function<PathArgument, QName> QNAME_FROM_PATH_ARGUMENT = new Function<PathArgument, QName>(){
-
- @Override
- public QName apply(final PathArgument input) {
- if(input == null) {
- return null;
- }
- return input.getNodeType();
- }
- };
-
- private YangSchemaUtils() {
- throw new UnsupportedOperationException("Utility class.");
- }
-
- public static DataSchemaNode getSchemaNode(final SchemaContext schema,final YangInstanceIdentifier path) {
- checkArgument(schema != null,"YANG Schema must not be null.");
- checkArgument(path != null,"Path must not be null.");
- return getSchemaNode(schema, FluentIterable.from(path.getPathArguments()).transform(QNAME_FROM_PATH_ARGUMENT));
- }
-
- public static DataSchemaNode getSchemaNode(final SchemaContext schema,final Iterable<QName> path) {
- checkArgument(schema != null,"YANG Schema must not be null.");
- checkArgument(path != null,"Path must not be null.");
- if(!path.iterator().hasNext()){
- return toRootDataNode(schema);
- }
-
- QName firstNode = path.iterator().next();
- DataNodeContainer previous = schema.findModuleByNamespaceAndRevision(firstNode.getNamespace(),
- firstNode.getRevision());
- Iterator<QName> iterator = path.iterator();
-
- while (iterator.hasNext()) {
- checkArgument(previous!= null, "Supplied path does not resolve into valid schema node.");
- QName arg = iterator.next();
- DataSchemaNode currentNode = previous.getDataChildByName(arg);
- if (currentNode == null && previous instanceof DataNodeContainer) {
- currentNode = searchInChoices(previous, arg);
- }
- if (currentNode instanceof DataNodeContainer) {
- previous = (DataNodeContainer) currentNode;
- } else if (currentNode instanceof LeafSchemaNode || currentNode instanceof LeafListSchemaNode) {
- checkArgument(!iterator.hasNext(), "Path nests inside leaf node, which is not allowed.");
- return currentNode;
- }
- checkState(currentNode != null, "Current node should not be null for %s",path);
- }
- checkState(previous instanceof DataSchemaNode, "Schema node for %s should be instance of DataSchemaNode. Found %s",path,previous);
- return (DataSchemaNode) previous;
- }
-
- private static DataSchemaNode searchInChoices(final DataNodeContainer node, final QName arg) {
- for (DataSchemaNode child : node.getChildNodes()) {
- if (child instanceof ChoiceSchemaNode) {
- ChoiceSchemaNode choiceNode = (ChoiceSchemaNode) child;
- DataSchemaNode potential = searchInCases(choiceNode, arg);
- if (potential != null) {
- return potential;
- }
- }
- }
- return null;
- }
-
- private static DataSchemaNode searchInCases(final ChoiceSchemaNode choiceNode, final QName arg) {
- Set<ChoiceCaseNode> cases = choiceNode.getCases();
- for (ChoiceCaseNode caseNode : cases) {
- DataSchemaNode node = caseNode.getDataChildByName(arg);
- if (node != null) {
- return node;
- }
- }
- return null;
- }
-
- private static ContainerSchemaNode toRootDataNode(final SchemaContext schema) {
- return new NetconfDataRootNode(schema);
- }
-
- private static final class NetconfDataRootNode implements ContainerSchemaNode {
-
- public NetconfDataRootNode(final SchemaContext schema) {
- // TODO Auto-generated constructor stub
- }
-
- @Override
- public Set<TypeDefinition<?>> getTypeDefinitions() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Set<DataSchemaNode> getChildNodes() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Set<GroupingDefinition> getGroupings() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public DataSchemaNode getDataChildByName(final QName name) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public DataSchemaNode getDataChildByName(final String name) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Set<UsesNode> getUses() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Set<AugmentationSchema> getAvailableAugmentations() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public boolean isAugmenting() {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public boolean isAddedByUses() {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public boolean isConfiguration() {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public ConstraintDefinition getConstraints() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public QName getQName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public SchemaPath getPath() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getDescription() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public String getReference() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public Status getStatus() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public List<UnknownSchemaNode> getUnknownSchemaNodes() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public boolean isPresenceContainer() {
- // TODO Auto-generated method stub
- return false;
- }
-
- }
-
-}
package org.opendaylight.mdsal.dom.broker;
+import org.opendaylight.mdsal.dom.api.DOMMountPointListener;
+
import org.opendaylight.mdsal.dom.api.DOMMountPoint;
import org.opendaylight.mdsal.dom.api.DOMMountPointService;
import org.opendaylight.mdsal.dom.api.DOMService;
-
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.collect.ClassToInstanceMap;
import java.util.HashMap;
import java.util.Map;
import org.opendaylight.controller.md.sal.dom.broker.spi.mount.SimpleDOMMountPoint;
-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.util.ListenerRegistry;
private final Map<YangInstanceIdentifier, DOMMountPoint> mountPoints = new HashMap<>();
- private final ListenerRegistry<MountProvisionListener> listeners = ListenerRegistry.create();
+ private final ListenerRegistry<DOMMountPointListener> listeners = ListenerRegistry.create();
@Override
public Optional<DOMMountPoint> getMountPoint(final YangInstanceIdentifier path) {
}
public void notifyMountCreated(final YangInstanceIdentifier identifier) {
- for (final ListenerRegistration<MountProvisionListener> listener : listeners
+ for (final ListenerRegistration<DOMMountPointListener> listener : listeners
.getListeners()) {
listener.getInstance().onMountPointCreated(identifier);
}
}
public void notifyMountRemoved(final YangInstanceIdentifier identifier) {
- for (final ListenerRegistration<MountProvisionListener> listener : listeners
+ for (final ListenerRegistration<DOMMountPointListener> listener : listeners
.getListeners()) {
listener.getInstance().onMountPointRemoved(identifier);
}
}
@Override
- public ListenerRegistration<MountProvisionListener> registerProvisionListener(
- final MountProvisionListener listener) {
+ public ListenerRegistration<DOMMountPointListener> registerProvisionListener(
+ final DOMMountPointListener listener) {
return listeners.register(listener);
}
*/
package org.opendaylight.mdsal.dom.broker;
-import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
-import org.opendaylight.mdsal.dom.api.DOMDataTreeListener;
-import org.opendaylight.mdsal.dom.api.DOMDataTreeProducer;
-import org.opendaylight.mdsal.dom.api.DOMDataTreeService;
-import org.opendaylight.mdsal.dom.api.DOMDataTreeShard;
-import org.opendaylight.mdsal.dom.api.DOMDataTreeShardingConflictException;
-import org.opendaylight.mdsal.dom.api.DOMDataTreeShardingService;
-
import com.google.common.base.Preconditions;
import java.util.Collection;
import java.util.EnumMap;
import java.util.TreeMap;
import javax.annotation.concurrent.GuardedBy;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
+import org.opendaylight.mdsal.dom.api.DOMDataTreeListener;
+import org.opendaylight.mdsal.dom.api.DOMDataTreeProducer;
+import org.opendaylight.mdsal.dom.api.DOMDataTreeService;
+import org.opendaylight.mdsal.dom.api.DOMDataTreeShard;
+import org.opendaylight.mdsal.dom.api.DOMDataTreeShardingConflictException;
+import org.opendaylight.mdsal.dom.api.DOMDataTreeShardingService;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
* this registration.
*/
final ShardingTableEntry parent = lookupShard(prefix);
- parentReg = parent.getRegistration();
- if (parentReg != null && prefix.equals(parentReg.getPrefix())) {
- throw new DOMDataTreeShardingConflictException(String.format("Prefix %s is already occupied by shard %s", prefix, parentReg.getInstance()));
+ if (parent != null) {
+ parentReg = parent.getRegistration();
+ if (parentReg != null && prefix.equals(parentReg.getPrefix())) {
+ throw new DOMDataTreeShardingConflictException(String.format(
+ "Prefix %s is already occupied by shard %s", prefix, parentReg.getInstance()));
+ }
+ } else {
+ parentReg = null;
}
// FIXME: wrap the shard in a proper adaptor based on implemented interface
private DOMDataTreeProducer createProducer(final Map<DOMDataTreeIdentifier, DOMDataTreeShard> shardMap) {
// Record the producer's attachment points
final DOMDataTreeProducer ret = ShardedDOMDataTreeProducer.create(this, shardMap);
- for (DOMDataTreeIdentifier s : shardMap.keySet()) {
+ for (final DOMDataTreeIdentifier s : shardMap.keySet()) {
idToProducer.put(s, ret);
}
* 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;
+package org.opendaylight.mdsal.dom.broker.osgi;
import static com.google.common.base.Preconditions.checkState;
+
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
-import org.opendaylight.controller.sal.core.api.model.SchemaService;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.concepts.Registration;
import org.opendaylight.yangtools.util.ListenerRegistry;
-import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
import org.opendaylight.yangtools.yang.model.api.SchemaContextProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class GlobalBundleScanningSchemaServiceImpl implements SchemaContextProvider, SchemaService, ServiceTrackerCustomizer<SchemaContextListener, SchemaContextListener>, AutoCloseable {
- private static final Logger LOG = LoggerFactory.getLogger(GlobalBundleScanningSchemaServiceImpl.class);
+public class OsgiBundleScanningSchemaService implements SchemaContextProvider, DOMSchemaService, ServiceTrackerCustomizer<SchemaContextListener, SchemaContextListener>, AutoCloseable {
+ private static final Logger LOG = LoggerFactory.getLogger(OsgiBundleScanningSchemaService.class);
private final ListenerRegistry<SchemaContextListener> listeners = new ListenerRegistry<>();
private final URLSchemaContextResolver contextResolver = URLSchemaContextResolver.create("global-bundle");
private ServiceTracker<SchemaContextListener, SchemaContextListener> listenerTracker;
private BundleTracker<Iterable<Registration>> bundleTracker;
private boolean starting = true;
- private static GlobalBundleScanningSchemaServiceImpl instance;
+ private static OsgiBundleScanningSchemaService instance;
- private GlobalBundleScanningSchemaServiceImpl(final BundleContext context) {
+ private OsgiBundleScanningSchemaService(final BundleContext context) {
this.context = Preconditions.checkNotNull(context);
}
- public synchronized static GlobalBundleScanningSchemaServiceImpl createInstance(final BundleContext ctx) {
+ public synchronized static OsgiBundleScanningSchemaService createInstance(final BundleContext ctx) {
Preconditions.checkState(instance == null);
- instance = new GlobalBundleScanningSchemaServiceImpl(ctx);
+ instance = new OsgiBundleScanningSchemaService(ctx);
instance.start();
return instance;
}
- public synchronized static GlobalBundleScanningSchemaServiceImpl getInstance() {
+ public synchronized static OsgiBundleScanningSchemaService getInstance() {
Preconditions.checkState(instance != null, "Global Instance was not instantiated");
return instance;
}
checkState(context != null);
LOG.debug("start() starting");
- listenerTracker = new ServiceTracker<>(context, SchemaContextListener.class, GlobalBundleScanningSchemaServiceImpl.this);
+ listenerTracker = new ServiceTracker<>(context, SchemaContextListener.class, OsgiBundleScanningSchemaService.this);
bundleTracker = new BundleTracker<>(context, Bundle.RESOLVED | Bundle.STARTING |
Bundle.STOPPING | Bundle.ACTIVE, scanner);
bundleTracker.open();
return contextResolver.getSchemaContext().orNull();
}
- @Override
- public void addModule(final Module module) {
- throw new UnsupportedOperationException();
- }
-
@Override
public SchemaContext getSessionContext() {
throw new UnsupportedOperationException();
}
- @Override
- public void removeModule(final Module module) {
- throw new UnsupportedOperationException();
- }
-
@Override
public synchronized ListenerRegistration<SchemaContextListener> registerSchemaContextListener(final SchemaContextListener listener) {
- Optional<SchemaContext> potentialCtx = contextResolver.getSchemaContext();
+ final Optional<SchemaContext> potentialCtx = contextResolver.getSchemaContext();
if(potentialCtx.isPresent()) {
listener.onGlobalContextUpdated(potentialCtx.get());
}
listenerTracker.close();
}
- for (ListenerRegistration<SchemaContextListener> l : listeners.getListeners()) {
+ for (final ListenerRegistration<SchemaContextListener> l : listeners.getListeners()) {
l.close();
}
}
private synchronized void updateContext(final SchemaContext snapshot) {
- Object[] services = listenerTracker.getServices();
- for (ListenerRegistration<SchemaContextListener> listener : listeners) {
+ final Object[] services = listenerTracker.getServices();
+ for (final ListenerRegistration<SchemaContextListener> listener : listeners) {
try {
listener.getInstance().onGlobalContextUpdated(snapshot);
- } catch (Exception e) {
+ } catch (final Exception e) {
LOG.error("Exception occured during invoking listener", e);
}
}
if (services != null) {
- for (Object rawListener : services) {
+ for (final Object rawListener : services) {
final SchemaContextListener listener = (SchemaContextListener) rawListener;
try {
listener.onGlobalContextUpdated(snapshot);
- } catch (Exception e) {
+ } catch (final Exception e) {
LOG.error("Exception occured during invoking listener {}", listener, e);
}
}
try {
urls.add(contextResolver.registerSource(u));
LOG.debug("Registered {}", u);
- } catch (Exception e) {
+ } catch (final Exception e) {
LOG.warn("Failed to register {}, ignoring it", e);
}
}
@Override
public synchronized void removedBundle(final Bundle bundle, final BundleEvent event, final Iterable<Registration> urls) {
- for (Registration url : urls) {
+ for (final Registration url : urls) {
try {
url.close();
- } catch (Exception e) {
+ } catch (final Exception e) {
LOG.warn("Failed do unregister URL {}, proceeding", url, e);
}
}
- int numUrls = Iterables.size(urls);
+ final int numUrls = Iterables.size(urls);
if(numUrls > 0 ) {
if(LOG.isDebugEnabled()) {
LOG.debug("removedBundle: {}, state: {}, # urls: {}", bundle.getSymbolicName(), bundle.getState(), numUrls);
@Override
public synchronized SchemaContextListener addingService(final ServiceReference<SchemaContextListener> reference) {
- SchemaContextListener listener = context.getService(reference);
- SchemaContext _ctxContext = getGlobalContext();
+ final SchemaContextListener listener = context.getService(reference);
+ final SchemaContext _ctxContext = getGlobalContext();
if (getContext() != null && _ctxContext != null) {
listener.onGlobalContextUpdated(_ctxContext);
}
if (starting) {
return;
}
- Optional<SchemaContext> schema = contextResolver.getSchemaContext();
+ final Optional<SchemaContext> schema = contextResolver.getSchemaContext();
if(schema.isPresent()) {
if(LOG.isDebugEnabled()) {
LOG.debug("Got new SchemaContext: # of modules {}", schema.get().getAllModuleIdentifiers().size());
* 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;
+package org.opendaylight.mdsal.dom.broker.osgi;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
import java.util.Hashtable;
-import org.opendaylight.controller.sal.core.api.model.SchemaService;
-import org.opendaylight.controller.sal.dom.broker.GlobalBundleScanningSchemaServiceImpl;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
public class SchemaServiceActivator implements BundleActivator {
- private ServiceRegistration<SchemaService> schemaServiceReg;
- private GlobalBundleScanningSchemaServiceImpl schemaService;
+ private ServiceRegistration<DOMSchemaService> schemaServiceReg;
+ private OsgiBundleScanningSchemaService schemaService;
@Override
public void start(final BundleContext context) {
- schemaService = GlobalBundleScanningSchemaServiceImpl.createInstance(context);
- schemaServiceReg = context.registerService(SchemaService.class, schemaService, new Hashtable<String,String>());
+ schemaService = OsgiBundleScanningSchemaService.createInstance(context);
+ schemaServiceReg = context.registerService(DOMSchemaService.class, schemaService, new Hashtable<String,String>());
}
@Override
*/
package org.opendaylight.controller.md.sal.dom.store.impl;
+import org.opendaylight.mdsal.dom.api.DOMSchemaService;
+
import java.util.concurrent.ExecutorService;
import javax.annotation.Nullable;
-import org.opendaylight.controller.sal.core.api.model.SchemaService;
import org.opendaylight.yangtools.util.concurrent.SpecialExecutors;
/**
}
public static InMemoryDOMDataStore create(final String name,
- @Nullable final SchemaService schemaService) {
+ @Nullable final DOMSchemaService schemaService) {
return create(name, schemaService, null);
}
* @return an InMemoryDOMDataStore instance
*/
public static InMemoryDOMDataStore create(final String name,
- @Nullable final SchemaService schemaService,
+ @Nullable final DOMSchemaService schemaService,
@Nullable final InMemoryDOMDataStoreConfigProperties properties) {
return create(name, schemaService, false, properties);
}
* @return an InMemoryDOMDataStore instance
*/
public static InMemoryDOMDataStore create(final String name,
- @Nullable final SchemaService schemaService, final boolean debugTransactions,
+ @Nullable final DOMSchemaService schemaService, final boolean debugTransactions,
@Nullable final InMemoryDOMDataStoreConfigProperties properties) {
InMemoryDOMDataStoreConfigProperties actualProperties = properties;
+++ /dev/null
-/*
- * 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.sal.core.spi;
-
-import org.opendaylight.controller.sal.core.api.Broker.ConsumerSession;
-import org.opendaylight.controller.sal.core.api.BrokerService;
-
-public abstract class ForwardingConsumerSession implements ConsumerSession {
-
- protected abstract ConsumerSession delegate();
-
- @Override
- public void close() {
- delegate().close();
- }
-
- @Override
- public <T extends BrokerService> T getService(Class<T> arg0) {
- return delegate().getService(arg0);
- }
-
- @Override
- public boolean isClosed() {
- return delegate().isClosed();
- }
-
-}
+++ /dev/null
-/*
- * 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.sal.core.spi;
-
-import org.opendaylight.controller.sal.core.api.Broker.ProviderSession;
-import org.opendaylight.controller.sal.core.api.BrokerService;
-
-public abstract class ForwardingProviderSession implements ProviderSession {
-
- protected abstract ProviderSession delegate();
-
- @Override
- public void close() {
- delegate().close();
- }
-
- @Override
- public <T extends BrokerService> T getService(Class<T> arg0) {
- return delegate().getService(arg0);
- }
-
- @Override
- public boolean isClosed() {
- return delegate().isClosed();
- }
-
-}
+++ /dev/null
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.controller.sal.core.spi;
\ No newline at end of file