private void writeUpdates(JsonWriter jsonWriter, Collection<PluginUpdate> pluginUpdates) { jsonWriter.name(ARRAY_UPDATES).beginArray(); for (PluginUpdate pluginUpdate : ImmutableSortedSet.copyOf(PLUGIN_UPDATE_BY_VERSION_ORDERING, pluginUpdates)) { jsonWriter.beginObject(); pluginWSCommons.writeRelease(jsonWriter, pluginUpdate.getRelease()); pluginWSCommons.writeUpdateProperties(jsonWriter, pluginUpdate); jsonWriter.endObject(); } jsonWriter.endArray(); }
private void writePluginUpdateAggregate(JsonWriter jsonWriter, PluginUpdateAggregate aggregate) { jsonWriter.beginObject(); Plugin plugin = aggregate.getPlugin(); pluginWSCommons.writePlugin(jsonWriter, plugin); writeUpdates(jsonWriter, aggregate.getUpdates()); jsonWriter.endObject(); }
@Override public void handle(Request request, Response response) throws Exception { userSession.checkPermission(SYSTEM_ADMIN); JsonWriter jsonWriter = response.newJsonWriter(); jsonWriter.beginObject(); Optional<UpdateCenter> updateCenter = updateCenterMatrixFactory.getUpdateCenter(DO_NOT_FORCE_REFRESH); writePlugins(jsonWriter, updateCenter); pluginWSCommons.writeUpdateCenterProperties(jsonWriter, updateCenter); jsonWriter.endObject(); jsonWriter.close(); }