Juan Hernandez has uploaded a new change for review.

Change subject: restapi: Remove ReadOnlyResources interface
......................................................................

restapi: Remove ReadOnlyResources interface

The presence of this interface induces errors in the RSDL generator. In
particular the type of the disk snapshots collection is reported as
"BaseResource" instead of "DiskSnapshot", which causes additional issues
in the consumers of the RSDL, including the generators of the Python and
Java SDKs. To avoid this issue this patch removes completely that
interface.

Change-Id: Id449ea7bb88f7acae0a3b536aa2d45e1ddbeb48e
Bug-Url: https://bugzilla.redhat.com/??????
Signed-off-by: Juan Hernandez <[email protected]>
---
M 
backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/DiskSnapshotResource.java
M 
backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/DiskSnapshotsResource.java
M 
backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/HostNumaNodeResource.java
M 
backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/ImageResource.java
M 
backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/ImagesResource.java
D 
backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/ReadOnlyResource.java
D 
backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/ReadOnlyResources.java
7 files changed, 22 insertions(+), 82 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/55/37755/1

diff --git 
a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/DiskSnapshotResource.java
 
b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/DiskSnapshotResource.java
index 7c6cdf0..87bec06 100644
--- 
a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/DiskSnapshotResource.java
+++ 
b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/DiskSnapshotResource.java
@@ -21,10 +21,9 @@
 import javax.ws.rs.Produces;
 
 @Produces({ApiMediaType.APPLICATION_XML, ApiMediaType.APPLICATION_JSON, 
ApiMediaType.APPLICATION_X_YAML})
-public interface DiskSnapshotResource extends ReadOnlyResource<DiskSnapshot> {
+public interface DiskSnapshotResource {
 
     @GET
-    @Override
     public DiskSnapshot get();
 
 }
diff --git 
a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/DiskSnapshotsResource.java
 
b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/DiskSnapshotsResource.java
index e5e6c60..7ca9f5b 100644
--- 
a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/DiskSnapshotsResource.java
+++ 
b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/DiskSnapshotsResource.java
@@ -1,17 +1,23 @@
 package org.ovirt.engine.api.resource;
 
 import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.Response;
 
-import org.ovirt.engine.api.model.DiskSnapshot;
 import org.ovirt.engine.api.model.DiskSnapshots;
 
 @Path("/disksnapshots")
 @Produces({ApiMediaType.APPLICATION_XML, ApiMediaType.APPLICATION_JSON, 
ApiMediaType.APPLICATION_X_YAML})
-public interface DiskSnapshotsResource extends ReadOnlyResources<DiskSnapshot, 
DiskSnapshots> {
+public interface DiskSnapshotsResource {
+
+    @GET
+    public DiskSnapshots list();
+
+    @Path("{id}")
+    public DiskSnapshotResource getDeviceSubResource(@PathParam("id") String 
id);
 
     @DELETE
     @Path("{id}")
diff --git 
a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/HostNumaNodeResource.java
 
b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/HostNumaNodeResource.java
index 130f10c..66dda0d 100644
--- 
a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/HostNumaNodeResource.java
+++ 
b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/HostNumaNodeResource.java
@@ -6,7 +6,7 @@
 import org.ovirt.engine.api.model.NumaNode;
 
 @Produces({ApiMediaType.APPLICATION_XML, ApiMediaType.APPLICATION_JSON, 
ApiMediaType.APPLICATION_X_YAML})
-public interface HostNumaNodeResource extends ReadOnlyResource<NumaNode>, 
MeasurableResource {
+public interface HostNumaNodeResource extends MeasurableResource {
 
     @GET
     public NumaNode get();
diff --git 
a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/ImageResource.java
 
b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/ImageResource.java
index f829111..fc2f4f7 100644
--- 
a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/ImageResource.java
+++ 
b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/ImageResource.java
@@ -20,6 +20,7 @@
 import org.ovirt.engine.api.model.Image;
 
 import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
 import javax.ws.rs.POST;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
@@ -27,7 +28,10 @@
 import javax.ws.rs.core.Response;
 
 @Produces({ApiMediaType.APPLICATION_XML, ApiMediaType.APPLICATION_JSON, 
ApiMediaType.APPLICATION_X_YAML})
-public interface ImageResource extends ReadOnlyResource<Image> {
+public interface ImageResource {
+
+    @GET
+    public Image get();
 
     @Path("{action: (import)}/{oid}")
     public ActionResource getActionSubresource(@PathParam("action") String 
action, @PathParam("oid") String oid);
diff --git 
a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/ImagesResource.java
 
b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/ImagesResource.java
index 0f33cf7..735f970 100644
--- 
a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/ImagesResource.java
+++ 
b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/ImagesResource.java
@@ -1,18 +1,20 @@
 package org.ovirt.engine.api.resource;
 
+import javax.ws.rs.GET;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
 
-import org.ovirt.engine.api.model.Image;
 import org.ovirt.engine.api.model.Images;
 
 @Path("/images")
 @Produces({ApiMediaType.APPLICATION_XML, ApiMediaType.APPLICATION_JSON, 
ApiMediaType.APPLICATION_X_YAML})
-public interface ImagesResource extends ReadOnlyResources<Image, Images> {
+public interface ImagesResource {
 
-    @Path("{identity}")
-    @Override
-    public ImageResource getDeviceSubResource(@PathParam("identity") String 
id);
+    @GET
+    public Images list();
+
+    @Path("{id}")
+    public ImageResource getDeviceSubResource(@PathParam("id") String id);
 
 }
diff --git 
a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/ReadOnlyResource.java
 
b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/ReadOnlyResource.java
deleted file mode 100644
index 59693e3..0000000
--- 
a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/ReadOnlyResource.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
-* Copyright (c) 2013 Red Hat, Inc.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*           http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-package org.ovirt.engine.api.resource;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Produces;
-
-import org.ovirt.engine.api.model.BaseResource;
-
-@Produces({ApiMediaType.APPLICATION_XML, ApiMediaType.APPLICATION_JSON, 
ApiMediaType.APPLICATION_X_YAML})
-public interface ReadOnlyResource<D extends BaseResource> {
-
-    @GET
-    public D get();
-}
diff --git 
a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/ReadOnlyResources.java
 
b/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/ReadOnlyResources.java
deleted file mode 100644
index 5c73b59..0000000
--- 
a/backend/manager/modules/restapi/interface/definition/src/main/java/org/ovirt/engine/api/resource/ReadOnlyResources.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-* Copyright (c) 2013 Red Hat, Inc.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-*           http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-
-package org.ovirt.engine.api.resource;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-
-import org.ovirt.engine.api.model.BaseResource;
-import org.ovirt.engine.api.model.BaseResources;
-
-@Produces({ApiMediaType.APPLICATION_XML, ApiMediaType.APPLICATION_JSON, 
ApiMediaType.APPLICATION_X_YAML})
-public interface ReadOnlyResources<D extends BaseResource, C extends 
BaseResources> {
-
-    @GET
-    public C list();
-
-    /**
-     * Sub-resource locator method, returns individual DeviceResource on which 
the
-     * remainder of the URI is dispatched.
-     *
-     * @param id  the Device ID
-     * @return    matching subresource if found
-     */
-    @Path("{id}")
-    public ReadOnlyResource<D> getDeviceSubResource(@PathParam("id") String 
id);
-}


-- 
To view, visit http://gerrit.ovirt.org/37755
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id449ea7bb88f7acae0a3b536aa2d45e1ddbeb48e
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to