Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

ApacheCon: Abdera A Java Atom Pub Implementation

2,855 views

Published on

  • Be the first to comment

ApacheCon: Abdera A Java Atom Pub Implementation

  1. 1. Abdera, a Java AtomPub implementation David Calavera 11870.com
  2. 2. vanity slide •Software architect at 11870.com • Open source “aholic”: Hudson, Netbeans • Commiter of the Apache Abdera project
  3. 3. Overview •Atom Publishing Protocol implementation • Atom Syndication Format implementation • version 0.5 comming soon
  4. 4. Creating feeds Abdera abdera = new Abdera(); Feed feed = abdera.newFeed(); feed.setId(quot;tag:example.org,2008:/fooquot;); feed.setTitle(quot;Test Feedquot;); feed.setSubtitle(quot;Feed subtitlequot;); feed.setUpdated(new Date()); feed.addAuthor(quot;David Calaveraquot;); feed.addLink(quot;http://example.comquot;); feed.addLink(quot;http://example.com/fooquot;,quot;selfquot;); Entry entry = feed.addEntry(); entry.setId(quot;tag:example.org,2007:/foo/entries/1quot;); entry.setTitle(quot;Entry titlequot;); entry.setSummaryAsHtml(quot;<p>This is the entry title</p>quot;); entry.setUpdated(new Date());
  5. 5. Reading feeds Abdera abdera = new Abdera(); Parser parser = abdera.getParser(); URL url = new URL(quot;http://example.org/feedquot;); Document<Feed> doc = parser.parse(url.openStream(),url); Feed feed = doc.getRoot(); System.out.println(feed.getTitle()); for (Entry entry : feed.getEntries()) { System.out.println(quot;tquot; + entry.getTitle()); }
  6. 6. How does a server work? • from top to bottom • AbderaServlet • RequestContext • AbderaFilters • Provider • TargetResolver • RequestProcessor • Adapter
  7. 7. Target resolvers • RouteManager TargetResolver ts = new RouteManager() .addRoute(quot;servicequot;, quot;/quot;, TargetType.TYPE_SERVICE) .addRoute(quot;feedquot;, quot;/:collectionquot;, TargetType.TYPE_COLLECTION) .addRoute(quot;entryquot;, quot;/:collection/:entry:quot;, TargetType.TYPE_ENTRY) .addRoute(quot;openSearchquot;, quot;/os.xmlquot;, CustomTargetType.OPEN_SEARCH); • RegexTargetResolver TargetResolver ts = new RegexTargetResolver() .setPattern(quot;/atom(?[^#]*)?quot;, TargetType.TYPE_SERVICE) .setPattern(quot;/atom/([^/#?;]+)$quot;, TargetType.TYPE_COLLECTION) .setPattern(quot;/atom/([^/#?]+)/([^/#?]+)$quot;, TargetType.TYPE_ENTRY) .setPattern(quot;/os.xmlquot;, CustomTargetType.OPEN_SEARCH);
  8. 8. Adapters • CollectionAdapter ResponseContext postEntry(RequestContext request); ResponseContext deleteEntry(RequestContext request); ResponseContext getEntry(RequestContext request); ResponseContext headEntry(RequestContext request); ResponseContext optionsEntry(RequestContext request); ResponseContext putEntry(RequestContext request); ResponseContext getFeed(RequestContext request); ResponseContext getCategories(RequestContext request);
  9. 9. Adapters • MediaCollectionAdapter ResponseContext postMedia(RequestContext request); ResponseContext deleteMedia(RequestContext request); ResponseContext getMedia(RequestContext request); ResponseContext headMedia(RequestContext request); ResponseContext optionsMedia(RequestContext request); ResponseContext putMedia(RequestContext request);
  10. 10. More stuff • Spring integration • Multipart media creation • OAuth • Open search • JSON Serialization • Custom writers • Pre-built adapters
  11. 11. Questions? • Resources • Abdera: http://incubator.apache.org/abdera • AtomPub: http://ietf.org/rfc/rfc5023 • Atom format: http://ietf.org/rfc/rfc4287 • Atom list: http://www.imc.org/atom-syntax • My blog: http://thinkincode.net

×