WSO2 Mashup Server, Atom Publishing Protocol (APP) Host Object Guide

This document describes the set of host objects available for publishing using the Atom Publishing Protocol (APP).

1.0 Introduction

The APP implementation consists of three main host objects, namely AtomFeed, AtomEntry and APPClient.

1.1 AtomFeed

The "AtomFeed" host object serves as the top level element of an Atom Feed Document, acting as a container for meta data and data associated with the feed. Its element children consist of meta data elements followed by zero or more "AtomEntry" child elements.

1.2 AtomEntry

The "AtomEntry" host object represents an individual entry, acting as a container for meta data and data associated with the entry. This element can appear as a child of the "AtomFeed" element, or it can appear as the document (i.e., top-level) element of a stand-alone Atom Entry Document.

1.3 APPClient

The "APPClient" host object acts as a client to an APP server. It is capable of authenticating using the given credentials and performing HTTP operations GET, POST, PUT and DELETE.

2.0 Examples

    // Creating an instance of APPClient
var client = new APPClient();

// Creating an instance of AtomFeed
var feed = new AtomFeed();

// Setting login credentials for the client
client.credentials={username:"you@email.com",password:"xxx",service:"blogger",authtype:"google"};

// Retrieving and online feed
feed = client.getFeed("http://blog.mooshup.com/feeds/posts/default");

// Getting an array of individual entries from the feed
var entries = new Array();
entries = feed.getEntries();

// Writing the retrieved feed to a file
feed.writeTo("my-file-name.xml");

3.0 API Documentation

3.1 AtomFeed Host Object API Documentation

Member Description
void addEntry(newEntry) Adds a new AtomEntry to the end of the collection of entries.
    atomfeed.addEntry(newEntry);
AtomEntry[] getEntries() Returns the complete set of entries contained in this feed.
    var atomentries = atomfeed.getEntries();
AtomEntry getEntry(String id) Returns the first entry in the feed with the given atom:id value.
    var atomentry = atomfeed.getEntry('id5432');
void writeTo(fileName) Serializes the AtomFeed to a given local file/
    atomfeed.writeTo("file-name.xml");
property String author The author of this feed.
property String category The category of this feed.
property String contributor The contributor of this feed.
property String id The id of this feed.
property String rights The rights associated with this feed.
property String[] link The location(s) of this feed.
property String title The title of this feed.
property String updated The date when this feed was last updated.
readonly property XML XML Returns the E4X XML contents of this AtomFeed object.

3.2 Entry Host Object API Documentation

Member Description
property String author The author of this entry.
property String category The category of this entry.
property String content The content of this entry.
property String contributor The contributor of this entry.
property String id The id of this entry.
property String[] link The location(s) of this entry.
property String published The date this entry was published.
property String rights The rights associated with this entry.
property String summary The summary of this entry.
property String title The title of this entry.
property String updated The date this entry was updated.
readonly property XML XML Returns the E4X XML contents of this AtomEntry.

3.3 APPClient Host Object API Documentation

Member Description
property Object credentials This property can be used to provide a JavaScript object with the username,password and authentication service credentials needed to communicate with APPServer. Currently this supports blogger authentication only.
    client.credentials={username:"you@email.com", password:"xxx", service:"blogger", authtype:"google"};
void deleteEntry(AtomEntry entry) Deletes the AtomEntry designated by the AtomEntry object.
void deleteEntry(String uri) Deletes the AtomEntry designated by the uri.
void get(AtomEntry entry) Get an AtomEntry from the APPServer, given an AtomEntry object.
void get(String uri) Get an AtomEntry from the APPServer, given a URI to an Atom entry.
    var entry2 = client.get("http://www.blogger.com/feeds/000/posts/full/000");
void getFeed(AtomFeed feed) Get an AtomFeed from the APPServer, given an AtomFeed object.
void getFeed(String uri) Get an AtomFeed from the APPServer, given a URI to an Atom feed.
    var entry2 = client.get("http://www.blogger.com/feeds/000/posts/full/000");
void post(String postURI, AtomEntry entry) Posts an AtomEntry object to an APP server using the given post URI as described in the APP specification.
void post(String postURI, Object entryObject) Posts an entry to an APP server using the given post URI as described in the APP specification, as an object with the following properties defined:
  • string author|string authors (comma separated list)
  • string category|string categories(comma separated list)
  • XML content|string content
  • string contributor|string contributors(comma separated list)
  • string id
  • string link|string links(comma separated list)
  • string published : can put the value as'now' to specify the current time
  • XML rights|string rights
  • XML summary | string summary
  • XML title | string title
  • string updated : can put the value as'now' to specify the current time
void put(String editURI, AtomEntry entry) Puts an AtomEntry object to an APP server using the given edit URI as described in the APP specification.
void put(String editURI, Object entryObject) Posts an entry to an APP server using the given edit URI as described in the APP specification, as an object with the following properties defined:
  • string author|string authors (comma separated list)
  • string category|string categories(comma separated list)
  • XML content|string content
  • string contributor|string contributors(comma separated list)
  • string id
  • string link|string links(comma separated list)
  • string published : can put the value as'now' to specify the current time
  • XML rights|string rights
  • XML summary | string summary
  • XML title | string title
  • string updated : can put the value as'now' to specify the current time

4.0 References


© 2007-2008 WSO2 Inc.