------=_Part_23610907_1521630269.1403011303574
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Hello everyone,
in past few weeks, we've been working on JavaScript SDK for oVirt Engine.
Today, I'm happy to announce the first prototype called oVirt.js :)
Attached, there's an "sdk-testdrive" UI plugin which:
- bundles oVirt.js prototype [ovirt.js]
- contains test code for DataCenter object [plugin.js]
To install this plugin, simply copy (or symlink) sdk-testdrive.json file and
sdk-testdrive-resources directory under /usr/share/ovirt-engine/ui-plugins.
Following is a quick recap of test code exercising oVirt.js.
To add new DataCenter:
// Obtain DataCenter resource collection.
// Resource collection is a handle to work with RESTful objects.
var dcColl = ovirt.api.datacenters;
// Obtain "add DataCenter" operation.
// Operation is a reusable, uhm, operation, backed by HTTP request.
// You can run the same operation multiple times, if necessary.
var addOp = dcColl.add({ name: 'test-dc', local: false });
// Register result handler and run the operation.
addOp.success(dcAddedCallback).run();
// Example of operation result handler that receives a single resource.
function dcAddedCallback (dc) {
console.log('Added: ' + dc.data().name);
}
In dcAddedCallback function shown above, "dc" is a resource object,
representing a handle to work with RESTful DataCenter object. It provides
access to underlying resource data:
var dcDataObj = dc.data();
// Get
var dcName = dcDataObj.name;
var dcDesc = dcDataObj.description;
// Set multiple properties at once ...
dc.data({ name: 'test-dc-updated', description: 'test' });
// ... or one by one
dcDataObj.name = 'test-dc-updated';
dcDataObj.description = 'test';
It also gives access to nested collections (if any) and supported
actions (if any):
// Obtain Cluster resource collection for given DataCenter.
var dcClusterColl = dc.clusters;
oVirt.js is currently only 445 lines of code, yey :) we're not using
any code generation at this point, we're simply relying on HATEOAS [1]
principle of REST and dynamically augmenting resource objects with
nested collections and supported actions, which are part of resource
representation.
[1]
http://en.wikipedia.org/wiki/HATEOAS
I feel we'll eventually come to a point where code generation can be
useful, but for now, we're trying to keep things small and simple.
oVirt.js currently uses Lo-Dash library [2] containing various utility
functions. I think that Lo-Dash is great because it makes working with
JavaScript a bit easier.
[2]
http://lodash.com/
Overall, oVirt.js will be self-contained, which means there will be
no additional dependencies from JavaScript perspective. Using oVirt.js
in HTML page will be as simple as this:
<script src="ovirt.js"></script>
This means that (build-time) dependencies such as Lo-Dash will be
inlined into resulting oVirt.js build. We're also planning to provide
minified version + Source Maps for better debugging.
oVirt.js is planned to be usable NOT ONLY in web browsers. In fact,
there's "ovirt.svc" namespace containing services used by oVirt.js API
implementation. You (or any 3rd party extension) can override these
services to achieve SDK portability for given runtime environment.
In other words, I'd love to see oVirt.js used also with Node.js :)
Finally, an important thing to mention - oVirt.js requires AT LEAST
ECMAScript 5.1 compliant environment. All modern browsers support
ES5, including IE9+. Unfortunately, IE9 doesn't support ES5 Strict
Mode, but that's not that big of a deal.
I'll send some more emails outlining implementation design and also
how to manage source control & distribution of oVirt.js.
Regards,
Vojtech
------=_Part_23610907_1521630269.1403011303574
Content-Type: application/x-compressed-tar; name=ovirt-js-sdk.tar.gz
Content-Disposition: attachment; filename=ovirt-js-sdk.tar.gz
Content-Transfer-Encoding: base64
H4sIADVAoFMAA+0873PbNrL9nL8C5w9H+VWm5F9xx4l749pO67ukztjOzZvJZDoQCVmMKUIlSDu6
nv/3t7sASYAEJaf1tL13oWcsiVzsLnYXi90FQBXfbhVCFXGe3ImtXChZ5pFQI3mX5EX4UX31BNd4
PH6+t8fgc/tgf2x/4rUHv56z7Z3dvYP9g93d8S4b74x3t59/xcZPQXzdVaqC58DKnfqXjFZ0d91z
3RlWf/6HXKMRk//UqmaLXBayWC5E+AxuX4qfywQMgp2dvDm+ivJkUbD9cJtFcr5IE54VTGRgJDKb
i6w4xBZsVhSLw9Ho/v4+FNGcbyVZIfKMF4nMeBrK/GZEt3ee74wA0wjbnJR5Du3TJcsreq/l1ilX
M5Ymk5znSwd1KmN4FAIPo2fUXGYFTzJWzAS7Ov0Hu0+KGfwMyHwDdpPKCU/ZHc8TPkmhX/CN0TN2
xH55eEE4zj4tpBJMifwuAdNnpRIxmyzZ8dtzlkBfBXaQOkFyOePRrAJmaibLFKAF4xmTk48iKkBA
xFOS3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