You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@knox.apache.org by kr...@apache.org on 2020/04/10 17:36:46 UTC

[knox] branch master updated: Minor javadoc fixes

This is an automated email from the ASF dual-hosted git repository.

krisden pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/knox.git


The following commit(s) were added to refs/heads/master by this push:
     new 7a93dd4  Minor javadoc fixes
7a93dd4 is described below

commit 7a93dd4037477585607057f6a632163448eb564a
Author: Kevin Risden <kr...@apache.org>
AuthorDate: Fri Apr 10 13:35:59 2020 -0400

    Minor javadoc fixes
    
    Signed-off-by: Kevin Risden <kr...@apache.org>
---
 .../model/cm/ClouderaManagerAPIServiceModelGenerator.java   | 12 ++++++------
 .../services/token/impl/DefaultTokenStateService.java       |  8 ++++----
 .../org/apache/knox/gateway/util/TopologyToDescriptor.java  |  7 +++++++
 .../gateway/service/knoxtoken/TokenServiceResourceTest.java |  4 +---
 .../gateway/services/security/token/TokenStateService.java  | 13 ++++++++++++-
 .../knox/gateway/services/topology/TopologyService.java     |  4 ++--
 6 files changed, 32 insertions(+), 16 deletions(-)

diff --git a/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/model/cm/ClouderaManagerAPIServiceModelGenerator.java b/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/model/cm/ClouderaManagerAPIServiceModelGenerator.java
index 0978362..49559f0 100644
--- a/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/model/cm/ClouderaManagerAPIServiceModelGenerator.java
+++ b/gateway-discovery-cm/src/main/java/org/apache/knox/gateway/topology/discovery/cm/model/cm/ClouderaManagerAPIServiceModelGenerator.java
@@ -62,12 +62,12 @@ public class ClouderaManagerAPIServiceModelGenerator
    * discovery client and uses the CM url used by the driver (which was
    * populated by the descriptor).
    *
-   * @param service
-   * @param serviceConfig
-   * @param role
-   * @param roleConfig
-   * @return
-   * @throws ApiException
+   * @param service Service.
+   * @param serviceConfig Service config.
+   * @param role Role.
+   * @param roleConfig Role config.
+   * @return ServiceModel for given service and role.
+   * @throws ApiException Exception interacting with CM.
    */
   @Override
   public ServiceModel generateService(ApiService service,
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/services/token/impl/DefaultTokenStateService.java b/gateway-server/src/main/java/org/apache/knox/gateway/services/token/impl/DefaultTokenStateService.java
index aad7b99..575213c 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/services/token/impl/DefaultTokenStateService.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/services/token/impl/DefaultTokenStateService.java
@@ -26,13 +26,13 @@ import org.apache.knox.gateway.services.security.token.impl.JWT;
 import org.apache.knox.gateway.services.security.token.impl.JWTToken;
 
 import java.time.Instant;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
-import java.util.stream.Collectors;
 
 /**
  * In-Memory authentication token state management implementation.
@@ -311,6 +311,7 @@ public class DefaultTokenStateService implements TokenStateService {
    * Method that checks if a token's state is a candidate for eviction.
    *
    * @param tokenId A unique token identifier
+   * @throws UnknownTokenException Exception if token is not found.
    *
    * @return true, if the associated token state can be evicted; Otherwise, false.
    */
@@ -325,10 +326,9 @@ public class DefaultTokenStateService implements TokenStateService {
   /**
    * Get a list of tokens
    *
-   * @return
+   * @return List of tokens
    */
   protected List<String> getTokens() {
-    return tokenExpirations.keySet().stream().collect(Collectors.toList());
+    return new ArrayList<>(tokenExpirations.keySet());
   }
-
 }
diff --git a/gateway-server/src/main/java/org/apache/knox/gateway/util/TopologyToDescriptor.java b/gateway-server/src/main/java/org/apache/knox/gateway/util/TopologyToDescriptor.java
index 852d937..3166901 100644
--- a/gateway-server/src/main/java/org/apache/knox/gateway/util/TopologyToDescriptor.java
+++ b/gateway-server/src/main/java/org/apache/knox/gateway/util/TopologyToDescriptor.java
@@ -118,6 +118,9 @@ public class TopologyToDescriptor {
 
   /**
    * Validate topology
+   *
+   * @throws IOException Exception on validating file.
+   * @throws SAXException Exception on parsing XML.
    */
   public void validate() throws IOException, SAXException {
     validateTopology(SCHEMA_FILE, topologyPath);
@@ -125,6 +128,10 @@ public class TopologyToDescriptor {
 
   /**
    * Convert topology to provider and descriptor
+   *
+   * @throws IOException Exception on validating file.
+   * @throws JAXBException Exception on parsing XML.
+   * @throws SAXException Exception on parsing XML.
    */
   public void convert() throws IOException, JAXBException, SAXException {
     final Topology topology = parseTopology(SCHEMA_FILE, topologyPath);
diff --git a/gateway-service-knoxtoken/src/test/java/org/apache/knox/gateway/service/knoxtoken/TokenServiceResourceTest.java b/gateway-service-knoxtoken/src/test/java/org/apache/knox/gateway/service/knoxtoken/TokenServiceResourceTest.java
index 7b9a82e..e10459b 100644
--- a/gateway-service-knoxtoken/src/test/java/org/apache/knox/gateway/service/knoxtoken/TokenServiceResourceTest.java
+++ b/gateway-service-knoxtoken/src/test/java/org/apache/knox/gateway/service/knoxtoken/TokenServiceResourceTest.java
@@ -158,9 +158,7 @@ public class TokenServiceResourceTest {
     assertTrue(authority.verifyToken(parsedToken));
   }
 
-  /**
-   * KNOX-2266
-   */
+  // KNOX-2266
   @Test
   public void testConcurrentGetToken() throws Exception {
 
diff --git a/gateway-spi/src/main/java/org/apache/knox/gateway/services/security/token/TokenStateService.java b/gateway-spi/src/main/java/org/apache/knox/gateway/services/security/token/TokenStateService.java
index 533cf9d..d89607c 100644
--- a/gateway-spi/src/main/java/org/apache/knox/gateway/services/security/token/TokenStateService.java
+++ b/gateway-spi/src/main/java/org/apache/knox/gateway/services/security/token/TokenStateService.java
@@ -66,8 +66,10 @@ public interface TokenStateService extends Service {
   void addToken(String tokenId, long issueTime, long expiration, long maxLifetimeDuration);
 
   /**
+   * Checks if the token is expired.
    *
    * @param token The token.
+   * @throws UnknownTokenException Exception if token is not found.
    *
    * @return true, if the token has expired; Otherwise, false.
    */
@@ -77,6 +79,7 @@ public interface TokenStateService extends Service {
    * Disable any subsequent use of the specified token.
    *
    * @param token The token.
+   * @throws UnknownTokenException Exception if token is not found.
    */
   void revokeToken(JWTToken token) throws UnknownTokenException;
 
@@ -84,6 +87,7 @@ public interface TokenStateService extends Service {
    * Disable any subsequent use of the specified token.
    *
    * @param tokenId The token unique identifier.
+   * @throws UnknownTokenException Exception if token is not found.
    */
   void revokeToken(String tokenId) throws UnknownTokenException;
 
@@ -91,6 +95,7 @@ public interface TokenStateService extends Service {
    * Extend the lifetime of the specified token by the default amount of time.
    *
    * @param token The token.
+   * @throws UnknownTokenException Exception if token is not found.
    *
    * @return The token's updated expiration time in milliseconds.
    */
@@ -101,6 +106,7 @@ public interface TokenStateService extends Service {
    *
    * @param token The token.
    * @param renewInterval The amount of time that should be added to the token's lifetime.
+   * @throws UnknownTokenException Exception if token is not found.
    *
    * @return The token's updated expiration time in milliseconds.
    */
@@ -110,6 +116,7 @@ public interface TokenStateService extends Service {
    * Extend the lifetime of the specified token by the default amount of time.
    *
    * @param tokenId The token unique identifier.
+   * @throws UnknownTokenException Exception if token is not found.
    *
    * @return The token's updated expiration time in milliseconds.
    */
@@ -120,25 +127,29 @@ public interface TokenStateService extends Service {
    *
    * @param tokenId The token unique identifier.
    * @param renewInterval The amount of time that should be added to the token's lifetime.
+   * @throws UnknownTokenException Exception if token is not found.
    *
    * @return The token's updated expiration time in milliseconds.
    */
   long renewToken(String tokenId, long renewInterval) throws UnknownTokenException;
 
   /**
+   * Get the token expiration.
    *
    * @param token The token.
+   * @throws UnknownTokenException Exception if token is not found.
    *
    * @return The token's expiration time in milliseconds.
    */
   long getTokenExpiration(JWT token) throws UnknownTokenException;
 
   /**
+   * Get the token expiration.
    *
    * @param tokenId The token unique identifier.
+   * @throws UnknownTokenException Exception if token is not found.
    *
    * @return The token's expiration time in milliseconds.
    */
   long getTokenExpiration(String tokenId) throws UnknownTokenException;
-
 }
diff --git a/gateway-spi/src/main/java/org/apache/knox/gateway/services/topology/TopologyService.java b/gateway-spi/src/main/java/org/apache/knox/gateway/services/topology/TopologyService.java
index c700014..12c3220 100644
--- a/gateway-spi/src/main/java/org/apache/knox/gateway/services/topology/TopologyService.java
+++ b/gateway-spi/src/main/java/org/apache/knox/gateway/services/topology/TopologyService.java
@@ -73,8 +73,8 @@ public interface TopologyService extends Service, ServiceDefinitionChangeListene
    *
    * @return A Topology object based on the specified content.
    *
-   * @throws IOException
-   * @throws SAXException
+   * @throws IOException Exception thrown parsing input stream.
+   * @throws SAXException Exception thrown parsing xml.
    */
   Topology parse(InputStream content) throws IOException, SAXException;