Return-Path: X-Original-To: apmail-cloudstack-dev-archive@www.apache.org Delivered-To: apmail-cloudstack-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 63FE518D9E for ; Sun, 20 Dec 2015 13:55:57 +0000 (UTC) Received: (qmail 70921 invoked by uid 500); 20 Dec 2015 13:55:56 -0000 Delivered-To: apmail-cloudstack-dev-archive@cloudstack.apache.org Received: (qmail 70866 invoked by uid 500); 20 Dec 2015 13:55:56 -0000 Mailing-List: contact dev-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list dev@cloudstack.apache.org Received: (qmail 70855 invoked by uid 99); 20 Dec 2015 13:55:56 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 20 Dec 2015 13:55:56 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5FA98DFF70; Sun, 20 Dec 2015 13:55:56 +0000 (UTC) From: GabrielBrascher To: dev@cloudstack.apache.org Reply-To: dev@cloudstack.apache.org Message-ID: Subject: [GitHub] cloudstack pull request: Removed unused code from com.cloud.api.Ap... Content-Type: text/plain Date: Sun, 20 Dec 2015 13:55:56 +0000 (UTC) GitHub user GabrielBrascher opened a pull request: https://github.com/apache/cloudstack/pull/1263 Removed unused code from com.cloud.api.ApiServer **Removed “\_” from variables names**: private variables with “\_” at the beginning is common in C++ but not in Java. **Removed unused methods from ApiServer:** - com.cloud.api.ApiServer.setPluggableServices(List\): this method can be removed and replaced by the annotation @Inject in the variable pluggableServices; - com.cloud.api.ApiServer.getPluggableServices(): unused method; - com.cloud.api.ApiServer.setApiAccessCheckers(List\): can be replaced by the @Inject in the variable apiAccessCheckers; - com.cloud.api.ApiServer.getApiAccessCheckers(): unused method. **Methods and variables access level reviewed:** - com.cloud.api.ApiServer.handleAsyncJobPublishEvent(String, String ,Object): this method was private but the annotation @MessageHandler requests public methods, as can be seen in org.apache.cloudstack.framework.messagebus.MessageDispatcher.buildHandlerMethodCache(Class\), which searches methods with the @MessageHandler annotation and changes it to be accessible (“setAccessible(true)”). Thus, there is no reason for handleAsyncJobPublishEvent be a private method and lead some other dev to wrong conclusions about the use of the method; - Global variables and methods called just by this class (ApiServer) were changed to private. **Changed variables and methods from static to non-static (if possible):** as some variables/methods are used just by one object of this class, instantiated by Spring, they were changed to non-static. With that, calls from com.cloud.api.ApiServlet.ApiServlet() that used static methods from ApiServer, were changed from ApiServer.\ to \_apiServer.\ that refers to the org.apache.cloudstack.api.ApiServerService interface. Thus, methods com.cloud.api.ApiServer.getJSONContentType() and com.cloud.api.ApiServer.isSecureSessionCookieEnabled() had to be added in the interface (org.apache.cloudstack.api.ApiServerService, interface implemented by class ApiServer). You can merge this pull request into a Git repository by running: $ git pull https://github.com/rafaelweingartner/cloudstack lrg-cs-hackday-018 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/cloudstack/pull/1263.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1263 ---- commit b8b09e7abf9c318d774d5dadd3663e2d79107f21 Author: gabrascher Date: 2015-12-20T11:38:04Z Removed unused code from com.cloud.api.ApiServer Removed “_” from variables names, private variables with “_” at the beginning is common in C++ but not in Java. Removed unused methods from ApiServer: - com.cloud.api.ApiServer.setPluggableServices(List): This method can be removed and replaced by the annotation @Inject in the variable pluggableServices (before _pluggableServices. - com.cloud.api.ApiServer.getPluggableServices(): Unused method. - com.cloud.api.ApiServer.setApiAccessCheckers(List): Can be replaced by the @Inject in the variable apiAccessCheckers (before _apiAccessCheckers). - com.cloud.api.ApiServer.getApiAccessCheckers(): Unused method. Methods and variables access level reviewed: - com.cloud.api.ApiServer.handleAsyncJobPublishEvent(String, String, Object): This method was private but the annotation @MessageHandler requests public methods, as can be seen in org.apache.cloudstack.framework.messagebus.MessageDispatcher.buildHandlerMethodCache(Class), which searches methods with the @MessageHandler annotation and changes it to be accessible (“setAccessible(true)”). Thus, there is no reason for handleAsyncJobPublishEvent be a private method and lead some other dev to wrong conclusions about the use of the method. - Global variables and methods called just by this class (ApiServer) were changed to private. Changed variables and methods from static to non-static (if possible): As some variables/methods are used just by one object of this class, instantiated by Spring, they were changed to non-static. With that, calls from com.cloud.api.ApiServlet.ApiServlet() that used static methods from ApiServer, were changed from ApiServer. to _apiServer. that refers to the org.apache.cloudstack.api.ApiServerService interface. Thus, methods com.cloud.api.ApiServer.getJSONContentType() and com.cloud.api.ApiServer.isSecureSessionCookieEnabled() had to be added in the interface (org.apache.cloudstack.api.ApiServerService, interface implemented by class ApiServer). ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---