X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-common-api%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fcommon%2Fapi%2Fdata%2FAsyncDataBroker.java;h=fb429e5fd1342c0ca675040a315c1b8ad76456c7;hb=bef0749bb2517eaae6a501be501e16a7d3905045;hp=87bbfd3d065a374e729c5f4e894bc4f40ddb17f9;hpb=3ca2b85262ea5d9a8f638b03477c968549133232;p=controller.git diff --git a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncDataBroker.java b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncDataBroker.java index 87bbfd3d06..fb429e5fd1 100644 --- a/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncDataBroker.java +++ b/opendaylight/md-sal/sal-common-api/src/main/java/org/opendaylight/controller/md/sal/common/api/data/AsyncDataBroker.java @@ -10,6 +10,52 @@ package org.opendaylight.controller.md.sal.common.api.data; import org.opendaylight.yangtools.concepts.ListenerRegistration; import org.opendaylight.yangtools.concepts.Path; +/** + * + * Provides access to a conceptual data tree store. + * + *
+ * Also provides the ability to subscribe for changes to data under a given + * branch of the tree. + * + *
+ * All operations on data tree are performed via one of the transactions: + *
+ * These transactions provide a stable isolated view of data tree, which is + * guaranteed to be not affected by other concurrent transactions, until + * transaction is committed. + * + *
+ * For a detailed explanation of how transaction are isolated and how transaction-local + * changes are committed to global data tree, see + * {@link AsyncReadTransaction}, {@link AsyncWriteTransaction}, + * {@link AsyncReadWriteTransaction} and {@link AsyncWriteTransaction#commit()}. + * + * + *
+ * It is strongly recommended to use the type of transaction, which + * provides only the minimal capabilities you need. This allows for + * optimizations at the data broker / data store level. For example, + * implementations may optimize the transaction for reading if they know ahead + * of time that you only need to read data - such as not keeping additional meta-data, + * which may be required for write transactions. + * + *
+ * Implementation Note: This interface is not intended to be implemented + * by users of MD-SAL, but only to be consumed by them. + * + * @param
+ * Type of path (subtree identifier), which represents location in
+ * tree
+ * @param , D, L extends AsyncDataChangeListener > extends //
AsyncDataTransactionFactory {
@@ -17,52 +63,150 @@ public interface AsyncDataBroker , D, L extends AsyncDataChange
*
* Scope of Data Change
*
+ *
* Represents scope of data change (addition, replacement, deletion).
*
- * The terminology for types is reused from LDAP
+ * The terminology for scope types is reused from LDAP.
+ *
+ * newReadOnlyTransaction();
+ /**
+ * {@inheritDoc}
+ */
@Override
- public AsyncReadWriteTransaction newReadWriteTransaction();
+ public AsyncReadWriteTransaction newReadWriteTransaction();
+ /**
+ * {@inheritDoc}
+ */
@Override
public AsyncWriteTransaction newWriteOnlyTransaction();
/**
- * Registers {@link DataChangeListener} for Data Change callbacks
- * which will be triggered on which will be triggered on the store
+ * Registers a {@link AsyncDataChangeListener} to receive
+ * notifications when data changes under a given path in the conceptual data
+ * tree.
+ *
+ * You are able to register for notifications for any node or subtree
+ * which can be reached via the supplied path.
+ *
+ * If path type
+ * You are able to register for data change notifications for a subtree even
+ * if it does not exist. You will receive notification once that node is
+ * created.
+ *
+ * If there is any preexisting data in data tree on path for which you are
+ * registering, you will receive initial data change event, which will
+ * contain all preexisting data, marked as created.
+ *
+ *
+ * You are also able to specify the scope of the changes you want to be
+ * notified.
+ *
+ * Supported scopes are:
+ *
+ * This method returns a {@link ListenerRegistration} object. To
+ * "unregister" your listener for changes call the "close" method on this
+ * returned object.
+ *
+ * You MUST call close when you no longer need to receive notifications
+ * (such as during shutdown or for example if your bundle is shutting down).
*
- *Â @param store Logical store in which listener is registered.
- * @param path Path (subtree identifier) on which client listener will be invoked.
- * @param listener Instance of listener which should be invoked on
- * @param triggeringScope Scope of change which triggers callback.
- * @return Listener registration of the listener, call {@link ListenerRegistration#close()}
- * to stop delivery of change events.
+ * @param store
+ * Logical Data Store - Logical Datastore you want to listen for
+ * changes in. For example
+ * {@link LogicalDatastoreType#OPERATIONAL} or
+ * {@link LogicalDatastoreType#CONFIGURATION}
+ * @param path
+ * Path (subtree identifier) on which client listener will be
+ * invoked.
+ * @param listener
+ * Instance of listener which should be invoked on
+ * @param triggeringScope
+ * Scope of change which triggers callback.
+ * @return Listener registration object, which may be used to unregister
+ * your listener using {@link ListenerRegistration#close()} to stop
+ * delivery of change events.
*/
- ListenerRegistrationExamples
+ *
+ * Following is an example model with comments describing what notifications
+ * you would receive based on the scope you specify, when you are
+ * registering for changes on container a.
*
- * @see http://www.idevelopment.info/data/LDAP/LDAP_Resources/SEARCH_Setting_the_SCOPE_Parameter.shtml
+ *
+ * container a // scope BASE, ONE, SUBTREE
+ * leaf "foo" // scope ONE, SUBTREE
+ * container // scope ONE, SUBTREE
+ * leaf "bar" // scope SUBTREE
+ * list list // scope ONE, SUBTREE
+ * list [a] // scope SUBTREE
+ * id "a" // scope SUBTREE
+ * list [b] // scope SUBTREE
+ * id "b" // scope SUBTREE
+ *
+ *
+ * Following is an example model with comments describing what notifications
+ * you would receive based on the scope you specify, when you are
+ * registering for changes on list list (without specifying concrete item in
+ * the list).
+ *
+ *
+ * list list // scope BASE, ONE, SUBTREE
+ * list [a] // scope ONE, SUBTREE
+ * id "a" // scope SUBTREE
+ * list [b] // scope ONE, SUBTREE
+ * id "b" // scope SUBTREE
+ *
+ *
+ *
+ * @see http://www.idevelopment.info/data/LDAP/LDAP_Resources/
+ * SEARCH_Setting_the_SCOPE_Parameter.shtml
*/
public enum DataChangeScope {
- /**
- * Represents only a direct change of the node, such as replacement of node,
- * addition or deletion.
- *
- */
- BASE,
- /**
- * Represent a change (addition,replacement,deletion)
- * of the node or one of it's direct childs.
- *
- */
- ONE,
- /**
- * Represents a change of the node or any of it's child nodes.
- *
- */
- SUBTREE
+ /**
+ * Represents only a direct change of the node, such as replacement of a
+ * node, addition or deletion.
+ *
+ */
+ BASE,
+ /**
+ * Represent a change (addition,replacement,deletion) of the node or one
+ * of its direct children.
+ *
+ * This scope is superset of {@link #BASE}.
+ *
+ */
+ ONE,
+ /**
+ * Represents a change of the node or any of or any of its child nodes,
+ * direct and nested.
+ *
+ * This scope is superset of {@link #ONE} and {@link #BASE}.
+ *
+ */
+ SUBTREE
}
+ /**
+ * {@inheritDoc}
+ */
@Override
public AsyncReadTransactionP
allows it, you may specify paths up to the leaf nodes
+ * then it is possible to listen on leaf nodes.
+ *
+ *
+ * See {@link DataChangeScope} for examples.
+ *