From 6b2993edd97749616524a5f542fa27dbb4659025 Mon Sep 17 00:00:00 2001 From: Svetoslav Neykov Date: Thu, 24 Mar 2016 17:19:52 +0200 Subject: [PATCH] Improve rest API behaviour in Karaf * Use the correct json serializer * Make version files accessible * Fix collecting version info from bundles - array should be mutable --- .../main/java/org/apache/brooklyn/core/BrooklynVersion.java | 4 ++-- .../org/apache/brooklyn/rest/resources/ServerResource.java | 2 +- .../src/main/resources/OSGI-INF/blueprint/service.xml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/main/java/org/apache/brooklyn/core/BrooklynVersion.java b/core/src/main/java/org/apache/brooklyn/core/BrooklynVersion.java index 12d6889c8e..18bb96d552 100644 --- a/core/src/main/java/org/apache/brooklyn/core/BrooklynVersion.java +++ b/core/src/main/java/org/apache/brooklyn/core/BrooklynVersion.java @@ -23,7 +23,6 @@ import java.io.IOException; import java.io.InputStream; import java.net.URL; -import java.util.Arrays; import java.util.Dictionary; import java.util.Enumeration; import java.util.Hashtable; @@ -58,6 +57,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; import com.google.common.collect.Maps; /** @@ -299,7 +299,7 @@ public static BrooklynVersion getInstance() { */ public static Iterable getFeatures(ManagementContext mgmt) { if (OsgiUtil.isBrooklynInsideFramework()) { - List bundles = Arrays.asList( + List bundles = Lists.newArrayList( FrameworkUtil.getBundle(BrooklynVersion.class) .getBundleContext() .getBundles() diff --git a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ServerResource.java b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ServerResource.java index 3f06cc53d3..7cc5e97de8 100644 --- a/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ServerResource.java +++ b/rest/rest-resources/src/main/java/org/apache/brooklyn/rest/resources/ServerResource.java @@ -318,7 +318,7 @@ public VersionSummary getVersion() { // * "build-metadata.properties" is probably the wrong name // * we should include brooklyn.version and a build timestamp in this file // * the authority for brooklyn should probably be core rather than brooklyn-rest-server - InputStream input = ResourceUtils.create().getResourceFromUrl("classpath://build-metadata.properties"); + InputStream input = ResourceUtils.create(this).getResourceFromUrl("classpath://build-metadata.properties"); Properties properties = new Properties(); String gitSha1 = null, gitBranch = null; try { diff --git a/rest/rest-resources/src/main/resources/OSGI-INF/blueprint/service.xml b/rest/rest-resources/src/main/resources/OSGI-INF/blueprint/service.xml index 0c19c136c1..4355dc2162 100644 --- a/rest/rest-resources/src/main/resources/OSGI-INF/blueprint/service.xml +++ b/rest/rest-resources/src/main/resources/OSGI-INF/blueprint/service.xml @@ -122,7 +122,7 @@ limitations under the License. - +