org.openorb.net
Interface ServerProtocol

All Known Implementing Classes:
IIOPServerProtocol

public interface ServerProtocol

The server protocol represents a listen point at which clients may create a ServerChannel object through which to issue requests. The server protocol is also responsible for constructing profiles to be published within an IOR.

Author:
Unknown

Field Summary
static int STATE_CLOSED
          Closed.
static int STATE_LISTENING
          Listening for new connections.
static int STATE_PAUSED
          Paused.
 
Method Summary
 void close()
          Stop listening, refuse all incoming connections.
 TaggedProfile create_profile(int profile_tag, ComponentSet component_set, byte[] object_key)
          Construct a tagged profile from parts.
 void listen(int timeout)
          Listen for a single connection.
 boolean open()
          Move to the listening state.
 ORB orb()
          An orb reference.
 boolean pause()
          Move to the paused state.
 void run_listen()
          Donate a thread for listening.
 int state()
          The channel state.
 

Field Detail

STATE_LISTENING

public static final int STATE_LISTENING
Listening for new connections. perform_work waits for a specified time for a new incoming connections and work_pending returns true if there is a queued connection request.

STATE_PAUSED

public static final int STATE_PAUSED
Paused. Connection requests are queued. Protocols which serve requests are created in this state. Listen returns immediatly and any thread used in run_listen will be sent to sleep.

STATE_CLOSED

public static final int STATE_CLOSED
Closed. Incoming connections are being refused. perform_work returns false. Leaving this state will result in re-registering with the ServerManager.
Method Detail

orb

public ORB orb()
An orb reference.

state

public int state()
The channel state.

open

public boolean open()
Move to the listening state. If in the closed state this will result in the protocol re-registering itself with the ServerManager. Returns true if state changed.

pause

public boolean pause()
Move to the paused state. This is only valid in the LISTENING state. returns true if state is now PAUSED.

close

public void close()
Stop listening, refuse all incoming connections. Returns true if state is now CLOSED.

listen

public void listen(int timeout)
Listen for a single connection. If a connection is available this will create and register a new server socket, otherwise it will return once the timeout has expired. A negative or zero timeout will be changed to a maximum.

run_listen

public void run_listen()
Donate a thread for listening. This function returns when interrupt is called on the thread or the protocol is closed.

create_profile

public TaggedProfile create_profile(int profile_tag,
                                    ComponentSet component_set,
                                    byte[] object_key)
Construct a tagged profile from parts. This is used by the ServerManager. If the profile should not be included in an IOR this may return null.