modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java
| 9 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/domain/CreateCBResourceRequest.java
| 56 ++++++++++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/domain/CreateCBRresourceRequest.java
| 56 ----------
3 files changed, 61 insertions(+), 60 deletions(-)
New commits:
commit 64286484fc7768e4bb4a956fb9aac09a448c715d
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Nov 1 16:17:48 2013 +0100
BZ 1025388 - wrap the result so it gets serialized to the correct media type.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java
index 5f9a91a..3480f3b 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java
@@ -104,7 +104,7 @@ import
org.rhq.enterprise.server.resource.ResourceFactoryManagerLocal;
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
import org.rhq.enterprise.server.rest.domain.AvailabilityRest;
import org.rhq.enterprise.server.rest.domain.AvailabilitySummary;
-import org.rhq.enterprise.server.rest.domain.CreateCBRresourceRequest;
+import org.rhq.enterprise.server.rest.domain.CreateCBResourceRequest;
import org.rhq.enterprise.server.rest.domain.Link;
import org.rhq.enterprise.server.rest.domain.MetricSchedule;
import org.rhq.enterprise.server.rest.domain.ResourceWithChildren;
@@ -728,7 +728,7 @@ public class ResourceHandlerBean extends AbstractRestBean {
notes= "If a handle is given, a content based resource is created; the
content identified by the handle is not removed from the content store." +
"If no handle is given, a resource is created from the data of the
passed 'resource' object.")
public Response createResource(
- @ApiParam("The info about the resource. You need to supply resource name,
resource type name, plugin name, id of the parent") CreateCBRresourceRequest
resource,
+ @ApiParam("The info about the resource. You need to supply resource name,
resource type name, plugin name, id of the parent") CreateCBResourceRequest
resource,
@ApiParam("A handle that identifies content that has been uploaded to the
server before.") @QueryParam("handle") String handle,
@Context HttpHeaders headers,
@Context UriInfo uriInfo) throws IOException
@@ -793,7 +793,7 @@ public class ResourceHandlerBean extends AbstractRestBean {
}
}
- private Response createContentBackedResource(CreateCBRresourceRequest request, String
handle, HttpHeaders headers, UriInfo uriInfo) throws IOException
+ private Response createContentBackedResource(CreateCBResourceRequest request, String
handle, HttpHeaders headers, UriInfo uriInfo) throws IOException
{
int parentId = request.getParentId();
String typeName = request.getTypeName();
@@ -927,7 +927,8 @@ public class ResourceHandlerBean extends AbstractRestBean {
}
else {
builder = Response.serverError();
- builder.entity(status + ": " + history.getErrorMessage());
+ StringValue errorMessage = new StringValue(status + ": " +
history.getErrorMessage());
+ builder.entity(errorMessage);
}
MediaType mediaType = headers.getAcceptableMediaTypes().get(0);
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/domain/CreateCBResourceRequest.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/domain/CreateCBResourceRequest.java
new file mode 100644
index 0000000..6357d4c
--- /dev/null
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/domain/CreateCBResourceRequest.java
@@ -0,0 +1,56 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2013 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+package org.rhq.enterprise.server.rest.domain;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.wordnik.swagger.annotations.ApiClass;
+import com.wordnik.swagger.annotations.ApiProperty;
+
+/**
+ * Request to create a content based resource
+ * @author Heiko W. Rupp
+ */
+@ApiClass("A request to create a content-based resource. For this to work, it is
required that the content to be deployed is already uploaded to the server.")
+public class CreateCBResourceRequest extends ResourceWithType {
+
+ Map<String,Object> pluginConfig = new HashMap<String, Object>();
+ Map<String,Object> resourceConfig = new HashMap<String, Object>();
+
+ @ApiProperty("The configuration of the connection properties")
+ public Map<String, Object> getPluginConfig() {
+ return pluginConfig;
+ }
+
+ public void setPluginConfig(Map<String, Object> pluginConfig) {
+ this.pluginConfig = pluginConfig;
+ }
+
+ @ApiProperty("The configuration of the resource to be created")
+ public Map<String, Object> getResourceConfig() {
+ return resourceConfig;
+ }
+
+ public void setResourceConfig(Map<String, Object> resourceConfig) {
+ this.resourceConfig = resourceConfig;
+ }
+
+}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/domain/CreateCBRresourceRequest.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/domain/CreateCBRresourceRequest.java
deleted file mode 100644
index aa1679a..0000000
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/domain/CreateCBRresourceRequest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2013 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
- */
-
-package org.rhq.enterprise.server.rest.domain;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import com.wordnik.swagger.annotations.ApiClass;
-import com.wordnik.swagger.annotations.ApiProperty;
-
-/**
- * Request to create a content based resource
- * @author Heiko W. Rupp
- */
-@ApiClass("A request to create a content-based resource. For this to work, it is
required that the content to be deployed is already uploaded to the server.")
-public class CreateCBRresourceRequest extends ResourceWithType {
-
- Map<String,Object> pluginConfig = new HashMap<String, Object>();
- Map<String,Object> resourceConfig = new HashMap<String, Object>();
-
- @ApiProperty("The configuration of the connection properties")
- public Map<String, Object> getPluginConfig() {
- return pluginConfig;
- }
-
- public void setPluginConfig(Map<String, Object> pluginConfig) {
- this.pluginConfig = pluginConfig;
- }
-
- @ApiProperty("The configuration of the resource to be created")
- public Map<String, Object> getResourceConfig() {
- return resourceConfig;
- }
-
- public void setResourceConfig(Map<String, Object> resourceConfig) {
- this.resourceConfig = resourceConfig;
- }
-
-}