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.

150 lines
5.3 KiB

  1. #ifndef _HSMSESS_
  2. #define _HSMSESS_
  3. /*++
  4. 1998 Seagate Software, Inc. All rights reserved.
  5. Module Name:
  6. hsmsess.h
  7. Abstract:
  8. This module contains the session component. The session is the collator of information for the work being done on
  9. a resource (for a job, demand recall, truncate, ...).
  10. Author:
  11. Chuck Bardeen [cbardeen] 18-Feb-1997
  12. Revision History:
  13. --*/
  14. #include "resource.h" // main symbols
  15. #include "wsb.h"
  16. #include "fsa.h"
  17. #include "job.h"
  18. /*++
  19. Class Name:
  20. CHsmSession
  21. Class Description:
  22. The session is the collator of information for the work being done on a resource (for a job, demand recall,
  23. truncate, ...).
  24. --*/
  25. class CHsmSession :
  26. public CWsbObject,
  27. public IHsmSession,
  28. public CComCoClass<CHsmSession,&CLSID_CHsmSession>,
  29. public IConnectionPointContainerImpl<CHsmSession>,
  30. public IConnectionPointImpl<CHsmSession, &IID_IHsmSessionSinkEveryEvent, CComDynamicUnkArray>,
  31. public IConnectionPointImpl<CHsmSession, &IID_IHsmSessionSinkEveryItem, CComDynamicUnkArray>,
  32. public IConnectionPointImpl<CHsmSession, &IID_IHsmSessionSinkEveryMediaState, CComDynamicUnkArray>,
  33. public IConnectionPointImpl<CHsmSession, &IID_IHsmSessionSinkEveryPriority, CComDynamicUnkArray>,
  34. public IConnectionPointImpl<CHsmSession, &IID_IHsmSessionSinkEveryState, CComDynamicUnkArray>,
  35. public IConnectionPointImpl<CHsmSession, &IID_IHsmSessionSinkSomeItems, CComDynamicUnkArray>
  36. {
  37. public:
  38. CHsmSession() {}
  39. BEGIN_COM_MAP(CHsmSession)
  40. COM_INTERFACE_ENTRY(IHsmSession)
  41. COM_INTERFACE_ENTRY2(IPersist, IPersistStream)
  42. COM_INTERFACE_ENTRY(IPersistStream)
  43. COM_INTERFACE_ENTRY(IWsbCollectable)
  44. COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
  45. COM_INTERFACE_ENTRY(IWsbTestable)
  46. END_COM_MAP()
  47. BEGIN_CONNECTION_POINT_MAP(CHsmSession)
  48. CONNECTION_POINT_ENTRY(IID_IHsmSessionSinkEveryEvent)
  49. CONNECTION_POINT_ENTRY(IID_IHsmSessionSinkEveryItem)
  50. CONNECTION_POINT_ENTRY(IID_IHsmSessionSinkEveryMediaState)
  51. CONNECTION_POINT_ENTRY(IID_IHsmSessionSinkEveryPriority)
  52. CONNECTION_POINT_ENTRY(IID_IHsmSessionSinkEveryState)
  53. CONNECTION_POINT_ENTRY(IID_IHsmSessionSinkSomeItems)
  54. END_CONNECTION_POINT_MAP()
  55. DECLARE_REGISTRY_RESOURCEID(IDR_CHsmSession)
  56. // CComObjectRoot
  57. public:
  58. STDMETHOD(FinalConstruct)(void);
  59. void FinalRelease(void);
  60. // IPersist
  61. public:
  62. STDMETHOD(GetClassID)(LPCLSID pClsid);
  63. // IPersistStream
  64. public:
  65. STDMETHOD(GetSizeMax)(ULARGE_INTEGER* pSize);
  66. STDMETHOD(Load)(IStream* pStream);
  67. STDMETHOD(Save)(IStream* pStream, BOOL clearDirty);
  68. // CHsmSession
  69. STDMETHOD(AdviseOfEvent)(HSM_JOB_PHASE phase, HSM_JOB_EVENT event);
  70. STDMETHOD(AdviseOfItem)(IHsmPhase* pPhase, IFsaScanItem* pScanItem, HRESULT hrItem, IHsmSessionTotals* pSessionTotals);
  71. STDMETHOD(AdviseOfMediaState)(IHsmPhase* pPhase, HSM_JOB_MEDIA_STATE state, OLECHAR* mediaName, HSM_JOB_MEDIA_TYPE mediaType, ULONG time);
  72. STDMETHOD(AdviseOfPriority)(IHsmPhase* pPhase);
  73. STDMETHOD(AdviseOfState)(IHsmPhase* pPhase, OLECHAR* currentPath);
  74. // IWsbTestable
  75. public:
  76. STDMETHOD(Test)(USHORT *passed, USHORT* failed);
  77. // IHsmSession
  78. public:
  79. STDMETHOD(Cancel)(HSM_JOB_PHASE phase);
  80. STDMETHOD(EnumPhases)(IWsbEnum** ppEnum);
  81. STDMETHOD(EnumTotals)(IWsbEnum** ppEnum);
  82. STDMETHOD(GetAdviseInterval)(LONGLONG* pFiletimeTicks);
  83. STDMETHOD(GetHsmId)(GUID* pId);
  84. STDMETHOD(GetIdentifier)(GUID* pId);
  85. STDMETHOD(GetJob)(IHsmJob** pJob);
  86. STDMETHOD(GetName)(OLECHAR** pName, ULONG bufferSize);
  87. STDMETHOD(GetResource)(IFsaResource** pResource);
  88. STDMETHOD(GetRunId)(ULONG* pRunId);
  89. STDMETHOD(GetSubRunId)(ULONG* pRunId);
  90. STDMETHOD(IsCanceling)(void);
  91. STDMETHOD(Pause)(HSM_JOB_PHASE phase);
  92. STDMETHOD(ProcessEvent)(HSM_JOB_PHASE phase, HSM_JOB_EVENT event);
  93. STDMETHOD(ProcessHr)(HSM_JOB_PHASE phase, CHAR* file, ULONG line, HRESULT hr);
  94. STDMETHOD(ProcessItem)(HSM_JOB_PHASE phase, HSM_JOB_ACTION action, IFsaScanItem* pScanItem, HRESULT hrItem);
  95. STDMETHOD(ProcessMediaState)(HSM_JOB_PHASE phase, HSM_JOB_MEDIA_STATE state, OLECHAR* mediaName, HSM_JOB_MEDIA_TYPE mediaType, ULONG time);
  96. STDMETHOD(ProcessPriority)(HSM_JOB_PHASE phase, HSM_JOB_PRIORITY priority);
  97. STDMETHOD(ProcessState)(HSM_JOB_PHASE phase, HSM_JOB_STATE state, OLECHAR* currentPath, BOOL bLog);
  98. STDMETHOD(ProcessString)(HSM_JOB_PHASE phase, OLECHAR* string);
  99. STDMETHOD(Resume)(HSM_JOB_PHASE phase);
  100. STDMETHOD(SetAdviseInterval)(LONGLONG filetimeTicks);
  101. STDMETHOD(Start)(OLECHAR* name, ULONG logControl, GUID hsmId, IHsmJob* pJob, IFsaResource* pResource, ULONG runId, ULONG subRunId);
  102. STDMETHOD(Suspend)(HSM_JOB_PHASE phase);
  103. protected:
  104. GUID m_id;
  105. CWsbStringPtr m_name;
  106. GUID m_hsmId;
  107. LONGLONG m_adviseInterval;
  108. ULONG m_runId;
  109. ULONG m_subRunId;
  110. FILETIME m_lastAdviseFile;
  111. HSM_JOB_STATE m_state;
  112. ULONG m_activePhases;
  113. ULONG m_logControl;
  114. CComPtr<IHsmJob> m_pJob;
  115. CComPtr<IFsaResource> m_pResource;
  116. CComPtr<IWsbCollection> m_pPhases;
  117. CComPtr<IWsbCollection> m_pTotals;
  118. BOOL m_isCanceling;
  119. };
  120. #endif // _HSMSESS_