IKernel.cs 5.0 KB

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