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.

589 lines
12 KiB

  1. /*++
  2. 1998 Seagate Software, Inc. All rights reserved.
  3. Module Name:
  4. hsmactn.cpp
  5. Abstract:
  6. This component represents the actions that can be performed by a policy.
  7. Author:
  8. Chuck Bardeen [cbardeen] 29-Oct-1996
  9. Revision History:
  10. --*/
  11. #include "resource.h" // main symbols
  12. #include "wsb.h"
  13. #ifndef _HSMACTN_
  14. #define _HSMACTN_
  15. // Abstract Classes
  16. /*++
  17. Class Name:
  18. CHsmAction
  19. Class Description:
  20. An abstract class that represents an action that can be performed
  21. upon an FsaScanItem. Specific actions are implemented as subclasses
  22. of this object.
  23. --*/
  24. class CHsmAction :
  25. public CWsbObject,
  26. public IHsmAction
  27. {
  28. public:
  29. // IPersistStream
  30. public:
  31. STDMETHOD(GetSizeMax)(ULARGE_INTEGER* pSize);
  32. STDMETHOD(Load)(IStream* pStream);
  33. STDMETHOD(Save)(IStream* pStream, BOOL clearDirty);
  34. // IHsmAction
  35. STDMETHOD(GetName)(OLECHAR** pName, ULONG bufferSize);
  36. // IWsbTestable
  37. STDMETHOD(Test)(USHORT *passed, USHORT* failed);
  38. protected:
  39. ULONG m_nameId;
  40. };
  41. /*++
  42. Class Name:
  43. CHsmDirectedAction
  44. Class Description:
  45. An abstract class that represents an action that can be performed
  46. upon an FsaScanItem that is directed towards a particular storage pool.
  47. --*/
  48. class CHsmDirectedAction :
  49. public CHsmAction,
  50. public IHsmDirectedAction
  51. {
  52. public:
  53. // CComObjectRoot
  54. STDMETHOD(FinalConstruct)(void);
  55. // IPersistStream
  56. public:
  57. STDMETHOD(GetSizeMax)(ULARGE_INTEGER* pSize);
  58. STDMETHOD(Load)(IStream* pStream);
  59. STDMETHOD(Save)(IStream* pStream, BOOL clearDirty);
  60. // IHsmDirectedAction
  61. public:
  62. STDMETHOD(GetStoragePoolId)(GUID* pId);
  63. STDMETHOD(SetStoragePoolId)(GUID id);
  64. protected:
  65. GUID m_storagePoolId;
  66. };
  67. /*++
  68. Class Name:
  69. CHsmRelocateAction
  70. Class Description:
  71. An abstract class that represents an action that can be performed
  72. upon an FsaScanItem that relocates the item to a particular path.
  73. --*/
  74. class CHsmRelocateAction :
  75. public CHsmAction,
  76. public IHsmRelocateAction
  77. {
  78. public:
  79. // CComObjectRoot
  80. STDMETHOD(FinalConstruct)(void);
  81. // IPersistStream
  82. public:
  83. STDMETHOD(GetSizeMax)(ULARGE_INTEGER* pSize);
  84. STDMETHOD(Load)(IStream* pStream);
  85. STDMETHOD(Save)(IStream* pStream, BOOL clearDirty);
  86. public:
  87. // IHsmRelocateAction
  88. STDMETHOD(ExpandPlaceholders)(void);
  89. STDMETHOD(GetDestination)(OLECHAR** pDest, ULONG bufferSize);
  90. STDMETHOD(RetainHierarchy)(void);
  91. STDMETHOD(SetDestination)(OLECHAR* dest);
  92. STDMETHOD(SetExpandPlaceholders)(BOOL expandPlaceholders);
  93. STDMETHOD(SetRetainHierarchy)(BOOL retainHierarchy);
  94. protected:
  95. CWsbStringPtr m_dest;
  96. BOOL m_expandPlaceholders;
  97. BOOL m_retainHierarchy;
  98. };
  99. // Concrete Classes : Inheriting from CHsmAction
  100. /*++
  101. Class Name:
  102. CHsmActionDelete
  103. Class Description:
  104. A class that represents the action of deleting a scan item.
  105. --*/
  106. class CHsmActionDelete :
  107. public CHsmAction,
  108. public CComCoClass<CHsmActionDelete,&CLSID_CHsmActionDelete>
  109. {
  110. public:
  111. CHsmActionDelete() {}
  112. BEGIN_COM_MAP(CHsmActionDelete)
  113. COM_INTERFACE_ENTRY2(IPersist, IPersistStream)
  114. COM_INTERFACE_ENTRY(IPersistStream)
  115. COM_INTERFACE_ENTRY(IHsmAction)
  116. COM_INTERFACE_ENTRY(IWsbCollectable)
  117. COM_INTERFACE_ENTRY(IWsbTestable)
  118. END_COM_MAP()
  119. DECLARE_REGISTRY_RESOURCEID(IDR_CHsmActionDelete)
  120. // CComObjectRoot
  121. public:
  122. STDMETHOD(FinalConstruct)(void);
  123. // IPersist
  124. public:
  125. STDMETHOD(GetClassID)(LPCLSID pClsid);
  126. // IHsmAction
  127. public:
  128. STDMETHOD(Do)(IFsaScanItem* pScanItem);
  129. };
  130. /*++
  131. Class Name:
  132. CHsmActionRecall
  133. Class Description:
  134. A class that represents the action of recalling an item from
  135. secondary storage.
  136. --*/
  137. class CHsmActionRecall :
  138. public CHsmAction,
  139. public CComCoClass<CHsmActionRecall,&CLSID_CHsmActionRecall>
  140. {
  141. public:
  142. CHsmActionRecall() {}
  143. BEGIN_COM_MAP(CHsmActionRecall)
  144. COM_INTERFACE_ENTRY2(IPersist, IPersistStream)
  145. COM_INTERFACE_ENTRY(IPersistStream)
  146. COM_INTERFACE_ENTRY(IHsmAction)
  147. COM_INTERFACE_ENTRY(IWsbCollectable)
  148. COM_INTERFACE_ENTRY(IWsbTestable)
  149. END_COM_MAP()
  150. DECLARE_REGISTRY_RESOURCEID(IDR_CHsmActionRecall)
  151. // CComObjectRoot
  152. public:
  153. STDMETHOD(FinalConstruct)(void);
  154. // IPersist
  155. public:
  156. STDMETHOD(GetClassID)(LPCLSID pClsid);
  157. // IHsmAction
  158. public:
  159. STDMETHOD(Do)(IFsaScanItem* pScanItem);
  160. };
  161. /*++
  162. Class Name:
  163. CHsmActionRecycle
  164. Class Description:
  165. A class that represents the action of recycling an item to the recycle
  166. bin.
  167. --*/
  168. class CHsmActionRecycle :
  169. public CHsmAction,
  170. public CComCoClass<CHsmActionRecycle,&CLSID_CHsmActionRecycle>
  171. {
  172. public:
  173. CHsmActionRecycle() {}
  174. BEGIN_COM_MAP(CHsmActionRecycle)
  175. COM_INTERFACE_ENTRY2(IPersist, IPersistStream)
  176. COM_INTERFACE_ENTRY(IPersistStream)
  177. COM_INTERFACE_ENTRY(IHsmAction)
  178. COM_INTERFACE_ENTRY(IWsbCollectable)
  179. COM_INTERFACE_ENTRY(IWsbTestable)
  180. END_COM_MAP()
  181. DECLARE_REGISTRY_RESOURCEID(IDR_CHsmActionRecycle)
  182. // CComObjectRoot
  183. public:
  184. STDMETHOD(FinalConstruct)(void);
  185. // IPersist
  186. public:
  187. STDMETHOD(GetClassID)(LPCLSID pClsid);
  188. // IHsmAction
  189. public:
  190. STDMETHOD(Do)(IFsaScanItem* pScanItem);
  191. };
  192. /*++
  193. Class Name:
  194. CHsmActionTruncate
  195. Class Description:
  196. A class that represents the action of truncating an item into a
  197. placeholder.
  198. --*/
  199. class CHsmActionTruncate :
  200. public CHsmAction,
  201. public CComCoClass<CHsmActionTruncate,&CLSID_CHsmActionTruncate>
  202. {
  203. public:
  204. CHsmActionTruncate() {}
  205. BEGIN_COM_MAP(CHsmActionTruncate)
  206. COM_INTERFACE_ENTRY2(IPersist, IPersistStream)
  207. COM_INTERFACE_ENTRY(IPersistStream)
  208. COM_INTERFACE_ENTRY(IHsmAction)
  209. COM_INTERFACE_ENTRY(IWsbCollectable)
  210. COM_INTERFACE_ENTRY(IWsbTestable)
  211. END_COM_MAP()
  212. DECLARE_REGISTRY_RESOURCEID(IDR_CHsmActionTruncate)
  213. // CComObjectRoot
  214. public:
  215. STDMETHOD(FinalConstruct)(void);
  216. // IPersist
  217. public:
  218. STDMETHOD(GetClassID)(LPCLSID pClsid);
  219. // IHsmAction
  220. public:
  221. STDMETHOD(Do)(IFsaScanItem* pScanItem);
  222. };
  223. /*++
  224. Class Name:
  225. CHsmActionUnmanage
  226. Class Description:
  227. A class that represents the action of "unmanaging" an item. This
  228. means recalling truncated files. removing any placeholder information and
  229. removing the item form any premigration list.
  230. --*/
  231. class CHsmActionUnmanage :
  232. public CHsmAction,
  233. public CComCoClass<CHsmActionUnmanage,&CLSID_CHsmActionUnmanage>
  234. {
  235. public:
  236. CHsmActionUnmanage() {}
  237. BEGIN_COM_MAP(CHsmActionUnmanage)
  238. COM_INTERFACE_ENTRY2(IPersist, IPersistStream)
  239. COM_INTERFACE_ENTRY(IPersistStream)
  240. COM_INTERFACE_ENTRY(IHsmAction)
  241. COM_INTERFACE_ENTRY(IWsbCollectable)
  242. COM_INTERFACE_ENTRY(IWsbTestable)
  243. END_COM_MAP()
  244. DECLARE_REGISTRY_RESOURCEID(IDR_CHsmActionUnmanage)
  245. // CComObjectRoot
  246. public:
  247. STDMETHOD(FinalConstruct)(void);
  248. // IPersist
  249. public:
  250. STDMETHOD(GetClassID)(LPCLSID pClsid);
  251. // IHsmAction
  252. public:
  253. STDMETHOD(Do)(IFsaScanItem* pScanItem);
  254. };
  255. /*++
  256. Class Name:
  257. CHsmActionValidate
  258. Class Description:
  259. A class that represents the action of checking an item's placeholder
  260. information to make sure that it is still correct, and correcting or
  261. deleting any inaccurate information.
  262. --*/
  263. class CHsmActionValidate :
  264. public CHsmAction,
  265. public CComCoClass<CHsmActionValidate,&CLSID_CHsmActionValidate>
  266. {
  267. public:
  268. CHsmActionValidate() {}
  269. BEGIN_COM_MAP(CHsmActionValidate)
  270. COM_INTERFACE_ENTRY2(IPersist, IPersistStream)
  271. COM_INTERFACE_ENTRY(IPersistStream)
  272. COM_INTERFACE_ENTRY(IHsmAction)
  273. COM_INTERFACE_ENTRY(IWsbCollectable)
  274. COM_INTERFACE_ENTRY(IWsbTestable)
  275. END_COM_MAP()
  276. DECLARE_REGISTRY_RESOURCEID(IDR_CHsmActionValidate)
  277. // CComObjectRoot
  278. public:
  279. STDMETHOD(FinalConstruct)(void);
  280. // IPersist
  281. public:
  282. STDMETHOD(GetClassID)(LPCLSID pClsid);
  283. // IHsmAction
  284. public:
  285. STDMETHOD(Do)(IFsaScanItem* pScanItem);
  286. };
  287. // Concrete Classes : Inheriting from CHsmDirectedAction
  288. /*++
  289. Class Name:
  290. CHsmActionMigrate
  291. Class Description:
  292. A class that represents the action of copying the migratable portion
  293. of an item to secondary storage and then truncating it.
  294. --*/
  295. class CHsmActionMigrate :
  296. public CHsmDirectedAction,
  297. public CComCoClass<CHsmActionMigrate,&CLSID_CHsmActionMigrate>
  298. {
  299. public:
  300. CHsmActionMigrate() {}
  301. BEGIN_COM_MAP(CHsmActionMigrate)
  302. COM_INTERFACE_ENTRY2(IPersist, IPersistStream)
  303. COM_INTERFACE_ENTRY(IPersistStream)
  304. COM_INTERFACE_ENTRY(IHsmAction)
  305. COM_INTERFACE_ENTRY(IHsmDirectedAction)
  306. COM_INTERFACE_ENTRY(IWsbCollectable)
  307. COM_INTERFACE_ENTRY(IWsbTestable)
  308. END_COM_MAP()
  309. DECLARE_REGISTRY_RESOURCEID(IDR_CHsmActionMigrate)
  310. // CComObjectRoot
  311. public:
  312. STDMETHOD(FinalConstruct)(void);
  313. // IPersist
  314. public:
  315. STDMETHOD(GetClassID)(LPCLSID pClsid);
  316. // IHsmAction
  317. public:
  318. STDMETHOD(Do)(IFsaScanItem* pScanItem);
  319. };
  320. /*++
  321. Class Name:
  322. CHsmActionManage
  323. Class Description:
  324. A class that represents the action of copying the migratable portion of
  325. an item to secondary storage and then adding the item to the
  326. premigration list. This action is also known as the premigration action.
  327. --*/
  328. class CHsmActionManage :
  329. public CHsmDirectedAction,
  330. public CComCoClass<CHsmActionManage,&CLSID_CHsmActionManage>
  331. {
  332. public:
  333. CHsmActionManage() {}
  334. BEGIN_COM_MAP(CHsmActionManage)
  335. COM_INTERFACE_ENTRY2(IPersist, IPersistStream)
  336. COM_INTERFACE_ENTRY(IPersistStream)
  337. COM_INTERFACE_ENTRY(IHsmAction)
  338. COM_INTERFACE_ENTRY(IHsmDirectedAction)
  339. COM_INTERFACE_ENTRY(IWsbCollectable)
  340. COM_INTERFACE_ENTRY(IWsbTestable)
  341. END_COM_MAP()
  342. DECLARE_REGISTRY_RESOURCEID(IDR_CHsmActionManage)
  343. // CComObjectRoot
  344. public:
  345. STDMETHOD(FinalConstruct)(void);
  346. // IPersist
  347. public:
  348. STDMETHOD(GetClassID)(LPCLSID pClsid);
  349. // IHsmAction
  350. public:
  351. STDMETHOD(Do)(IFsaScanItem* pScanItem);
  352. };
  353. // Concrete Classes : Inheriting from CHsmRelocateAction
  354. /*++
  355. Class Name:
  356. CHsmActionCopy
  357. Class Description:
  358. A class that represents the action of copying item to another location.
  359. --*/
  360. class CHsmActionCopy :
  361. public CHsmRelocateAction,
  362. public CComCoClass<CHsmActionCopy,&CLSID_CHsmActionCopy>
  363. {
  364. public:
  365. CHsmActionCopy() {}
  366. BEGIN_COM_MAP(CHsmActionCopy)
  367. COM_INTERFACE_ENTRY2(IPersist, IPersistStream)
  368. COM_INTERFACE_ENTRY(IPersistStream)
  369. COM_INTERFACE_ENTRY(IHsmAction)
  370. COM_INTERFACE_ENTRY(IHsmRelocateAction)
  371. COM_INTERFACE_ENTRY(IWsbCollectable)
  372. COM_INTERFACE_ENTRY(IWsbTestable)
  373. END_COM_MAP()
  374. DECLARE_REGISTRY_RESOURCEID(IDR_CHsmActionCopy)
  375. // CComObjectRoot
  376. public:
  377. STDMETHOD(FinalConstruct)(void);
  378. // IPersist
  379. public:
  380. STDMETHOD(GetClassID)(LPCLSID pClsid);
  381. // IHsmAction
  382. public:
  383. STDMETHOD(Do)(IFsaScanItem* pScanItem);
  384. };
  385. /*++
  386. Class Name:
  387. CHsmActionMove
  388. Class Description:
  389. A class that represents the action of moving an item to another location
  390. (i.e. copy and delete).
  391. --*/
  392. class CHsmActionMove :
  393. public CHsmRelocateAction,
  394. public CComCoClass<CHsmActionMove,&CLSID_CHsmActionMove>
  395. {
  396. public:
  397. CHsmActionMove() {}
  398. BEGIN_COM_MAP(CHsmActionMove)
  399. COM_INTERFACE_ENTRY2(IPersist, IPersistStream)
  400. COM_INTERFACE_ENTRY(IPersistStream)
  401. COM_INTERFACE_ENTRY(IHsmAction)
  402. COM_INTERFACE_ENTRY(IHsmRelocateAction)
  403. COM_INTERFACE_ENTRY(IWsbCollectable)
  404. COM_INTERFACE_ENTRY(IWsbTestable)
  405. END_COM_MAP()
  406. DECLARE_REGISTRY_RESOURCEID(IDR_CHsmActionMove)
  407. // CComObjectRoot
  408. public:
  409. STDMETHOD(FinalConstruct)(void);
  410. // IPersist
  411. public:
  412. STDMETHOD(GetClassID)(LPCLSID pClsid);
  413. // IHsmAction
  414. public:
  415. STDMETHOD(Do)(IFsaScanItem* pScanItem);
  416. };
  417. #endif // _HSMACTN