Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

SonarLintPushAction.java 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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.server.pushapi.sonarlint;
  21. import org.sonar.api.server.ws.Request;
  22. import org.sonar.api.server.ws.Response;
  23. import org.sonar.api.server.ws.WebService;
  24. import org.sonar.api.utils.log.Logger;
  25. import org.sonar.api.utils.log.Loggers;
  26. import org.sonar.server.pushapi.ServerPushAction;
  27. public class SonarLintPushAction implements ServerPushAction {
  28. private static final Logger LOGGER = Loggers.get(SonarLintPushAction.class);
  29. private static final String PROJECT_PARAM_KEY = "projectKeys";
  30. private static final String LANGUAGE_PARAM_KEY = "languages";
  31. @Override
  32. public void define(WebService.NewController controller) {
  33. WebService.NewAction action = controller
  34. .createAction("sonarlint_events")
  35. .setInternal(true)
  36. .setDescription("Endpoint for listening to server side events. Currently it notifies listener about change to activation of a rule")
  37. .setSince("9.4")
  38. .setHandler(this);
  39. action
  40. .createParam(PROJECT_PARAM_KEY)
  41. .setDescription("Comma-separated list of projects keys for which events will be delivered")
  42. .setRequired(true)
  43. .setExampleValue("example-project-key,example-project-key2");
  44. action
  45. .createParam(LANGUAGE_PARAM_KEY)
  46. .setDescription("Comma-separated list of languages for which events will be delivered")
  47. .setRequired(true)
  48. .setExampleValue("java,cobol");
  49. }
  50. @Override
  51. public void handle(Request request, Response response) {
  52. String projectKeys = request.getParam(PROJECT_PARAM_KEY).getValue();
  53. String languages = request.getParam(LANGUAGE_PARAM_KEY).getValue();
  54. //to remove later
  55. LOGGER.debug(projectKeys != null ? projectKeys : "");
  56. LOGGER.debug(languages != null ? languages : "");
  57. response.noContent();
  58. }
  59. }