Skip to content
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

Closed
wants to merge 4 commits into from

Conversation

dadoonet
Copy link
Member

@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 :)

nickminutello and others added 2 commits April 29, 2014 12:46
…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.
File pluginFile = distroFile();
File extractLocation = extractedDir();
ZipFile zipFile = null;
try {
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. Thanks.

@dadoonet
Copy link
Member Author

dadoonet commented May 7, 2014

Hey @pickypg!

Thanks for the review. I applied most of proposed changes. Looks better now.
Some changes are not applied here as they concern IMHO another issue.

Let me know what you think.

if (outputMode != OutputMode.SILENT) System.out.println(line);
}
}

private void debug(String line) {
Copy link
Member

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;
Copy link
Member

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.

@pickypg
Copy link
Member

pickypg commented May 8, 2014

@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.

@spinscale spinscale assigned spinscale and unassigned dadoonet May 12, 2014
@dadoonet dadoonet removed the v1.2.0 label May 12, 2014
@s1monw
Copy link
Contributor

s1monw commented Jun 12, 2014

@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?

@dadoonet dadoonet changed the title Update code after reviewing PR #5566 Expose a PluginManager.isPluginInstalled(String name) method Jun 12, 2014
@s1monw s1monw removed the review label Jun 18, 2014
@s1monw
Copy link
Contributor

s1monw commented Jun 18, 2014

ping?

@spinscale
Copy link
Contributor

@s1monw will do it today

@spinscale
Copy link
Contributor

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):

  • No need for several DownloadProgress impls, if you hand over the logger appropriately (also no need for the outputMode then, when the logger is created on startup
  • Unify the usage of the plugin class compared with a lot of File s being passed around.
  • Make the HttpDownloadHelper a bit more self-contained (quite a few arguments for downloading)

@dadoonet Is there a differente between /bin/plugin and /bin/plugin -v? Just setting -s seems to have an affect? Or is that some BWC option, we could drop in a major release?

@clintongormley
Copy link

@dadoonet ping?

@dadoonet
Copy link
Member Author

@spinscale -v is a DEBUG mode. So it adds lot of information.
-s is the exact opposite. It does not output anything. In that mode you could only rely on exit code.

If you don't set -v or -s you will get back some information while the plugin is installing, like progress bar and success message.

BTW, I'll look at your comments, update the PR and ping you again when ready. Thanks for the review so far!

@clintongormley
Copy link

@dadoonet any progress on this?

@clintongormley
Copy link

@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?

@clintongormley
Copy link

Chatted to @tlrx - this functionality is included in #9998, so closing this one.

@dadoonet dadoonet deleted the pr/5566-plugin-isinstalled branch August 18, 2015 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Plugins Plugin API and infrastructure >enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants