org.wso2.mashup.hostobjects.atom
Class APPClientHostObject

java.lang.Object
  extended by org.mozilla.javascript.ScriptableObject
      extended by org.wso2.mashup.hostobjects.atom.APPClientHostObject
All Implemented Interfaces:
java.io.Serializable, org.mozilla.javascript.ConstProperties, org.mozilla.javascript.debug.DebuggableObject, org.mozilla.javascript.Scriptable

public class APPClientHostObject
extends org.mozilla.javascript.ScriptableObject

A Mozilla Rhino based javascript host object to act as a client to an APP server as defined in the APP specification.

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
APPClientHostObject()
           
 
Method Summary
 java.lang.String getClassName()
           
 void jsConstructor()
           
static void jsFunction_deleteEntry(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, java.lang.Object[] arguments, org.mozilla.javascript.Function funObj)
          

Deletes the AtomEntry designated by the URI or by the AtomEntry object from the APPServer.

static org.mozilla.javascript.Scriptable jsFunction_get(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, java.lang.Object[] arguments, org.mozilla.javascript.Function funObj)
          

Get an AtomEntry from the APPServer.

static org.mozilla.javascript.Scriptable jsFunction_getFeed(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, java.lang.Object[] arguments, org.mozilla.javascript.Function funObj)
          

Get an AtomFeed from the APPServer.

static org.mozilla.javascript.Scriptable jsFunction_getForEdit(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, java.lang.Object[] arguments, org.mozilla.javascript.Function funObj)
          TODO: Do we really need this...??
static org.mozilla.javascript.Scriptable jsFunction_post(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, java.lang.Object[] arguments, org.mozilla.javascript.Function funObj)
          

Posts an AtomEntry object in to an APP server using the given post URI as mentioned in the APP specification.

static void jsFunction_put(org.mozilla.javascript.Context cx, org.mozilla.javascript.Scriptable thisObj, java.lang.Object[] arguments, org.mozilla.javascript.Function funObj)
          

Puts an AtomEntry object in to a APP server using the given edit URI as mentioned in the APP specification.

 org.mozilla.javascript.Scriptable jsGet_credentials()
           
 void jsSet_credentials(java.lang.Object object)
          

This property can be used to provide a JavaScript object with the username,password and authentication service credentials needed to communicate with APPServer.

 void jsSet_options(java.lang.Object object)
          Not implemented yet.
 
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

APPClientHostObject

public APPClientHostObject()
Method Detail

jsConstructor

public void jsConstructor()

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_credentials

public void jsSet_credentials(java.lang.Object object)
                       throws java.io.IOException

This property can be used to provide a JavaScript object with the username,password and authentication service credentials needed to communicate with APPServer. Currently this supports blogger authentication only.

 eg:
 client.credentials={username:"you@email.com",password:"xxx",service:"blogger",authtype:"google"};
 

Parameters:
object -
Throws:
java.io.IOException

jsGet_credentials

public org.mozilla.javascript.Scriptable jsGet_credentials()
                                                    throws java.io.IOException
Returns:
the credentials object or null
Throws:
java.io.IOException

jsSet_options

public void jsSet_options(java.lang.Object object)
Not implemented yet.

Parameters:
object -

jsFunction_get

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

Get an AtomEntry from the APPServer. Expects an Atom entry URI or an AtomEntry object as the arguments.

get(string AtomEntryURI|AtomEntry entryObject);

 var entry2 = client.get("http://www.blogger.com/feeds/000/posts/full/000");
 

Returns:
AtomEntry
Throws:
java.io.IOException

jsFunction_getFeed

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

Get an AtomFeed from the APPServer. Expects an Atom feed URI or an AtomFeed object as the arguments.

getFeed(string AtomFeedURI|AtomFeed feedObject);

 var feed = client.getFeed("http://www.blogger.com/feeds/000/posts/full/000");
 

Returns:
AtomFeed
Throws:
java.io.IOException

jsFunction_getForEdit

public static org.mozilla.javascript.Scriptable jsFunction_getForEdit(org.mozilla.javascript.Context cx,
                                                                      org.mozilla.javascript.Scriptable thisObj,
                                                                      java.lang.Object[] arguments,
                                                                      org.mozilla.javascript.Function funObj)
                                                               throws java.io.IOException
TODO: Do we really need this...?? (Thilina)

Throws:
java.io.IOException

jsFunction_post

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

Posts an AtomEntry object in to an APP server using the given post URI as mentioned in the APP specification.

post(string postURI, {AtomEntry entry|object entry});

Entry to be posted can be given as a AtomEntry object as well as a javascript object with following properties defined.

Returns:
posted AtomEntry
Throws:
java.io.IOException

jsFunction_put

public static void jsFunction_put(org.mozilla.javascript.Context cx,
                                  org.mozilla.javascript.Scriptable thisObj,
                                  java.lang.Object[] arguments,
                                  org.mozilla.javascript.Function funObj)
                           throws java.io.IOException,
                                  java.lang.Exception,
                                  org.apache.abdera.i18n.iri.IRISyntaxException

Puts an AtomEntry object in to a APP server using the given edit URI as mentioned in the APP specification.

put(optional string editURI, {AtomEntry entry|object entry});

Entry to be put can be given as a AtomEntry object as well as a javascript object with following properties defined.

Throws:
java.io.IOException
java.lang.Exception
org.apache.abdera.i18n.iri.IRISyntaxException

jsFunction_deleteEntry

public static void jsFunction_deleteEntry(org.mozilla.javascript.Context cx,
                                          org.mozilla.javascript.Scriptable thisObj,
                                          java.lang.Object[] arguments,
                                          org.mozilla.javascript.Function funObj)
                                   throws java.io.IOException,
                                          java.lang.Exception,
                                          org.apache.abdera.i18n.iri.IRISyntaxException

Deletes the AtomEntry designated by the URI or by the AtomEntry object from the APPServer.

deleteEntry(string AtomEntryURI|AtomEntry entryObject);

 client.delete("http://www.blogger.com/feeds/000/posts/full/000");
 

Throws:
java.io.IOException
java.lang.Exception
org.apache.abdera.i18n.iri.IRISyntaxException