deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Lutterkort <lut...@redhat.com>
Subject Re: CIMI: CIMISelect filter added
Date Sat, 10 Dec 2011 00:56:53 GMT
On Thu, 2011-12-08 at 13:19 +0100, mfojtik@redhat.com wrote:
> Practically it will display a full Machine entity instead of
> reference. Currently the Collection models are defined to hold only references.
> I was thinking about adding something like:
> 
> array :machines do
>   scalar :href
>   inherit :machine
> end
> 
> The 'inherit' method will 'copy' schema from Machine model to this Array, so
> then the CIMIExpand parameter should be used properly (Collection entity will
> contain a full entity with all properties).

I haven't thought through this in code, but my gut feeling says we need
to tie the href and the object that it references together more tightly,
i.e. I think we'd need something like

        array :machines do
          reference :machine, :attribute => :href
        end

where :href is the default for :attribute. At that point, we should
probably copy Rails even farther and say

        has_many :machines, :attribute => :href, :class => Machine

where :attribute and :class default to :href and Machine
(singularization of the association name)

One of the advantages of tying things together like that is that it
gives us a lot of flexibility if the association itself should gain
attributes in a future draft, e.g. so that the collection of volumes
attached to a machine gets its own URL.

And we probably want a has_one, too.

David




Mime
View raw message