<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: PerfObjGetInstancesRequest - Counters and Instances Type Restriction in Software Development Kit (SDK) and API Discussions</title>
    <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/PerfObjGetInstancesRequest-Counters-and-Instances-Type-Restriction/m-p/16478#M151</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sens,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It does make sense in general to select List types as parameters where arrays are expected. But I am curious as to what specific functionality is being used from the List interface ? I am taking a somewhat wild guess that the API ultimately ends up calling a "toArray()" method to get an actual array representation of the Collection and then uses indexed access directly on that array rather then relying on Java SDK's List features. (I might be wrong... like I said I am guessing)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The "toArray()" method is actually very conveniently located in the Collection interface rather than in List interface &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_macro_emoticon jive_emote" src="https://community.netapp.com/5.0.1/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyways, some more background on this. This is what I tried...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried by creating a class which simply wraps a Set in a List, something like this...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;class SetAsList&amp;lt;E&amp;gt; implements List&amp;lt;E&amp;gt; {&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; private static final UnsupportedOperationException UNSUPPORTED = new UnsupportedOperationException();&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; private Set&amp;lt;E&amp;gt; mySet;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; public void wrap(Set&amp;lt;E&amp;gt; theSet) {&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mySet = theSet;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; }&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #339966;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;// Implement all the methods enforced by List&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #339966;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; // Throw UNSUPPORTED from the methods which exposed indexed functionality of a List for e.g. public E get(int index)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;Then use the above class to actually wrap a key set from a HashMap which contains names of the Vservers. The use that SetAsList object to set the "List of instances" as per the API method signature.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;And it worked !&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;If it were relying on any List specific functionality it would have thrown the runtime exception UNSUPPORTED.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;Now, I am not saying this might be true for all possible statistics Objects, but it might be worthwhile taking a look into the code and possibly introducing additional methods which accept Collection type parameters. This will make the API a lot more consumer friendly. I am sure API consumers will heavily rely on HashMap based data structures (i.e. Maps and Sets) to interact with the appliances using the API and will possibly run up against cases such as the one I have come across.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;--&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;Gagan Grewal&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 16 Apr 2013 15:07:13 GMT</pubDate>
    <dc:creator>VIEMEARD</dc:creator>
    <dc:date>2013-04-16T15:07:13Z</dc:date>
    <item>
      <title>PerfObjGetInstancesRequest - Counters and Instances Type Restriction</title>
      <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/PerfObjGetInstancesRequest-Counters-and-Instances-Type-Restriction/m-p/16469#M149</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This probably is a question for the NetApp API developers directly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The &lt;STRONG style="font-family: courier new,courier;"&gt;setCounters() &lt;/STRONG&gt;and &lt;STRONG style="font-family: courier new,courier;"&gt;setInstances()&lt;/STRONG&gt; methods in &lt;SPAN style="font-family: courier new,courier; font-size: 10pt;"&gt;&lt;STRONG&gt;PerfObjGetInstancesRequest&lt;/STRONG&gt;&lt;/SPAN&gt; type require the arguments to be of type &lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;List&amp;lt;String&amp;gt;&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a specific reason why this is the case ? Do they require to be internally represented as a &lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;List&lt;/STRONG&gt;&lt;/SPAN&gt; rather than a less restrictive &lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;Collection&lt;/STRONG&gt;&lt;/SPAN&gt; ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If there is no specific need for the them to be arranged as a &lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;List&lt;/STRONG&gt;&lt;/SPAN&gt; then will it be possible to introduce methods in the next release which accept &lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;Collection&lt;/STRONG&gt;&lt;/SPAN&gt; type arguments as well ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I came across this situation where it is possible that come client code is internally keeping a &lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;Set&lt;/STRONG&gt;&lt;/SPAN&gt; (or &lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;Map&lt;/STRONG&gt;&lt;/SPAN&gt;) type collection of the for e.g. Vservers and then want to query the counters for the Vservers. Where the Vserver names are the &lt;STRONG&gt;Keys&lt;/STRONG&gt; in the maps i.e. a &lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;Set&lt;/STRONG&gt;&lt;/SPAN&gt; collection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the current form, there will have to be code written somewhere in the client application which provides a &lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;Set&lt;/STRONG&gt;&lt;/SPAN&gt; to &lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;List&lt;/STRONG&gt;&lt;/SPAN&gt; mapping of the Vservers before being able to run this request against an &lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;ApiRunner&lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In case there is no real need internally in the implementation for a &lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;List&lt;/STRONG&gt;&lt;/SPAN&gt; type collection then will it be possible to provide API methods which accept &lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;Collection&lt;/STRONG&gt;&lt;/SPAN&gt; type arguments instead of a &lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;List&lt;/STRONG&gt;&lt;/SPAN&gt; type ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;--&lt;/P&gt;&lt;P&gt;Gagan Grewal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Jun 2025 06:05:10 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/PerfObjGetInstancesRequest-Counters-and-Instances-Type-Restriction/m-p/16469#M149</guid>
      <dc:creator>VIEMEARD</dc:creator>
      <dc:date>2025-06-05T06:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: PerfObjGetInstancesRequest - Counters and Instances Type Restriction</title>
      <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/PerfObjGetInstancesRequest-Counters-and-Instances-Type-Restriction/m-p/16474#M150</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gagan,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your feedback.&lt;/P&gt;&lt;P&gt;Most of the "&lt;EM&gt;array&lt;/EM&gt;" type parameters are defined as "&lt;STRONG&gt;List&amp;lt;String&amp;gt;&lt;/STRONG&gt;".&lt;/P&gt;&lt;P&gt;We will surely consider your suggestion to define these parameters as a "&lt;STRONG&gt;Collection&lt;/STRONG&gt;" and we will check if we can provide the new definitions in the upcoming releases of NMSDK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sen.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Apr 2013 08:38:23 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/PerfObjGetInstancesRequest-Counters-and-Instances-Type-Restriction/m-p/16474#M150</guid>
      <dc:creator>sens</dc:creator>
      <dc:date>2013-04-16T08:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: PerfObjGetInstancesRequest - Counters and Instances Type Restriction</title>
      <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/PerfObjGetInstancesRequest-Counters-and-Instances-Type-Restriction/m-p/16478#M151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sens,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It does make sense in general to select List types as parameters where arrays are expected. But I am curious as to what specific functionality is being used from the List interface ? I am taking a somewhat wild guess that the API ultimately ends up calling a "toArray()" method to get an actual array representation of the Collection and then uses indexed access directly on that array rather then relying on Java SDK's List features. (I might be wrong... like I said I am guessing)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The "toArray()" method is actually very conveniently located in the Collection interface rather than in List interface &lt;SPAN __jive_emoticon_name="happy" __jive_macro_name="emoticon" class="jive_macro jive_macro_emoticon jive_emote" src="https://community.netapp.com/5.0.1/images/emoticons/happy.gif"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyways, some more background on this. This is what I tried...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried by creating a class which simply wraps a Set in a List, something like this...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;class SetAsList&amp;lt;E&amp;gt; implements List&amp;lt;E&amp;gt; {&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; private static final UnsupportedOperationException UNSUPPORTED = new UnsupportedOperationException();&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; private Set&amp;lt;E&amp;gt; mySet;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; public void wrap(Set&amp;lt;E&amp;gt; theSet) {&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; mySet = theSet;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; }&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #339966;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;// Implement all the methods enforced by List&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #339966;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt; // Throw UNSUPPORTED from the methods which exposed indexed functionality of a List for e.g. public E get(int index)&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;Then use the above class to actually wrap a key set from a HashMap which contains names of the Vservers. The use that SetAsList object to set the "List of instances" as per the API method signature.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;And it worked !&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;If it were relying on any List specific functionality it would have thrown the runtime exception UNSUPPORTED.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;Now, I am not saying this might be true for all possible statistics Objects, but it might be worthwhile taking a look into the code and possibly introducing additional methods which accept Collection type parameters. This will make the API a lot more consumer friendly. I am sure API consumers will heavily rely on HashMap based data structures (i.e. Maps and Sets) to interact with the appliances using the API and will possibly run up against cases such as the one I have come across.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;--&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;Gagan Grewal&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Apr 2013 15:07:13 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/PerfObjGetInstancesRequest-Counters-and-Instances-Type-Restriction/m-p/16478#M151</guid>
      <dc:creator>VIEMEARD</dc:creator>
      <dc:date>2013-04-16T15:07:13Z</dc:date>
    </item>
  </channel>
</rss>

