abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Calavera" <david.calav...@gmail.com>
Subject Re: Adding an extension
Date Tue, 02 Sep 2008 09:58:19 GMT
Hi Neil,

there is a page into the wiki where we list all our extensions, but it
doesn't include a section of how to create an extension:

http://cwiki.apache.org/confluence/display/ABDERA/Extensions

Actually, it's quite simple,

if you want to add a simple element to an entry with a value:

   Entry e = abdera.getFactory().newEntry();
   e.addSimpleExtension(QNAME, value);

if you want to add nested elements to an entry:

    ExtensibleElement extension = e.addExtension(QNAME);
    extension = extension.addExtension(QNAME);
    extension.addSimpleExtension(QNAME, value);

and if you want to add an atom element into other element, for instance, a
nested collection into an entry:

   Entry entry = abdera.getFactory().newEntry();
   Collection c = abdera.getFactory().newCollection(entry);

I hope it will be useful, by the way take a look at the source of one of the
prebuilt extensions, I think the geo extension is one of the most cleaner
that we have.

Regards.

On Tue, Sep 2, 2008 at 11:32 AM, Neil Taylor <nst@aber.ac.uk> wrote:

> I am looking at Abdera as a possible replacement for code on a project
> using the atom publishing protocol. Our project would need to process custom
> enhancements, from a couple of different namespaces, to the service and
> entry elements. We would also need to add elements within lower level
> elements such as collection.
>
> It seems that the ExtensionFactory is an easy way to add elements. I have
> looked at the examples, but I am not sure what steps I need to do to create
> an extension. Is there a summary available on the steps to create an
> extension - suitable for someone new to this project?
>
> Thanks,
>
> Neil
>
>


-- 
David Calavera
http://www.thinkincode.net

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message