Change in ovirt-engine[master]: restapi: Remove underscore prefix from Java names before par...

juan.hernandez at redhat.com juan.hernandez at redhat.com
Thu Jan 7 10:52:57 UTC 2016


Juan Hernandez has submitted this change and it was merged.

Change subject: restapi: Remove underscore prefix from Java names before parsing
......................................................................


restapi: Remove underscore prefix from Java names before parsing

Some of the names used in the model conflict with Java reserved words.
For example the "nic.interface" property conflicts with the Java
"interface" reserved word. To avoid this conflict the model uses the
uderscore character as a prefix:

  interface Nic {
    String _interface();
  }

But this underscore isn't currently removed from the name before adding
it to the model. As a result the generated XML schema contains also
the prefix:

  <xs:complexType name="Nic">
    <xs:complexContent>
      <xs:extension base="BaseDevice">
        <xs:sequence>
          <xs:element name="_interface" .../>
          ...
        </xs:sequence>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

One of the effects of this is that when the server receives a request
that doesn't contain the undercore it rejects it, because it is
syntactically incorrect according to the XML schema.

This patch changes the model analyzer so that it will remove underscores
used as prefixes of suffixes. The XML schema will then be generated
correctly.

Change-Id: If5d0ab57e3cb81f79e1c6b4a45e94dd89e8fe48e
Signed-off-by: Juan Hernandez <juan.hernandez at redhat.com>
---
M backend/manager/modules/restapi/metamodel/analyzer/src/main/java/org/ovirt/api/metamodel/analyzer/ModelAnalyzer.java
1 file changed, 27 insertions(+), 11 deletions(-)

Approvals:
  Juan Hernandez: Verified; Looks good to me, approved
  Jenkins CI: Passed CI tests



-- 
To view, visit https://gerrit.ovirt.org/50579
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: If5d0ab57e3cb81f79e1c6b4a45e94dd89e8fe48e
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Martin Peřina <mperina at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>



More information about the Engine-commits mailing list