Source code of Windows XP (NT5)
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.

149 lines
3.9 KiB

  1. #ifndef _HSMJOB_
  2. #define _HSMJOB_
  3. /*++
  4. 1998 Seagate Software, Inc. All rights reserved.
  5. Module Name:
  6. hsmjob.cpp
  7. Abstract:
  8. This class contains properties that defines the context in which the job
  9. should be run.
  10. Author:
  11. Chuck Bardeen [cbardeen] 29-Oct-1996
  12. Revision History:
  13. --*/
  14. #include "resource.h" // main symbols
  15. #include "wsb.h"
  16. #include "fsa.h"
  17. #include "job.h"
  18. #include "hsmeng.h"
  19. /*++
  20. Class Name:
  21. CHsmJob
  22. Class Description:
  23. --*/
  24. class CHsmJob :
  25. public CWsbObject,
  26. public IHsmJob,
  27. public IHsmJobPriv,
  28. public CComCoClass<CHsmJob,&CLSID_CHsmJob>,
  29. public IConnectionPointContainerImpl<CHsmJob>,
  30. public IConnectionPointImpl<CHsmJob, &IID_IHsmJobSinkEverySession, CComDynamicUnkArray>
  31. {
  32. public:
  33. CHsmJob() {}
  34. BEGIN_COM_MAP(CHsmJob)
  35. COM_INTERFACE_ENTRY(IHsmJob)
  36. COM_INTERFACE_ENTRY(IHsmJobPriv)
  37. COM_INTERFACE_ENTRY2(IPersist, IPersistStream)
  38. COM_INTERFACE_ENTRY(IPersistStream)
  39. COM_INTERFACE_ENTRY(IWsbCollectable)
  40. COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
  41. COM_INTERFACE_ENTRY(IWsbTestable)
  42. END_COM_MAP()
  43. BEGIN_CONNECTION_POINT_MAP(CHsmJob)
  44. CONNECTION_POINT_ENTRY(IID_IHsmJobSinkEverySession)
  45. END_CONNECTION_POINT_MAP()
  46. DECLARE_REGISTRY_RESOURCEID(IDR_CHsmJob)
  47. // CComObjectRoot
  48. public:
  49. STDMETHOD(FinalConstruct)(void);
  50. void FinalRelease(void);
  51. // CHsmJob
  52. STDMETHOD(Do)();
  53. STDMETHOD(UpdateWorkItems)(BOOL isRestart);
  54. // IPersist
  55. public:
  56. STDMETHOD(GetClassID)(LPCLSID pClsid);
  57. // IPersistStream
  58. public:
  59. STDMETHOD(GetSizeMax)(ULARGE_INTEGER* pSize);
  60. STDMETHOD(Load)(IStream* pStream);
  61. STDMETHOD(Save)(IStream* pStream, BOOL clearDirty);
  62. // IWsbTestable
  63. public:
  64. STDMETHOD(Test)(USHORT *passed, USHORT* failed);
  65. // IHsmJobPriv
  66. public:
  67. STDMETHOD(AdviseOfSessionState)(IHsmSession* pSession, IHsmPhase* pPhase, OLECHAR* currentPath);
  68. STDMETHOD(DoNext)();
  69. // IHsmJob
  70. public:
  71. STDMETHOD(Cancel)(HSM_JOB_PHASE phase);
  72. STDMETHOD(DidFinish)(void);
  73. STDMETHOD(DidFinishOk)(void);
  74. STDMETHOD(EnumWorkItems)(IWsbEnum** ppEnum);
  75. STDMETHOD(FindWorkItem)(IHsmSession* pSession, IHsmJobWorkItem** ppWorkItem);
  76. STDMETHOD(GetContext)(IHsmJobContext** ppContext);
  77. STDMETHOD(GetDef)(IHsmJobDef** ppDef);
  78. STDMETHOD(GetHsmId)(GUID* pId);
  79. STDMETHOD(GetIdentifier)(GUID* pId);
  80. STDMETHOD(GetMaxActiveSessions)(ULONG* pMaxActiveSessions);
  81. STDMETHOD(GetName)(OLECHAR** pName, ULONG bufferSize);
  82. STDMETHOD(GetRunId)(ULONG* pRunId);
  83. STDMETHOD(GetState)(HSM_JOB_STATE* pState);
  84. STDMETHOD(InitAs)(OLECHAR* name, IHsmJobDef* pDef, HSM_JOB_DEF_TYPE type, GUID storagePool, IHsmServer* pServer, BOOL isUserDefined, IFsaResource* pResource);
  85. STDMETHOD(IsActive)(void);
  86. STDMETHOD(IsUserDefined)(void);
  87. STDMETHOD(Pause)(HSM_JOB_PHASE phase);
  88. STDMETHOD(Restart)(void);
  89. STDMETHOD(Resume)(HSM_JOB_PHASE phase);
  90. STDMETHOD(SetContext)(IHsmJobContext* pContext);
  91. STDMETHOD(SetDef)(IHsmJobDef* pDef);
  92. STDMETHOD(SetHsmId)(GUID id);
  93. STDMETHOD(SetIsUserDefined)(BOOL isUserDefined);
  94. STDMETHOD(SetName)(OLECHAR* name);
  95. STDMETHOD(Start)(void);
  96. STDMETHOD(Suspend)(HSM_JOB_PHASE phase);
  97. STDMETHOD(WaitUntilDone)(void);
  98. // Private functions
  99. STDMETHOD(CheckResourceNotInUse)(GUID resid);
  100. STDMETHOD(RestartSuspendedJobs)(void);
  101. protected:
  102. HSM_JOB_STATE m_state;
  103. GUID m_hsmId;
  104. GUID m_id;
  105. BOOL m_isUserDefined;
  106. BOOL m_isActive;
  107. BOOL m_isTerminating;
  108. ULONG m_activeSessions;
  109. ULONG m_runId;
  110. CWsbStringPtr m_name;
  111. CComPtr<IHsmJobContext> m_pContext;
  112. CComPtr<IHsmJobDef> m_pDef;
  113. CComPtr<IWsbCollection> m_pWorkItems;
  114. };
  115. #endif // _HSMJOB_