diff options
Diffstat (limited to 'sonar-plugin-api/src/main/java')
17 files changed, 70 insertions, 59 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/debt/DebtModel.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/debt/DebtModel.java index d7e156d246b..fe6e0b4dbea 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/debt/DebtModel.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/debt/DebtModel.java @@ -19,15 +19,14 @@ */ package org.sonar.api.batch.debt; -import javax.annotation.CheckForNull; - import java.util.List; +import javax.annotation.CheckForNull; /** * This class can be used to retrieve characteristics or sub-characteristics from the technical debt model during analysis. * * Unfortunately, this class cannot be used to set characteristic on {@link org.sonar.api.measures.Measure}, - * because the Measure API still uses deprecated {@link org.sonar.api.technicaldebt.batch.Characteristic}. + * because the Measure API still uses deprecated {@code org.sonar.api.technicaldebt.batch.Characteristic}. * * @since 4.3 * @deprecated since 5.1 debt model will soon be unavailable on batch side diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/InitializersPhaseHandler.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/InitializersPhaseHandler.java index 52a242c6d15..8ac2876e933 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/InitializersPhaseHandler.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/events/InitializersPhaseHandler.java @@ -19,9 +19,8 @@ */ package org.sonar.api.batch.events; -import org.sonar.api.batch.Initializer; - import java.util.List; +import org.sonar.api.batch.Initializer; /** * @since 3.7 @@ -45,7 +44,7 @@ public interface InitializersPhaseHandler extends EventHandler { } /** - * Called before and after execution of all {@link Initializers}s. + * Called before and after execution of all {@link Initializer}s. */ void onInitializersPhase(InitializersPhaseEvent event); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/MeasureComputer.java b/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/MeasureComputer.java index ab3b876d79d..5a33360e05b 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/MeasureComputer.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/MeasureComputer.java @@ -52,7 +52,7 @@ import org.sonar.api.ce.measure.MeasureComputer.MeasureComputerDefinition.Builde * public void compute(MeasureComputerContext context) { * int ncloc = context.getMeasure("ncloc"); * List<Issue> issues = context.getIssues(); - * if (ncloc != null && !issues.isEmpty()) { + * if (ncloc != null && !issues.isEmpty()) { * double value = issues.size() / ncloc; * context.addMeasure("my_new_metric", value); * } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/i18n/I18n.java b/sonar-plugin-api/src/main/java/org/sonar/api/i18n/I18n.java index c696b22e201..df37c340bb9 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/i18n/I18n.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/i18n/I18n.java @@ -88,8 +88,10 @@ public interface I18n { /** * Return the formatted datetime. - * <br> - * Example : formatDateTime(Locale.ENGLISH, DateUtils.parseDateTime("2014-01-22T19:10:03+0100")) -> Jan 22, 2014 7:10 PM + * <p> + * Example: {@code formatDateTime(Locale.ENGLISH, DateUtils.parseDateTime("2014-01-22T19:10:03+0100"))} + * returns {@code "Jan 22, 2014 7:10 PM"}. + * </p> * * @since 4.2 */ @@ -98,7 +100,8 @@ public interface I18n { /** * Return the formatted date. * <br> - * Example : formatDateTime(Locale.ENGLISH, DateUtils.parseDateTime("2014-01-22")) -> Jan 22, 2014 + * Example: {@code formatDateTime(Locale.ENGLISH, DateUtils.parseDateTime("2014-01-22"))} + * returns {@code "Jan 22, 2014"}. * * @since 4.2 */ @@ -107,7 +110,7 @@ public interface I18n { /** * Return the formatted decimal, with always one fraction digit. * <br> - * Example : formatDouble(Locale.FRENCH, 10.56) -> 10,6 + * Example: {@code formatDouble(Locale.FRENCH, 10.56)} returns {@code "10,6"}. * * @since 4.4 */ @@ -116,7 +119,7 @@ public interface I18n { /** * Return the formatted integer. * <br> - * Example : formatInteger(Locale.ENGLISH, 100000) -> 100,000 + * Example: {@code formatInteger(Locale.ENGLISH, 100000)} returns {@code "100,000"}. * * @since 4.4 */ diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerUpgradeStatus.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerUpgradeStatus.java index 7751060a6c7..80359a835f6 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerUpgradeStatus.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ServerUpgradeStatus.java @@ -40,7 +40,7 @@ public interface ServerUpgradeStatus { boolean isFreshInstall(); /** - * The database version before the server startup. Returns <=0 if db created from scratch. + * The database version before the server startup. Returns a non-zero negative value if db created from scratch. */ int getInitialDbVersion(); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/IdentityProvider.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/IdentityProvider.java index f1b43ba1b2c..78ac0a2d6ef 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/IdentityProvider.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/IdentityProvider.java @@ -25,8 +25,8 @@ import org.sonar.api.server.ServerSide; * Entry-point to define a new Identity provider. * Only one of this two interfaces can be used : * <ul> - * <li>{@link OAuth2IdentityProvider}</li> for OAuth2 authentication - * <li>{@link BaseIdentityProvider}</li> for other kind of authentication + * <li>{@link OAuth2IdentityProvider} for OAuth2 authentication</li> + * <li>{@link BaseIdentityProvider} for other kind of authentication</li> * </ul> * * @since 5.4 diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/LocalConnector.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/LocalConnector.java index 468077674c8..eb93d97957d 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/LocalConnector.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/LocalConnector.java @@ -27,7 +27,7 @@ import javax.annotation.CheckForNull; * This class allows a web service to call another web service through the sonar-ws library. * The call is in-process, synchronous and does not involve the HTTP stack. * <p> - * Example of a web service that uses sonar-ws 5.5 to get some issues: + * Example of a web service that loads some issues: * <pre> * import org.sonar.api.server.ws.RequestHandler; * import org.sonarqube.ws.client.WsClientFactories; @@ -35,12 +35,20 @@ import javax.annotation.CheckForNull; * public class MyRequestHandler implements RequestHandler { * {@literal @}Override * public void handle(Request request, Response response) { - * WsClient wsClient = WsClientFactories.getLocal().newClient(request.getLocalConnector()); + * WsClient wsClient = WsClientFactories.getLocal().newClient(request.localConnector()); * SearchWsResponse issues = wsClient.issues().search(new SearchWsRequest()); * // ... * } * } * </pre> + * + * It requires to use the sonar-ws library which Maven ids are: + * <pre> + * <dependency> + * <groupId>org.sonarsource.sonarqube</groupId> + * <artifactId>sonar-ws</artifactId> + * </dependency> + * </pre> * * @since 5.5 */ diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/Request.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/Request.java index fdc54cee2b0..6396ecab761 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/Request.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/Request.java @@ -237,10 +237,10 @@ public abstract class Request { } /** - * Used by the sonar-ws library to allow a web service to call another web service. + * Allows a web service to call another web service. * @see LocalConnector * @since 5.5 */ @Beta - public abstract LocalConnector getLocalConnector(); + public abstract LocalConnector localConnector(); } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java index de2f60033b8..484956d7a68 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/WebService.java @@ -88,6 +88,9 @@ import static java.lang.String.format; * } * </pre> * + * Since version 5.5, a web service can call another web service to get some data. See {@link Request#localConnector()} + * provided by {@link RequestHandler#handle(Request, Response)}. + * * @since 4.2 */ @ServerSide @@ -100,7 +103,7 @@ public interface WebService extends Definable<WebService.Context> { /** * Create a new controller. * <br> - * Structure of request URL is <code>http://<server>/<>controller path>/<action path>?<parameters></code>. + * Structure of request URL is <code>http://<server>/<controller path>/<action path>?<parameters></code>. * * @param path the controller path must not start or end with "/". It is recommended to start with "api/" * and to use lower-case format with underscores, for example "api/coding_rules". Usual actions @@ -378,8 +381,10 @@ public interface WebService extends Definable<WebService.Context> { /**$ * * Creates the parameter {@link org.sonar.api.server.ws.WebService.Param#TEXT_QUERY}, which is - * used to search for a subset of fields containing the supplied string.<br /> - * The fields must be in the <strong>plural</strong> form (ex: "names", "keys") + * used to search for a subset of fields containing the supplied string. + * <p> + * The fields must be in the <strong>plural</strong> form (ex: "names", "keys"). + * </p> */ public NewAction addSearchQuery(String exampleValue, String... pluralFields) { String actionDescription = format("Limit search to %s that contain the supplied string.", Joiner.on(" or ").join(pluralFields)); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/internal/SimpleGetRequest.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/internal/SimpleGetRequest.java index f08816d5bd7..e9d2c0827d1 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/internal/SimpleGetRequest.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/internal/SimpleGetRequest.java @@ -82,7 +82,7 @@ public class SimpleGetRequest extends Request { } @Override - public LocalConnector getLocalConnector() { + public LocalConnector localConnector() { throw new UnsupportedOperationException(); } } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/internal/ValidatingRequest.java b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/internal/ValidatingRequest.java index f38a1bed2e2..58615ec636e 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/internal/ValidatingRequest.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/server/ws/internal/ValidatingRequest.java @@ -53,7 +53,7 @@ public abstract class ValidatingRequest extends Request { } @Override - public LocalConnector getLocalConnector() { + public LocalConnector localConnector() { checkNotNull(localConnector, "Local connector has not been set"); return localConnector; } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/TempFolder.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/TempFolder.java index a1cd561677f..da16a352447 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/TempFolder.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/TempFolder.java @@ -30,7 +30,7 @@ import org.sonar.api.server.ServerSide; * depends on situation: * <ul> * <li>${SONAR_HOME}/temp on server side</li> - * <li>${SONAR_HOME}/.sonartmp<rnd> on the batch side</li> + * <li>${SONAR_HOME}/.sonartmp on scanner side</li> * </ul> * @since 4.0 * diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/XpathParser.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/XpathParser.java index a202004989e..df350a4893b 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/XpathParser.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/XpathParser.java @@ -19,26 +19,6 @@ */ package org.sonar.api.utils; -import org.apache.commons.io.IOUtils; -import org.sonar.api.utils.log.Logger; -import org.sonar.api.utils.log.Loggers; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; - -import javax.annotation.Nullable; -import javax.xml.namespace.QName; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathExpression; -import javax.xml.xpath.XPathExpressionException; -import javax.xml.xpath.XPathFactory; - import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.File; @@ -53,6 +33,24 @@ import java.util.List; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; +import javax.annotation.Nullable; +import javax.xml.namespace.QName; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathConstants; +import javax.xml.xpath.XPathExpression; +import javax.xml.xpath.XPathExpressionException; +import javax.xml.xpath.XPathFactory; +import org.apache.commons.io.IOUtils; +import org.sonar.api.utils.log.Logger; +import org.sonar.api.utils.log.Loggers; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; /** * XML Parsing tool using XPATH. It's recommended to use StaxParser when parsing big XML files. @@ -260,7 +258,7 @@ public class XpathParser { /** * Fix the error occured when parsing a string containing unicode character - * Example : &u20ac; will be replaced by € + * Example : {@code &u20ac;} will be replaced by {@code €} */ protected String fixUnicodeChar(String text) { String unicode = "&u"; diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/JsonWriter.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/JsonWriter.java index 7658439803c..bea1dcc2d27 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/JsonWriter.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/text/JsonWriter.java @@ -19,12 +19,11 @@ */ package org.sonar.api.utils.text; -import org.sonar.api.utils.DateUtils; - -import javax.annotation.Nullable; import java.io.Writer; import java.util.Date; import java.util.Map; +import javax.annotation.Nullable; +import org.sonar.api.utils.DateUtils; /** * Writes JSON as a stream. This class allows plugins to not directly depend @@ -208,7 +207,7 @@ public class JsonWriter { * <ul> * <li>primitive types: String, Number, Boolean</li> * <li>java.util.Date: encoded as datetime (see {@link #valueDateTime(java.util.Date)}</li> - * <li><code>Map<Object, Object></code>. Method toString is called for the key.</li> + * <li>{@code Map<Object, Object>}. Method toString is called for the key.</li> * <li>Iterable</li> * </ul> * diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/PageDecoration.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/PageDecoration.java index 73edeb1dc6f..963759254db 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/web/PageDecoration.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/web/PageDecoration.java @@ -34,13 +34,13 @@ import org.sonar.api.server.ServerSide; * * <p>Example of template: <pre> - <% content_for :script do %> - <script>alert('page loaded')</script> - <% end %> + <% content_for :script do %> + <script>alert('page loaded')</script> + <% end %> - <% content_for :footer do %> - <div>this is <b>my footer</b></div> -<% end %> + <% content_for :footer do %> + <div>this is <b>my footer</b></div> +<% end %> </pre> * * @since 3.3 diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/RubyRailsWebservice.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/RubyRailsWebservice.java index 9178f9bddf9..e09bcf9b34c 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/web/RubyRailsWebservice.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/web/RubyRailsWebservice.java @@ -23,7 +23,7 @@ package org.sonar.api.web; /** * Interface to create a web service by implementing a Ruby On Rails controller. * The method getTemplate() return the ROR controller code, the name of the controller class defined in the template - * MUST match the following name scheme : Api::$Webservice.getId()Controller I.E : Webservice.getId() = TestWS > Api::TestWSController. + * MUST match the following name scheme : Api::$Webservice.getId()Controller I.E : Webservice.getId() = TestWS > Api::TestWSController. * The plugin will be deployed with the following URL scheme: http://sonarhost/api/plugins/$Webservice.getId()/:action/:id * :action is the name of the controller method to call, :id is a param that will be passed to the controller, these 2 params are not mandatory * and will call the index controller method if not specified. diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/web/WidgetProperty.java b/sonar-plugin-api/src/main/java/org/sonar/api/web/WidgetProperty.java index f547a7d5fa3..5003381681e 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/web/WidgetProperty.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/web/WidgetProperty.java @@ -39,7 +39,7 @@ public @interface WidgetProperty { boolean optional() default true; /** - * @since 3.3 Options for property of type WidgetPropertyType.METRIC</code>. + * @since 3.3 Options for property of type {@link WidgetPropertyType#METRIC}. * * If no option is specified, any metric will match. * If options are specified, all must match for the metric to be displayed. @@ -48,7 +48,7 @@ public @interface WidgetProperty { * For example <code>type:INT,FLOAT</code> will match any metric of type <code>INT</code> or <code>FLOAT</code>. * For example <code>type:NUMERIC</code> will match any metric of numerictype. * - * @since 3.5 Options for property of type WidgetPropertyType.SINGLE_SELECT_LIST</code> + * @since 3.5 Options for property of type {@link WidgetPropertyType#SINGLE_SELECT_LIST}. * For example {"property_1", "property_3", "property_3"}). * */ |