# OpenORB 1.3.1: Class IIOPServerProtocol

## org.openorb.iiop
Class IIOPServerProtocol

    java.lang.Object
      |
      +--org.openorb.iiop.IIOPServerProtocol

All Implemented Interfaces:
  ServerProtocol

public class IIOPServerProtocol
extends java.lang.Object
implements ServerProtocol

This class provides the implementation of the IIOP protocol on the server side.

Version:
  $Revision: 1.18 $ $Date: 2002/09/15 21:48:46 $
Author:
  Chris Wood

Fields inherited from interface org.openorb.net.ServerProtocol
`STATE_CLOSED, STATE_LISTENING, STATE_PAUSED`

Constructor Summary
`IIOPServerProtocol(ServerManager serverManager, CDRCodecFactory codecFactory, IIOPTransportServerInitializer trans)` Create new IIOPServerProtocol

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.
`ServerManager` `getServerManager()` Return the server mnanager instance.
`void` `listen(int timeout)` Listen for a single connection.
`boolean` `open()` Move to the listening state.
`ORB` `orb()` Return the orb instance.
`boolean` `pause()` Move to the paused state.
`void` `run_listen()` Donate a thread for listening.
`boolean` `servesAddress(java.lang.String addr, int port)`
`void` `setClientProtocol(IIOPClientProtocol clientProtocol)`
`int` `state()` Return the state.
`java.lang.String` `toString()` Return a stringified representation of the information in this class.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### IIOPServerProtocol

    public IIOPServerProtocol(ServerManager serverManager,
                              CDRCodecFactory codecFactory,
                              IIOPTransportServerInitializer trans)

  Create new IIOPServerProtocol
  Parameters:
    `serverManager` - the server manager instance.
    `codecFactory` - codec factory for iiop codecs.
    `hostname` - Hostname to publish in IORs
    `port` - Port to publish in IORs
    `trans` - transport initializer.
  Throws:
    `INITIALIZE` - if problem occoured during startup.

Method Detail

### toString

    public java.lang.String toString()

  Return a stringified representation of the information in this class.
  Overrides:
    `toString` in class `java.lang.Object`

### setClientProtocol

    public void setClientProtocol(IIOPClientProtocol clientProtocol)

### orb

    public ORB orb()

  Return the orb instance.
  Specified by:
    `orb` in interface `ServerProtocol`

### getServerManager

    public ServerManager getServerManager()

  Return the server mnanager instance.

### servesAddress

    public boolean servesAddress(java.lang.String addr,
                                 int port)

### state

    public int state()

  Return the state.
  Specified by:
    `state` in interface `ServerProtocol`

### open

    public boolean open()

  Move to the listening state. If in the closed state this wil result in the protocol re-registering itself with the ServerManager. Returns true if state changed.
  Specified by:
    `open` in interface `ServerProtocol`

### pause

    public boolean pause()

  Move to the paused state. This is only valid in the LISTENING state. returns true if state is now PAUSED.
  Specified by:
    `pause` in interface `ServerProtocol`

### close

    public void close()

  Stop listening, refuse all incoming connections.
  Specified by:
    `close` in interface `ServerProtocol`

### 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.
  Specified by:
    `listen` in interface `ServerProtocol`
  Returns:
    true unless the socket has been closed.

### 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.
  Specified by:
    `run_listen` in interface `ServerProtocol`

### 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.
  Specified by:
    `create_profile` in interface `ServerProtocol`