IKernel.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. using MediaBrowser.Common.IO;
  2. using MediaBrowser.Common.Net;
  3. using MediaBrowser.Common.Net.Handlers;
  4. using MediaBrowser.Common.Plugins;
  5. using MediaBrowser.Common.ScheduledTasks;
  6. using MediaBrowser.Common.Serialization;
  7. using MediaBrowser.Model.Configuration;
  8. using MediaBrowser.Model.System;
  9. using System;
  10. using System.Collections.Generic;
  11. using System.Reflection;
  12. using System.Threading.Tasks;
  13. namespace MediaBrowser.Common.Kernel
  14. {
  15. /// <summary>
  16. /// Interface IKernel
  17. /// </summary>
  18. public interface IKernel
  19. {
  20. /// <summary>
  21. /// Occurs when [application restart requested].
  22. /// </summary>
  23. event EventHandler ApplicationRestartRequested;
  24. /// <summary>
  25. /// Gets the application paths.
  26. /// </summary>
  27. /// <value>The application paths.</value>
  28. BaseApplicationPaths ApplicationPaths { get; }
  29. /// <summary>
  30. /// Gets the configuration.
  31. /// </summary>
  32. /// <value>The configuration.</value>
  33. BaseApplicationConfiguration Configuration { get; }
  34. /// <summary>
  35. /// Gets the kernel context.
  36. /// </summary>
  37. /// <value>The kernel context.</value>
  38. KernelContext KernelContext { get; }
  39. /// <summary>
  40. /// Gets the protobuf serializer.
  41. /// </summary>
  42. /// <value>The protobuf serializer.</value>
  43. DynamicProtobufSerializer ProtobufSerializer { get; }
  44. /// <summary>
  45. /// Inits this instance.
  46. /// </summary>
  47. /// <returns>Task.</returns>
  48. Task Init();
  49. /// <summary>
  50. /// Reloads this instance.
  51. /// </summary>
  52. /// <returns>Task.</returns>
  53. Task Reload();
  54. /// <summary>
  55. /// Gets or sets a value indicating whether this instance has pending kernel reload.
  56. /// </summary>
  57. /// <value><c>true</c> if this instance has pending kernel reload; otherwise, <c>false</c>.</value>
  58. bool HasPendingRestart { get; }
  59. /// <summary>
  60. /// Disposes this instance.
  61. /// </summary>
  62. void Dispose();
  63. /// <summary>
  64. /// Gets the system status.
  65. /// </summary>
  66. /// <returns>SystemInfo.</returns>
  67. SystemInfo GetSystemInfo();
  68. /// <summary>
  69. /// Gets the scheduled tasks.
  70. /// </summary>
  71. /// <value>The scheduled tasks.</value>
  72. IEnumerable<IScheduledTask> ScheduledTasks { get; }
  73. /// <summary>
  74. /// Reloads the logger.
  75. /// </summary>
  76. void ReloadLogger();
  77. /// <summary>
  78. /// Called when [application updated].
  79. /// </summary>
  80. /// <param name="newVersion">The new version.</param>
  81. void OnApplicationUpdated(Version newVersion);
  82. /// <summary>
  83. /// Gets the name of the web application.
  84. /// </summary>
  85. /// <value>The name of the web application.</value>
  86. string WebApplicationName { get; }
  87. /// <summary>
  88. /// Gets the log file path.
  89. /// </summary>
  90. /// <value>The log file path.</value>
  91. string LogFilePath { get; }
  92. /// <summary>
  93. /// Performs the pending restart.
  94. /// </summary>
  95. void PerformPendingRestart();
  96. /// <summary>
  97. /// Gets the plugins.
  98. /// </summary>
  99. /// <value>The plugins.</value>
  100. IEnumerable<IPlugin> Plugins { get; }
  101. /// <summary>
  102. /// Gets the UDP server port number.
  103. /// </summary>
  104. /// <value>The UDP server port number.</value>
  105. int UdpServerPortNumber { get; }
  106. /// <summary>
  107. /// Gets the HTTP server URL prefix.
  108. /// </summary>
  109. /// <value>The HTTP server URL prefix.</value>
  110. string HttpServerUrlPrefix { get; }
  111. /// <summary>
  112. /// Gets a value indicating whether this instance is first run.
  113. /// </summary>
  114. /// <value><c>true</c> if this instance is first run; otherwise, <c>false</c>.</value>
  115. bool IsFirstRun { get; }
  116. /// <summary>
  117. /// Gets the TCP manager.
  118. /// </summary>
  119. /// <value>The TCP manager.</value>
  120. TcpManager TcpManager { get; }
  121. /// <summary>
  122. /// Gets the task manager.
  123. /// </summary>
  124. /// <value>The task manager.</value>
  125. TaskManager TaskManager { get; }
  126. /// <summary>
  127. /// Gets the web socket listeners.
  128. /// </summary>
  129. /// <value>The web socket listeners.</value>
  130. IEnumerable<IWebSocketListener> WebSocketListeners { get; }
  131. /// <summary>
  132. /// Occurs when [logger loaded].
  133. /// </summary>
  134. event EventHandler LoggerLoaded;
  135. /// <summary>
  136. /// Occurs when [reload completed].
  137. /// </summary>
  138. event EventHandler<EventArgs> ReloadCompleted;
  139. /// <summary>
  140. /// Occurs when [configuration updated].
  141. /// </summary>
  142. event EventHandler<EventArgs> ConfigurationUpdated;
  143. /// <summary>
  144. /// Gets the assemblies.
  145. /// </summary>
  146. /// <value>The assemblies.</value>
  147. Assembly[] Assemblies { get; }
  148. /// <summary>
  149. /// Gets the rest services.
  150. /// </summary>
  151. /// <value>The rest services.</value>
  152. IEnumerable<IRestfulService> RestServices { get; }
  153. }
  154. }