Change in ovirt-engine-sdk-java[master]: generator: Remember order of parameters
juan.hernandez at redhat.com
juan.hernandez at redhat.com
Tue Jun 23 09:00:49 UTC 2015
Juan Hernandez has submitted this change and it was merged.
Change subject: generator: Remember order of parameters
......................................................................
generator: Remember order of parameters
When a resource method supports multiple parameters (in the form of URL
parameters or headers) the code generator produces a method with
multiple parameters as well. For example, the host "activate" method
supports the "async" URL parameter and the "correlationId" parameter
because it can be invoked as follows:
POST /hosts/{host:id}/activate;async=true
Correlation-Id: 0123
<action/>
So the generated Java method for this resource method looks like this:
Action activate(Action action, Boolean async, String correlationId)
But in previous versions of the engine or the SDK some of these
parameters may be missing. In the particular case of the host "activate"
method, for example, the 3.5 version of the SDK didn't support the
"async" parameter (because it was missing from the RSDL metadata) so the
generated method looked like this:
Action activate(Action action, String correlationId)
Replacing the 3.5 signature with the new one causes a backwards
compatibility problem.
A previous change tried to solve this issue introducing a "memory" file
where the SDK remembers the signatures used in previous versions:
codegen: Sort and remember header parameters
https://gerrit.ovirt.org/39459
But this change only took into account header parameters. The "async"
parameter in the above example wasn't handled correctly.
To avoid this issue this patch changes the "memory" concept so that
instead of remembering the headers corresponding to a link it remembers
the names and order of the parameters of the generated methods.
The patch also resets the state of the memory to that of the latest 3.5
branch, so the next time that the SDK is regenerated it will be
backwards compatible with version 3.5.
Change-Id: I1c71aa8fb26f7f11c84b4b556245db36420c29c2
Bug-Url: https://bugzilla.redhat.com/1231786
Signed-off-by: Juan Hernandez <juan.hernandez at redhat.com>
---
M generator/pom.xml
M generator/src/main/java/org/ovirt/engine/sdk/generator/Memory.java
A generator/src/main/java/org/ovirt/engine/sdk/generator/java/ParameterContext.java
A generator/src/main/java/org/ovirt/engine/sdk/generator/java/ParameterData.java
A generator/src/main/java/org/ovirt/engine/sdk/generator/java/ParameterType.java
M generator/src/main/java/org/ovirt/engine/sdk/generator/java/RsdlCodegen.java
M generator/src/main/java/org/ovirt/engine/sdk/generator/java/documentation/DocsGen.java
M generator/src/main/java/org/ovirt/engine/sdk/generator/java/templates/AbstractOverloadableTemplate.java
M generator/src/main/java/org/ovirt/engine/sdk/generator/java/templates/CollectionActionMethodTemplate.java
M generator/src/main/java/org/ovirt/engine/sdk/generator/java/templates/CollectionAddMethodTemplate.java
M generator/src/main/java/org/ovirt/engine/sdk/generator/java/templates/CollectionTemplate.java
M generator/src/main/java/org/ovirt/engine/sdk/generator/java/templates/DeleteMethodTemplate.java
M generator/src/main/java/org/ovirt/engine/sdk/generator/java/templates/DeleteMethodWithBodyTemplate.java
M generator/src/main/java/org/ovirt/engine/sdk/generator/java/templates/HeaderBuilderParameterTemplate
M generator/src/main/java/org/ovirt/engine/sdk/generator/java/templates/HeaderBuilderParameterTemplate.java
M generator/src/main/java/org/ovirt/engine/sdk/generator/java/templates/ListMethodTemplate.java
D generator/src/main/java/org/ovirt/engine/sdk/generator/java/templates/MethodParameterTemplate
D generator/src/main/java/org/ovirt/engine/sdk/generator/java/templates/MethodParameterTemplate.java
M generator/src/main/java/org/ovirt/engine/sdk/generator/java/templates/ResourceActionMethodTemplate.java
M generator/src/main/java/org/ovirt/engine/sdk/generator/java/templates/ResourceTemplate.java
M generator/src/main/java/org/ovirt/engine/sdk/generator/java/templates/SubCollectionAddMethodTemplate.java
M generator/src/main/java/org/ovirt/engine/sdk/generator/java/templates/SubCollectionTemplate.java
M generator/src/main/java/org/ovirt/engine/sdk/generator/java/templates/SubResourceTemplate.java
M generator/src/main/java/org/ovirt/engine/sdk/generator/java/templates/UpdateMethodTemplate.java
M generator/src/main/java/org/ovirt/engine/sdk/generator/java/templates/UrlBuilderParameterTemplate
M generator/src/main/java/org/ovirt/engine/sdk/generator/java/templates/UrlBuilderParameterTemplate.java
M generator/src/main/java/org/ovirt/engine/sdk/generator/java/utils/ExceptionsAwareComparator.java
M generator/src/main/java/org/ovirt/engine/sdk/generator/java/utils/LinkUtils.java
A generator/src/main/java/org/ovirt/engine/sdk/generator/java/utils/MethodUtils.java
M generator/src/main/java/org/ovirt/engine/sdk/generator/java/utils/StringUtils.java
M generator/src/main/resources/memory.properties
M sdk/README.md
32 files changed, 957 insertions(+), 989 deletions(-)
Approvals:
Martin Peřina: Looks good to me, but someone else must approve
Juan Hernandez: Verified; Looks good to me, approved; Passed CI tests
--
To view, visit https://gerrit.ovirt.org/42452
To unsubscribe, visit https://gerrit.ovirt.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1c71aa8fb26f7f11c84b4b556245db36420c29c2
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine-sdk-java
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Martin Peřina <mperina at redhat.com>
Gerrit-Reviewer: Ori Liel <oliel at redhat.com>
Gerrit-Reviewer: automation at ovirt.org
More information about the Engine-commits
mailing list