org.wso2.mashup.hostobjects.feed
Class Feed
java.lang.Object
org.mozilla.javascript.ScriptableObject
org.wso2.mashup.hostobjects.feed.Feed
- All Implemented Interfaces:
- java.io.Serializable, org.mozilla.javascript.ConstProperties,
org.mozilla.javascript.debug.DebuggableObject,
org.mozilla.javascript.Scriptable,
org.wso2.mashup.hostobjects.feed.IFeed
-
public class Feed
- extends org.mozilla.javascript.ScriptableObject
- implements org.wso2.mashup.hostobjects.feed.IFeed
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");
- See Also:
-
Serialized Form
| 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()
|
org.mozilla.javascript.NativeArray |
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 |
Feed
public Feed()
jsConstructor
public org.mozilla.javascript.Scriptable jsConstructor()
-
- Specified by:
jsConstructor in interface
org.wso2.mashup.hostobjects.feed.IFeed
getClassName
public java.lang.String getClassName()
-
- Specified by:
getClassName in interface
org.mozilla.javascript.Scriptable
- Specified by:
getClassName in class
org.mozilla.javascript.ScriptableObject
jsSet_feedType
public void jsSet_feedType(java.lang.Object feedtype)
jsGet_feedType
public java.lang.String jsGet_feedType()
jsSet_author
public void jsSet_author(java.lang.Object author)
-
- Specified by:
jsSet_author in interface
org.wso2.mashup.hostobjects.feed.IFeed
jsGet_author
public java.lang.String jsGet_author()
-
- Specified by:
jsGet_author in interface
org.wso2.mashup.hostobjects.feed.IFeed
jsSet_description
public void jsSet_description(java.lang.Object description)
jsGet_description
public java.lang.String jsGet_description()
jsSet_updated
public void jsSet_updated(java.lang.Object updated)
throws org.wso2.mashup.MashupFault
-
- Specified by:
jsSet_updated in interface
org.wso2.mashup.hostobjects.feed.IFeed
-
- Throws:
org.wso2.mashup.MashupFault
jsGet_updated
public java.lang.String jsGet_updated()
-
- Specified by:
jsGet_updated in interface
org.wso2.mashup.hostobjects.feed.IFeed
jsSet_category
public void jsSet_category(java.lang.Object category)
-
- Specified by:
jsSet_category in interface
org.wso2.mashup.hostobjects.feed.IFeed
jsGet_category
public java.lang.String jsGet_category()
-
- Specified by:
jsGet_category in interface
org.wso2.mashup.hostobjects.feed.IFeed
jsSet_contributor
public void jsSet_contributor(java.lang.Object contributor)
-
- Specified by:
jsSet_contributor in interface
org.wso2.mashup.hostobjects.feed.IFeed
jsGet_contributor
public java.lang.String jsGet_contributor()
-
- Specified by:
jsGet_contributor in interface
org.wso2.mashup.hostobjects.feed.IFeed
jsSet_link
public void jsSet_link(java.lang.Object link)
-
- Specified by:
jsSet_link in interface
org.wso2.mashup.hostobjects.feed.IFeed
jsGet_link
public org.mozilla.javascript.NativeArray jsGet_link()
-
- Specified by:
jsGet_link in interface
org.wso2.mashup.hostobjects.feed.IFeed
jsSet_title
public void jsSet_title(java.lang.Object title)
-
- Specified by:
jsSet_title in interface
org.wso2.mashup.hostobjects.feed.IFeed
jsGet_title
public java.lang.String jsGet_title()
-
- Specified by:
jsGet_title in interface
org.wso2.mashup.hostobjects.feed.IFeed
jsGet_XML
public org.mozilla.javascript.Scriptable jsGet_XML()
throws org.wso2.mashup.MashupFault
- Returns the E4X XML contents of this AtomFeed object
-
- Specified by:
jsGet_XML in interface
org.wso2.mashup.hostobjects.feed.IFeed
-
- Returns:
- E4X XML
- Throws:
org.wso2.mashup.MashupFault
jsFunction_getEntries
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();
-
- Parameters:
cx - Provides the current context
thisObj - Gives an instance of the js object from
which this method was called
arguments - No arguments required
funObj -
- Returns:
- AtomEntryHostObject[] An Array of Entry Host Objects contained
in this feed
jsFunction_insertEntry
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);
-
- Parameters:
cx - Provides the current context
thisObj - Gives an instance of the js object from
which this method was called
arguments - Argumets can be either an Entry
HostObject or None
funObj -
- Returns:
- Scriptable Entry HostObject
- Throws:
java.io.IOException
jsFunction_writeTo
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");
-
- Parameters:
cx - Provides the current context
thisObj - Gives an instance of the js object from
which this method was called
arguments - The expected argument is a String
representing the file path
funObj -
- Throws:
org.wso2.mashup.MashupFault