org.symcomp.scscp
Class ProcedureCallHandler

java.lang.Object
  extended by org.symcomp.scscp.ProcedureCallHandler
Direct Known Subclasses:
SCSCP2HandlersHandler, SCSCP2RemoteObjectsHandler, SCSCP2ServDescHandler

public abstract class ProcedureCallHandler
extends java.lang.Object

The class used to implement the handlers inside an SCSCP server.
To create your own handler this class needs to be subclassed and the methods

need to be overriden. In a more advanced scenario you may want to override handle (instead of handlePayload), and/or getServiceNames or getServiceName (instead of getServiceNameStr)


Constructor Summary
ProcedureCallHandler()
           
 
Method Summary
abstract  java.lang.String getDescription(org.symcomp.openmath.OMSymbol smb)
          A concise description of this handler.
 org.symcomp.openmath.OMSymbol getServiceName()
          In ProcedureCallHandler, this method simply returns an OMSymbol whose CD is scscp_transient_1, and whose name is getServiceNameStr().
 org.symcomp.openmath.OMSymbol[] getServiceNames()
          Method used by the server to check whether a handler supports a particular service.
 java.lang.String getServiceNameStr()
          In ProcedureCallHandler, this method returns null.
 ProcedureDone handle(ProcedureCall pc)
          The method called by the server.
 OpenMathBase handlePayload(OpenMathBase payload)
          The method that subclasses should override and do something sensible in.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProcedureCallHandler

public ProcedureCallHandler()
Method Detail

handlePayload

public OpenMathBase handlePayload(OpenMathBase payload)
                           throws OpenMathException
The method that subclasses should override and do something sensible in.

Parameters:
payload - the input
Returns:
the output
Throws:
OpenMathException

handle

public ProcedureDone handle(ProcedureCall pc)
                     throws OpenMathException
The method called by the server. In ProcedureCallHandler it simply calls handlePayload and wraps its response in a ProcedureCompleted object.

Parameters:
pc - the Procedure Call containing the query
Returns:
a Procedure Completed message
Throws:
OpenMathException

getDescription

public abstract java.lang.String getDescription(org.symcomp.openmath.OMSymbol smb)
A concise description of this handler.

Parameters:
smb - Since ProcedureCallHandlers may handle more than one service (by implementing handle), different descriptions may be required for different services. Hence this parameter.
Returns:
a String describing the service.

getServiceNames

public org.symcomp.openmath.OMSymbol[] getServiceNames()
Method used by the server to check whether a handler supports a particular service. In ProcedureCallHandler, this method simply returns an array with one element: the result of getServiceName().

Returns:
the service names handled by this handler

getServiceName

public org.symcomp.openmath.OMSymbol getServiceName()
In ProcedureCallHandler, this method simply returns an OMSymbol whose CD is scscp_transient_1, and whose name is getServiceNameStr().

Returns:
the single service name handled by this handler

getServiceNameStr

public java.lang.String getServiceNameStr()
In ProcedureCallHandler, this method returns null.

Returns:
the single service name handled by this handler as string, if available.


Copyright © 2010. All Rights Reserved.