<!-- 
RSS generated by JIRA (8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d) at Wed Feb 07 20:11:02 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>OpenDaylight JIRA</title>
    <link>https://jira.opendaylight.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>8.20.10</version>
        <build-number>820010</build-number>
        <build-date>22-06-2022</build-date>
    </build-info>


<item>
            <title>[MDSAL-813] Add DataBroker.registerListener(DataTreeIdentifier,DataListener)</title>
                <link>https://jira.opendaylight.org/browse/MDSAL-813</link>
                <project id="10137" key="MDSAL">mdsal</project>
                    <description>&lt;p&gt;Current ClusteredDataTreeChangeListener exposes the details about what changed in the entire tree.&lt;/p&gt;

&lt;p&gt;There are a number of users which receive these changes like this:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
@Override
&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; void onDataTreeChanged(Collection&amp;lt;DataTreeModification&amp;lt;Config&amp;gt;&amp;gt; changes) {
    updateConfig(Iterables.getLast(changes).getRootNode().getDataAfter());
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;i.e. they are interested only in the last state.&lt;/p&gt;

&lt;p&gt;Since we are overlaying on DOMDataBroker, whose version of DTCL provides a List of changes, it should be trivial to support:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
@FunctionalInterface
&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;interface&lt;/span&gt; DataListener&amp;lt;T &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; DataObject&amp;gt; {
    &lt;span class=&quot;code-comment&quot;&gt;// Note: needs a better name
&lt;/span&gt;    void dataChangedTo(@Nullable T data);
}&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;and users doing just:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
@Override
&lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; void dataChangedTo(Config data) {
    &lt;span class=&quot;code-comment&quot;&gt;// the contents of updateConfig(data);
&lt;/span&gt;}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;This will make for much simpler users, as this also covers the case of onInitialData(). Furthermore users do not care about data locality &#8211; hence this should imply ClusteredDataTreeChangeListener in all cases, without the distinction available through DataTreeChangeListener &#8211; i.e. an implementation could be (just painting a picture!)&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
@FunctionalInterface
&lt;span class=&quot;code-keyword&quot;&gt;interface&lt;/span&gt; DataObjectListenerAdapter&amp;lt;T &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; DataObject&amp;gt; &lt;span class=&quot;code-keyword&quot;&gt;extends&lt;/span&gt; ClusteredDataTreeChangeListener&amp;lt;T&amp;gt;, DataListener&amp;lt;T&amp;gt; {
    @Override
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; void onInitialData() {
 &#160; &#160; &#160; &#160; dataChangedTo(&lt;span class=&quot;code-keyword&quot;&gt;null&lt;/span&gt;);
    }

    @Override
    &lt;span class=&quot;code-keyword&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;final&lt;/span&gt; void onDataTreeChanged(Collection&amp;lt;DataTreeModification&amp;lt;T&amp;gt;&amp;gt; changes) {
 &#160; &#160; &#160; &#160; dataChangedTo(Iterables.getLast(changes).getRootNode().getDataAfter());
    }
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Implementation-wise, mdsal-binding-dom-adapter can perform the equivalent of getLast()... on top of DOM data (which is a List, not a Collection) and just decode the last fragment &#8211; which will be very efficient indeed.&lt;/p&gt;

&lt;p&gt;There is a wrinkle with wildcard InstanceIdentifiers, where this approach falls flat. As a first step, DataBroker.registerListener() should reject wildcards with an IllegalArgumentException. A follow-up will provide similar interfaces which report the InstanceIdentifier as well (and thus can deal with wildcards).&lt;/p&gt;

&lt;p&gt;A further use case is comparison on before-value and after-value, so another interface like:&lt;/p&gt;
&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;@FunctionalInterface
interface DataChangeListener&amp;lt;T extends DataObject&amp;gt; {
    void dataChanged(@Nullable T previousValue, @Nullable T currentValue);
}&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;which is to say: previousValue = first.getRootNode().getDataBefore(), currentValue = last.getRootNode().getDataAfter() in terms of DTCL.&lt;/p&gt;</description>
                <environment></environment>
        <key id="36664">MDSAL-813</key>
            <summary>Add DataBroker.registerListener(DataTreeIdentifier,DataListener)</summary>
                <type id="10103" iconUrl="https://jira.opendaylight.org/secure/viewavatar?size=xsmall&amp;avatarId=10311&amp;avatarType=issuetype">New Feature</type>
                                            <priority id="2" iconUrl="https://jira.opendaylight.org/images/icons/priorities/critical.svg">High</priority>
                        <status id="5" iconUrl="https://jira.opendaylight.org/images/icons/statuses/resolved.png" description="A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.">Resolved</status>
                    <statusCategory id="3" key="done" colorName="green"/>
                                    <resolution id="10000">Done</resolution>
                                        <assignee username="opanasiuk">Oleksandr Panasiuk</assignee>
                                    <reporter username="rovarga">Robert Varga</reporter>
                        <labels>
                            <label>pt</label>
                    </labels>
                <created>Fri, 10 Feb 2023 00:12:31 +0000</created>
                <updated>Wed, 21 Jun 2023 10:54:10 +0000</updated>
                            <resolved>Wed, 21 Jun 2023 10:54:09 +0000</resolved>
                                                    <fixVersion>12.0.0</fixVersion>
                                    <component>Binding API</component>
                    <component>Binding runtime</component>
                        <due></due>
                            <votes>0</votes>
                                    <watches>1</watches>
                                                                                                                <comments>
                            <comment id="71979" author="rovarga" created="Fri, 10 Feb 2023 00:26:58 +0000"  >&lt;p&gt;Since this can be solved with default interface methods for compatibility, we should introduce this in 11.0.x stream.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                            <customfield id="customfield_11400" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10000" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|i044b3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                </customfields>
    </item>
</channel>
</rss>