[ovirt-devel] oVirt.js GWT wrapper prototype

Vojtech Szocs vszocs at redhat.com
Tue Jul 8 12:55:45 UTC 2014


Hi Martin, thanks for your feedback!

(Sorry for getting back to you so late, had to take some time off.)

Please find my comments below.


----- Original Message -----
> From: "Martin Betak" <mbetak at redhat.com>
> To: "Vojtech Szocs" <vszocs at redhat.com>
> Cc: devel at ovirt.org
> Sent: Monday, June 30, 2014 6:22:47 PM
> Subject: Re: [ovirt-devel] oVirt.js GWT wrapper prototype
> 
> Hi Vojtech,
> 
> just one small remark to the oVirt.GWT wrapper.
> Do you think it would be possible to replace
> > Sdk.get().api().getDataCenters() with
> > Sdk.api().getDataCenters() or even better yet with
> > Sdk.getDataCenters()

Sure :)

> In general I think that "Flat is better than nested" and I don't think
> the collection names would introduce any collisions with the .services()
> namespace so this should be a safe change.

Sdk.getDataCenters() could be a shortcut for Sdk.api().getDataCenters(),
oVirt.js service namespace could be exposed through Sdk.svc() method.

> 
> Other than that I really like the current prototypes for both oVirt.js
> and oVirt.GWT and I'm looking forward to future development.

Thanks! I'd love to see others review it too, hopefully :)

> 
> Best regards
> 
> Martin
> 
> ----- Original Message -----
> > From: "Vojtech Szocs" <vszocs at redhat.com>
> > To: devel at ovirt.org
> > Sent: Tuesday, June 24, 2014 1:29:26 PM
> > Subject: [ovirt-devel] oVirt.js GWT wrapper prototype
> > 
> > Hello everyone,
> > 
> > following the announcement of oVirt.js prototype, I've developed a sample
> > GWT wrapper that provides Java API to oVirt.js for all GWT applications.
> > 
> > Please find the GWT wrapper patch attached. It bundles oVirt.js & Lo-Dash
> > libraries via GWT module (SdkGwtWrapper) providing Java-like API based on
> > oVirt.js.
> > 
> > In order for WebAdmin to use oVirt.js GWT wrapper, all we have to do is
> > add following into WebAdmin.gwt.xml (GWT module descriptor):
> > 
> >   <inherits name="org.ovirt.engine.sdk.gwt.SdkGwtWrapper" />
> > 
> > and add following into pom.xml (Maven project descriptor):
> > 
> >   <dependency>
> >     <groupId>${engine.groupId}</groupId>
> >     <artifactId>ovirt-js-gwt-wrapper</artifactId>
> >     <version>${engine.version}</version>
> >     <scope>provided</scope>
> >   </dependency>
> > 
> > and that's it.
> > 
> > The Java API takes inspiration from oVirt.js API. For example, to add
> > new DataCenter:
> > 
> >   // Create data object template, 'name' and 'local' are required.
> >   DataCenterTemplate dcTemplate = DataCenterTemplate.create(
> >     "test-dc", // name
> >     false // local
> >   );
> >   // Set optional parameters such as 'description', if necessary.
> >   dcTemplate.setDescription("my-desc");
> > 
> >   // Obtain DataCenter resource collection.
> >   ResourceCollection<DataCenter> dcColl = Sdk.get().api().getDataCenters();
> > 
> >   // Add new DataCenter by running 'add' operation on 'dcColl'.
> >   dcColl.add(dcTemplate).success(new SuccessCallback<DataCenter>() {
> >     @Override
> >     public void onSuccess(DataCenter dc) {
> >       Window.alert("Added: " + dc.getName());
> >     }
> >   }).run();
> > 
> > The concept of resource, resource collection and operation is the same
> > as presented in oVirt.js.
> > 
> >   dc.setName("test-dc-updated");
> >   dc.setDescription("test")
> >   dc.update().run(); // we could register 'success' callback here
> > 
> > You can see the full example by looking at SdkGwtWrapperTest class,
> > located in WebAdmin codebase (org.ovirt.engine.ui.webadmin.sdk_test).
> > 
> > Note that 'DataCenter' and 'DataCenterTemplate' will probably be
> > auto-generated from oVirt Engine REST API definition (XSD/RSDL).
> > 
> > As mentioned in my previous email, oVirt.js GWT wrapper ("overlay")
> > can be initially part of ovirt-engine repo, while oVirt.js project
> > deserves (in my opinion) a separate repo on its own.
> > 
> > Regards,
> > Vojtech
> > 
> > _______________________________________________
> > Devel mailing list
> > Devel at ovirt.org
> > http://lists.ovirt.org/mailman/listinfo/devel
> 



More information about the Devel mailing list