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

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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.util.Date;
  22. import org.sonar.api.scanner.ScannerSide;
  23. import org.sonar.api.ce.ComputeEngineSide;
  24. import org.sonar.api.server.ServerSide;
  25. /**
  26. * Runtime information about server
  27. *
  28. * @since 2.2
  29. */
  30. @ScannerSide
  31. @ServerSide
  32. @ComputeEngineSide
  33. public abstract class Server {
  34. /**
  35. * UUID identifying the installation. It is persisted
  36. * so that it does not change over time, even after
  37. * a restart.
  38. * In the context of cluster, the value is shared
  39. * by all the nodes.
  40. *
  41. * @return a non-null UUID. Format can change over versions.
  42. */
  43. public abstract String getId();
  44. /**
  45. * Since 6.7, it returns exactly {@link #getId()}. In previous
  46. * versions it returned ab UUID generated on demand by system
  47. * administrators and may be null.
  48. *
  49. * @deprecated replaced by {@link #getId()} in 6.7.
  50. * @since 2.10
  51. */
  52. @Deprecated
  53. public abstract String getPermanentServerId();
  54. /**
  55. * Non-null version of SonarQube at runtime
  56. */
  57. public abstract String getVersion();
  58. /**
  59. * Date when server started. In the context of cluster, this is the
  60. * date of the startup of the first node. Value is the same on all
  61. * cluster nodes.
  62. */
  63. public abstract Date getStartedAt();
  64. /**
  65. * Context path of web server. Value is blank {@code ""} by default. When defined by
  66. * the property {@code sonar.web.context} of conf/sonar.properties, then value starts but does
  67. * not end with slash {@code '/'}, for instance {@code "/sonarqube"}.
  68. *
  69. * @return non-null but possibly blank path
  70. */
  71. public abstract String getContextPath();
  72. /**
  73. * Return the public root url, without trailing slash, for instance : https://nemo.sonarqube.org.
  74. *
  75. * @since 5.4
  76. */
  77. public abstract String getPublicRootUrl();
  78. /**
  79. * Return whether or not the {#getPublicRootUrl} is started with https.
  80. *
  81. * @since 5.4
  82. * @deprecated since 5.6, use instead {@link javax.servlet.http.HttpServletRequest#getHeader(String)} and check that X-Forwarded-Proto header is set to "https".
  83. */
  84. @Deprecated
  85. public abstract boolean isSecured();
  86. }