GitHub user GabrielBrascher reopened 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 code from ApiServer:** - com.cloud.api.ApiServer.getPluggableServices(): unused method; - 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.\<staticMethodName\> to \_apiServer.\<methodName\> 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 9ba72a500a141131ad5085028cc1a60b88a3dd0c Author: gabrascher <gabrasc...@hotmail.com> Date: 2015-12-20T11:38:04Z The goal of this PR is to review com.cloud.api.ApiServer class, with the following actions: Removed â_â in beginning of global variables names: Variables was changed from â_<variablename>â to â<variablename>â, as this convension (private veriables with â_â) is common in C++ but not in Java. Removed unused code from ApiServer: - com.cloud.api.ApiServer.getPluggableServices(): Unused method. - 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 accessible (âsetAccessible(true)â). Thus, there is no reason for handleAsyncJobPublishEvent be a private 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 springer), they were changed to non static. With that, calls from com.cloud.api.ApiServlet.ApiServlet() that used static methods from ApiServer, was changed from ApiServer.<staticMethodName> to _apiServer.<methodName> 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 included in the interface (org.apache.cloudstack.api.ApiServerService, interface implemented by class ApiServer). However, com.cloud.api.ApiServer.isEncodeApiResponse() was keept static, as its call hierarchy would have to be changed (more than planed for this PR). ---- --- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---