-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor handler method #158
Conversation
Signed-off-by: mloufra <[email protected]>
Signed-off-by: mloufra <[email protected]>
Signed-off-by: mloufra <[email protected]>
Signed-off-by: mloufra <[email protected]>
Signed-off-by: mloufra <[email protected]>
Signed-off-by: mloufra <[email protected]>
Signed-off-by: mloufra <[email protected]>
Signed-off-by: mloufra <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why so many variables were changed to static
, and suspect there's a better way to handle whatever challenge that was meant to address.
src/main/java/org/opensearch/sdk/handlers/ExtensionsRestRequestHandler.java
Outdated
Show resolved
Hide resolved
src/main/java/org/opensearch/sdk/handlers/OpensearchRequestHandler.java
Outdated
Show resolved
Hide resolved
Signed-off-by: mloufra <[email protected]>
Signed-off-by: mloufra <[email protected]>
Signed-off-by: mloufra <[email protected]>
Signed-off-by: mloufra <[email protected]>
Signed-off-by: mloufra <[email protected]>
Signed-off-by: mloufra <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #158 +/- ##
============================================
+ Coverage 63.69% 64.60% +0.90%
- Complexity 90 99 +9
============================================
Files 20 25 +5
Lines 482 500 +18
Branches 18 18
============================================
+ Hits 307 323 +16
- Misses 167 169 +2
Partials 8 8
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
…Handler Signed-off-by: mloufra <[email protected]>
src/main/java/org/opensearch/sdk/handlers/OpensearchRequestHandler.java
Outdated
Show resolved
Hide resolved
* @return A response to OpenSearch for the corresponding API | ||
* @throws Exception if the corresponding handler for the request is not present | ||
*/ | ||
public TransportResponse handleOpenSearchRequest(OpenSearchRequest request) throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a class for NamedWriteableRegistry
and not OpenSearchRequest
. Also, we don't need a switch case here. If/else can do the job.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It used to have a lot more cases before we refactored :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can keep this switch case here, it will easier for others adding more case in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good with the documentation comments noted!
src/main/java/org/opensearch/sdk/handlers/ExtensionsRestRequestHandler.java
Show resolved
Hide resolved
* @return A response to OpenSearch for the corresponding API | ||
* @throws Exception if the corresponding handler for the request is not present | ||
*/ | ||
public TransportResponse handleOpenSearchRequest(OpenSearchRequest request) throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It used to have a lot more cases before we refactored :-)
Signed-off-by: mloufra <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Any additional requests please put on the linked issue for the next round, so we can merge this. :)
* issue opensearch-project#28 Signed-off-by: mloufra <[email protected]> * Update the lastest coomit Signed-off-by: mloufra <[email protected]> * Rename the method and fix the conflict Signed-off-by: mloufra <[email protected]> * fix merge conflict Signed-off-by: mloufra <[email protected]> * Add code coverage report Signed-off-by: mloufra <[email protected]> * Rebase the lastest commit Signed-off-by: mloufra <[email protected]> * update the lastest commit Signed-off-by: mloufra <[email protected]> * refactor class for handler method in ExtensionsRunner Signed-off-by: mloufra <[email protected]> * add documentation for handler Signed-off-by: mloufra <[email protected]> * fix merge conflict Signed-off-by: mloufra <[email protected]> * delete all the static Signed-off-by: mloufra <[email protected]> * fix documentation problem Signed-off-by: mloufra <[email protected]> * fix NullPointerException bug Signed-off-by: mloufra <[email protected]> * change RestResponse to ExtensionRestResponse in ExtensionsRestRequestHandler Signed-off-by: mloufra <[email protected]> * change documentation for ExtensionsRunner Signed-off-by: mloufra <[email protected]> Signed-off-by: mloufra <[email protected]>
Description
Create the following five new classes to handle each handler method for refactoring the class in
ExtensionsRunner.java
.ExtensionsInitRequestHandler
handle methodhandleExtensionInitRequest
OpensearchRequestHandler
handle methodhandleOpenSearchRequest
ExtensionsIndicesModuleRequestHandler
handle methodhandleIndicesModuleRequest
ExtensionsIndicesModuleNameRequestHandler
handle methodhandleIndicesModuleNameRequest
ExtenionsRestRequestHandler
handle methodhandleRestExecuteOnExtensionRequest
Issues Resolved
#116
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.