java.lang.Objectorg.mozilla.javascript.ScriptableObject
org.wso2.mashup.hostobjects.feed.Feed
public class Feed
The Feed host object is a generic host object capable of intelligently working with both Atom and RSS feeds. The underlying protocol implementation is kept transparent. However, some data might be lost due to this being an abstraction of both Atom and RSS feeds. Notes: 1. When instantiating a Feed object, feedType, title, description and link are mandatory according to the RSS specification 2. Valid feed types to be passed in feed.feedType() are rss_0.90, rss_0.91, rss_0.92, rss_0.93, rss_0.94, rss_1.0 rss_2.0 or atom_0.3.
eg:
//Creating an RSS 2.0 feed and writing it to file.
var feed = new Feed();
feed.feedType = "rss_2.0"; // Not necessary for RSS 2.0 since the Feed object defaults to this feed type.
feed.title = "This is a test Feed";
feed.description = "This feed demonsrates the use of Feed host object to create an RSS 2.0 feed.";
feed.link = "http://mooshup.com/rss20.xml";
var entry = new Entry();
entry.title = "This is a test entry.";
entry.description = "This is a sample entry demonstrating the use of the Entry host object.";
feed.insertEntry(entry);
var entry2 = new Entry();
entry2.title = "This is another test entry.";
entry2.description = "This is a sample entry demonstrating the use of the Entry host object.";
feed.insertEntry(entry2);
var result = feed.writeTo("test-created-rss-feed.xml");
| Field Summary |
|---|
| Fields inherited from class org.mozilla.javascript.ScriptableObject |
|---|
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST |
| Fields inherited from interface org.mozilla.javascript.Scriptable |
|---|
NOT_FOUND |
| Constructor Summary | |
|---|---|
Feed()
|
|
| Method Summary | |
|---|---|
java.lang.String |
getClassName()
|
org.mozilla.javascript.Scriptable |
jsConstructor()
|
static Entry[] |
jsFunction_getEntries(org.mozilla.javascript.Context cx,
org.mozilla.javascript.Scriptable thisObj,
java.lang.Object[] arguments,
org.mozilla.javascript.Function funObj)
Returns the complete set of entries contained in this feed eg: var entries = feed.getEntries(); |
static org.mozilla.javascript.Scriptable |
jsFunction_insertEntry(org.mozilla.javascript.Context cx,
org.mozilla.javascript.Scriptable thisObj,
java.lang.Object[] arguments,
org.mozilla.javascript.Function funObj)
Adds a new Entry to the end of the Feeds collection of entries eg: feed.insertEntry(newEntry); |
static org.mozilla.javascript.Scriptable |
jsFunction_writeTo(org.mozilla.javascript.Context cx,
org.mozilla.javascript.Scriptable thisObj,
java.lang.Object[] arguments,
org.mozilla.javascript.Function funObj)
Serializes the Feed to a given local file eg: feed.writeTo("file-name.xml"); |
java.lang.String |
jsGet_author()
|
java.lang.String |
jsGet_category()
|
java.lang.String |
jsGet_contributor()
|
java.lang.String |
jsGet_description()
|
java.lang.String |
jsGet_feedType()
|
java.lang.String[] |
jsGet_link()
|
java.lang.String |
jsGet_title()
|
java.lang.String |
jsGet_updated()
|
org.mozilla.javascript.Scriptable |
jsGet_XML()
Returns the E4X XML contents of this AtomFeed object |
void |
jsSet_author(java.lang.Object author)
|
void |
jsSet_category(java.lang.Object category)
|
void |
jsSet_contributor(java.lang.Object contributor)
|
void |
jsSet_description(java.lang.Object description)
|
void |
jsSet_feedType(java.lang.Object feedtype)
|
void |
jsSet_link(java.lang.Object link)
|
void |
jsSet_title(java.lang.Object title)
|
void |
jsSet_updated(java.lang.Object updated)
|
| Methods inherited from class org.mozilla.javascript.ScriptableObject |
|---|
associateValue, callMethod, callMethod, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, get, get, getAllIds, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, has, has, hasInstance, hasProperty, hasProperty, isConst, isSealed, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Feed()
| Method Detail |
|---|
public org.mozilla.javascript.Scriptable jsConstructor()
jsConstructor in interface org.wso2.mashup.hostobjects.feed.IFeedpublic java.lang.String getClassName()
getClassName in interface org.mozilla.javascript.ScriptablegetClassName in class org.mozilla.javascript.ScriptableObjectpublic void jsSet_feedType(java.lang.Object feedtype)
public java.lang.String jsGet_feedType()
public void jsSet_author(java.lang.Object author)
jsSet_author in interface org.wso2.mashup.hostobjects.feed.IFeedpublic java.lang.String jsGet_author()
jsGet_author in interface org.wso2.mashup.hostobjects.feed.IFeedpublic void jsSet_description(java.lang.Object description)
public java.lang.String jsGet_description()
public void jsSet_updated(java.lang.Object updated)
throws org.wso2.mashup.MashupFault
jsSet_updated in interface org.wso2.mashup.hostobjects.feed.IFeedorg.wso2.mashup.MashupFaultpublic java.lang.String jsGet_updated()
jsGet_updated in interface org.wso2.mashup.hostobjects.feed.IFeedpublic void jsSet_category(java.lang.Object category)
jsSet_category in interface org.wso2.mashup.hostobjects.feed.IFeedpublic java.lang.String jsGet_category()
jsGet_category in interface org.wso2.mashup.hostobjects.feed.IFeedpublic void jsSet_contributor(java.lang.Object contributor)
jsSet_contributor in interface org.wso2.mashup.hostobjects.feed.IFeedpublic java.lang.String jsGet_contributor()
jsGet_contributor in interface org.wso2.mashup.hostobjects.feed.IFeedpublic void jsSet_link(java.lang.Object link)
jsSet_link in interface org.wso2.mashup.hostobjects.feed.IFeedpublic java.lang.String[] jsGet_link()
jsGet_link in interface org.wso2.mashup.hostobjects.feed.IFeedpublic void jsSet_title(java.lang.Object title)
jsSet_title in interface org.wso2.mashup.hostobjects.feed.IFeedpublic java.lang.String jsGet_title()
jsGet_title in interface org.wso2.mashup.hostobjects.feed.IFeed
public org.mozilla.javascript.Scriptable jsGet_XML()
throws org.wso2.mashup.MashupFault
jsGet_XML in interface org.wso2.mashup.hostobjects.feed.IFeedorg.wso2.mashup.MashupFault
public static Entry[] jsFunction_getEntries(org.mozilla.javascript.Context cx,
org.mozilla.javascript.Scriptable thisObj,
java.lang.Object[] arguments,
org.mozilla.javascript.Function funObj)
Returns the complete set of entries contained in this feed
eg:
var entries = feed.getEntries();
cx - Provides the current contextthisObj - Gives an instance of the js object from which this method was calledarguments - No arguments requiredfunObj -
public static org.mozilla.javascript.Scriptable jsFunction_insertEntry(org.mozilla.javascript.Context cx,
org.mozilla.javascript.Scriptable thisObj,
java.lang.Object[] arguments,
org.mozilla.javascript.Function funObj)
Adds a new Entry to the end of the Feeds collection of entries
eg:
feed.insertEntry(newEntry);
cx - Provides the current contextthisObj - Gives an instance of the js object from which this method was calledarguments - Argumets can be either an Entry HostObject or NonefunObj -
java.io.IOException
public static org.mozilla.javascript.Scriptable jsFunction_writeTo(org.mozilla.javascript.Context cx,
org.mozilla.javascript.Scriptable thisObj,
java.lang.Object[] arguments,
org.mozilla.javascript.Function funObj)
throws org.wso2.mashup.MashupFault
Serializes the Feed to a given local file
eg:
feed.writeTo("file-name.xml");
cx - Provides the current contextthisObj - Gives an instance of the js object from which this method was calledarguments - The expected argument is a String representing the file pathfunObj -
org.wso2.mashup.MashupFault