示例#1
0
        public static void Main(string[] args)
        {
            try {
                string nameServiceHost = "localhost";
                int    nameServicePort = 1050;
                parseArgs(ref nameServiceHost, ref nameServicePort, args);

                // register the channel
                IiopClientChannel channel = new IiopClientChannel();
                ChannelServices.RegisterChannel(channel, false);

                // access COS naming service
                CorbaInit       init        = CorbaInit.GetInit();
                NamingContext   nameService = init.GetNameService(nameServiceHost, nameServicePort);
                NameComponent[] name        = new NameComponent[] { new NameComponent("service", "") };
                // get the reference to the adder
                Service service = (Service)nameService.resolve(name);
                // call fail
                service.fail();
            } catch (CustomEx je) {
                Console.WriteLine("Java-side exception: {0}\nReason: {1}", je.value.message, je.value.reason);
            } catch (Exception e) {
                Console.WriteLine("exception: " + e);
            }
        }
示例#2
0
        public static void Main(string[] args)
        {
            try {
                string nameServiceHost = "localhost";
                int    nameServicePort = 1050;
                parseArgs(ref nameServiceHost, ref nameServicePort, args);

                Console.WriteLine("input the two summands");
                Console.WriteLine("sum1:");
                double sum1 = Double.Parse(Console.ReadLine());
                Console.WriteLine("sum2:");
                double sum2 = Double.Parse(Console.ReadLine());

                // register the channel
                IiopClientChannel channel = new IiopClientChannel();
                ChannelServices.RegisterChannel(channel, false);

                // access COS nameing service
                CorbaInit       init        = CorbaInit.GetInit();
                NamingContext   nameService = init.GetNameService(nameServiceHost, nameServicePort);
                NameComponent[] name        = new NameComponent[] { new NameComponent("adder", "") };
                // get the reference to the adder
                Adder adder = (Adder)nameService.resolve(name);
                // call add
                double result = adder.add(sum1, sum2);
                Console.WriteLine("result: " + result);
            } catch (Exception e) {
                Console.WriteLine("exception: " + e);
            }
        }
示例#3
0
        public void Open()
        {
            ChannelServices.RegisterChannel(new IiopChannel(0), false);

            CorbaInit m_Init = CorbaInit.GetInit();

            m_NameService = m_Init.GetNameService(m_IPAddress, m_Port);
        }
示例#4
0
        private NamingContext GetNameService()
        {
            // access COS nameing service
            CorbaInit     init        = CorbaInit.GetInit();
            NamingContext nameService = init.GetNameService("localhost", 1050);

            return(nameService);
        }
示例#5
0
        public void Open()
        {
            ChannelServices.RegisterChannel(_iiopChannel, false);
            CorbaInit m_Init = CorbaInit.GetInit();

            _nameService = m_Init.GetNameService(_ipAddress, _ipPort);
            RebindToNameService();
            IsConnected = true;
        }
示例#6
0
        private void RetrieveChatRoom(string nameServiceHost,
                                      int nameServicePort)
        {
            CorbaInit     init        = CorbaInit.GetInit();
            NamingContext nameService = (NamingContext)init.GetNameService(nameServiceHost, nameServicePort);

            NameComponent[] name = new NameComponent[] { new NameComponent("chatroom", "") };
            // get the chatroom
            m_chatroom = (IChatroom)nameService.resolve(name);
        }
示例#7
0
        public HostComm()
        {
            String caseManagerIP   = (string)ConfigurationManager.AppSettings["host"];
            Int32  caseManagerPort = Int32.Parse(ConfigurationManager.AppSettings["port"]);

            //connected with host manager
            m_Channel = new IiopChannel(0);
            ChannelServices.RegisterChannel(m_Channel, false);

            CorbaInit m_Init = CorbaInit.GetInit();

            m_NameService = m_Init.GetNameService(caseManagerIP, (int)caseManagerPort);

            HostConnThread = new Thread(new ThreadStart(HostConnState));
        }
    static void Main(string[] args)
    {
        IiopClientChannel channel = new IiopClientChannel();

        ChannelServices.RegisterChannel(channel, false);
        CorbaInit     init    = CorbaInit.GetInit();
        NamingContext context = init.GetNameService("MYLICSRV", 30000);

        NameComponent[] names = new NameComponent[] { new NameComponent("B1LicenseInfo") };
        ILicenseInfo    li    = (ILicenseInfo)context.resolve(names);

        byte[] hwKey;
        byte[] instNum;
        li.GetHardwareKey(out hwKey);
        li.GetInstallationNumberList(out instNum);
        Encoding encoding = new System.Text.UnicodeEncoding(false, false, true);

        Console.WriteLine(encoding.GetString(hwKey));
        Console.WriteLine(encoding.GetString(instNum));
    }
示例#9
0
    /// <summary>
    /// CargoHostInterface.  This is the constructor for this
    /// class. It publishes XI and SNM objects for CargoHost to receive notifications
    ///
    /// Arguments:
    ///
    ///
    ///
    ///     none
    /// Exceptions:
    ///     none
    /// Return:
    ///     none
    /// </summary>
    public CargoHostInterface()
    {
        try
        {
            // register the channel
            m_Channel = new IiopChannel(0); // assign port automatically
            ChannelServices.RegisterChannel(m_Channel, false);

            CorbaInit m_Init = CorbaInit.GetInit();

            string CORBA_NS_Host = (string)ConfigurationManager.AppSettings["host"];
            Int32  CORBA_NS_Port = Int32.Parse(ConfigurationManager.AppSettings["port"]);

            m_NameService = m_Init.GetNameService(CORBA_NS_Host, (int)CORBA_NS_Port);

            xrayInterface = new XI_Impl();
            NameComponent[] ncXI = GetNameComponent(xrayInterface, "xi");
        }
        catch (Exception e)
        {
            MessageBox.Show(e.StackTrace);
            return;
        }

        // Get Logger from CargoHost
        try
        {
            m_CargoHostLogger = (l3.cargo.corba.Logger)m_NameService.resolve(m_ncLogger);
        }
        catch (CargoException e1)
        {
            MessageBox.Show(e1.error_msg);
        }
        catch (omg.org.CORBA.AbstractCORBASystemException a)
        {
            MessageBox.Show(a.Message);
        }
    }
示例#10
0
        public void SetupEnvironment()
        {
            // register the channel
            m_channel = new IiopClientChannel();
            ChannelServices.RegisterChannel(m_channel, false);

            // access COS nameing service
            CorbaInit     init        = CorbaInit.GetInit();
            NamingContext nameService = init.GetNameService("localhost", 1050);

            NameComponent[] name = new NameComponent[] { new NameComponent("testPlugin", "") };
            // get the reference to the test-service
            m_testService = (TestService)nameService.resolve(name);

            try {
                CustomMapperRegistry reg = CustomMapperRegistry.GetSingleton();
                reg.AddMappingsFromFile(new FileInfo("customMapping.xml"));
                reg.AddMappingsFromFile(new FileInfo("customMappingTest.xml"));
            } catch (Exception e) {
                Console.WriteLine("custom mapper not loadable: " + e);
                throw e;
            }
        }
示例#11
0
        private void StartListening()
        {
            IiopChannel channel = null;

            RtecEventChannelAdmin.ProxyPushSupplier supplier = null;
            RtecEventComm.PushConsumer consumer = null;

            try {
                string host = txtHost.Text;
                int    port = Convert.ToInt32(txtHostPort.Text);
                m_logger.Log("HostName : " + host);
                m_logger.Log("Port : " + port.ToString());

                IDictionary property = new Hashtable();
                channel = new IiopChannel(0);

                ChannelServices.RegisterChannel(channel, false);
                CorbaInit     init        = CorbaInit.GetInit();
                NamingContext nameService = (NamingContext)RemotingServices.Connect(typeof(NamingContext),
                                                                                    String.Format("corbaloc:iiop:{0}:{1}/NameService", host, port));

                RtecEventChannelAdmin.EventChannel ec = ResolveEventChannel(nameService);
                if (ec != null)
                {
                    m_logger.Log("Found the EchoEventChannel");

                    //Obtain a reference to the consumer administration object
                    RtecEventChannelAdmin.ConsumerAdmin admin = ec.for_consumers();
                    // Obtain a reference to the push supplier proxy.
                    supplier = admin.obtain_push_supplier();
                    consumer = RegisterConsumer(supplier);


                    m_logger.Log("Ready to Receive Messages...");
                    this.Run = true;
                    while (this.Run)
                    {
                        Thread.Sleep(1);
                    }
                }
                else
                {
                    m_logger.Log("Not Found the EchoEventChannel");
                }
            } catch (Exception exception) {
                m_logger.Log(exception.Message);
                BtnListen.Enabled = true;
            } finally {
                if (supplier != null)
                {
                    supplier.disconnect_push_supplier();
                }
                if (consumer != null)
                {
                    consumer.disconnect_push_consumer();
                    RemotingServices.Disconnect((MarshalByRefObject)consumer);
                }
                ChannelServices.UnregisterChannel(channel);
                m_logger.Log("Cleanup event consumer complete.");
            }
        }