Example #1
0
 /// <summary>this constructor is used by configuration</summary>
 public IiopChannel(IDictionary properties,
                    IClientChannelSinkProvider clientSinkProvider,
                    IServerChannelSinkProvider serverSinkProvider)
 {
     IDictionary clientProp = new Hashtable();
     IDictionary serverProp = new Hashtable();
     bool isServer = false;
     bool isBidir = false;
     // prepare properties for client channel and server channel
     if (properties != null)
     {
         foreach (DictionaryEntry entry in properties)
         {
             switch ((string)entry.Key)
             {
                 case CHANNEL_NAME_KEY:
                     m_channelName = (string)entry.Value;
                     clientProp[CHANNEL_NAME_KEY] = m_channelName;
                     serverProp[CHANNEL_NAME_KEY] = m_channelName;
                     break;
                 case PRIORITY_KEY:
                     m_channelPriority = Convert.ToInt32(entry.Value);
                     clientProp[PRIORITY_KEY] = m_channelPriority;
                     serverProp[PRIORITY_KEY] = m_channelPriority;
                     break;
                 case ENDIAN_KEY:
                     clientProp[ENDIAN_KEY] = entry.Value;
                     serverProp[ENDIAN_KEY] = entry.Value;
                     break;
                 case IiopServerChannel.PORT_KEY:
                     serverProp[IiopServerChannel.PORT_KEY] = Convert.ToInt32(entry.Value);
                     isServer = true;
                     break;
                 case IiopServerChannel.USE_IPADDRESS_KEY:
                     serverProp[IiopServerChannel.USE_IPADDRESS_KEY] = Convert.ToBoolean(entry.Value);
                     break;
                 case IiopServerChannel.BIND_TO_KEY:
                     serverProp[IiopServerChannel.BIND_TO_KEY] = entry.Value; // don't convert here, because conversion is also done in server channel constructor
                     break;
                 case IiopServerChannel.MACHINE_NAME_KEY:
                     serverProp[IiopServerChannel.MACHINE_NAME_KEY] = entry.Value;
                     break;
                 case IiopServerChannel.SERVERTHREADS_MAX_PER_CONNECTION_KEY:
                     serverProp[IiopServerChannel.SERVERTHREADS_MAX_PER_CONNECTION_KEY] = entry.Value;
                     break;
                 case IiopClientChannel.CLIENT_RECEIVE_TIMEOUT_KEY:
                     clientProp[IiopClientChannel.CLIENT_RECEIVE_TIMEOUT_KEY] = Convert.ToInt32(entry.Value);
                     break;
                 case IiopClientChannel.CLIENT_SEND_TIMEOUT_KEY:
                     clientProp[IiopClientChannel.CLIENT_SEND_TIMEOUT_KEY] = Convert.ToInt32(entry.Value);
                     break;
                 case IiopClientChannel.CLIENT_REQUEST_TIMEOUT_KEY:
                     clientProp[IiopClientChannel.CLIENT_REQUEST_TIMEOUT_KEY] = Convert.ToInt32(entry.Value);
                     break;
                 case IiopClientChannel.CLIENT_UNUSED_CONNECTION_KEEPALIVE_KEY:
                     clientProp[IiopClientChannel.CLIENT_UNUSED_CONNECTION_KEEPALIVE_KEY] = Convert.ToInt32(entry.Value);
                     break;
                 case IiopClientChannel.CLIENT_CONNECTION_LIMIT_KEY:
                     clientProp[IiopClientChannel.CLIENT_CONNECTION_LIMIT_KEY] = Convert.ToInt32(entry.Value);
                     break;
                 case IiopClientChannel.ALLOW_REQUEST_MULTIPLEX_KEY:
                     clientProp[IiopClientChannel.ALLOW_REQUEST_MULTIPLEX_KEY] = Convert.ToBoolean(entry.Value);
                     break;
                 case IiopClientChannel.MAX_NUMBER_OF_MULTIPLEXED_REQUESTS_KEY:
                     clientProp[IiopClientChannel.MAX_NUMBER_OF_MULTIPLEXED_REQUESTS_KEY] = Convert.ToInt32(entry.Value);
                     break;
                 case IiopClientChannel.MAX_NUMBER_OF_RETRIES_KEY:
                     clientProp[IiopClientChannel.MAX_NUMBER_OF_RETRIES_KEY] = Convert.ToInt32(entry.Value);
                     break;
                 case IiopClientChannel.RETRY_DELAY_KEY:
                     clientProp[IiopClientChannel.RETRY_DELAY_KEY] = Convert.ToInt32(entry.Value);
                     break;
                 case TRANSPORT_FACTORY_KEY:
                     serverProp[TRANSPORT_FACTORY_KEY] =
                         entry.Value;
                     clientProp[TRANSPORT_FACTORY_KEY] =
                         entry.Value;
                     break;
                 case BIDIR_KEY:
                     isBidir = Convert.ToBoolean(entry.Value);
                     clientProp[BIDIR_KEY] = isBidir;
                     break;
                 default:
                     Debug.WriteLine("unknown property found for IIOP channel: " +
                                     entry.Key);
                     // pass non-default options further on to the client and server-channel for handling by the e.g. transport-factory
                     serverProp[entry.Key] = entry.Value;
                     clientProp[entry.Key] = entry.Value;
                     break;
             }
         }
     }
     m_clientChannel = new IiopClientChannel(clientProp, clientSinkProvider);
     if (isServer)
     {
         if (isBidir)
         {
             serverProp[IiopServerChannel.BIDIR_CONNECTION_MANAGER] =
                 m_clientChannel.ConnectionManager;
         }
         // only create server if port is specified
         m_serverChannel = new IiopServerChannel(serverProp, serverSinkProvider);
     }
 }
Example #2
0
 public IiopChannel(int port)
     : this()
 {
     m_serverChannel = new IiopServerChannel(port);
 }