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";
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()
|
void |
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.String author)
|
void |
jsSet_category(java.lang.String category)
|
void |
jsSet_contributor(java.lang.String contributor)
|
void |
jsSet_description(java.lang.String description)
|
void |
jsSet_feedType(java.lang.String feedtype)
|
void |
jsSet_link(java.lang.String 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 void 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.String feedtype)
public java.lang.String jsGet_feedType()
public void jsSet_author(java.lang.String 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.String description)
public java.lang.String jsGet_description()
public void jsSet_updated(java.lang.Object updated)
throws org.apache.axis2.AxisFault
jsSet_updated in interface org.wso2.mashup.hostobjects.feed.IFeedorg.apache.axis2.AxisFaultpublic java.lang.String jsGet_updated()
jsGet_updated in interface org.wso2.mashup.hostobjects.feed.IFeedpublic void jsSet_category(java.lang.String 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.String 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.IFeed
public void jsSet_link(java.lang.String link)
throws org.apache.abdera.i18n.iri.IRISyntaxException
jsSet_link in interface org.wso2.mashup.hostobjects.feed.IFeedorg.apache.abdera.i18n.iri.IRISyntaxException
public java.lang.String[] jsGet_link()
throws org.apache.abdera.i18n.iri.IRISyntaxException
jsGet_link in interface org.wso2.mashup.hostobjects.feed.IFeedorg.apache.abdera.i18n.iri.IRISyntaxExceptionpublic 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)
throws java.io.IOException
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 -
java.io.IOException
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)
throws java.io.IOException
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 java.io.IOException
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 -
java.io.IOException