Skip to content

Commit

Permalink
KAA-1279: Fixed about 50 warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
sashadidukh committed Sep 29, 2016
1 parent 649df63 commit 2c88cb9
Show file tree
Hide file tree
Showing 16 changed files with 246 additions and 176 deletions.

Large diffs are not rendered by default.

Expand Up @@ -100,7 +100,7 @@ public interface GenericKaaClient {
void setProfileContainer(ProfileContainer container);

/**
* Sync of updated profile with server
* Sync of updated profile with server.
*/
void updateProfile();

Expand All @@ -112,15 +112,15 @@ public interface GenericKaaClient {
void setConfigurationStorage(ConfigurationStorage storage);

/**
* Register configuration update listener
* Register configuration update listener.
*
* @param listener to register
* @return true if listener is registered, false if already registered
*/
boolean addConfigurationListener(ConfigurationListener listener);

/**
* Removes configuration update listener
* Removes configuration update listener.
*
* @param listener to register
* @return true if listener is removed, false if not found
Expand Down Expand Up @@ -182,7 +182,8 @@ public interface GenericKaaClient {
* @throws UnavailableTopicException Throw if unknown topic id is provided.
* @see NotificationListener
*/
void addNotificationListener(Long topicId, NotificationListener listener) throws UnavailableTopicException;
void addNotificationListener(Long topicId, NotificationListener listener)
throws UnavailableTopicException;

/**
* <p>
Expand Down Expand Up @@ -210,7 +211,8 @@ public interface GenericKaaClient {
* @throws UnavailableTopicException Throw if unknown topic id is provided.
* @see NotificationListener
*/
void removeNotificationListener(Long topicId, NotificationListener listener) throws UnavailableTopicException;
void removeNotificationListener(Long topicId, NotificationListener listener)
throws UnavailableTopicException;

/**
* <p>
Expand Down Expand Up @@ -326,7 +328,8 @@ public interface GenericKaaClient {
* optional.
* @see #syncTopicsList()
*/
void unsubscribeFromTopics(List<Long> topicIds, boolean forceSync) throws UnavailableTopicException;
void unsubscribeFromTopics(List<Long> topicIds, boolean forceSync)
throws UnavailableTopicException;

/**
* <p> Force sync of pending subscription changes with server. </p>
Expand Down Expand Up @@ -377,15 +380,15 @@ public interface GenericKaaClient {
EventFamilyFactory getEventFamilyFactory();

/**
* Submits an event listeners resolution request
* Submits an event listeners resolution request.
*
* @param eventFQNs List of event class FQNs which have to be supported by endpoint.
* @param eventFqns List of event class FQNs which have to be supported by endpoint.
* @param listener Result listener {@link FindEventListenersCallback}}
*/
void findEventListeners(List<String> eventFQNs, FindEventListenersCallback listener);
void findEventListeners(List<String> eventFqns, FindEventListenersCallback listener);

/**
* Retrieves Kaa channel manager
* Retrieves Kaa channel manager.
*
* @return {@link KaaChannelManager} object
*/
Expand Down Expand Up @@ -435,28 +438,29 @@ public interface GenericKaaClient {
String getEndpointKeyHash();

/**
* Generate new access token for a current endpoint
* Generate new access token for a current endpoint.
*
* @return String containing new endpoint access token
*/
String refreshEndpointAccessToken();

/**
* Retrieve an access token for a current endpoint
* Retrieve an access token for a current endpoint.
*
* @return String containing current endpoint access token
*/
String getEndpointAccessToken();

/**
* Set new access token for a current endpoint
* Set new access token for a current endpoint.
*
* @param token the token
*/
void setEndpointAccessToken(String token);

/**
* Updates with new endpoint attach request<br> <br> {@link org.kaaproject.kaa.client.event.registration.OnAttachEndpointOperationCallback}
* Updates with new endpoint attach request<br> <br> {@link
* org.kaaproject.kaa.client.event.registration.OnAttachEndpointOperationCallback}
* is populated with {@link org.kaaproject.kaa.client.event.EndpointKeyHash} of an attached
* endpoint.
*
Expand All @@ -465,7 +469,8 @@ public interface GenericKaaClient {
* @see org.kaaproject.kaa.client.event.EndpointAccessToken
* @see org.kaaproject.kaa.client.event.registration.OnAttachEndpointOperationCallback
*/
void attachEndpoint(EndpointAccessToken endpointAccessToken, OnAttachEndpointOperationCallback resultListener);
void attachEndpoint(EndpointAccessToken endpointAccessToken,
OnAttachEndpointOperationCallback resultListener);

/**
* Updates with new endpoint detach request
Expand All @@ -475,7 +480,8 @@ public interface GenericKaaClient {
* @see org.kaaproject.kaa.client.event.EndpointKeyHash
* @see OnDetachEndpointOperationCallback
*/
void detachEndpoint(EndpointKeyHash endpointKeyHash, OnDetachEndpointOperationCallback resultListener);
void detachEndpoint(EndpointKeyHash endpointKeyHash,
OnDetachEndpointOperationCallback resultListener);

/**
* Creates user attach request using default verifier. Default verifier is selected during SDK
Expand All @@ -498,7 +504,8 @@ public interface GenericKaaClient {
* @param callback called when authentication result received
* @see UserAttachCallback
*/
void attachUser(String userVerifierToken, String userExternalId, String userAccessToken, UserAttachCallback callback);
void attachUser(String userVerifierToken, String userExternalId, String userAccessToken,
UserAttachCallback callback);

/**
* Checks if current endpoint is attached to user.
Expand Down
Expand Up @@ -26,62 +26,63 @@
import java.security.PublicKey;

/**
* Represents platform specific context for Kaa client initialization
* Represents platform specific context for Kaa client initialization.
*
* @author Andrew Shvayka
*/
public interface KaaClientPlatformContext {

/**
* Returns platform SDK properties
* Returns platform SDK properties.
*
* @return client SDK properties
*/
KaaClientProperties getProperties();

/**
* Returns platform dependent implementation of http client
* Returns platform dependent implementation of http client.
*
* @param url the url
* @param privateKey the private key
* @param publicKey the public key
* @param remotePublicKey the remote public key
* @return platform dependent implementation of http client
*/
AbstractHttpClient createHttpClient(String url, PrivateKey privateKey, PublicKey publicKey, PublicKey remotePublicKey);
AbstractHttpClient createHttpClient(String url, PrivateKey privateKey, PublicKey publicKey,
PublicKey remotePublicKey);

/**
* Returns platform dependent implementation of {@link PersistentStorage
* persistent storage}
* persistent storage}.
*
* @return implementation of {@link PersistentStorage persistent storage}
*/
PersistentStorage createPersistentStorage();

/**
* Returns platform dependent implementation of {@link Base64 base64}
* algorithm
* algorithm.
*
* @return implementation of {@link Base64 base64} algorithm
*/
Base64 getBase64();

/**
* Returns platform dependent implementation of {@link ConnectivityChecker}
* Returns platform dependent implementation of {@link ConnectivityChecker}.
*
* @return implementation of {@link ConnectivityChecker}
*/
ConnectivityChecker createConnectivityChecker();

/**
* Returns SDK thread execution context
* Returns SDK thread execution context.
*
* @return SDK thread execution context
*/
ExecutorContext getExecutorContext();

/**
* Determines if client state should be checked
* Determines if client state should be checked.
*
* @return true if client state should be checked
*/
Expand Down
Expand Up @@ -57,8 +57,8 @@ protected void shutdownExecutor(ExecutorService executor) {
LOG.debug("Waiting for executor service to shutdown for {} {}", getTimeout(), getTimeunit());
try {
executor.awaitTermination(getTimeout(), getTimeunit());
} catch (InterruptedException e) {
LOG.warn("Interrupted while waiting for executor to shutdown", e);
} catch (InterruptedException ex) {
LOG.warn("Interrupted while waiting for executor to shutdown", ex);
}
}
}
Expand Up @@ -34,25 +34,25 @@
public interface ExecutorContext {

/**
* Initialize executors
* Initialize executors.
*/
void init();

/**
* Stops executors
* Stops executors.
*/
void stop();

/**
* Executes lifecycle events/commands of Kaa client
* Executes lifecycle events/commands of Kaa client.
*
* @return the lifecycle executor
*/
ExecutorService getLifeCycleExecutor();

/**
* Executes user API calls to SDK client. For example, serializing of log
* records before submit to transport
* records before submit to transport.
*
* @return the API executor
*/
Expand All @@ -66,7 +66,7 @@ public interface ExecutorContext {
ExecutorService getCallbackExecutor();

/**
* Executes scheduled tasks(periodically if needed) as log upload
* Executes scheduled tasks(periodically if needed) as log upload.
*
* @return the scheduled executor
*/
Expand Down
Expand Up @@ -25,7 +25,7 @@

/**
* Simple implementation of {@link ExecutorContext executorContext} that uses
* one thread per each executor
* one thread per each executor.
*
* @author Andrew Shvayka
*/
Expand All @@ -48,7 +48,8 @@ public SimpleExecutorContext() {
this(SINGLE_THREAD, SINGLE_THREAD, SINGLE_THREAD, SINGLE_THREAD);
}

public SimpleExecutorContext(int lifeCycleThreadCount, int apiThreadCount, int callbackThreadCount, int scheduledThreadCount) {
public SimpleExecutorContext(int lifeCycleThreadCount, int apiThreadCount,
int callbackThreadCount, int scheduledThreadCount) {
super();
this.lifeCycleThreadCount = lifeCycleThreadCount;
this.apiThreadCount = apiThreadCount;
Expand Down Expand Up @@ -94,19 +95,19 @@ public ScheduledExecutorService getScheduledExecutor() {
return scheduledExecutor;
}

private ExecutorService createExecutor(int nThreads) {
if (nThreads == 1) {
private ExecutorService createExecutor(int threadsNumber) {
if (threadsNumber == 1) {
return Executors.newSingleThreadExecutor();
} else {
return Executors.newFixedThreadPool(nThreads);
return Executors.newFixedThreadPool(threadsNumber);
}
}

private ScheduledExecutorService createScheduledExecutor(int nThreads) {
if (nThreads == 1) {
private ScheduledExecutorService createScheduledExecutor(int threadsNumber) {
if (threadsNumber == 1) {
return Executors.newSingleThreadScheduledExecutor();
} else {
return Executors.newScheduledThreadPool(nThreads);
return Executors.newScheduledThreadPool(threadsNumber);
}
}
}
Expand Up @@ -23,7 +23,8 @@
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

public class SingleThreadExecutorContext extends AbstractExecutorContext implements ExecutorContext {
public class SingleThreadExecutorContext extends AbstractExecutorContext implements
ExecutorContext {
private static final Logger LOG = LoggerFactory.getLogger(SingleThreadExecutorContext.class);

private ScheduledExecutorService singleThreadExecutor;
Expand Down
Expand Up @@ -98,8 +98,9 @@ public LogTransport getLogTransport() {
}

public void initTransports(KaaChannelManager channelManager, KaaClientState clientState) {
for (KaaTransport transport : Arrays.asList(bootstrapTransport, profileTransport, eventTransport, notificationTransport,
configurationTransport, userTransport, logTransport)) {
for (KaaTransport transport : Arrays.asList(bootstrapTransport, profileTransport,
eventTransport, notificationTransport, configurationTransport, userTransport,
logTransport)) {
transport.setChannelManager(channelManager);
transport.setClientState(clientState);
}
Expand Down
Expand Up @@ -32,11 +32,11 @@ public InputStream openForRead(String path) throws IOException {

@Override
public OutputStream openForWrite(String path) throws IOException {
File f = new File(path);
if (f.getParentFile() != null && !f.getParentFile().exists()) {
f.getParentFile().mkdirs();
File file = new File(path);
if (file.getParentFile() != null && !file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
return new FileOutputStream(f);
return new FileOutputStream(file);
}

@Override
Expand Down

0 comments on commit 2c88cb9

Please sign in to comment.