edu.cmu.aura.service.rpc
Class SkelServer

java.lang.Object
  |
  +--edu.cmu.aura.service.rpc.SkelServer
All Implemented Interfaces:
edu.cmu.aura.service.net.http.HTTPRequestHandler, RemotelyReferable

public class SkelServer
extends java.lang.Object
implements edu.cmu.aura.service.net.http.HTTPRequestHandler, RemotelyReferable

SkelServer is used on the RPC receive side to dispatch incoming calls to their correct skeleton. SkelServer will run an HTTP server on a specified port to listen for incoming calls, and dispatch them in their own thread.


Constructor Summary
SkelServer(int port)
          Create a new SkelServer listening on the specified port.
 
Method Summary
 void addSkel(java.lang.String methodName, Skel skel)
          Associate a skeleton with a specific method.
 int getPort()
          Return the port this skeleton is accepting calls on.
 RemoteReference getSkelRef()
          Return a reference to this skeleton.
 edu.cmu.aura.service.net.http.Response handleRequest(edu.cmu.aura.service.net.http.Request request)
          Handle an incoming HTTP Request.
 void removeSkel(java.lang.String methodName)
          Disassociate a skeleton with a previously associated method.
 void start()
          Start listening for incoming calls.
 void stop()
          Stop listening for incoming calls.
 boolean supportsConcurrency()
          HTTPRequestHandler method that lets the HTTPServer know that this is a threaded server.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SkelServer

public SkelServer(int port)
           throws java.io.IOException
Create a new SkelServer listening on the specified port.
Parameters:
port - port to listen for incoming calls on.
Method Detail

getSkelRef

public RemoteReference getSkelRef()
Return a reference to this skeleton.
Specified by:
getSkelRef in interface RemotelyReferable

getPort

public int getPort()
Return the port this skeleton is accepting calls on.
Returns:
the port this skeleton is accepting calls on.

start

public void start()
Start listening for incoming calls.

stop

public void stop()
Stop listening for incoming calls.

supportsConcurrency

public boolean supportsConcurrency()
HTTPRequestHandler method that lets the HTTPServer know that this is a threaded server.
Specified by:
supportsConcurrency in interface edu.cmu.aura.service.net.http.HTTPRequestHandler
Following copied from interface: edu.cmu.aura.service.net.http.HTTPRequestHandler
Returns:
true if the implementation supports concurrent handling of requests.

addSkel

public void addSkel(java.lang.String methodName,
                    Skel skel)
Associate a skeleton with a specific method.
Parameters:
methodName - method to associate.
skel - skeleton to associate.

removeSkel

public void removeSkel(java.lang.String methodName)
Disassociate a skeleton with a previously associated method.
Parameters:
methodName - method to disassociate.

handleRequest

public edu.cmu.aura.service.net.http.Response handleRequest(edu.cmu.aura.service.net.http.Request request)
Handle an incoming HTTP Request.
Specified by:
handleRequest in interface edu.cmu.aura.service.net.http.HTTPRequestHandler
Parameters:
Request - incoming HTTP Request.
Returns:
an HTTP response containing the method result.