[Grok-dev] Problem with Annotations
Paul Wilson
paulalexwilson at gmail.com
Wed Sep 23 06:15:18 EDT 2009
Hi there,
I've been having difficulty thinking this one through, any hints appreciated.
I'm writing a hobby framework (and content management system) with
Grok. The content will have meta-data associated with it. Naturally,
I've decided to use annotations to model this meta data. I don't know
what meta data will be stored up front; opting instead to allow such a
facility to be plugged in. Let's say a have an object called 'foo'
that is found at location:
http://localhost/container/foo
A plugin may, for example, define an IMetaData interface and MetaData
annotation that stores the X and Y coordinate of foo. When a client
accesses the metadata, it is the interface's schema that is used to
deserialise it. So, what I need is some URL format or mechanism that
allows me to reference an interface so that I can adapt the content
object to it and retrieve the object and then go on to deserialise it.
So the first question is, is there some way to look up (in the ZCA) an
interface by name? This would allow:
http://localhost/container/foo/_metadata
I would then go on to define a grok.Traverser that strips the leading
slash and looks up the interface.
My second question is related. Is there a way to avoid having this
naming convention of the leading underscore or similar. Views have @@,
and layers have ++Layer++, is there some way of doing something
similar in grok to say 'this is not an object, please treat it
differently'?
Thanks in advance.
Regards,
Paul
More information about the Grok-dev
mailing list