org.wso2.mashup.hostobjects.atom
Class AtomFeedHostObject

java.lang.Object
  extended by org.mozilla.javascript.ScriptableObject
      extended by org.wso2.mashup.hostobjects.atom.AtomFeedHostObject
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 AtomFeedHostObject
extends org.mozilla.javascript.ScriptableObject
implements org.wso2.mashup.hostobjects.feed.IFeed

This is a Mozilla Rhino Host Object implementation which tries to provide a javascript representation of the AtomFeed defined in the ATOM specification

Per RFC4287:

 The "atom:feed" element is the document (i.e., top-level) element of
 an Atom Feed Document, acting as a container for metadata and data
 associated with the feed.  Its element children consist of metadata
 elements followed by zero or more atom:entry child elements.
 

atomFeed = element atom:feed { atomCommonAttributes, (atomAuthor* & atomCategory* & atomContributor* & atomGenerator? & atomIcon? & atomId & atomLink* & atomLogo? & atomRights? & atomSubtitle? & atomTitle & atomUpdated & extensionElement*), atomEntry* }

This specification assigns no significance to the order of atom:entry elements within the feed.

The following child elements are defined by this specification (note that the presence of some of these elements is required):

o atom:feed elements MUST contain one or more atom:author elements, unless all of the atom:feed element's child atom:entry elements contain at least one atom:author element. o atom:feed elements MAY contain any number of atom:category elements. o atom:feed elements MAY contain any number of atom:contributor elements. o atom:feed elements MUST NOT contain more than one atom:generator element. o atom:feed elements MUST NOT contain more than one atom:icon element. o atom:feed elements MUST NOT contain more than one atom:logo element. o atom:feed elements MUST contain exactly one atom:id element. o atom:feed elements SHOULD contain one atom:link element with a rel attribute value of "self". This is the preferred URI for retrieving Atom Feed Documents representing this Atom feed. o atom:feed elements MUST NOT contain more than one atom:link element with a rel attribute value of "alternate" that has the same combination of type and hreflang attribute values. o atom:feed elements MAY contain additional atom:link elements beyond those described above. o atom:feed elements MUST NOT contain more than one atom:rights element. o atom:feed elements MUST NOT contain more than one atom:subtitle element. o atom:feed elements MUST contain exactly one atom:title element. o atom:feed elements MUST contain exactly one atom:updated element.

If multiple atom:entry elements with the same atom:id value appear in an Atom Feed Document, they represent the same entry. Their atom:updated timestamps SHOULD be different. If an Atom Feed Document contains multiple entries with the same atom:id, Atom Processors MAY choose to display all of them or some subset of them. One typical behavior would be to display only the entry with the latest atom:updated timestamp.

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
AtomFeedHostObject()
           
 
Method Summary
 java.lang.String getClassName()
           
 void jsConstructor()
          Constructor the user will be using inside javaScript
static org.mozilla.javascript.Scriptable jsFunction_addEntry(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

static AtomEntryHostObject[] 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
static org.mozilla.javascript.Scriptable jsFunction_getEntry(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, java.lang.Object[] arguments, org.mozilla.javascript.Function funObj)
          Retrieves the first entry in the feed with the given atom:id value
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 start of the Feeds collection of entries
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
 java.lang.String jsGet_author()
           
 java.lang.String jsGet_category()
           
 java.lang.String jsGet_contributor()
           
 java.lang.String jsGet_id()
           
 java.lang.String[] jsGet_link()
           
 java.lang.String jsGet_rights()
           
 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_id(java.lang.Object id)
           
 void jsSet_link(java.lang.String link)
           
 void jsSet_rights(java.lang.Object rights)
           
 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

AtomFeedHostObject

public AtomFeedHostObject()
Method Detail

jsConstructor

public void jsConstructor()
Constructor the user will be using inside javaScript

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_id

public void jsSet_id(java.lang.Object id)
              throws org.apache.abdera.i18n.iri.IRISyntaxException
Throws:
org.apache.abdera.i18n.iri.IRISyntaxException

jsGet_id

public java.lang.String jsGet_id()
                          throws org.apache.abdera.i18n.iri.IRISyntaxException
Throws:
org.apache.abdera.i18n.iri.IRISyntaxException

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_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

jsSet_rights

public void jsSet_rights(java.lang.Object rights)

jsGet_rights

public java.lang.String jsGet_rights()

jsGet_XML

public org.mozilla.javascript.Scriptable jsGet_XML()
Returns the E4X XML contents of this AtomFeed object

Specified by:
jsGet_XML in interface org.wso2.mashup.hostobjects.feed.IFeed
Returns:
E4X XML

jsFunction_addEntry

public static org.mozilla.javascript.Scriptable jsFunction_addEntry(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

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 AtomEntryHostObject or None
funObj -
Returns:
Scriptable AtomEntryHostObject
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 start of the Feeds collection of entries

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 AtomEntryHostObject or None
funObj -
Returns:
Scriptable AtomEntryHostObject
Throws:
java.io.IOException

jsFunction_getEntry

public static org.mozilla.javascript.Scriptable jsFunction_getEntry(org.mozilla.javascript.Context cx,
                                                                    org.mozilla.javascript.Scriptable thisObj,
                                                                    java.lang.Object[] arguments,
                                                                    org.mozilla.javascript.Function funObj)
                                                             throws java.io.IOException

Retrieves the first entry in the feed with the given atom:id value

Parameters:
cx - Provides the current context
thisObj - Gives an instance of the js object from which this method was called
arguments - A String representation of the Atom Entry's id
funObj -
Returns:
Scriptable AtomEntryHostObject
Throws:
java.io.IOException

jsFunction_getEntries

public static AtomEntryHostObject[] 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

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 AtomEntryHostObjects contained in this feed
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

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