Skip to content

Commit

Permalink
Add checkstyle validation and fix style violations in the pulsar clie…
Browse files Browse the repository at this point in the history
…nt api module (#5115)

### Modifications

The following changes were made in this pull request:

* Configured the checkstyle plugin
* Fixed reported style violations

This pull request has only cosmetic changes in the pulsar client api module and shouldn't introduce any change in the business logic.
  • Loading branch information
vzhikserg authored and sijie committed Sep 16, 2019
1 parent 61ba4e7 commit 716daff
Show file tree
Hide file tree
Showing 56 changed files with 1,273 additions and 762 deletions.
24 changes: 24 additions & 0 deletions pulsar-client-api/pom.xml
Expand Up @@ -40,4 +40,28 @@
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<executions>
<execution>
<id>check-style</id>
<phase>verify</phase>
<configuration>
<configLocation>../buildtools/src/main/resources/pulsar/checkstyle.xml</configLocation>
<suppressionsLocation>../buildtools/src/main/resources/pulsar/suppressions.xml</suppressionsLocation>
<encoding>UTF-8</encoding>
</configuration>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Expand Up @@ -50,7 +50,6 @@ default AuthenticationDataProvider getAuthData() throws PulsarClientException {
}

/**
*
* Get/Create an authentication data provider which provides the data that this client will be sent to the broker.
* Some authentication method need to auth between each client channel. So it need the broker, who it will talk to.
*
Expand All @@ -64,7 +63,7 @@ default AuthenticationDataProvider getAuthData(String brokerHostName) throws Pul
}

/**
* Configure the authentication plugins with the supplied parameters
* Configure the authentication plugins with the supplied parameters.
*
* @param authParams
* @deprecated This method will be deleted on version 2.0, instead please use configure(String
Expand All @@ -75,7 +74,7 @@ default AuthenticationDataProvider getAuthData(String brokerHostName) throws Pul
void configure(Map<String, String> authParams);

/**
* Initialize the authentication provider
* Initialize the authentication provider.
*/
void start() throws PulsarClientException;

Expand All @@ -91,7 +90,7 @@ default void authenticationStage(String requestUrl,
}

/**
* Add an authenticationStage that will complete along with authFuture
* Add an authenticationStage that will complete along with authFuture.
*/
default Set<Entry<String, String>> newRequestHeader(String hostName,
AuthenticationDataProvider authData,
Expand Down
Expand Up @@ -31,7 +31,7 @@
import org.apache.pulsar.common.api.AuthData;

/**
* Interface for accessing data which are used in variety of authentication schemes on client side
* Interface for accessing data which are used in variety of authentication schemes on client side.
*/
public interface AuthenticationDataProvider extends Serializable {
/*
Expand Down Expand Up @@ -78,7 +78,7 @@ default boolean hasDataForHttp() {

/**
*
* @return a authentication scheme, or <code>null<c/ode> if the request will not be authenticated
* @return a authentication scheme, or {@code null} if the request will not be authenticated.
*/
default String getHttpAuthType() {
return null;
Expand Down Expand Up @@ -118,7 +118,7 @@ default String getCommandData() {
* then returns null if authentication has completed;
* returns authenticated data back to server side, if authentication has not completed.
*
* Mainly used for mutual authentication like sasl.
* <p>Mainly used for mutual authentication like sasl.
*/
default AuthData authenticate(AuthData data) throws AuthenticationException {
byte[] bytes = (hasDataFromCommand() ? this.getCommandData() : "").getBytes(UTF_8);
Expand Down
Expand Up @@ -52,6 +52,8 @@ public static Authentication token(Supplier<String> tokenSupplier) {
return DefaultImplementation.newAuthenticationToken(tokenSupplier);
}

// CHECKSTYLE.OFF: MethodName

/**
* Create an authentication provider for TLS based authentication.
*
Expand All @@ -65,6 +67,8 @@ public static Authentication TLS(String certFilePath, String keyFilePath) {
return DefaultImplementation.newAuthenticationTLS(certFilePath, keyFilePath);
}

// CHECKSTYLE.ON: MethodName

/**
* Create an instance of the {@link Authentication} object by using
* the plugin class name.
Expand All @@ -86,14 +90,14 @@ public static Authentication create(String authPluginClassName, String authParam
}

/**
* Create an instance of the Authentication-Plugin
* Create an instance of the Authentication-Plugin.
*
* @param authPluginClassName name of the Authentication-Plugin you want to use
* @param authParams map which represents parameters for the Authentication-Plugin
* @return instance of the Authentication-Plugin
* @throws UnsupportedAuthenticationException
*/
public static final Authentication create(String authPluginClassName, Map<String, String> authParams)
public static Authentication create(String authPluginClassName, Map<String, String> authParams)
throws UnsupportedAuthenticationException {
try {
return DefaultImplementation.createAuthentication(authPluginClassName, authParams);
Expand Down
Expand Up @@ -19,7 +19,7 @@
package org.apache.pulsar.client.api;

/**
* Batch message container for individual messages being published until they are batched and sent to broker
* Batch message container for individual messages being published until they are batched and sent to broker.
*/
public interface BatchMessageContainer {

Expand Down Expand Up @@ -57,7 +57,7 @@ public interface BatchMessageContainer {
void discard(Exception ex);

/**
* Return the batch container batch message in multiple batches
* Return the batch container batch message in multiple batches.
* @return
*/
boolean isMultiBatches();
Expand Down
Expand Up @@ -18,33 +18,32 @@
*/
package org.apache.pulsar.client.api;

import org.apache.pulsar.client.internal.DefaultImplementation;

import java.io.Serializable;
import org.apache.pulsar.client.internal.DefaultImplementation;

/**
* Batcher builder
* Batcher builder.
*/
public interface BatcherBuilder extends Serializable {

/**
* Default batch message container
* Default batch message container.
*
* incoming single messages:
* <p>incoming single messages:
* (k1, v1), (k2, v1), (k3, v1), (k1, v2), (k2, v2), (k3, v2), (k1, v3), (k2, v3), (k3, v3)
*
* batched into single batch message:
* <p>batched into single batch message:
* [(k1, v1), (k2, v1), (k3, v1), (k1, v2), (k2, v2), (k3, v2), (k1, v3), (k2, v3), (k3, v3)]
*/
BatcherBuilder DEFAULT = DefaultImplementation.newDefaultBatcherBuilder();

/**
* Key based batch message container
* Key based batch message container.
*
* incoming single messages:
* <p>incoming single messages:
* (k1, v1), (k2, v1), (k3, v1), (k1, v2), (k2, v2), (k3, v2), (k1, v3), (k2, v3), (k3, v3)
*
* batched into multiple batch messages:
* <p>batched into multiple batch messages:
* [(k1, v1), (k1, v2), (k1, v3)], [(k2, v1), (k2, v2), (k2, v3)], [(k3, v1), (k3, v2), (k3, v3)]
*/
BatcherBuilder KEY_BASED = DefaultImplementation.newKeyBasedBatcherBuilder();
Expand Down

0 comments on commit 716daff

Please sign in to comment.