140 lines
5.0 KiB
HTML
140 lines
5.0 KiB
HTML
<html>
|
|
|
|
<head>
|
|
<title>Memo </title>
|
|
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
|
|
</head>
|
|
|
|
<body bgcolor="#C0C0C0" text="#000080">
|
|
|
|
<p><big><big><u><font color="#800080">WMI Core Memo </font>: Subclass Providers and
|
|
Queries</u></big></big></p>
|
|
|
|
<p>Rev 1.00, raymcc, Jul-16-99</p>
|
|
|
|
<hr>
|
|
|
|
<p><strong>1.0 Introduction</strong></p>
|
|
|
|
<p>This memo concerns an inconsistency found on 16-Jul-99 within WinMmgt concerning
|
|
providers which support queries and which are also involved in a class hierarchy where
|
|
multiple providers are subclassing the same base class.</p>
|
|
|
|
<p>Specifically, in order to avoid orphaned instances, the result sets of two providers
|
|
which are chained together in a class hierarchy must match exactly. Given that the
|
|
subclass provider <em>may </em>override one or more properties, the providers may not
|
|
agree on the sets of instances which are returned.</p>
|
|
|
|
<p><strong>Cf. RAID 54070.</strong></p>
|
|
|
|
<hr>
|
|
|
|
<p><strong>2.0 Example</strong></p>
|
|
|
|
<p>Assume the following class hierarachy, where instances of each class are provided by
|
|
providers which support queries:</p>
|
|
|
|
<p><strong> </strong></p>
|
|
|
|
<blockquote>
|
|
<p>[dynamic, provider("abc")]<br>
|
|
class MyClass<br>
|
|
{<br>
|
|
[key] sint32 ID;<br>
|
|
sint32 p1;<br>
|
|
sint32 p2;</p>
|
|
<p>[dynamic, provider("xyz")]<br>
|
|
class Subclass : MyClass<br>
|
|
{<br>
|
|
[override] sint32 p2;<br>
|
|
sint32 p3;<br>
|
|
}</p>
|
|
</blockquote>
|
|
|
|
<p>If the client issues a query <em>select * from MyClass where p2 = 1 </em>the first
|
|
provider <strong>abc </strong>may determine that there are no instances in which <em>p2 =
|
|
1</em> and return an empty result set. The second provider, for <em>Subclass</em>,
|
|
which will be called during the execution of the query, may in fact believe that there are
|
|
several instances where <em>p2=1 </em>and return several instances. These instances
|
|
must be joined to instances of <em>MyClass, </em>which do not actually exist. </p>
|
|
|
|
<p>Thus, the overridden property has introduced a conflict in the result set.</p>
|
|
|
|
<hr>
|
|
|
|
<p><strong>3.0 MOF Conventions</strong></p>
|
|
|
|
<p>Strictly speaking, if a property is overridden in a subclass, it <em>must </em>be
|
|
marked with the <strong>override </strong>qualifier. WinMgmt will enforce this
|
|
in Win2000.</p>
|
|
|
|
<blockquote>
|
|
<p>class MyClass<br>
|
|
{<br>
|
|
[key] sint32 ID;<br>
|
|
sint32 p1;<br>
|
|
sint32 p2;</p>
|
|
<p>class Subclass : MyClass<br>
|
|
{<br>
|
|
[override] sint32 p2;<br>
|
|
sint32 p3;<br>
|
|
}</p>
|
|
</blockquote>
|
|
|
|
<p>This allows WinMmgt to detect that there may be a conflict in how the providers
|
|
determine correct result sets.</p>
|
|
|
|
<hr>
|
|
|
|
<p><strong>4.0 Providers and Clients</strong></p>
|
|
|
|
<p>There is no change involved in provider construction or in the way clients issue their
|
|
queries. This issue is solved entirely within WMI Core Components.</p>
|
|
|
|
<p>The only rule, <strong>still enforced, </strong>is that subclass providers and
|
|
superclass providers must return the same set of instances with regard to key values.
|
|
A subclass provider may provide <em>less </em>instances than the set of instances
|
|
provided by the superclass provider, but may not return <em>more</em><strong> </strong>instances.</p>
|
|
|
|
<hr>
|
|
|
|
<p><strong>5.0 WinMgmt Modifications</strong></p>
|
|
|
|
<p>WinMmgt will be modified as a result of RAI D 54070 to change the queries it submits to
|
|
providers. In the simplest cases, changing to pure enumeration would solve the
|
|
problem. However, many providers can support queries and considerable
|
|
optimizations would be lost.</p>
|
|
|
|
<p>WinMgmt will be altered to change the client's query to a subset of the query which
|
|
eliminates any mention of properties overridden in a subclass provider. If the
|
|
client issues the following query:</p>
|
|
|
|
<p> <em>select * from MyClass where ID > 10 and p1 < 100 and p2
|
|
> 200</em></p>
|
|
|
|
<p>Then the query supplied to the superclass provider would be</p>
|
|
|
|
<p> <em>select * from MyClass where ID > 10 and p1 < 100</em></p>
|
|
|
|
<p>It is not correct for the superclass provider to know that an additional test of <em>p2
|
|
> 200 </em>was present on the query, because it cannot know if the subclass provider
|
|
will override the value for any given instance, thus changing the result set.</p>
|
|
|
|
<p>Since subclass providers may only support enumeration, or vice-versa, WinMgmt will
|
|
customize the query for the provider, following the above guidelines.
|
|
Likewise, since the subclass provider which can support queries doesn't know
|
|
about superclass property values that it hasn't overriden, these will be removed from the
|
|
queries to the subclass providers.</p>
|
|
|
|
<p> </p>
|
|
|
|
<p> </p>
|
|
|
|
<p> </p>
|
|
|
|
<p><em> </em></p>
|
|
|
|
<p><strong> </strong></p>
|
|
</body>
|
|
</html>
|