diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2018-08-10 14:45:45 -0400 |
---|---|---|
committer | Pamela Dragosh <pdragosh@research.att.com> | 2018-08-13 10:17:19 -0400 |
commit | 269e543ba89dbf553fc66227f7123a302f56b5b4 (patch) | |
tree | b5ac0196770bc6669246953800dc832c6a1b3056 /policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http | |
parent | 637993a21e4826c36ac3dab256acf1510b824d82 (diff) |
Remove simple checkstyle
Mostly concentrated on the period at the end of summary.
But I did clear a few others for longer than 120 characters
and placement of methods next to each other. Possibly a few
others.
I did not clear everything, but will submit a few more
reviews to get the others.
Issue-ID: POLICY-881
Change-Id: I692a5349d686d52fee4040757cdc2ed8b5cc221b
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http')
6 files changed, 81 insertions, 68 deletions
diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/HttpClientFactory.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/HttpClientFactory.java index ee07d129..c002402d 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/HttpClientFactory.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/HttpClientFactory.java @@ -2,7 +2,7 @@ * ============LICENSE_START======================================================= * policy-endpoints * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,24 +34,24 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * Http Client Factory + * Http Client Factory. */ public interface HttpClientFactory { /** - * build and http client with the following parameters + * Build and http client with the following parameters. */ public HttpClient build(String name, boolean https, boolean selfSignedCerts, String hostname, int port, String baseUrl, String userName, String password, boolean managed) throws KeyManagementException, NoSuchAlgorithmException; /** - * build http client from properties + * Build http client from properties. */ public List<HttpClient> build(Properties properties) throws KeyManagementException, NoSuchAlgorithmException; /** - * get http client + * Get http client. * * @param name the name * @return the http client @@ -59,14 +59,14 @@ public interface HttpClientFactory { public HttpClient get(String name); /** - * list of http clients + * List of http clients. * * @return http clients */ public List<HttpClient> inventory(); /** - * destroy by name + * Destroy by name. * * @param name name */ @@ -77,12 +77,12 @@ public interface HttpClientFactory { /** - * http client factory implementation indexed by name + * HTTP client factory implementation indexed by name. */ class IndexedHttpClientFactory implements HttpClientFactory { /** - * Logger + * Logger. */ private static Logger logger = LoggerFactory.getLogger(IndexedHttpClientFactory.class); diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/internal/JerseyClient.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/internal/JerseyClient.java index d5e16117..0454e54b 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/internal/JerseyClient.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/client/internal/JerseyClient.java @@ -43,7 +43,7 @@ import org.slf4j.LoggerFactory; public class JerseyClient implements HttpClient { /** - * Logger + * Logger. */ private static Logger logger = LoggerFactory.getLogger(JerseyClient.class); diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/HttpServletServer.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/HttpServletServer.java index a2dd948a..1f008a8b 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/HttpServletServer.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/HttpServletServer.java @@ -23,24 +23,25 @@ package org.onap.policy.common.endpoints.http.server; import org.onap.policy.common.capabilities.Startable; /** - * Http Servlet Server interface + * Http Servlet Server interface. */ public interface HttpServletServer extends Startable { /** - * Factory of Http Servlet Servers + * Factory of Http Servlet Servers. */ HttpServletServerFactory factory = new IndexedHttpServletServerFactory(); /** + * Get the port. * * @return port */ int getPort(); /** - * enables basic authentication with user and password on the the relative path relativeUriPath + * Enables basic authentication with user and password on the the relative path relativeUriPath. * * @param user user * @param password password @@ -49,7 +50,7 @@ public interface HttpServletServer extends Startable { void setBasicAuthentication(String user, String password, String relativeUriPath); /** - * adds a filter at the specified path + * Adds a filter at the specified path. * * @param filterPath filter path * @param filterClass filter class @@ -57,7 +58,7 @@ public interface HttpServletServer extends Startable { void addFilterClass(String filterPath, String filterClass); /** - * adds a JAX-RS servlet class to serve REST requests + * Adds a JAX-RS servlet class to serve REST requests. * * @param servletPath servlet path * @param restClass JAX-RS API Class @@ -68,7 +69,7 @@ public interface HttpServletServer extends Startable { void addServletClass(String servletPath, String restClass); /** - * adds a package containing JAX-RS classes to serve REST requests + * Adds a package containing JAX-RS classes to serve REST requests. * * @param servletPath servlet path * @param restPackage JAX-RS package to scan @@ -79,7 +80,7 @@ public interface HttpServletServer extends Startable { void addServletPackage(String servletPath, String restPackage); /** - * blocking start of the http server + * Blocking start of the http server. * * @param maxWaitTime max time to wait for the start to take place * @return true if start was successful diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/HttpServletServerFactory.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/HttpServletServerFactory.java index 4a430b20..8d2953b6 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/HttpServletServerFactory.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/HttpServletServerFactory.java @@ -33,12 +33,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * Factory of HTTP Servlet-Enabled Servlets + * Factory of HTTP Servlet-Enabled Servlets. */ public interface HttpServletServerFactory { /** - * builds an http or https server with support for servlets + * Builds an http or https server with support for servlets. * * @param name name * @param https use secured http over tls connection @@ -54,7 +54,7 @@ public interface HttpServletServerFactory { boolean managed); /** - * builds an http server with support for servlets + * Builds an http server with support for servlets. * * @param name name * @param host binding host @@ -69,7 +69,7 @@ public interface HttpServletServerFactory { boolean managed); /** - * list of http servers per properties + * Build a list of http servers per properties. * * @param properties properties based configuration * @return list of http servers @@ -78,7 +78,7 @@ public interface HttpServletServerFactory { List<HttpServletServer> build(Properties properties); /** - * gets a server based on the port + * Gets a server based on the port. * * @param port port * @return http server @@ -86,45 +86,46 @@ public interface HttpServletServerFactory { HttpServletServer get(int port); /** - * provides an inventory of servers + * Provides an inventory of servers. * * @return inventory of servers */ List<HttpServletServer> inventory(); /** - * destroys server bound to a port + * Destroys server bound to a port. * - * @param port + * @param port the port the server is bound to */ void destroy(int port); /** - * destroys the factory and therefore all servers + * Destroys the factory and therefore all servers. */ void destroy(); } /** - * Indexed factory implementation + * Indexed factory implementation. */ class IndexedHttpServletServerFactory implements HttpServletServerFactory { private static final String SPACES_COMMA_SPACES = "\\s*,\\s*"; /** - * logger + * logger. */ protected static Logger logger = LoggerFactory.getLogger(IndexedHttpServletServerFactory.class); /** - * servers index + * servers index. */ protected HashMap<Integer, HttpServletServer> servers = new HashMap<>(); @Override - public synchronized HttpServletServer build(String name, boolean https, String host, int port, String contextPath, boolean swagger, + public synchronized HttpServletServer build(String name, boolean https, + String host, int port, String contextPath, boolean swagger, boolean managed) { if (servers.containsKey(port)) { diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyJerseyServer.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyJerseyServer.java index 9932d094..72013395 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyJerseyServer.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyJerseyServer.java @@ -30,78 +30,78 @@ import org.slf4j.LoggerFactory; import io.swagger.jersey.config.JerseyJaxrsConfig; /** - * REST Jetty Server that uses Jersey Servlets to support JAX-RS Web Services + * REST Jetty Server that uses Jersey Servlets to support JAX-RS Web Services. */ public class JettyJerseyServer extends JettyServletServer { /** - * Swagger API Base Path + * Swagger API Base Path. */ protected static final String SWAGGER_API_BASEPATH = "swagger.api.basepath"; /** - * Swagger Context ID + * Swagger Context ID. */ protected static final String SWAGGER_CONTEXT_ID = "swagger.context.id"; /** - * Swagger Scanner ID + * Swagger Scanner ID. */ protected static final String SWAGGER_SCANNER_ID = "swagger.scanner.id"; /** - * Swagger Pretty Print + * Swagger Pretty Print. */ protected static final String SWAGGER_PRETTY_PRINT = "swagger.pretty.print"; /** - * Swagger Packages + * Swagger Packages. */ protected static final String SWAGGER_INIT_PACKAGES_PARAM_VALUE = "io.swagger.jaxrs.listing"; /** - * Jersey Packages Init Param Name + * Jersey Packages Init Param Name. */ protected static final String JERSEY_INIT_PACKAGES_PARAM_NAME = "jersey.config.server.provider.packages"; /** - * Jersey Packages Init Param Value + * Jersey Packages Init Param Value. */ protected static final String JERSEY_INIT_PACKAGES_PARAM_VALUE = "com.fasterxml.jackson.jaxrs.json"; /** - * Jersey Classes Init Param Name + * Jersey Classes Init Param Name. */ protected static final String JERSEY_INIT_CLASSNAMES_PARAM_NAME = "jersey.config.server.provider.classnames"; /** - * Jersey Jackson Classes Init Param Value + * Jersey Jackson Classes Init Param Value. */ protected static final String JERSEY_JACKSON_INIT_CLASSNAMES_PARAM_VALUE = "com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider"; /** - * Jersey Swagger Classes Init Param Value + * Jersey Swagger Classes Init Param Value. */ protected static final String SWAGGER_INIT_CLASSNAMES_PARAM_VALUE = "io.swagger.jaxrs.listing.ApiListingResource," + "io.swagger.jaxrs.listing.SwaggerSerializers"; /** - * Logger + * Logger. */ protected static Logger logger = LoggerFactory.getLogger(JettyJerseyServer.class); /** - * Container for servlets + * Container for servlets. */ protected HashMap<String, ServletHolder> servlets = new HashMap<>(); /** - * Swagger ID + * Swagger ID. */ protected String swaggerId = null; /** - * Constructor + * Constructor. * * @param name name * @param https enable https? @@ -122,7 +122,7 @@ public class JettyJerseyServer extends JettyServletServer { } /** - * attaches a swagger initialization servlet + * Attaches a swagger initialization servlet. */ protected void attachSwaggerServlet(boolean https) { @@ -146,7 +146,7 @@ public class JettyJerseyServer extends JettyServletServer { } /** - * retrieves cached server based on servlet path + * Retrieves cached server based on servlet path. * * @param servletPath servlet path * @return the jetty servlet holder diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java index b22a9401..b866a81e 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/http/server/internal/JettyServletServer.java @@ -43,12 +43,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * Http Server implementation using Embedded Jetty + * Http Server implementation using Embedded Jetty. */ public abstract class JettyServletServer implements HttpServletServer, Runnable { /** - * Keystore/Truststore system property names + * Keystore/Truststore system property names. */ public static final String SYSTEM_KEYSTORE_PROPERTY_NAME = "javax.net.ssl.keyStore"; public static final String SYSTEM_KEYSTORE_PASSWORD_PROPERTY_NAME = "javax.net.ssl.keyStorePassword"; @@ -56,67 +56,67 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable public static final String SYSTEM_TRUSTSTORE_PASSWORD_PROPERTY_NAME = "javax.net.ssl.trustStorePassword"; /** - * Logger + * Logger. */ private static Logger logger = LoggerFactory.getLogger(JettyServletServer.class); /** - * server name + * Server name. */ protected final String name; /** - * server host address + * Server host address. */ protected final String host; /** - * server port to bind + * Server port to bind. */ protected final int port; /** - * server auth user name + * Server auth user name. */ protected String user; /** - * server auth password name + * Server auth password name. */ protected String password; /** - * server base context path + * Server base context path. */ protected final String contextPath; /** - * embedded jetty server + * Embedded jetty server. */ protected final Server jettyServer; /** - * servlet context + * Servlet context. */ protected final ServletContextHandler context; /** - * jetty connector + * Jetty connector. */ protected final ServerConnector connector; /** - * jetty thread + * Jetty thread. */ protected volatile Thread jettyThread; /** - * start condition + * Start condition. */ protected Object startCondition = new Object(); /** - * constructor + * Constructor. * * @param name server name * @param host server host @@ -159,11 +159,12 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable this.jettyServer = new Server(); this.jettyServer.setRequestLog(new Slf4jRequestLog()); - if (https) + if (https) { this.connector = httpsConnector(); - else + } else { this.connector = httpConnector(); - + } + this.connector.setName(srvName); this.connector.setReuseAddress(true); this.connector.setPort(port); @@ -200,8 +201,9 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable sslContextFactory.setKeyStorePath(keyStore); String ksPassword = System.getProperty(SYSTEM_KEYSTORE_PASSWORD_PROPERTY_NAME); - if (ksPassword != null) + if (ksPassword != null) { sslContextFactory.setKeyStorePassword(ksPassword); + } } String trustStore = System.getProperty(SYSTEM_TRUSTSTORE_PROPERTY_NAME); @@ -209,8 +211,9 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable sslContextFactory.setTrustStorePath(trustStore); String tsPassword = System.getProperty(SYSTEM_TRUSTSTORE_PASSWORD_PROPERTY_NAME); - if (tsPassword != null) + if (tsPassword != null) { sslContextFactory.setTrustStorePassword(tsPassword); + } } HttpConfiguration https = new HttpConfiguration(); @@ -261,7 +264,7 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable } /** - * jetty server execution + * jetty server execution. */ @Override public void run() { @@ -425,6 +428,8 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable } /** + * Get name. + * * @return the name */ public String getName() { @@ -432,6 +437,8 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable } /** + * Get host. + * * @return the host */ public String getHost() { @@ -439,6 +446,8 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable } /** + * Get user. + * * @return the user */ public String getUser() { @@ -446,6 +455,8 @@ public abstract class JettyServletServer implements HttpServletServer, Runnable } /** + * Get password. + * * @return the password */ @JsonIgnore |