BootstrapServerRequestDispatcher.javaAPI DocJava SE 5 API4311Fri Aug 26 14:54:30 BST


public class BootstrapServerRequestDispatcher extends Object implements CorbaServerRequestDispatcher
Class BootstrapServerRequestDispatcher handles the requests coming to the BootstrapServer. It implements Server so that it can be registered as a subcontract. It is passed a BootstrapServiceProperties object which contains the supported ids and their values for the bootstrap service. This Properties object is only read from, never written to, and is shared among all threads.

The BootstrapServerRequestDispatcher responds primarily to GIOP requests, but LocateRequests are also handled for graceful interoperability. The BootstrapServerRequestDispatcher handles one request at a time.

Fields Summary
private ORB
private static final boolean
Constructors Summary
public BootstrapServerRequestDispatcher(ORB orb)

	this.orb = orb;
	this.wrapper = ORBUtilSystemException.get( orb,
	    CORBALogDomains.RPC_PROTOCOL ) ;
Methods Summary
public voiddispatch( messageMediator)
Dispatch is called by the ORB and will serve get(key) and list() invocations on the initial object key.

	CorbaMessageMediator request = (CorbaMessageMediator) messageMediator;
	CorbaMessageMediator response = null;

	try {
	    MarshalInputStream is = (MarshalInputStream) 
	    String method = request.getOperationName();
	    response = request.getProtocolHandler().createResponse(request, null);
	    MarshalOutputStream os = (MarshalOutputStream) 

            if (method.equals("get")) {
                // Get the name of the requested service
                String serviceKey = is.read_string();

                // Look it up
		org.omg.CORBA.Object serviceObject = 
		    orb.getLocalResolver().resolve( serviceKey ) ;

                // Write reply value
            } else if (method.equals("list")) {
		java.util.Set keys = orb.getLocalResolver().list() ;
		os.write_long( keys.size() ) ;
		Iterator iter = keys.iterator() ;
		while (iter.hasNext()) {
		    String obj = (String) ;
		    os.write_string( obj ) ;
	    } else {
		throw wrapper.illegalBootstrapOperation( method ) ;

	} catch (org.omg.CORBA.SystemException ex) {
            // Marshal the exception thrown
	    response = request.getProtocolHandler().createSystemExceptionResponse(
		request, ex, null);
	} catch (java.lang.RuntimeException ex) {
            // Unknown exception
	    SystemException sysex = wrapper.bootstrapRuntimeException( ex ) ;
	    response = request.getProtocolHandler().createSystemExceptionResponse(
                 request, sysex, null ) ;
	} catch (java.lang.Exception ex) {
            // Unknown exception
	    SystemException sysex = wrapper.bootstrapException( ex ) ;
	    response = request.getProtocolHandler().createSystemExceptionResponse(
                 request, sysex, null ) ;

public intgetId()
Not implemented

	throw wrapper.genericNoImpl() ;
public objectKey)
Locates the object mentioned in the locate requests, and returns object here iff the object is the initial object key. A SystemException thrown if the object key is not the initial object key.

	return null;