<br><br><div class="gmail_quote">On Sat, Apr 14, 2012 at 10:46 AM, Justin Santa Barbara <span dir="ltr"><<a href="mailto:justin@fathomdb.com">justin@fathomdb.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div><ul><li>Each (known) extension has its own strongly-typed model object.</li></ul></div></blockquote></div><div><br>Does that mean that an extension cannot add properties to an existing object (such as adding a new attribute an Image), or just that all of those properties will be an a nested object (such as Image.my_extension.my_attribute)?</div>

</div></blockquote><div><br></div></div><div>Good point - I should clarify...  I'm not using the standard Java XML binding code here, because they would require a wrapping object.  It's using custom code to do the binding whenever data from a different namespace is encountered, although it uses the standard JAXB annotations to guide it.  From the user's point of view, "it just works"; the implementation is not as nice :-)</div>
</div></blockquote><div><br></div><div>OK. I was asking from a lack-of-knowledge of how this sort of thing is usually done in Java. If an extension adds a piece of data to an object, what does a client need to do to access it?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote">
<div><br></div><div>Because we're not wrapping our extensions in their own elements, I didn't know how to get the standard tooling to work with it anyway.  Interesting data-point for the "standard tools" argument...</div>
<div class="im">
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote"><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div></div><div>Now, how you would do something that awesome in Python, I don't know ;-)</div></blockquote><div><br></div></div><div>Probably the same way. I would use setuptools entry points to map namespace prefixes to the class, so the client could load the handler automatically when it encounters data it does not recognize.</div>

</div></blockquote><div><br></div></div><div>Yes - I should have said "dictionary" rather than "registry"!  Are you doing this in python-novaclient?  Awesome!</div></div></blockquote><div><br></div><div>
I've done it before in other projects, but not in OpenStack, yet. I was going to bring up the idea of using setuptools for plugins and extensions like this at the summit during the session(s) on moving code into common and revamping the CLI tools.</div>
<div><br></div><div>Doug </div></div>