
On 11/20/2012 12:13 AM, Itamar Heim wrote:
On 11/19/2012 02:07 PM, Vojtech Szocs wrote:
Hi Itamar,
UI plugin infrastructure translates internal business entities into JSON-like representations and passes those representations to UI plugins. (Internal entities are NOT exposed to UI plugins directly.)
Currently, all entities supported by UI plugin infrastructure (as per org.ovirt.engine.ui.webadmin.plugin.entity.EntityType) are transformed into following representation:
{ entityId: "[BusinessEntityGuidAsString]" }
For example, a VM entity with entity ID "vm123" will translate to:
{ entityId: "vm123" }
Translation is currently based on org.ovirt.engine.core.common.businessentities.BusinessEntity interface, like so: "BusinessEntity<? extends NGuid>" (we expect ID type parameter to be NGuid-compatible). However, I've found that there are some entities (like Pool - org.ovirt.engine.core.common.businessentities.vm_pools) that don't implement BusinessEntity interface.
ok, so we only pass the ID for now. good.
Quick question to backend folks - IIRC all entities extend org.ovirt.engine.core.common.businessentities.IVdcQueryable, but not all entities implement org.ovirt.engine.core.common.businessentities.BusinessEntity interface. What is the precise relation between IVdcQueryable and BusinessEntity?
As for UI plugins, currently all entities get translated to above mentioned basic JSON-like representation. You can see the relevant code in org.ovirt.engine.ui.webadmin.plugin.entity.BaseEntity.from() static method. There's a TODO that says "make this class [BaseEntity] abstract and create specific entity for each EntityType" - this means we are planning to extend the above mentioned basic JSON-like representation for different entity types.
For example, for a VM entity we might do:
{ entityId: "[BusinessEntityGuidAsString]", osType: "[VmOsType]" }
just make sure the entity matches the REST API entity. (which probably means entityId should be changed to id?)
if we plan moving UI on top of API, you should be: 1. importing restapi-types project 2. writing intermediate layer to translate BE entities to API's using #1 3. using public entities from #2 this way your future migration to API (instead of native BE) will be much more easier.
Vojtech
----- Original Message ----- From: "Itamar Heim" <iheim@redhat.com> To: "Vojtech Szocs" <vszocs@redhat.com> Cc: "engine-devel" <engine-devel@ovirt.org> Sent: Friday, November 16, 2012 5:24:52 PM Subject: Re: [Engine-devel] UI Plugins: PoC patch revision 7 is here
On 11/16/2012 06:08 PM, Vojtech Szocs wrote:
is there a clear list of all APIs supported now?
Not yet, unfortunately, this should be part of "for plugin developers" wiki that is planned to be written in upcoming weeks.
i just wanted to review how we solved not using internal entities as part of the API
-- Michael Pasternak RedHat, ENG-Virtualization R&D