package org.opendaylight.controller.md.sal.dom.api;
/**
- * <p>ClusteredDOMDataChangeListener is a marker interface to enable data change notifications on all instances in a cluster,
- * where this listener is registered.</p>
- *
- *
- * <p>Applications should implement ClusteredDOMDataChangeListener instead of DOMDataChangeListener, if they want to listen
- * to data change notifications on any node of clustered datastore. DOMDataChangeListener enables data change notifications
- * only at leader of the datastore shard.</p>
+ * ClusteredDOMDataChangeListener is a marker interface to enable data change
+ * notifications on all instances in a cluster, where this listener is
+ * registered.
*
+ * <p>
+ * Applications should implement ClusteredDOMDataChangeListener instead of DOMDataChangeListener, if they want to
+ * listen to data change notifications on any node of clustered datastore. DOMDataChangeListener enables data change
+ * notifications only at leader of the datastore shard.
*/
-
public interface ClusteredDOMDataChangeListener extends DOMDataChangeListener{
-
}
package org.opendaylight.controller.md.sal.dom.api;
/**
- * ClusteredDOMDataTreeChangeListener is a marker interface to enable data tree change notifications on all
+ * ClusteredDOMDataTreeChangeListener is a marker interface to enable data tree change notifications on all
* instances in a cluster where this listener is registered.
+ *
* <p>
* Applications should implement ClusteredDOMDataTreeChangeListener instead of {@link DOMDataTreeChangeListener},
* if they want to listen for data tree change notifications on any node of a clustered data store.
* Data Broker which provides data transaction and data change listener functionality
* using {@link NormalizedNode} data format.
*
+ * <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<?, ?>, DOMDataChangeListener>,
- TransactionChainFactory<YangInstanceIdentifier, NormalizedNode<?, ?>>, BrokerService, DOMExtensibleService<DOMDataBroker, DOMDataBrokerExtension> {
+ TransactionChainFactory<YangInstanceIdentifier, NormalizedNode<?, ?>>, BrokerService,
+ DOMExtensibleService<DOMDataBroker, DOMDataBrokerExtension> {
- /**
- * {@inheritDoc}
- */
@Override
DOMDataReadOnlyTransaction newReadOnlyTransaction();
- /**
- * {@inheritDoc}
- */
@Override
DOMDataReadWriteTransaction newReadWriteTransaction();
- /**
- * {@inheritDoc}
- */
@Override
DOMDataWriteTransaction newWriteOnlyTransaction();
- /**
- * {@inheritDoc}
- */
@Override
DOMTransactionChain createTransactionChain(TransactionChainListener listener);
}
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-public interface DOMDataReadOnlyTransaction extends DOMDataReadTransaction, AsyncReadOnlyTransaction<YangInstanceIdentifier, NormalizedNode<?, ?>> {
-
+public interface DOMDataReadOnlyTransaction extends DOMDataReadTransaction,
+ AsyncReadOnlyTransaction<YangInstanceIdentifier, NormalizedNode<?, ?>> {
}
*/
package org.opendaylight.controller.md.sal.dom.api;
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.CheckedFuture;
import org.opendaylight.controller.md.sal.common.api.data.AsyncReadTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import com.google.common.base.Optional;
-import com.google.common.util.concurrent.CheckedFuture;
-
/**
* A transaction that provides read access to a logical data store.
+ *
* <p>
* For more information on usage and examples, please see the documentation in {@link AsyncReadTransaction}.
*/
/**
* Reads data from provided logical data store located at the provided path.
- *<p>
+ *
+ * <p>
* If the target is a subtree, then the whole subtree is read (and will be
* accessible from the returned data object).
*
/**
/**
* Checks if data is available in the logical data store located at provided path.
- * <p>
*
+ * <p>
* Note: a successful result from this method makes no guarantee that a subsequent call to {@link #read}
* will succeed. It is possible that the data resides in a data store on a remote node and, if that
* node goes down or a network failure occurs, a subsequent read would fail. Another scenario is if
* {@link ReadFailedException} or an exception derived from ReadFailedException.</li>
* </ul>
*/
- CheckedFuture<Boolean, ReadFailedException> exists(
- LogicalDatastoreType store, YangInstanceIdentifier path);
-
+ CheckedFuture<Boolean, ReadFailedException> exists(LogicalDatastoreType store, YangInstanceIdentifier path);
}
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-public interface DOMDataReadWriteTransaction extends DOMDataReadTransaction, DOMDataWriteTransaction, AsyncReadWriteTransaction<YangInstanceIdentifier, NormalizedNode<?, ?>> {
-
+public interface DOMDataReadWriteTransaction extends DOMDataReadTransaction, DOMDataWriteTransaction,
+ AsyncReadWriteTransaction<YangInstanceIdentifier, NormalizedNode<?, ?>> {
}
* data tree changes. This interface differs from {@link DOMDataChangeListener}
* in that it provides a cursor-based view of the change, which has potentially
* lower overhead.
+ *
* <p>
* Note: this interface enables notifications only at the leader of the data store, if clustered. If you want
* notifications on all instances in a cluster, use the {@link ClusteredDOMDataTreeChangeListener}.
* to recover from such events. Event producers are expected to exert reasonable
* effort to suppress such events.
*
+ * <p>
* In other words, it is completely acceptable to observe
* a {@link org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode},
* which reports a {@link org.opendaylight.yangtools.yang.data.api.schema.tree.ModificationType}
* Registers a {@link DOMDataTreeChangeListener} to receive
* notifications when data changes under a given path in the conceptual data
* tree.
+ *
* <p>
* You are able to register for notifications for any node or subtree
* which can be represented using {@link DOMDataTreeIdentifier}.
- * <p>
*
+ * <p>
* You are able to register for data change notifications for a subtree or leaf
* even if it does not exist. You will receive notification once that node is
* created.
+ *
* <p>
* If there is any pre-existing data in the data tree for the path for which you are
* registering, you will receive an initial data change event, which will
* This method returns a {@link ListenerRegistration} object. To
* "unregister" your listener for changes call the {@link ListenerRegistration#close()}
* method on the returned object.
+ *
* <p>
* You MUST explicitly unregister your listener when you no longer want to receive
* notifications. This is especially true in OSGi environments, where failure to
* your listener using {@link ListenerRegistration#close()} to stop
* delivery of change events.
*/
- @Nonnull <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerDataTreeChangeListener(@Nonnull DOMDataTreeIdentifier treeId, @Nonnull L listener);
+ @Nonnull <L extends DOMDataTreeChangeListener> ListenerRegistration<L> registerDataTreeChangeListener(
+ @Nonnull DOMDataTreeIdentifier treeId, @Nonnull L listener);
}
* A unique identifier for a particular subtree. It is composed of the logical
* data store type and the instance identifier of the root node.
*/
-public final class DOMDataTreeIdentifier implements Immutable, Path<DOMDataTreeIdentifier>, Serializable, Comparable<DOMDataTreeIdentifier> {
+public final class DOMDataTreeIdentifier implements Immutable,
+ Path<DOMDataTreeIdentifier>, Serializable, Comparable<DOMDataTreeIdentifier> {
private static final long serialVersionUID = 1L;
private final YangInstanceIdentifier rootIdentifier;
private final LogicalDatastoreType datastoreType;
- public DOMDataTreeIdentifier(final LogicalDatastoreType datastoreType, final YangInstanceIdentifier rootIdentifier) {
+ public DOMDataTreeIdentifier(final LogicalDatastoreType datastoreType,
+ final YangInstanceIdentifier rootIdentifier) {
this.datastoreType = Preconditions.checkNotNull(datastoreType);
this.rootIdentifier = Preconditions.checkNotNull(rootIdentifier);
}
}
@Override
- public int compareTo(final DOMDataTreeIdentifier o) {
- int i = datastoreType.compareTo(o.datastoreType);
- if (i != 0) {
- return i;
+ public int compareTo(final DOMDataTreeIdentifier obj) {
+ int cmp = datastoreType.compareTo(obj.datastoreType);
+ if (cmp != 0) {
+ return cmp;
}
final Iterator<PathArgument> mi = rootIdentifier.getPathArguments().iterator();
- final Iterator<PathArgument> oi = o.rootIdentifier.getPathArguments().iterator();
+ final Iterator<PathArgument> oi = obj.rootIdentifier.getPathArguments().iterator();
while (mi.hasNext()) {
if (!oi.hasNext()) {
final PathArgument ma = mi.next();
final PathArgument oa = oi.next();
- i = ma.compareTo(oa);
- if (i != 0) {
- return i;
+ cmp = ma.compareTo(oa);
+ if (cmp != 0) {
+ return cmp;
}
}
this.treeIdentifier = Preconditions.checkNotNull(treeIdentifier);
}
- public DOMDataTreeInaccessibleException(final DOMDataTreeIdentifier treeIdentifier, final String message, final Throwable cause) {
+ public DOMDataTreeInaccessibleException(final DOMDataTreeIdentifier treeIdentifier, final String message,
+ final Throwable cause) {
super(message);
this.treeIdentifier = Preconditions.checkNotNull(treeIdentifier);
}
* This includes all the subtrees this listener is subscribed to, even those
* which have not changed.
*/
- void onDataTreeChanged(@Nonnull Collection<DataTreeCandidate> changes, @Nonnull Map<DOMDataTreeIdentifier, NormalizedNode<?, ?>> subtrees);
+ void onDataTreeChanged(@Nonnull Collection<DataTreeCandidate> changes,
+ @Nonnull Map<DOMDataTreeIdentifier, NormalizedNode<?, ?>> subtrees);
/**
* Invoked when a subtree listening failure occurs. This can be triggered, for example, when
* open. It needs to be either submitted or cancelled before another one can be open.
* Once a transaction is submitted, it will proceed to be committed asynchronously.
*
+ * <p>
* Each instance has an upper bound on the number of transactions which can be in-flight,
* once that capacity is exceeded, an attempt to create a new transaction will block
* until some transactions complete.
*
+ * <p>
* Each {@link DOMDataTreeProducer} can be in two logical states, bound and unbound,
* which define the lifecycle rules for when is it legal to create and submit transactions
* in relationship with {@link DOMDataTreeListener} callbacks.
*
+ * <p>
* When a producer is first created, it is unbound. In this state the producer can be
* accessed by any application thread to allocate or submit transactions, as long as
* the 'single open transaction' rule is maintained. The producer and any transaction
* object MUST NOT be accessed, directly or indirectly, from a {@link DOMDataTreeListener}
* callback.
*
- * When a producer is referenced in a call to {@link DOMDataTreeService#registerListener(DOMDataTreeListener, java.util.Collection, boolean, java.util.Collection)},
+ * <p>
+ * When a producer is referenced in a call to {@link DOMDataTreeService#registerListener(DOMDataTreeListener,
+ * java.util.Collection, boolean, java.util.Collection)},
* an attempt will be made to bind the producer to the specified {@link DOMDataTreeListener}.
* Such an attempt will fail the producer is already bound, or it has an open transaction.
* Once bound, the producer can only be accessed from within the {@link DOMDataTreeListener}
/**
* {@inheritDoc}
*
+ * <p>
* When invoked on a {@link DOMDataTreeProducer}, this method has additional restrictions.
* There may not be an open transaction from this producer. The method needs to be
* invoked in appropriate context, e.g. bound or unbound.
*
+ * <p>
* Specified subtrees must be accessible by this producer. Accessible means they are a subset
* of the subtrees specified when the producer is instantiated. The set is further reduced as
* child producers are instantiated -- if you create a producer for /a and then a child for
* /a/b, /a/b is not accessible from the first producer.
*
+ * <p>
* Once this method returns successfully, this (parent) producer loses the ability to
* access the specified paths until the resulting (child) producer is shut down.
*
* with the data tree are split into data producers and consumers (listeners). Each
* of them operate on a set of subtrees, which need to be declared at instantiation time.
*
+ * <p>
* Returned instances are not thread-safe and expected to be used by a single thread
* at a time. Furthermore, producers may not be accessed from consumer callbacks
* unless they were specified when the listener is registered.
*
+ * <p>
* The service maintains a loop-free topology of producers and consumers. What this means
* is that a consumer is not allowed to access a producer, which affects any of the
* subtrees it is subscribed to. This restriction is in place to ensure the system does
* is free to merge the changes, so that a smaller number of them will be reported,
* possibly hiding some data transitions (like flaps).
*
+ * <p>
* If the listener wants to write into any producer, that producer has to be mentioned
* in the call to this method. Those producers will be bound exclusively to the
* registration, so that accessing them outside of this listener's callback will trigger
* an error. Any producers mentioned must be idle, e.g. they may not have an open
* transaction at the time this method is invoked.
*
+ * <p>
* Each listener instance can be registered at most once. Implementations of this
* interface have to guarantee that the listener's methods will not be invoked
* concurrently from multiple threads.
* feedback loop
*/
@Nonnull <T extends DOMDataTreeListener> ListenerRegistration<T> registerListener(@Nonnull T listener,
- @Nonnull Collection<DOMDataTreeIdentifier> subtrees, boolean allowRxMerges, @Nonnull Collection<DOMDataTreeProducer> producers) throws DOMDataTreeLoopException;
+ @Nonnull Collection<DOMDataTreeIdentifier> subtrees, boolean allowRxMerges,
+ @Nonnull Collection<DOMDataTreeProducer> producers) throws DOMDataTreeLoopException;
}
* single {@link DOMDataTreeIdentifier}. Based on those data tree identifiers, the
* shards are organized in a tree, where there is a logical parent/child relationship.
*
+ * <p>
* It is not allowed to attach two shards to the same data tree identifier, which means
* the mapping of each piece of information has an unambiguous home. When accessing
* the information, the shard with the longest matching data tree identifier is used,
* which is why this interface treats it is a prefix.
*
+ * <p>
* Whenever a parent/child relationship is changed, the parent is notified, so it can
* understand that a logical child has been attached.
*
* @return A registration. To remove the shard's binding, close the registration.
* @throws DOMDataTreeShardingConflictException if the prefix is already bound
*/
- @Nonnull <T extends DOMDataTreeShard> ListenerRegistration<T> registerDataTreeShard(@Nonnull DOMDataTreeIdentifier prefix, @Nonnull T shard) throws DOMDataTreeShardingConflictException;
+ @Nonnull <T extends DOMDataTreeShard> ListenerRegistration<T> registerDataTreeShard(
+ @Nonnull DOMDataTreeIdentifier prefix, @Nonnull T shard) throws DOMDataTreeShardingConflictException;
}
/**
* A transaction that provides mutation capabilities on a data tree.
+ *
* <p>
* For more information on usage and examples, please see the documentation in {@link AsyncWriteTransaction}.
*/
/**
* Stores a piece of data at the specified path. This acts as an add / replace
* operation, which is to say that whole subtree will be replaced by the specified data.
+ *
* <p>
* For more information on usage and examples, please see the documentation in {@link AsyncWriteTransaction}.
+ *
* <p>
* If you need to make sure that a parent object exists but you do not want modify
* its pre-existing state by using put, consider using {@link #merge} instead.
* Merges a piece of data with the existing data at a specified path. Any pre-existing data
* which is not explicitly overwritten will be preserved. This means that if you store a container,
* its child lists will be merged.
+ *
* <p>
* For more information on usage and examples, please see the documentation in {@link AsyncWriteTransaction}.
+ *
*<p>
* If you require an explicit replace operation, use {@link #put} instead.
*
import java.util.Date;
/**
- * Generic event interface
+ * Generic event interface.
*/
public interface DOMEvent {
/**
- * Get the time of the event occurrence
+ * Get the time of the event occurrence.
*
* @return the event time
*/
* @param <E> Extension type
*/
@Beta
-public interface DOMExtensibleService<T extends DOMExtensibleService<T, E>, E extends DOMServiceExtension<T, E>> extends DOMService {
+public interface DOMExtensibleService<T extends DOMExtensibleService<T, E>,
+ E extends DOMServiceExtension<T, E>> extends DOMService {
/**
* Return a map of currently-supported extensions, along with accessor services
* which provide access to the specific functionality bound to this service.
package org.opendaylight.controller.md.sal.dom.api;
+import com.google.common.base.Optional;
import org.opendaylight.yangtools.concepts.Identifiable;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-
-import com.google.common.base.Optional;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
public interface DOMMountPoint extends Identifiable<YangInstanceIdentifier> {
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.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import com.google.common.base.Optional;
-
-
public interface DOMMountPointService extends BrokerService {
Optional<DOMMountPoint> getMountPoint(YangInstanceIdentifier path);
* Well-known value indicating that the implementation is currently not
* able to accept a notification.
*/
- ListenableFuture<Object> REJECTED = Futures.immediateFailedFuture(new DOMNotificationRejectedException("Unacceptable blocking conditions encountered"));
+ ListenableFuture<Object> REJECTED = Futures.immediateFailedFuture(
+ new DOMNotificationRejectedException("Unacceptable blocking conditions encountered"));
/**
* Publish a notification. The result of this method is a {@link ListenableFuture}
* and implementations may use it to convey additional information related to the
* publishing process.
*
+ * <p>
* Abstract subclasses can refine the return type as returning a promise of a
* more specific type, e.g.:
*
* ListenableFuture<? extends DeliveryStatus> putNotification(DOMNotification notification);
* }
*
+ * <p>
* Once the Future succeeds, the resulting object can be queried for traits using
* instanceof, e.g:
*
* }
* }
*
+ * <p>
* In case an implementation is running out of resources, it can block the calling
* thread until enough resources become available to accept the notification for
* processing, or it is interrupted.
*
+ * <p>
* Caution: completion here means that the implementation has completed processing
* of the notification. This does not mean that all existing registrants
* have seen the notification. Most importantly, the delivery process at
package org.opendaylight.controller.md.sal.dom.api;
/**
- * <p>
* This exception indicates that given notification can not be processed by corresponding mechanism.
* More info can be provided in message.
*
* null or a SchemaPath which does not represent a valid {@link DOMNotification} type.
* @throws NullPointerException if either of the arguments is null
*/
- <T extends DOMNotificationListener> ListenerRegistration<T> registerNotificationListener(@Nonnull T listener, @Nonnull Collection<SchemaPath> types);
+ <T extends DOMNotificationListener> ListenerRegistration<T> registerNotificationListener(
+ @Nonnull T listener, @Nonnull Collection<SchemaPath> types);
/**
* Register a {@link DOMNotificationListener} to receive a set of notifications. As with
* @throws NullPointerException if listener is null
*/
// FIXME: Java 8: provide a default implementation of this method.
- <T extends DOMNotificationListener> ListenerRegistration<T> registerNotificationListener(@Nonnull T listener, SchemaPath... types);
+ <T extends DOMNotificationListener> ListenerRegistration<T> registerNotificationListener(
+ @Nonnull T listener, SchemaPath... types);
}
* @param contextReference Context reference, null means a global RPC identifier.
* @return A global RPC identifier, guaranteed to be non-null.
*/
- public static @Nonnull DOMRpcIdentifier create(final @Nonnull SchemaPath type, final @Nullable YangInstanceIdentifier contextReference) {
+ public static @Nonnull DOMRpcIdentifier create(final @Nonnull SchemaPath type,
+ final @Nullable YangInstanceIdentifier contextReference) {
if (contextReference == null || contextReference.isEmpty()) {
return new Global(type);
}
@Override
public final String toString() {
- return MoreObjects.toStringHelper(this).omitNullValues().add("type", type).add("contextReference", getContextReference()).toString();
+ return MoreObjects.toStringHelper(this).omitNullValues().add("type", type).add("contextReference",
+ getContextReference()).toString();
}
}
super(String.format(format, args));
}
- public DOMRpcImplementationNotAvailableException(@Nonnull final Throwable cause, @Nonnull final String format, final Object... args) {
+ public DOMRpcImplementationNotAvailableException(@Nonnull final Throwable cause, @Nonnull final String format,
+ final Object... args) {
super(String.format(format, args), Preconditions.checkNotNull(cause));
}
}
/**
* A chain of DOM Data transactions.
*
+ * <p>
* Transactions in a chain need to be committed in sequence and each
* transaction should see the effects of previous transactions as if they happened. A chain
* makes no guarantees of atomicity, in fact transactions are committed as soon as possible.
@Override
DOMDataWriteTransaction newWriteOnlyTransaction();
-
}
private Broker broker;
@Override
- public final void start(final BundleContext context) throws Exception {
- this.context = context;
- this.startImpl(context);
- tracker = new ServiceTracker<>(context, Broker.class, this);
+ public final void start(final BundleContext bundleContext) throws Exception {
+ this.context = bundleContext;
+ this.startImpl(bundleContext);
+ tracker = new ServiceTracker<>(bundleContext, Broker.class, this);
tracker.open();
}
@Override
- public final void stop(final BundleContext context) throws Exception {
- stopImpl(context);
+ public final void stop(final BundleContext bundleContext) throws Exception {
+ stopImpl(bundleContext);
broker = null;
tracker.close();
}
- protected void startImpl(final BundleContext context) {
+ protected void startImpl(final BundleContext bundleContext) {
// NOOP
}
- protected void stopImpl(final BundleContext context) {
+
+ protected void stopImpl(final BundleContext bundleContext) {
// NOOP
}
@Override
public Broker addingService(final ServiceReference<Broker> reference) {
- if(broker == null) {
+ if (broker == null) {
broker = context.getService(reference);
broker.registerConsumer(this, context);
return broker;
}
@Override
- public final void start(final BundleContext context) throws Exception {
- this.context = context;
- this.startImpl(context);
- tracker = new ServiceTracker<>(context, Broker.class, this);
+ public final void start(final BundleContext bundleContext) throws Exception {
+ this.context = bundleContext;
+ this.startImpl(bundleContext);
+ tracker = new ServiceTracker<>(bundleContext, Broker.class, this);
tracker.open();
}
- protected void startImpl(final BundleContext context) {
+ protected void startImpl(final BundleContext bundleContext) {
// NOOP
}
- protected void stopImpl(final BundleContext context) {
+
+ protected void stopImpl(final BundleContext bundleContext) {
// NOOP
}
@Override
- public final void stop(final BundleContext context) throws Exception {
+ public final void stop(final BundleContext bundleContext) throws Exception {
broker = null;
tracker.close();
tracker = null;
- stopImpl(context);
+ stopImpl(bundleContext);
}
@Override
public Broker addingService(final ServiceReference<Broker> reference) {
- if(broker == null) {
+ if (broker == null) {
broker = context.getService(reference);
broker.registerProvider(this, context);
return broker;
public void removedService(final ServiceReference<Broker> reference, final Broker service) {
stopImpl(context);
}
-
}
/**
* Core component of the SAL layer responsible for wiring the SAL consumers.
*
+ * <p>
* 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.
*
- *
+ * <p>
* The services are exposed via session.
*
* <h3>Session-based access</h3>
*
+ * <p>
* The providers and consumers needs to register in order to use the
* binding-independent SAL layer and to expose functionality via SAL layer.
*
+ * <p>
* For more information about session-based access see {@link ConsumerSession}
* and {@link ProviderSession}
- *
- *
- *
*/
public interface Broker {
* from consumer, using the {@link Provider#getProviderFunctionality()}, and
* register that functionality into system and concrete infrastructure
* services.
+ *
* <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
boolean isClosed();
/**
- * Returns a session specific instance (implementation) of requested
- * service
+ * Returns a session specific instance (implementation) of requested service.
*
* @param service
* Broker service
package org.opendaylight.controller.sal.core.api;
/**
- *
* Session-specific instance of the broker functionality.
*
* <p>
*
* <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.
+ * 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
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.
*
+ * <p>
* 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.
*
+ * <p>
* The consumer MUST use the session for all communication with SAL or
* retrieving SAL infrastructure services.
*
+ * <p>
* This method is invoked by {@link Broker#registerConsumer(Consumer)}
*
* @param session
void onSessionInitiated(ConsumerSession session);
/**
- * @deprecated - no longer used or needed
- * *
- * Suggested implementation until removed:
- * {@code
- * public Collection<ConsumerFunctionality> getConsumerFunctionality() {
- * return Collections.emptySet();
- * }
- * }
+ * Deprecated.
+ *
+ * @deprecated - no longer used or needed. Suggested implementation until removed:
+ * {@code
+ * public Collection<ConsumerFunctionality> getConsumerFunctionality() {
+ * return Collections.emptySet();
+ * }
+ * }
*/
@Deprecated
Collection<ConsumerFunctionality> getConsumerFunctionality();
/**
+ * Deprecated.
+ *
* @deprecated - no longer used or needed
*/
@Deprecated
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.
* 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 {
void onSessionInitiated(ProviderSession session);
/**
- * @deprecated - No longer used or needed
+ * Deprecated.
*
- * Suggested implementation until removed:
+ * @deprecated - No longer used or needed. Suggested implementation until removed:
* {@code
* public Collection<ProviderFunctionality> getProviderFunctionality() {
* return Collections.emptySet();
Collection<ProviderFunctionality> getProviderFunctionality();
/**
+ * Deprecated.
+ *
* @deprecated - no longer used or needed
*/
@Deprecated
package org.opendaylight.controller.sal.core.api;
import java.io.Serializable;
-
import org.opendaylight.yangtools.concepts.Immutable;
import org.opendaylight.yangtools.yang.common.QName;
-public class RpcRoutingContext implements Immutable, Serializable {
-
- /**
- *
- */
+public final class RpcRoutingContext implements Immutable, Serializable {
private static final long serialVersionUID = -9079324728075883325L;
private final QName context;
this.rpc = rpc;
}
- public static final RpcRoutingContext create(QName context, QName rpc) {
+ public static RpcRoutingContext create(QName context, QName rpc) {
return new RpcRoutingContext(context, rpc);
}
public int hashCode() {
final int prime = 31;
int result = 1;
- result = prime * result + ((context == null) ? 0 : context.hashCode());
- result = prime * result + ((rpc == null) ? 0 : rpc.hashCode());
+ result = prime * result + (context == null ? 0 : context.hashCode());
+ result = prime * result + (rpc == null ? 0 : rpc.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
RpcRoutingContext other = (RpcRoutingContext) obj;
if (context == null) {
- if (other.context != null)
+ if (other.context != null) {
return false;
- } else if (!context.equals(other.context))
+ }
+ } else if (!context.equals(other.context)) {
return false;
+ }
if (rpc == null) {
- if (other.rpc != null)
+ if (other.rpc != null) {
return false;
- } else if (!rpc.equals(other.rpc))
+ }
+ } else if (!rpc.equals(other.rpc)) {
return false;
+ }
return true;
}
}
import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
/**
+ * Deprecated.
+ *
* @deprecated Use {@link DOMSchemaService} instead.
*/
@Deprecated
public interface SchemaService extends BrokerService, DOMSchemaService {
/**
- * Registers a YANG module to session and global context
+ * Registers a YANG module to session and global context.
*/
void addModule(Module module);
/**
- * Unregisters a YANG module from session context
+ * Unregisters a YANG module from session context.
*/
void removeModule(Module module);
/**
- * Returns session specific YANG schema context
+ * Returns session specific YANG schema context.
*/
@Override
SchemaContext getSessionContext();
/**
- * Returns global schema context
+ * Returns global schema context.
*/
@Override
SchemaContext getGlobalContext();
* can be used.
*/
public abstract class AbstractDOMDataTreeServiceTestSuite {
- protected static final QNameModule TEST_MODULE = QNameModule.create(URI.create("urn:opendaylight:params:xml:ns:yang:controller:md:sal:test:store"));
+ protected static final QNameModule TEST_MODULE = QNameModule.create(URI.create(
+ "urn:opendaylight:params:xml:ns:yang:controller:md:sal:test:store"));
protected static final YangInstanceIdentifier UNORDERED_CONTAINER_IID = YangInstanceIdentifier.create(
new NodeIdentifier(QName.create(TEST_MODULE, "lists")),
new NodeIdentifier(QName.create(TEST_MODULE, "unordered-container")));
- protected static final DOMDataTreeIdentifier UNORDERED_CONTAINER_TREE = new DOMDataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, UNORDERED_CONTAINER_IID);
+ protected static final DOMDataTreeIdentifier UNORDERED_CONTAINER_TREE =
+ new DOMDataTreeIdentifier(LogicalDatastoreType.OPERATIONAL, UNORDERED_CONTAINER_IID);
/**
* Return a reference to the service used in this test. The instance
/**
* A simple unbound producer. It write some basic things into the data store based on the
* test model.
- * @throws DOMDataTreeProducerException
- * @throws TransactionCommitFailedException
*/
@Test
public final void testBasicProducer() throws DOMDataTreeProducerException, TransactionCommitFailedException {
// Create a producer. It is an AutoCloseable resource, hence the try-with pattern
- try (final DOMDataTreeProducer prod = service().createProducer(Collections.singleton(UNORDERED_CONTAINER_TREE))) {
+ try (DOMDataTreeProducer prod = service().createProducer(Collections.singleton(UNORDERED_CONTAINER_TREE))) {
assertNotNull(prod);
final DOMDataWriteTransaction tx = prod.createTransaction(true);
assertNotNull(tx);
- tx.put(LogicalDatastoreType.OPERATIONAL, UNORDERED_CONTAINER_IID, ImmutableContainerNodeBuilder.create().build());
+ tx.put(LogicalDatastoreType.OPERATIONAL, UNORDERED_CONTAINER_IID,
+ ImmutableContainerNodeBuilder.create().build());
final CheckedFuture<Void, TransactionCommitFailedException> f = tx.submit();
assertNotNull(f);
package org.opendaylight.controller.md.sal.test.model.util;
import com.google.common.collect.ImmutableList;
+import java.util.Arrays;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.augment.rev140709.TreeComplexUsesAugment;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.augment.rev140709.TreeComplexUsesAugmentBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.test.augment.rev140709.TreeLeafOnlyUsesAugment;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import java.util.Arrays;
-
-public class ListsBindingUtils {
+public final class ListsBindingUtils {
private static final InstanceIdentifier<Top> TOP_PATH = InstanceIdentifier.create(Top.class);
return path(top).augmentation(TreeComplexUsesAugment.class).child(ListViaUses.class, uses);
}
- public static <T extends DataObject & Augmentation<TopLevelList>> InstanceIdentifier<T> path(final TopLevelListKey key, final Class<T> augmentation) {
+ public static <T extends DataObject & Augmentation<TopLevelList>> InstanceIdentifier<T> path(
+ final TopLevelListKey key, final Class<T> augmentation) {
return path(key).augmentation(augmentation);
}
}
public static TreeComplexUsesAugment complexUsesAugment(final ListViaUsesKey... keys) {
- ImmutableList.Builder<ListViaUses> listViaUses = ImmutableList.<ListViaUses> builder();
+ ImmutableList.Builder<ListViaUses> listViaUses = ImmutableList.<ListViaUses>builder();
for (ListViaUsesKey key : keys) {
listViaUses.add(new ListViaUsesBuilder().setKey(key).build());
}