diff options
author | Godin <mandrikov@gmail.com> | 2010-11-01 16:12:30 +0000 |
---|---|---|
committer | Godin <mandrikov@gmail.com> | 2010-11-01 16:12:30 +0000 |
commit | 4d5ed597d80f8e0a070b52e1c673d14e3597e9e8 (patch) | |
tree | 4f1cf7237b19f47ef50991093e3c1fe47edce2f3 /sonar-ws-client/src/main/java | |
parent | d4d455365c5d08ede8c5b5c81b8afbb57e70ffb5 (diff) | |
download | sonarqube-4d5ed597d80f8e0a070b52e1c673d14e3597e9e8.tar.gz sonarqube-4d5ed597d80f8e0a070b52e1c673d14e3597e9e8.zip |
SONAR-1897: Add web service to get information about installed plugins
Diffstat (limited to 'sonar-ws-client/src/main/java')
4 files changed, 78 insertions, 0 deletions
diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Plugin.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Plugin.java new file mode 100644 index 00000000000..ce8d4c7e499 --- /dev/null +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/Plugin.java @@ -0,0 +1,39 @@ +package org.sonar.wsclient.services; + +/** + * @since 2.4 + */ +public class Plugin extends Model { + + private String key; + private String name; + private String version; + + public String getKey() { + return key; + } + + public Plugin setKey(String key) { + this.key = key; + return this; + } + + public String getName() { + return name; + } + + public Plugin setName(String name) { + this.name = name; + return this; + } + + public String getVersion() { + return version; + } + + public Plugin setVersion(String version) { + this.version = version; + return this; + } + +} diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/services/PluginQuery.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/PluginQuery.java new file mode 100644 index 00000000000..6ba030cf03c --- /dev/null +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/services/PluginQuery.java @@ -0,0 +1,19 @@ +package org.sonar.wsclient.services; + +/** + * @since 2.4 + */ +public class PluginQuery extends Query<Plugin> { + + public static final String BASE_URL = "/api/plugins"; + + @Override + public Class<Plugin> getModelClass() { + return Plugin.class; + } + + @Override + public String getUrl() { + return BASE_URL; + } +} diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/PluginUnmarshaller.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/PluginUnmarshaller.java new file mode 100644 index 00000000000..29d785f485e --- /dev/null +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/PluginUnmarshaller.java @@ -0,0 +1,19 @@ +package org.sonar.wsclient.unmarshallers; + +import org.json.simple.JSONObject; +import org.sonar.wsclient.services.Plugin; + +/** + * @since 2.4 + */ +public class PluginUnmarshaller extends AbstractUnmarshaller<Plugin> { + + @Override + protected Plugin parse(JSONObject json) { + return new Plugin() + .setKey(JsonUtils.getString(json, "key")) + .setName(JsonUtils.getString(json, "name")) + .setVersion(JsonUtils.getString(json, "version")); + } + +} diff --git a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java index 3523f1ce836..35f1f31ed58 100644 --- a/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java +++ b/sonar-ws-client/src/main/java/org/sonar/wsclient/unmarshallers/Unmarshallers.java @@ -42,6 +42,7 @@ public final class Unmarshallers { unmarshallers.put(DependencyTree.class, new DependencyTreeUnmarshaller()); unmarshallers.put(Event.class, new EventUnmarshaller()); unmarshallers.put(Favourite.class, new FavouriteUnmarshaller()); + unmarshallers.put(Plugin.class, new PluginUnmarshaller()); } public static <MODEL extends Model> Unmarshaller<MODEL> forModel(Class<MODEL> modelClass) { |