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.

277 lines
8.3 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1996-1997 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // Group.h
  7. //
  8. // Abstract:
  9. // Definition of the CGroup class.
  10. //
  11. // Implementation File:
  12. // Group.cpp
  13. //
  14. // Author:
  15. // David Potter (davidp) May 3, 1996
  16. //
  17. // Revision History:
  18. //
  19. // Notes:
  20. //
  21. /////////////////////////////////////////////////////////////////////////////
  22. #ifndef _GROUP_H_
  23. #define _GROUP_H_
  24. /////////////////////////////////////////////////////////////////////////////
  25. // Forward Class Declarations
  26. /////////////////////////////////////////////////////////////////////////////
  27. class CGroup;
  28. class CGroupList;
  29. /////////////////////////////////////////////////////////////////////////////
  30. // External Class Declarations
  31. /////////////////////////////////////////////////////////////////////////////
  32. class CClusterDoc;
  33. class CClusterNode;
  34. class CNodeList;
  35. class CResourceList;
  36. /////////////////////////////////////////////////////////////////////////////
  37. // Type Definitions
  38. /////////////////////////////////////////////////////////////////////////////
  39. /////////////////////////////////////////////////////////////////////////////
  40. // Include Files
  41. /////////////////////////////////////////////////////////////////////////////
  42. #ifndef _TREEITEM_
  43. #include "ClusItem.h" // for CClusterItem
  44. #endif
  45. #ifndef _RES_H_
  46. #include "Res.h" // for CResourceList
  47. #endif
  48. #ifndef _PROPLIST_H_
  49. #include "PropList.h" // for CObjectProperty, CClusPropList
  50. #endif
  51. /////////////////////////////////////////////////////////////////////////////
  52. // CGroup command target
  53. /////////////////////////////////////////////////////////////////////////////
  54. class CGroup : public CClusterItem
  55. {
  56. DECLARE_DYNCREATE(CGroup)
  57. // Construction
  58. public:
  59. CGroup(void); // protected constructor used by dynamic creation
  60. CGroup(IN BOOL bDocObj);
  61. void Init(IN OUT CClusterDoc * pdoc, IN LPCTSTR lpszName);
  62. void Create(IN OUT CClusterDoc * pdoc, IN LPCTSTR lpszName);
  63. protected:
  64. void CommonConstruct(void);
  65. // Attributes
  66. protected:
  67. HGROUP m_hgroup;
  68. CLUSTER_GROUP_STATE m_cgs;
  69. CString m_strOwner;
  70. CClusterNode * m_pciOwner;
  71. CResourceList * m_plpcires;
  72. DWORD m_nFailoverThreshold;
  73. DWORD m_nFailoverPeriod;
  74. CGAFT m_cgaftAutoFailbackType;
  75. DWORD m_nFailbackWindowStart;
  76. DWORD m_nFailbackWindowEnd;
  77. CNodeList * m_plpcinodePreferredOwners;
  78. enum
  79. {
  80. epropName = 0,
  81. epropDescription,
  82. epropFailoverThreshold,
  83. epropFailoverPeriod,
  84. epropAutoFailbackType,
  85. epropFailbackWindowStart,
  86. epropFailbackWindowEnd,
  87. epropMAX
  88. };
  89. CObjectProperty m_rgProps[epropMAX];
  90. public:
  91. HGROUP Hgroup(void) const { return m_hgroup; }
  92. CLUSTER_GROUP_STATE Cgs(void) const { return m_cgs; }
  93. const CString & StrOwner(void) const { return m_strOwner; }
  94. CClusterNode * PciOwner(void) const { return m_pciOwner; }
  95. const CResourceList & Lpcires(void) const { ASSERT(m_plpcires != NULL); return *m_plpcires; }
  96. DWORD NFailoverThreshold(void) const { return m_nFailoverThreshold; }
  97. DWORD NFailoverPeriod(void) const { return m_nFailoverPeriod; }
  98. CGAFT CgaftAutoFailbackType(void) const { return m_cgaftAutoFailbackType; }
  99. DWORD NFailbackWindowStart(void) const { return m_nFailbackWindowStart; }
  100. DWORD NFailbackWindowEnd(void) const { return m_nFailbackWindowEnd; }
  101. const CNodeList & LpcinodePreferredOwners(void) const { ASSERT(m_plpcinodePreferredOwners != NULL); return *m_plpcinodePreferredOwners; }
  102. void GetStateName(OUT CString & rstrState) const;
  103. // Operations
  104. public:
  105. void Move(IN const CClusterNode * pciNode);
  106. void DeleteGroup(void);
  107. void ReadExtensions(void);
  108. void SetOwnerState(IN LPCTSTR pszNewOwner);
  109. void AddResource(IN OUT CResource * pciResource);
  110. void RemoveResource(IN OUT CResource * pciResource);
  111. void SetName(IN LPCTSTR pszName);
  112. void SetPreferredOwners(IN const CNodeList & rlpci);
  113. void SetCommonProperties(
  114. IN const CString & rstrDesc,
  115. IN DWORD nThreshold,
  116. IN DWORD nPeriod,
  117. IN CGAFT cgaft,
  118. IN DWORD nStart,
  119. IN DWORD nEnd,
  120. IN BOOL bValidateOnly
  121. );
  122. void SetCommonProperties(
  123. IN const CString & rstrDesc,
  124. IN DWORD nThreshold,
  125. IN DWORD nPeriod,
  126. IN CGAFT cgaft,
  127. IN DWORD nStart,
  128. IN DWORD nEnd
  129. )
  130. {
  131. SetCommonProperties(rstrDesc, nThreshold, nPeriod, cgaft, nStart, nEnd, FALSE /*bValidateOnly*/);
  132. }
  133. void ValidateCommonProperties(
  134. IN const CString & rstrDesc,
  135. IN DWORD nThreshold,
  136. IN DWORD nPeriod,
  137. IN CGAFT cgaft,
  138. IN DWORD nStart,
  139. IN DWORD nEnd
  140. )
  141. {
  142. SetCommonProperties(rstrDesc, nThreshold, nPeriod, cgaft, nStart, nEnd, TRUE /*bValidateOnly*/);
  143. }
  144. void ConstructList(OUT CNodeList & rlpci, IN DWORD dwType);
  145. void ConstructList(OUT CResourceList & rlpci, IN DWORD dwType);
  146. void ConstructPossibleOwnersList(OUT CNodeList & rlpciNodes);
  147. // Overrides
  148. public:
  149. virtual void Cleanup(void);
  150. virtual void ReadItem(void);
  151. virtual void UpdateState(void);
  152. virtual void Rename(IN LPCTSTR pszName);
  153. virtual BOOL BGetColumnData(IN COLID colid, OUT CString & rstrText);
  154. virtual BOOL BCanBeEdited(void) const;
  155. virtual BOOL BDisplayProperties(IN BOOL bReadOnly = FALSE);
  156. // Drag & Drop
  157. virtual BOOL BCanBeDragged(void) const { return TRUE; }
  158. virtual BOOL BCanBeDropTarget(IN const CClusterItem * pci) const;
  159. virtual void DropItem(IN OUT CClusterItem * pci);
  160. virtual const CStringList * PlstrExtensions(void) const;
  161. #ifdef _DISPLAY_STATE_TEXT_IN_TREE
  162. virtual void GetTreeName(OUT CString & rstrName) const;
  163. #endif
  164. // ClassWizard generated virtual function overrides
  165. //{{AFX_VIRTUAL(CGroup)
  166. public:
  167. virtual void OnFinalRelease();
  168. virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo);
  169. //}}AFX_VIRTUAL
  170. virtual LRESULT OnClusterNotify(IN OUT CClusterNotify * pnotify);
  171. protected:
  172. virtual const CObjectProperty * Pprops(void) const { return m_rgProps; }
  173. virtual DWORD Cprops(void) const { return sizeof(m_rgProps) / sizeof(CObjectProperty); }
  174. virtual DWORD DwSetCommonProperties(IN const CClusPropList & rcpl, IN BOOL bValidateOnly = FALSE);
  175. // Implementation
  176. public:
  177. virtual ~CGroup(void);
  178. public:
  179. // Generated message map functions
  180. //{{AFX_MSG(CGroup)
  181. afx_msg void OnUpdateBringOnline(CCmdUI* pCmdUI);
  182. afx_msg void OnUpdateTakeOffline(CCmdUI* pCmdUI);
  183. afx_msg void OnUpdateMoveGroup(CCmdUI* pCmdUI);
  184. afx_msg void OnUpdateMoveGroupRest(CCmdUI* pCmdUI);
  185. afx_msg void OnUpdateDelete(CCmdUI* pCmdUI);
  186. afx_msg void OnUpdateProperties(CCmdUI* pCmdUI);
  187. afx_msg void OnCmdBringOnline();
  188. afx_msg void OnCmdTakeOffline();
  189. afx_msg void OnCmdMoveGroup();
  190. afx_msg void OnCmdDelete();
  191. //}}AFX_MSG
  192. afx_msg BOOL OnUpdateMoveGroupItem(CCmdUI* pCmdUI);
  193. afx_msg BOOL OnUpdateMoveGroupSubMenu(CCmdUI* pCmdUI);
  194. afx_msg void OnCmdMoveGroup(IN UINT nID);
  195. DECLARE_MESSAGE_MAP()
  196. #ifdef _CLUADMIN_USE_OLE_
  197. DECLARE_OLECREATE(CGroup)
  198. // Generated OLE dispatch map functions
  199. //{{AFX_DISPATCH(CGroup)
  200. // NOTE - the ClassWizard will add and remove member functions here.
  201. //}}AFX_DISPATCH
  202. DECLARE_DISPATCH_MAP()
  203. DECLARE_INTERFACE_MAP()
  204. #endif // _CLUADMIN_USE_OLE_
  205. }; //*** class CGroup
  206. /////////////////////////////////////////////////////////////////////////////
  207. // CGroupList
  208. /////////////////////////////////////////////////////////////////////////////
  209. class CGroupList : public CClusterItemList
  210. {
  211. public:
  212. CGroup * PciGroupFromName(
  213. IN LPCTSTR pszName,
  214. OUT POSITION * ppos = NULL
  215. )
  216. {
  217. return (CGroup *) PciFromName(pszName, ppos);
  218. }
  219. }; //*** class CGroupList
  220. /////////////////////////////////////////////////////////////////////////////
  221. // Global Functions
  222. /////////////////////////////////////////////////////////////////////////////
  223. //void DeleteAllItemData(IN OUT CGroupList & rlp);
  224. #ifdef _DEBUG
  225. class CTraceTag;
  226. extern CTraceTag g_tagGroup;
  227. extern CTraceTag g_tagGroupNotify;
  228. #endif
  229. /////////////////////////////////////////////////////////////////////////////
  230. #endif // _GROUP_H_