oscript.data
Class XmlRpcHandler

java.lang.Object
  extended by oscript.data.Value
      extended by oscript.data.OObject
          extended by oscript.data.XmlRpcHandler
All Implemented Interfaces:
java.io.Serializable, org.apache.xmlrpc.XmlRpcHandler

public class XmlRpcHandler
extends oscript.data.OObject
implements org.apache.xmlrpc.XmlRpcHandler

An XML-RPC handler that can wrap an arbitrary script object, for serving that object via XML-RPC. For convenience this can start it's own web server, if you use the startWebServer(java.lang.String, int) method, or you can create multiple handler objects and add them to a server that you create.

   // stand-alone mode:
   (new XmlRpcHandler(adder)).startWebServer( "adder", 12345 );
   
   // adding multiple handlers to a single server:
   var server = new org.apache.xmlrpc.WebServer(12345);
   server.addHandler( "adder",      new XmlRpcHandler(adder) );
   server.addHandler( "multiplier", new XmlRpcHandler(multipler) );
   ... etc ...
 

Author:
Rob Clark (rob@ti.com)
See Also:
Serialized Form

Field Summary
static java.lang.String[] MEMBER_NAMES
           
static java.lang.String PARENT_TYPE_NAME
           
static oscript.data.Value TYPE
          The type object for an instance of XmlRpcHandler.
static java.lang.String TYPE_NAME
           
 
Fields inherited from class oscript.data.OObject
EMPTY_EXPR_LIST_EVALUATOR
 
Fields inherited from class oscript.data.Value
DEBUG, NULL, UNDEFINED
 
Constructor Summary
XmlRpcHandler(oscript.util.MemberTable args)
          Class Constructor.
XmlRpcHandler(oscript.data.Value obj)
          Class Constructor.
 
Method Summary
 java.lang.Object execute(java.lang.String name, java.util.Vector params)
          Execute the specified method.
protected  oscript.data.Value getTypeImpl()
          Get the type of this object.
static void init()
           
 void startWebServer(java.lang.String name, int port)
          A convenience method for creating and initializing a web server to serve just this object.
 
Methods inherited from class oscript.data.OObject
castToString, getMember, populateMemberSet
 
Methods inherited from class oscript.data.Value
_getTypeMember, _populateTypeMemberSet, bopBitwiseAnd, bopBitwiseAndR, bopBitwiseOr, bopBitwiseOrR, bopBitwiseXor, bopBitwiseXorR, bopCast, bopCastR, bopDivide, bopDivideR, bopEquals, bopEqualsR, bopGreaterThan, bopGreaterThanOrEquals, bopGreaterThanOrEqualsR, bopGreaterThanR, bopInstanceOf, bopInstanceOfR, bopLeftShift, bopLeftShiftR, bopLessThan, bopLessThanOrEquals, bopLessThanOrEqualsR, bopLessThanR, bopLogicalAnd, bopLogicalAndR, bopLogicalOr, bopLogicalOrR, bopMinus, bopMinusR, bopMultiply, bopMultiplyR, bopNotEquals, bopNotEqualsR, bopPlus, bopPlusR, bopRemainder, bopRemainderR, bopSignedRightShift, bopSignedRightShiftR, bopUnsignedRightShift, bopUnsignedRightShiftR, callAsConstructor, callAsConstructor, callAsConstructor, callAsExtends, callAsExtends, callAsExtends, callAsFunction, callAsFunction, callAsFunction, castToBoolean, castToExactNumber, castToInexactNumber, castToJavaObject, elementAt, elementsAt, getMember, getMember, getMember, getMember, getMember, getMonitor, getType, getTypeMember, getTypeMember, isA, length, memberSet, noSuchMember, opAssign, populateTypeMemberSet, readExternal, toString, unhand, uopBitwiseNot, uopDecrement, uopIncrement, uopLogicalNot, uopMinus, uopPlus, writeExternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE

public static final oscript.data.Value TYPE
The type object for an instance of XmlRpcHandler.


PARENT_TYPE_NAME

public static final java.lang.String PARENT_TYPE_NAME
See Also:
Constant Field Values

TYPE_NAME

public static final java.lang.String TYPE_NAME
See Also:
Constant Field Values

MEMBER_NAMES

public static final java.lang.String[] MEMBER_NAMES
Constructor Detail

XmlRpcHandler

public XmlRpcHandler(oscript.data.Value obj)
Class Constructor.

Parameters:
obj - the server object

XmlRpcHandler

public XmlRpcHandler(oscript.util.MemberTable args)
Class Constructor. This is the constructor that gets called via an BuiltinType instance.

Parameters:
args - arguments to this constructor
Throws:
PackagedScriptObjectException(Exception) - if wrong number of args
Method Detail

init

public static void init()

getTypeImpl

protected oscript.data.Value getTypeImpl()
Get the type of this object. The returned type doesn't have to take into account the possibility of a script type extending a built-in type, since that is handled by Value.getType().

Overrides:
getTypeImpl in class oscript.data.OObject
Returns:
the object's type

startWebServer

public void startWebServer(java.lang.String name,
                           int port)
A convenience method for creating and initializing a web server to serve just this object. Methods of this object will be callable remotely as name.methodName

Parameters:
name - the object name.
port - the port number that the server will listen for new connections on

execute

public java.lang.Object execute(java.lang.String name,
                                java.util.Vector params)
Execute the specified method.

Specified by:
execute in interface org.apache.xmlrpc.XmlRpcHandler
Parameters:
name - the method name
params - the parameters to the method
Returns:
the result