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.

Server.java 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /*
  2. * SonarQube
  3. * Copyright (C) 2009-2021 SonarSource SA
  4. * mailto:info AT sonarsource DOT com
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 3 of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public License
  17. * along with this program; if not, write to the Free Software Foundation,
  18. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  19. */
  20. package org.sonar.api.platform;
  21. import java.io.File;
  22. import java.util.Date;
  23. import org.sonar.api.scanner.ScannerSide;
  24. import org.sonar.api.ce.ComputeEngineSide;
  25. import org.sonar.api.server.ServerSide;
  26. /**
  27. * Runtime information about server
  28. *
  29. * @since 2.2
  30. */
  31. @ScannerSide
  32. @ServerSide
  33. @ComputeEngineSide
  34. public abstract class Server {
  35. /**
  36. * UUID identifying the installation. It is persisted
  37. * so that it does not change over time, even after
  38. * a restart.
  39. * In the context of cluster, the value is shared
  40. * by all the nodes.
  41. *
  42. * @return a non-null UUID. Format can change over versions.
  43. */
  44. public abstract String getId();
  45. /**
  46. * Since 6.7, it returns exactly {@link #getId()}. In previous
  47. * versions it returned ab UUID generated on demand by system
  48. * administrators and may be null.
  49. *
  50. * @deprecated replaced by {@link #getId()} in 6.7.
  51. * @since 2.10
  52. */
  53. @Deprecated
  54. public abstract String getPermanentServerId();
  55. /**
  56. * Non-null version of SonarQube at runtime
  57. */
  58. public abstract String getVersion();
  59. /**
  60. * Date when server started. In the context of cluster, this is the
  61. * date of the startup of the first node. Value is the same on all
  62. * cluster nodes.
  63. */
  64. public abstract Date getStartedAt();
  65. /**
  66. * Context path of web server. Value is blank {@code ""} by default. When defined by
  67. * the property {@code sonar.web.context} of conf/sonar.properties, then value starts but does
  68. * not end with slash {@code '/'}, for instance {@code "/sonarqube"}.
  69. *
  70. * @return non-null but possibly blank path
  71. */
  72. public abstract String getContextPath();
  73. /**
  74. * Return the public root url, without trailing slash, for instance : https://nemo.sonarqube.org.
  75. *
  76. * @since 5.4
  77. */
  78. public abstract String getPublicRootUrl();
  79. /**
  80. * Return whether or not the {#getPublicRootUrl} is started with https.
  81. *
  82. * @since 5.4
  83. * @deprecated since 5.6, use instead {@link javax.servlet.http.HttpServletRequest#getHeader(String)} and check that X-Forwarded-Proto header is set to "https".
  84. */
  85. @Deprecated
  86. public abstract boolean isSecured();
  87. }