org.wso2.mashup.hostobjects.feed
Class Feed

java.lang.Object
  extended by org.mozilla.javascript.ScriptableObject
      extended by 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"; 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

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

Feed

public Feed()
Method Detail

jsConstructor

public void 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.String feedtype)

jsGet_feedType

public java.lang.String jsGet_feedType()

jsSet_author

public void jsSet_author(java.lang.String 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.String description)

jsGet_description

public java.lang.String jsGet_description()

jsSet_updated

public void jsSet_updated(java.lang.Object updated)
                   throws org.apache.axis2.AxisFault
Specified by:
jsSet_updated in interface org.wso2.mashup.hostobjects.feed.IFeed
Throws:
org.apache.axis2.AxisFault

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.String 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.String 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.String link)
                throws org.apache.abdera.i18n.iri.IRISyntaxException
Specified by:
jsSet_link in interface org.wso2.mashup.hostobjects.feed.IFeed
Throws:
org.apache.abdera.i18n.iri.IRISyntaxException

jsGet_link

public java.lang.String[] jsGet_link()
                              throws org.apache.abdera.i18n.iri.IRISyntaxException
Specified by:
jsGet_link in interface org.wso2.mashup.hostobjects.feed.IFeed
Throws:
org.apache.abdera.i18n.iri.IRISyntaxException

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)
                                     throws java.io.IOException

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
Throws:
java.io.IOException

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)
                                                                throws java.io.IOException

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 java.io.IOException

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:
java.io.IOException