deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michal Fojtik <mfoj...@redhat.com>
Subject Re: Sketch of CIMI model layer
Date Fri, 04 Nov 2011 13:15:21 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David Lutterkort wrote:

> On Thu, 2011-11-03 at 16:20 -0700, David Lutterkort wrote:
>> On Wed, 2011-11-02 at 16:08 -0700, lutter@redhat.com wrote:
>>> This patch is a first attempt at a CIMI model layer. Such a layer
>>> is needed to deal with deserialization (and possibly
>>> serialization) of CIMI model objects from (to) XML/JSON, and to
>>> give us a place to stash business logic connected to model
>>> classes.
>> For those following at home, I uploaded an updated patch to 
>> http://people.apache.org/~lutter/patches/cimi-model/ (and I'll
>> continue updating the patch there)
> 
> And if you're really following along at home, you can run the
> minimal specs that are there with
> 
> cd server rspec spec/cimi/model/machine_template_spec.rb
> 
> If you make changes, keep them as a separate patch and send them to
> me, I'll incorporate them.

I made couple fixes (mostly because it's my way how to get familiar with
the code ;-). I attached 4 patches:

0001-CIMI-Fixed-requires-and-added-module.patch

* This was required for executing the rspec command above :-)

0002-CIMI-Fixed-typo-in-base-model.patch

* Seems like wrong assertion to me.

0003-CIMI-Added-symbolize_key-to-convert-all-string-Hash-.patch

* Usually I prefer Symbol as Hash key instead of String (XmlSimple sux
there, this patch should add appropriate fix to Hash core_ext)

0004-CIMI-Use-instance-variables-instead-of-getter-setter.patch

* It's better in some (rare) cases to use instance variable when reading
or storing something. You never know if someone smart enough will not
redefine the attribute_values getter :)

I drop a quick note in the last one. I suggest to use HAML views to
produce output XML instead of returning XML programmatically. In worst
case we can use something like:

engine = Tilt::HamlTemplate.new(File.join(self.name, 'index.xml.haml'))
engine.render(self, :'@entity' => self)

to produce XML output.

 -- Michal

- --
Michal Fojtik, mfojtik@redhat.com
Deltacloud API: http://deltacloud.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJOs+VpAAoJEEnFpmY+LvFRnMQH/0Goc7Y/6f1tCSiyOrqFtIuB
XrTB6OSPGSSfcZcEskY+iQR6gv/Jth56HpEZkqHNPIqd/0o0y/ZKHpRxSnVGnMIh
MV+9CLMxwsDGfYjUGm6NrHjhzMMvqcLwHrxP38+u8Adu0KkOIEixS5jh06n9tZve
G/5v6h6EvrHK1XhwFa1BJD/cBzcyZh54ICsb32UGsjwwbnlerhk1xkzm4NduB70K
DhWinF1jDpbwc8+0gh4+olumwoVePtsxQZZe3Jpj0Cu/W3Fz6RuzqfM55F42mOyL
TaMLUF5fokVDK9rZ/3Cry8O1RIbLCYRgNF/hdSTiPo3OKiAl3nXMyuGnplAMyF4=
=kVZK
-----END PGP SIGNATURE-----

Mime
View raw message