|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.symcomp.scscp.C3PO
org.symcomp.scscp.SCSCPServer
public class SCSCPServer
A class to wrap the functionality of an SCSCP-server.
Whilst its superclass C3PO implements the transport layer of the
SCSCP protocol, you can subclass SCSCPServer to simplify the
development of an actual SCSCP compliant server.
A typical subclass looks like this (remove the _ before the @):
_@SCSCPServerInfo(
serviceName="MyBrilliantSCSCPServer",
serviceVersion="0.0.1",
serviceDescription="Solves every problem"
)
public class MySCSCPServer extends SCSCPServer {
public static void MySCSCPServer(String[] args) throws Exception {
System.out.println(getServiceName() + " " + getServiceVersion() + " starting...");
breed(MySCSCPServer.class, 26134); // blocks
}
MySCSCPServer(String serviceId, java.io.PrintWriter out, java.io.BufferedReader inn) {
super(MySCSCPServer.class, serviceId, out, inn);
this.addHandler(new ProblemSolver());
// ... further Handlers go here
}
}
| Field Summary | |
|---|---|
protected CookieStore |
cookies
|
protected java.util.HashSet<java.lang.String> |
terminatedComputations
Keeps track of terminated computations |
| Fields inherited from class org.symcomp.scscp.C3PO |
|---|
inn, loglevel, out, scscpVersion, serviceId, state, waitingComputations |
| Constructor Summary | |
|---|---|
SCSCPServer()
|
|
SCSCPServer(java.lang.Class claz,
java.lang.String serviceId,
java.io.PrintWriter out,
java.io.BufferedReader inn)
Creating an instance of the SCSCP server. |
|
| Method Summary | |
|---|---|
void |
addHandler(ProcedureCallHandler pch)
Adds a handler for a request. |
java.lang.String |
compute(java.lang.String input)
This method is called from within C3POs run |
ProcedureCallHandler |
findHandler(org.symcomp.openmath.OMSymbol servicename)
Find the appropriate Handler for a given service |
protected void |
receivedTerminateRequestInternal(java.lang.String callID)
Keep track of terminated computations |
| Methods inherited from class org.symcomp.scscp.C3PO |
|---|
announceRendevouz, breed, cleanup, getServiceDescription, getServiceName, getServiceVersion, log, logStackTrace, receivedInfo, receivedTerminateRequest, run, setLoglevel, spawn |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected CookieStore cookies
protected java.util.HashSet<java.lang.String> terminatedComputations
| Constructor Detail |
|---|
public SCSCPServer()
public SCSCPServer(java.lang.Class claz,
java.lang.String serviceId,
java.io.PrintWriter out,
java.io.BufferedReader inn)
spawn and breed methods
can make your life easier.
claz - The class itself, necessary due to the stupid inheritance-model of Java.serviceId - The id of the instanceout - The socket to which the SCSCP server sends it outputinn - The socket from which the SCSCP server reads its input| Method Detail |
|---|
public java.lang.String compute(java.lang.String input)
C3POs run command.
In this implementation the request is parsed to a tree of OpenMathBase
objects, deconstructed, and the appropriate handler for the request is called.
- Specified by:
compute in class C3PO
- Parameters:
input - A request as an XML encoded OpenMath string.
- Returns:
- The answer as an XML encoded OpenMath string, or the empty string
if the procedure call had option_return_nothing set.
protected void receivedTerminateRequestInternal(java.lang.String callID)
receivedTerminateRequestInternal in class C3POcallID - the callID of the call that could be terminatedpublic void addHandler(ProcedureCallHandler pch)
pch - The new handler.public ProcedureCallHandler findHandler(org.symcomp.openmath.OMSymbol servicename)
servicename - The name of the service
ProcedureCallHandler that can handle the given servicename
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||