ApplicationSetting.java 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. /*
  2. *
  3. */
  4. package com.leanwo.management.model;
  5. import java.util.List;
  6. import com.leanwo.management.service.ProgramRunResult;
  7. import com.leanwo.management.util.CloseableUtil;
  8. /**
  9. * 应用程序实体类.
  10. *
  11. * @author YangZhiJie
  12. */
  13. public class ApplicationSetting {
  14. /** 应用程序名称. */
  15. private String name;
  16. /** 安装路径. */
  17. private String installPath;
  18. /** 启动程序命令. */
  19. private String startCommand;
  20. /** 启动程序BAT文件路径. */
  21. private String startBatFile;
  22. /** 停止程序BAT文件路径. */
  23. private String stopBatFile;
  24. /** 监控地址. */
  25. private String monitorUrl;
  26. /** token. */
  27. private String token;
  28. /** 自动更新的文件名. */
  29. private List<String> autoUpdateFileNames;
  30. /** XML文件配置. */
  31. private XmlConfigPath xmlConfigPath;
  32. /** 应用程序是否在线(计算值). */
  33. private boolean online;
  34. /** 程序运行结果(计算值). */
  35. private ProgramRunResult programRunResult;
  36. /**
  37. * Gets the 应用程序名称.
  38. *
  39. * @return the 应用程序名称
  40. */
  41. public String getName() {
  42. return name;
  43. }
  44. /**
  45. * Sets the 应用程序名称.
  46. *
  47. * @param name the new 应用程序名称
  48. */
  49. public void setName(String name) {
  50. this.name = name;
  51. }
  52. /**
  53. * Gets the 安装路径.
  54. *
  55. * @return the 安装路径
  56. */
  57. public String getInstallPath() {
  58. return installPath;
  59. }
  60. /**
  61. * Sets the 安装路径.
  62. *
  63. * @param installPath the new 安装路径
  64. */
  65. public void setInstallPath(String installPath) {
  66. this.installPath = installPath;
  67. }
  68. /**
  69. * Gets the 启动程序命令.
  70. *
  71. * @return the 启动程序命令
  72. */
  73. public String getStartCommand() {
  74. return startCommand;
  75. }
  76. /**
  77. * Sets the 启动程序命令.
  78. *
  79. * @param startCommand the new 启动程序命令
  80. */
  81. public void setStartCommand(String startCommand) {
  82. this.startCommand = startCommand;
  83. }
  84. /**
  85. * Gets the 启动程序BAT文件路径.
  86. *
  87. * @return the 启动程序BAT文件路径
  88. */
  89. public String getStartBatFile() {
  90. return startBatFile;
  91. }
  92. /**
  93. * Sets the 启动程序BAT文件路径.
  94. *
  95. * @param startBatFile the new 启动程序BAT文件路径
  96. */
  97. public void setStartBatFile(String startBatFile) {
  98. this.startBatFile = startBatFile;
  99. }
  100. /**
  101. * Gets the 停止程序BAT文件路径.
  102. *
  103. * @return the 停止程序BAT文件路径
  104. */
  105. public String getStopBatFile() {
  106. return stopBatFile;
  107. }
  108. /**
  109. * Sets the 停止程序BAT文件路径.
  110. *
  111. * @param stopBatFile the new 停止程序BAT文件路径
  112. */
  113. public void setStopBatFile(String stopBatFile) {
  114. this.stopBatFile = stopBatFile;
  115. }
  116. /**
  117. * Gets the 监控地址.
  118. *
  119. * @return the 监控地址
  120. */
  121. public String getMonitorUrl() {
  122. return monitorUrl;
  123. }
  124. /**
  125. * Sets the 监控地址.
  126. *
  127. * @param monitorUrl the new 监控地址
  128. */
  129. public void setMonitorUrl(String monitorUrl) {
  130. this.monitorUrl = monitorUrl;
  131. }
  132. /**
  133. * Gets the token.
  134. *
  135. * @return the token
  136. */
  137. public String getToken() {
  138. return token;
  139. }
  140. /**
  141. * Sets the token.
  142. *
  143. * @param token the new token
  144. */
  145. public void setToken(String token) {
  146. this.token = token;
  147. }
  148. /**
  149. * Gets the 自动更新的文件名.
  150. *
  151. * @return the 自动更新的文件名
  152. */
  153. public List<String> getAutoUpdateFileNames() {
  154. return autoUpdateFileNames;
  155. }
  156. /**
  157. * Sets the 自动更新的文件名.
  158. *
  159. * @param autoUpdateFileNames the new 自动更新的文件名
  160. */
  161. public void setAutoUpdateFileNames(List<String> autoUpdateFileNames) {
  162. this.autoUpdateFileNames = autoUpdateFileNames;
  163. }
  164. /**
  165. * Gets the xML文件配置.
  166. *
  167. * @return the xML文件配置
  168. */
  169. public XmlConfigPath getXmlConfigPath() {
  170. return xmlConfigPath;
  171. }
  172. /**
  173. * Sets the xML文件配置.
  174. *
  175. * @param xmlConfigPath the new xML文件配置
  176. */
  177. public void setXmlConfigPath(XmlConfigPath xmlConfigPath) {
  178. this.xmlConfigPath = xmlConfigPath;
  179. }
  180. /**
  181. * Checks if is 应用程序是否在线(计算值).
  182. *
  183. * @return the 应用程序是否在线(计算值)
  184. */
  185. public boolean isOnline() {
  186. return online;
  187. }
  188. /**
  189. * Sets the 应用程序是否在线(计算值).
  190. *
  191. * @param online the new 应用程序是否在线(计算值)
  192. */
  193. public void setOnline(boolean online) {
  194. this.online = online;
  195. }
  196. /**
  197. * Gets the 程序运行结果(计算值).
  198. *
  199. * @return the 程序运行结果(计算值)
  200. */
  201. public ProgramRunResult getProgramRunResult() {
  202. return programRunResult;
  203. }
  204. /**
  205. * Sets the 程序运行结果(计算值).
  206. *
  207. * @param programRunResult the new 程序运行结果(计算值)
  208. */
  209. public void setProgramRunResult(ProgramRunResult programRunResult) {
  210. if(programRunResult == null) {
  211. if(this.programRunResult != null) {
  212. Process process = this.programRunResult.getProcess();
  213. if(process != null) {
  214. CloseableUtil.close(process.getInputStream(), process.getOutputStream(),
  215. process.getErrorStream());
  216. process.destroyForcibly();
  217. }
  218. }
  219. }
  220. this.programRunResult = programRunResult;
  221. }
  222. }