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
Expose a PluginManager.isPluginInstalled(String name) method #5977
Conversation
…ier embedded use Exposed a PluginManager.isPluginInstalled(String name) method to make it a bit cleaner using the PluginManager embedded (when running elastic embedded). Did a bit of a refactor to reduce some duplication (that the above change introduced - and little bit of existing). Not sure if it was intentional - but there was a bit of mixed usage of IllegalArgumentException and ElasticsearchIllegalArgumentException - so I standardised on ElasticsearchIllegalArgumentException. There was also some validation on the name when removing a plugin - that is worthwhile having when installing a plugin - so I made that common. Closes elastic#5565.
After reviewing elastic#5566. Closes elastic#5565. Closes elastic#5566.
File pluginFile = distroFile(); | ||
File extractLocation = extractedDir(); | ||
ZipFile zipFile = null; | ||
try { |
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.
Can change this to the new autoclose functionality in Java 7 now that the codebase is on it:
try (ZipFile zipFile = new ZipFile(pluginFile)) {
// ...
}
catch (Exception e) {
// ...
}
Thereby dropping the entire zipFile
-related code from within the finally
block.
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.
Agreed. Thanks.
Hey @pickypg! Thanks for the review. I applied most of proposed changes. Looks better now. Let me know what you think. |
if (outputMode != OutputMode.SILENT) System.out.println(line); | ||
} | ||
} | ||
|
||
private void debug(String line) { |
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.
Helper method is no longer needed now that Logger.debug
exists.
@@ -69,6 +69,7 @@ | |||
|
|||
private String url; | |||
private OutputMode outputMode; | |||
private Logger logger; |
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.
Should probably make these final
where possible.
@dadoonet LGTM. It makes sense that those comments will not be addressed here. I have some other really minor comments that should just help you drop a few lines of code and keep it tidier. |
Use final attributes
@dadoonet can you update the PR title it's very hard to tell what this is about? @spinscale are you going to review this, can I remove the review tag? |
ping? |
@s1monw will do it today |
First: Please adapt the forbidden API config, so this compiles with maven again. The change itself LGTM, but I am still in favor of a bigger refactorting of the PluginManager, which IMO needs some cleanup (can be done after this got in of course):
@dadoonet Is there a differente between |
@dadoonet ping? |
@spinscale If you don't set BTW, I'll look at your comments, update the PR and ping you again when ready. Thanks for the review so far! |
@dadoonet any progress on this? |
@tlrx this PR is over a year old. Does your plugin work already cover a check for whether a plugin is installed or not? Can we close this PR? |
@nickminutello did a nice work to expose
isInstalled(String)
method in PR #5566.After reviewing it, I made the
Plugin
class static.This changes needs also to be reviewed :)