197 lines
5.3 KiB
Plaintext
197 lines
5.3 KiB
Plaintext
///////////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// VP_SAMPLE3.MOF
|
|
|
|
//
|
|
|
|
// Purpose: Sample view provider MOF for association views
|
|
|
|
//
|
|
|
|
// Copyright (c) 1999-2001 Microsoft Corporation, All Rights Reserved
|
|
//
|
|
///////////////////////////////////////////////////////////////////////
|
|
|
|
#pragma namespace("\\\\.\\root")
|
|
|
|
instance of __namespace
|
|
{
|
|
Name = "sample_views";
|
|
};
|
|
|
|
|
|
#pragma namespace("\\\\.\\root\\sample_views")
|
|
|
|
instance of __Win32Provider as $DataProv
|
|
{
|
|
Name = "MS_VIEW_INSTANCE_PROVIDER";
|
|
ClsId = "{AA70DDF4-E11C-11D1-ABB0-00C04FD9159E}";
|
|
ImpersonationLevel = 1;
|
|
PerUserInitialization = "True";
|
|
};
|
|
|
|
instance of __InstanceProviderRegistration
|
|
{
|
|
Provider = $DataProv;
|
|
SupportsPut = True;
|
|
SupportsGet = True;
|
|
SupportsDelete = True;
|
|
SupportsEnumeration = True;
|
|
QuerySupportLevels = {"WQL:UnarySelect"};
|
|
};
|
|
|
|
//*********************************************************************************************************
|
|
//
|
|
// The following classes demonstrate views of associations
|
|
//
|
|
//*********************************************************************************************************
|
|
|
|
// ASSOCIATION CASE1
|
|
// The following class is a view of the CIMv2 class Win32_SystemOperatingSystem
|
|
// association. It is practically useless as both end points are in other
|
|
// namespaces and Associators/References queries cannot be used accross
|
|
// namespaces.
|
|
//
|
|
// This view uses the direct qualifier to identify a reference property that
|
|
// is not to be mapped to a view reference.
|
|
//======================================================================================
|
|
|
|
[
|
|
Association,
|
|
ViewSources {"Select * From Win32_SystemOperatingSystem"},
|
|
ViewSpaces {"\\\\.\\root\\cimv2"},
|
|
dynamic, provider("MS_VIEW_INSTANCE_PROVIDER")
|
|
]
|
|
class Association_SystemOperatingSystem
|
|
{
|
|
[
|
|
Direct, key, PropertySources{"GroupComponent"}
|
|
]
|
|
Win32_ComputerSystem ref Computer;
|
|
|
|
[
|
|
Direct, key, PropertySources{"PartComponent"}
|
|
]
|
|
Win32_OperatingSystem ref OperatingSystem;
|
|
};
|
|
|
|
|
|
// ASSOCIATION CASE2
|
|
// The following class is a view of the CIMv2 class Win32_SystemOperatingSystem
|
|
// association. This version is a little more useful. In this case Win32_OperatingSystem
|
|
// is mapped into the sample namespace and Win32_ComputerSystem is not. However,
|
|
// this view association allows the view operating system to be associated to the
|
|
// Win32_ComputerSystem. And perfroming an Associators of the view operating system
|
|
// instance will return the Win32_ComputerSystem
|
|
//
|
|
// Again, this view uses the direct qualifier to identify a reference property that
|
|
// is not to be mapped to a view reference.
|
|
//
|
|
// NOTE: First the view operating system is shown then the view association.
|
|
//======================================================================================
|
|
|
|
[union,
|
|
ViewSources {"Select * from Win32_OperatingSystem"},
|
|
ViewSpaces {"\\\\.\\root\\cimv2"},
|
|
dynamic, provider("MS_VIEW_INSTANCE_PROVIDER")
|
|
]
|
|
class Union_OS_For_AssociationExample
|
|
{
|
|
[key, PropertySources{"Name"}]
|
|
string Name;
|
|
|
|
[PropertySources{"Version"}]
|
|
string Version;
|
|
|
|
[PropertySources{"BuildNumber"}]
|
|
string BuildNumber;
|
|
};
|
|
|
|
[
|
|
Association,
|
|
ViewSources {"Select * From Win32_SystemOperatingSystem"},
|
|
ViewSpaces {"\\\\.\\root\\cimv2"},
|
|
dynamic, provider("MS_VIEW_INSTANCE_PROVIDER")
|
|
]
|
|
class Association_SystemViewOperatingSystem
|
|
{
|
|
[
|
|
Direct, key, PropertySources{"GroupComponent"}
|
|
]
|
|
Win32_ComputerSystem ref Computer;
|
|
|
|
[
|
|
key, PropertySources{"PartComponent"}
|
|
]
|
|
Union_OS_For_AssociationExample ref OperatingSystem;
|
|
};
|
|
|
|
|
|
// ASSOCIATION CASE3
|
|
// The following class is a view of the CIMv2 class Win32_SystemOperatingSystem
|
|
// association. In this case Win32_OperatingSystem and Win32_ComputerSystem
|
|
// are mapped into the sample namespace. However, this view association allows
|
|
// the view operating system to be associated to the view computer system.
|
|
// Perfroming an Associators of the view operating system instance will return
|
|
// the view computer system. Furthermore, Perfroming an Associators of the view
|
|
// computer system instance will return the view operating system.
|
|
//
|
|
// This view makes no use of the direct qualifier.
|
|
//
|
|
// NOTE: First the view computer system is shown then the view association.
|
|
//======================================================================================
|
|
[
|
|
Union,
|
|
ViewSources {"Select * From Win32_ComputerSystem"},
|
|
ViewSpaces {"\\\\.\\root\\cimv2"},
|
|
dynamic, provider("MS_VIEW_INSTANCE_PROVIDER")
|
|
]
|
|
class Union_ComputerSystem_For_AssociationExample
|
|
{
|
|
[key,
|
|
PropertySources{"Name"}
|
|
]
|
|
string Name;
|
|
|
|
[
|
|
PropertySources{"Domain"}
|
|
]
|
|
string Domain;
|
|
|
|
[
|
|
PropertySources{"Manufacturer"}
|
|
]
|
|
string Manufacturer;
|
|
|
|
[
|
|
PropertySources{"Model"}
|
|
]
|
|
string Model;
|
|
|
|
[
|
|
PropertySources{"NumberOfProcessors"}
|
|
]
|
|
uint32 NumberOfProcessors;
|
|
};
|
|
|
|
[
|
|
Association,
|
|
ViewSources {"Select * From Win32_SystemOperatingSystem"},
|
|
ViewSpaces {"\\\\.\\root\\cimv2"},
|
|
dynamic, provider("MS_VIEW_INSTANCE_PROVIDER")
|
|
]
|
|
class Association_ViewSystemViewOperatingSystem
|
|
{
|
|
[
|
|
key, PropertySources{"GroupComponent"}
|
|
]
|
|
Union_ComputerSystem_For_AssociationExample ref Computer;
|
|
|
|
[
|
|
key, PropertySources{"PartComponent"}
|
|
]
|
|
Union_OS_For_AssociationExample ref OperatingSystem;
|
|
};
|