Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

218 lines
6.9 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1997-1999 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // ClusResG.h
  7. //
  8. // Description:
  9. // Definition of the resource group classes for the MSCLUS automation
  10. // classes.
  11. //
  12. // Implementation File:
  13. // ClusResG.cpp
  14. //
  15. // Author:
  16. // Charles Stacy Harris (stacyh) 28-Feb-1997
  17. // Galen Barbee (galenb) July 1998
  18. //
  19. // Revision History:
  20. // July 1998 GalenB Maaaaaajjjjjjjjjoooooorrrr clean up
  21. //
  22. // Notes:
  23. //
  24. /////////////////////////////////////////////////////////////////////////////
  25. #ifndef _CLUSRESG_H_
  26. #define _CLUSRESG_H_
  27. /////////////////////////////////////////////////////////////////////////////
  28. // Forward Class Declarations
  29. /////////////////////////////////////////////////////////////////////////////
  30. class CClusResGroup;
  31. class CClusResGroups;
  32. /////////////////////////////////////////////////////////////////////////////
  33. // External Class Declarations
  34. /////////////////////////////////////////////////////////////////////////////
  35. class CClusNodes;
  36. class CClusResGroupPreferredOwnerNodes;
  37. /////////////////////////////////////////////////////////////////////////////
  38. //++
  39. //
  40. // class CClusResGroup
  41. //
  42. // Description:
  43. // Cluster Resource Group Automation Class.
  44. //
  45. // Inheritance:
  46. // IDispatchImpl< ISClusResGroup, &IID_ISClusResGroup, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  47. // CSupportErrorInfo,
  48. // CComObjectRootEx< CComSingleThreadModel >
  49. // CComCoClass< CClusResGroup, &CLSID_ClusResGroup >
  50. // CClusterObject
  51. //
  52. //--
  53. /////////////////////////////////////////////////////////////////////////////
  54. class ATL_NO_VTABLE CClusResGroup :
  55. public IDispatchImpl< ISClusResGroup, &IID_ISClusResGroup, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  56. public CSupportErrorInfo,
  57. public CComObjectRootEx< CComSingleThreadModel >,
  58. public CComCoClass< CClusResGroup, &CLSID_ClusResGroup >,
  59. public CClusterObject
  60. {
  61. typedef CComObjectRootEx< CComSingleThreadModel > BaseComClass;
  62. public:
  63. CClusResGroup( void );
  64. ~CClusResGroup( void );
  65. BEGIN_COM_MAP(CClusResGroup)
  66. COM_INTERFACE_ENTRY(IDispatch)
  67. COM_INTERFACE_ENTRY(ISClusResGroup)
  68. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  69. END_COM_MAP()
  70. DECLARE_NOT_AGGREGATABLE(CClusResGroup)
  71. DECLARE_NO_REGISTRY()
  72. private:
  73. ISClusRefObject * m_pClusRefObject;
  74. CComObject< CClusResGroupResources > * m_pClusterResources;
  75. CComObject< CClusResGroupPreferredOwnerNodes > * m_pPreferredOwnerNodes;
  76. CComObject< CClusProperties > * m_pCommonProperties;
  77. CComObject< CClusProperties > * m_pPrivateProperties;
  78. CComObject< CClusProperties > * m_pCommonROProperties;
  79. CComObject< CClusProperties > * m_pPrivateROProperties;
  80. CRefcountedHGROUP m_hGroup;
  81. CComBSTR m_bstrGroupName;
  82. HRESULT GetProperties( OUT ISClusProperties ** ppProperties, IN BOOL bPrivate, IN BOOL bReadOnly );
  83. protected:
  84. virtual DWORD ScWriteProperties( IN const CClusPropList & rcplPropList, IN BOOL bPrivate );
  85. public:
  86. HRESULT Create( IN ISClusRefObject * pClusRefObject, IN BSTR bstrGroupName );
  87. HRESULT Open( IN ISClusRefObject * pClusRefObject, IN BSTR bstrGroupName );
  88. STDMETHODIMP get_Handle( OUT ULONG_PTR * phandle );
  89. STDMETHODIMP Close( void );
  90. STDMETHODIMP put_Name( IN BSTR bstrGroupName );
  91. STDMETHODIMP get_Name( OUT BSTR * pbstrGroupName );
  92. STDMETHODIMP get_State( OUT CLUSTER_GROUP_STATE * dwState );
  93. STDMETHODIMP get_OwnerNode( OUT ISClusNode ** ppOwnerNode );
  94. STDMETHODIMP get_Resources( OUT ISClusResGroupResources ** ppClusterGroupResources );
  95. STDMETHODIMP get_PreferredOwnerNodes( OUT ISClusResGroupPreferredOwnerNodes ** ppOwnerNodes );
  96. STDMETHODIMP Delete( void );
  97. STDMETHODIMP Online( IN VARIANT varTimeout, VARIANT varNode, OUT VARIANT * pvarPending );
  98. STDMETHODIMP Move( IN VARIANT varTimeout, VARIANT varNode, OUT VARIANT * pvarPending );
  99. STDMETHODIMP Offline( IN VARIANT varTimeout, OUT VARIANT * pvarPending );
  100. STDMETHODIMP get_CommonProperties( OUT ISClusProperties ** ppProperties );
  101. STDMETHODIMP get_PrivateProperties( OUT ISClusProperties ** ppProperties );
  102. STDMETHODIMP get_CommonROProperties( OUT ISClusProperties ** ppProperties );
  103. STDMETHODIMP get_PrivateROProperties( OUT ISClusProperties ** ppProperties );
  104. STDMETHODIMP get_Cluster( OUT ISCluster ** ppCluster );
  105. virtual HRESULT HrLoadProperties( IN OUT CClusPropList & rcplPropList, IN BOOL bReadOnly, IN BOOL bPrivate );
  106. const CComBSTR Name( void ) const { return m_bstrGroupName; };
  107. const HGROUP Hgroup( void ) const { return m_hGroup->get_Handle(); };
  108. }; //*** Class CClusResGroup
  109. /////////////////////////////////////////////////////////////////////////////
  110. //++
  111. //
  112. // class CClusResGroups
  113. //
  114. // Description:
  115. // Cluster Resource Group Collection Automation Class.
  116. //
  117. // Inheritance:
  118. // IDispatchImpl< ISClusResGroups, &IID_ISClusResGroups, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  119. // CSupportErrorInfo
  120. // CComObjectRootEx< CComSingleThreadModel >
  121. // CComCoClass< CClusResGroups, &CLSID_ClusResGroups >
  122. //
  123. //--
  124. /////////////////////////////////////////////////////////////////////////////
  125. class ATL_NO_VTABLE CClusResGroups :
  126. public IDispatchImpl< ISClusResGroups, &IID_ISClusResGroups, &LIBID_MSClusterLib, MAJORINTERFACEVER, MINORINTERFACEVER >,
  127. public CSupportErrorInfo,
  128. public CComObjectRootEx< CComSingleThreadModel >,
  129. public CComCoClass< CClusResGroups, &CLSID_ClusResGroups >
  130. {
  131. typedef CComObjectRootEx< CComSingleThreadModel > BaseComClass;
  132. public:
  133. CClusResGroups( void );
  134. ~CClusResGroups( void );
  135. BEGIN_COM_MAP(CClusResGroups)
  136. COM_INTERFACE_ENTRY(IDispatch)
  137. COM_INTERFACE_ENTRY(ISClusResGroups)
  138. COM_INTERFACE_ENTRY(ISupportErrorInfo)
  139. END_COM_MAP()
  140. DECLARE_NOT_AGGREGATABLE(CClusResGroups)
  141. DECLARE_NO_REGISTRY()
  142. HRESULT Create( IN ISClusRefObject * pClusRefObject, IN LPCWSTR pszNodeName = NULL );
  143. protected:
  144. typedef std::vector< CComObject< CClusResGroup > * > ResourceGroupList;
  145. ResourceGroupList m_ResourceGroups;
  146. ISClusRefObject * m_pClusRefObject;
  147. CComBSTR m_bstrNodeName;
  148. void Clear( void );
  149. HRESULT FindItem( IN LPWSTR lpszGroupName, OUT ULONG * pnIndex );
  150. HRESULT FindItem( IN ISClusResGroup * pResourceGroup, OUT ULONG * pnIndex );
  151. HRESULT GetIndex( IN VARIANT varIndex, OUT ULONG * pnIndex );
  152. HRESULT RemoveAt( IN size_t pos );
  153. HRESULT RefreshCluster( void );
  154. HRESULT RefreshNode( void );
  155. public:
  156. STDMETHODIMP get_Count( OUT long * plCount );
  157. STDMETHODIMP get_Item( IN VARIANT varIndex, OUT ISClusResGroup ** ppResourceGroup );
  158. STDMETHODIMP get__NewEnum( OUT IUnknown ** ppunk );
  159. STDMETHODIMP CreateItem( IN BSTR bstrResourceGroupName, OUT ISClusResGroup ** ppResourceGroup );
  160. STDMETHODIMP DeleteItem( IN VARIANT varIndex );
  161. STDMETHODIMP Refresh( void );
  162. }; //*** Class CClusResGroups
  163. #endif // _CLUSRESG_H_