[plugin] shorten plugin names
We can now simplify PluginHandle as `name` and `repo` are the same thing.
This commit is contained in:
parent
33e8fae824
commit
e19090b2ad
|
@ -163,7 +163,7 @@ public class PluginManager {
|
||||||
terminal.println("Failed: %s", ExceptionsHelper.detailedMessage(e));
|
terminal.println("Failed: %s", ExceptionsHelper.detailedMessage(e));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (PluginHandle.isOfficialPlugin(pluginHandle.repo, pluginHandle.user, pluginHandle.version)) {
|
if (PluginHandle.isOfficialPlugin(pluginHandle.name, pluginHandle.user, pluginHandle.version)) {
|
||||||
checkForOfficialPlugins(pluginHandle.name);
|
checkForOfficialPlugins(pluginHandle.name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -438,16 +438,14 @@ public class PluginManager {
|
||||||
*/
|
*/
|
||||||
static class PluginHandle {
|
static class PluginHandle {
|
||||||
|
|
||||||
final String name;
|
|
||||||
final String version;
|
final String version;
|
||||||
final String user;
|
final String user;
|
||||||
final String repo;
|
final String name;
|
||||||
|
|
||||||
PluginHandle(String name, String version, String user, String repo) {
|
PluginHandle(String name, String version, String user) {
|
||||||
this.name = name;
|
|
||||||
this.version = version;
|
this.version = version;
|
||||||
this.user = user;
|
this.user = user;
|
||||||
this.repo = repo;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<URL> urls() {
|
List<URL> urls() {
|
||||||
|
@ -457,24 +455,24 @@ public class PluginManager {
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
// TODO Update to https
|
// TODO Update to https
|
||||||
if (!Strings.isNullOrEmpty(System.getProperty(PROPERTY_SUPPORT_STAGING_URLS))) {
|
if (!Strings.isNullOrEmpty(System.getProperty(PROPERTY_SUPPORT_STAGING_URLS))) {
|
||||||
addUrl(urls, String.format(Locale.ROOT, "http://download.elastic.co/elasticsearch/staging/%s-%s/org/elasticsearch/plugin/%s/%s/%s-%s.zip", version, Build.CURRENT.hashShort(), repo, version, repo, version));
|
addUrl(urls, String.format(Locale.ROOT, "http://download.elastic.co/elasticsearch/staging/%s-%s/org/elasticsearch/plugin/%s/%s/%s-%s.zip", version, Build.CURRENT.hashShort(), name, version, name, version));
|
||||||
}
|
}
|
||||||
addUrl(urls, String.format(Locale.ROOT, "http://download.elastic.co/elasticsearch/release/org/elasticsearch/plugin/%s/%s/%s-%s.zip", repo, version, repo, version));
|
addUrl(urls, String.format(Locale.ROOT, "http://download.elastic.co/elasticsearch/release/org/elasticsearch/plugin/%s/%s/%s-%s.zip", name, version, name, version));
|
||||||
} else {
|
} else {
|
||||||
// Elasticsearch old download service
|
// Elasticsearch old download service
|
||||||
// TODO Update to https
|
// TODO Update to https
|
||||||
addUrl(urls, String.format(Locale.ROOT, "http://download.elastic.co/%1$s/%2$s/%2$s-%3$s.zip", user, repo, version));
|
addUrl(urls, String.format(Locale.ROOT, "http://download.elastic.co/%1$s/%2$s/%2$s-%3$s.zip", user, name, version));
|
||||||
// Maven central repository
|
// Maven central repository
|
||||||
addUrl(urls, String.format(Locale.ROOT, "http://search.maven.org/remotecontent?filepath=%1$s/%2$s/%3$s/%2$s-%3$s.zip", user.replace('.', '/'), repo, version));
|
addUrl(urls, String.format(Locale.ROOT, "http://search.maven.org/remotecontent?filepath=%1$s/%2$s/%3$s/%2$s-%3$s.zip", user.replace('.', '/'), name, version));
|
||||||
// Sonatype repository
|
// Sonatype repository
|
||||||
addUrl(urls, String.format(Locale.ROOT, "https://oss.sonatype.org/service/local/repositories/releases/content/%1$s/%2$s/%3$s/%2$s-%3$s.zip", user.replace('.', '/'), repo, version));
|
addUrl(urls, String.format(Locale.ROOT, "https://oss.sonatype.org/service/local/repositories/releases/content/%1$s/%2$s/%3$s/%2$s-%3$s.zip", user.replace('.', '/'), name, version));
|
||||||
// Github repository
|
// Github repository
|
||||||
addUrl(urls, String.format(Locale.ROOT, "https://github.com/%1$s/%2$s/archive/%3$s.zip", user, repo, version));
|
addUrl(urls, String.format(Locale.ROOT, "https://github.com/%1$s/%2$s/archive/%3$s.zip", user, name, version));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
// Github repository for master branch (assume site)
|
// Github repository for master branch (assume site)
|
||||||
addUrl(urls, String.format(Locale.ROOT, "https://github.com/%1$s/%2$s/archive/master.zip", user, repo));
|
addUrl(urls, String.format(Locale.ROOT, "https://github.com/%1$s/%2$s/archive/master.zip", user, name));
|
||||||
}
|
}
|
||||||
return urls;
|
return urls;
|
||||||
}
|
}
|
||||||
|
@ -527,10 +525,10 @@ public class PluginManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isOfficialPlugin(repo, user, version)) {
|
if (isOfficialPlugin(repo, user, version)) {
|
||||||
return new PluginHandle(repo, Version.CURRENT.number(), null, repo);
|
return new PluginHandle(repo, Version.CURRENT.number(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new PluginHandle(repo, version, user, repo);
|
return new PluginHandle(repo, version, user);
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean isOfficialPlugin(String repo, String user, String version) {
|
static boolean isOfficialPlugin(String repo, String user, String version) {
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class PluginManagerUnitTests extends ESTestCase {
|
||||||
.build();
|
.build();
|
||||||
Environment environment = new Environment(settings);
|
Environment environment = new Environment(settings);
|
||||||
|
|
||||||
PluginManager.PluginHandle pluginHandle = new PluginManager.PluginHandle(pluginName, "version", "user", "repo");
|
PluginManager.PluginHandle pluginHandle = new PluginManager.PluginHandle(pluginName, "version", "user");
|
||||||
String configDirPath = Files.simplifyPath(pluginHandle.configDir(environment).normalize().toString());
|
String configDirPath = Files.simplifyPath(pluginHandle.configDir(environment).normalize().toString());
|
||||||
String expectedDirPath = Files.simplifyPath(genericConfigFolder.resolve(pluginName).normalize().toString());
|
String expectedDirPath = Files.simplifyPath(genericConfigFolder.resolve(pluginName).normalize().toString());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue