Return-Path: Delivered-To: apmail-incubator-abdera-user-archive@locus.apache.org Received: (qmail 5190 invoked from network); 3 Sep 2008 07:19:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Sep 2008 07:19:17 -0000 Received: (qmail 85760 invoked by uid 500); 3 Sep 2008 07:19:15 -0000 Delivered-To: apmail-incubator-abdera-user-archive@incubator.apache.org Received: (qmail 85628 invoked by uid 500); 3 Sep 2008 07:19:15 -0000 Mailing-List: contact abdera-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: abdera-user@incubator.apache.org Delivered-To: mailing list abdera-user@incubator.apache.org Received: (qmail 85617 invoked by uid 99); 3 Sep 2008 07:19:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Sep 2008 00:19:15 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of david.calavera@gmail.com designates 209.85.132.250 as permitted sender) Received: from [209.85.132.250] (HELO an-out-0708.google.com) (209.85.132.250) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Sep 2008 07:18:14 +0000 Received: by an-out-0708.google.com with SMTP id b38so418017ana.83 for ; Wed, 03 Sep 2008 00:18:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type:references; bh=2sPqUvSBVKVm0OOcH5ordzQ0nuK/DDPoMAoYb1kXJL8=; b=ipdOEzMLvNH38/4psX2b5k4hJeIVVp0qll8y6jBTbPcVQSSaeSWZEWbmgvLSruvMFX it+Yrvw0f65ZxZYmq43eDD05PwSbS972E+yH1nS8rJxSk6jMWIevRYhHQcoKa5siJGWK 5YWMv8DjsoXGsaqjO3GwTJYg2Nzuo0pSJAmNk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:references; b=oxg6xZWz8P8x8zI8LG9MgdfZw+v9B69amMO6s1V7v3GkYZEqScqc7nhEDKwG6i9CqE e0x3jNqD0cgoUG20AqeY5bkI1Snwz2H4G7EvclWTrGayGflSHTujPPSDBfUy6AQLWq/+ T2U0PmL3nb3PoYJeji0+LLBe1GPvM6Xn8Rci4= Received: by 10.100.140.10 with SMTP id n10mr8520927and.115.1220426305713; Wed, 03 Sep 2008 00:18:25 -0700 (PDT) Received: by 10.100.154.18 with HTTP; Wed, 3 Sep 2008 00:18:25 -0700 (PDT) Message-ID: Date: Wed, 3 Sep 2008 09:18:25 +0200 From: "David Calavera" To: abdera-user@incubator.apache.org Subject: Re: Adding an extension In-Reply-To: <48BD4FE7.3070901@aber.ac.uk> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_16162_6412598.1220426305707" References: <48BD0835.3040405@aber.ac.uk> <48BD4FE7.3070901@aber.ac.uk> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_16162_6412598.1220426305707 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Neil, in my opinion, there aren't pros and cons about extensions, it depends on your requirements. I mean, I usually follow the standard as much as I can and I try to use standard extensions but if you need to show more specific data you need a custom extension. Of course, standard clients don't understand your markup but it's there in case of anyone want to use it. Let me give you an example, I built an api on atomPub for the company where I work, 11870.com, we show services reviews as title and content on entries and we use opensearch extension in order to show result numbers, etc, but we wanted to show other specific data, like addresses, telephone numbers, or an internal id, there is where an own extension is needed. Now, we're planning to release a new version of that api and we're going to add support for multipart data using the AtomPub multipart creation extension, but we are not trying to reinvent the wheel. I'd say the two Abdera extension approaches are good, it depends on the requirements of the extension and if you want to build it as an independent module. On Tue, Sep 2, 2008 at 4:38 PM, Neil Taylor wrote: > Hi David, > > Thank you, that has given me a push in the right direction. I see how I can > create a bit of custom code to manipulate the fields easily - it works > really well. > > I could just create a custom class that manages this approach. I wonder if > there is any value in creating an extension to package any elements in one > place. I suspect the answer is yes, but I don't have a list of reasons why. > I wonder if it is mostly useful if we wanted to share an extension outside > of the current project. I am happy to hear any pros/cons about creating an > extension. > > I have had a look at the examples and I see two approaches to an extension > - they may be more. In the GeoRSS extension, it looks like there is a helper > class (GeoHelper) that provides static methods to be used to process any > extra elements. In the MediaRSS example, there is a factory class and > associated classes. The factory is then referenced in the > org.apache.abdera.factory.ExtensionFactory file that is bundled into the > META-INF. Are there any recommendations about using one approach over the > other? > > Regards, > > Neil > > > > David Calavera wrote: > >> 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. >> > -- David Calavera http://www.thinkincode.net ------=_Part_16162_6412598.1220426305707--