abdera-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James M Snell <jasn...@gmail.com>
Subject Re: Extension Development
Date Wed, 06 Sep 2006 21:57:12 GMT
One way of implementing extensions that do not rely on the underlying
parser implementation would be to implement wrappers around the Feed
Object Model interfaces.  For instance,

  Document<Feed> doc = ...
  Feed feed = doc.getRoot();
  QName myExtensionQName = new QName("urn:foo:bar", "Test");
  Element test_el = feed.getExtension(myExtensionQName);
  Test test = new TestImpl(test_el);

With this approach, you could use some form of XSD-to-Java  skeleton
generator to define the API of your wrapper interfaces then fill in the
implementation by delegating to the FOM object.

- James

Garrett Rooney wrote:
> On 9/1/06, Rob Evans <objectiveous@gmail.com> wrote:
>> I have a large'ish information model that I'd like to expose via a
>> feed. I
>> started looking at the OpenSearch extension to learn how to structure an
>> extension and I have a simple extension and factory working. My
>> information
>> model has already been described in xml schema and I'm wondering if
>> there is
>> a way to use leverage that schema. For example, could I use apache ADB to
>> generate the classes? It looks like my generated classes would need to
>> implement org.apache.abdera.model.Element in order for them to be
>> added as
>> Extensions.
>> Is there a simpler approach?
> It's actually worse than that.  Not only do your classes have to
> implement Element, but these days they also have to be intimately
> familiar with the parser implementation.  If you look at the
> implementations of the OpenSearch classes, you'll see that they
> reference FOM classes.
> I'd really like to make that go away.  It would be awfully nice if the
> extensions didn't have to know anything at all about the parser,
> perhaps the parser would just hand off an Element object to the
> extension factory, and it would be responsible for converting that
> element into the particular type of element it cares to generate.
> Anyway, that's the state of the union at this point.  No there's no
> "easy" way to automatically generate extensions, and when you do
> generate them they need to have a lot of knowledge about the parser
> they work with, although that may change in the future.
> -garrett

View raw message