abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Snell <jasn...@gmail.com>
Subject [abdera2] Feed to Activity Stream Conversion
Date Thu, 22 Sep 2011 22:02:10 GMT
Another note to point out new features in abdera2...

As part of the Activity Streams implementation, there is a new
mechanism for converting an Atom Feed to an Activity Stream... it
should work with any Atom Feed, including those that using the
Activity Streams Atom spec (http://activitystrea.ms/specs/atom/1.0)


     Abdera abdera = Abdera.getInstance();
     URL url = new URL("http://intertwingly.net/blog/index.atom");
     Parser parser = abdera.getParser();
     ParserOptions options = parser.getDefaultParserOptions();
     options.setCharset("UTF-8");
     Document<Feed> doc =
abdera.getParser().parse(url.openStream(),url.toString(),options);
     Feed feed = doc.getRoot();

     FeedToActivityConverter c = new FeedToActivityConverter() {};

     IO io = IO.get();

     CollectionWriter cw = io.getCollectionWriter(System.out, "UTF-8");

     c.convert(feed, cw);


You can subclass the FeedToActivityConverter class to customize the
conversion process.

Mime
View raw message