Example #1
0
        public static void Main(string[] args) {
            try {                
                string nameserviceLoc = "corbaloc::localhost:3528/JBoss/Naming/root";
                // the port the callback is listening on
                int callbackPort = 0; // auto assign
                if (args.Length > 0) {
                	nameserviceLoc = args[0];
                }
                if (args.Length > 1) {
                    callbackPort = Int32.Parse(args[1]);
                }
            
                IiopChannel channel = new IiopChannel(callbackPort);
                ChannelServices.RegisterChannel(channel, false);

                NamingContext nameService = (NamingContext)RemotingServices.Connect(typeof(NamingContext), nameserviceLoc);

                NameComponent[] name = new NameComponent[] { new NameComponent("demo", ""),
                                                             new NameComponent("chatroomHome", "") };
                // get the chatroom home interface
                ChatroomHome home = (ChatroomHome) nameService.resolve(name);
                Chatroom chatroom = home.create();

	        Application.Run(new Chatform(chatroom));

            } catch (Exception e) {
                Console.WriteLine("exception: " + e);
            }
        }
        public Portugol iniciar()
        {
            string caminhoJARs = Path.GetDirectoryName(Application.ExecutablePath) + "\\".Replace("\n", "");
            string portugol_integracao_jar = caminhoJARs + "portugol-integracao.jar";

            ProcessStartInfo construtorProcesso = new ProcessStartInfo();
            construtorProcesso.FileName = "java";
            construtorProcesso.Arguments = "-jar \"" + portugol_integracao_jar + "\"";
            construtorProcesso.CreateNoWindow = false;
            construtorProcesso.WindowStyle = ProcessWindowStyle.Hidden;

            Process.Start(construtorProcesso);

            Thread.Sleep(5000);

            canal = new IiopChannel(PORTA_PADRAO_CALLBACK);
            ChannelServices.RegisterChannel(canal, false);

            CorbaInit init = CorbaInit.GetInit();

            NamingContext nameService = init.GetNameService("localhost", PORTA_PADRAO);
            NameComponent[] name = new NameComponent[] { new NameComponent("Portugol", "") };

            portugol = (Portugol) nameService.resolve(name);

            return portugol;
        }
		public static void Main(string[] args) {
                        if (args.Length != 1) {
                            Console.WriteLine("Please specify the nameservice url either as ior or corbaloc");
                        }
                        string nameServiceUrl = args[0];

			// register the channel
			int port = 8087;
			IiopChannel chan = new IiopChannel(port);
			ChannelServices.RegisterChannel(chan, false);
		
			AdderImpl adder = new AdderImpl();
			string objectURI = "adder";
			RemotingServices.Marshal(adder, objectURI);

			// publish the adder with an external name service
                        NamingContext nameService = (NamingContext)RemotingServices.Connect(typeof(NamingContext),
                                                                                            nameServiceUrl);
			NameComponent[] name = new NameComponent[] { new NameComponent("adder") };
			nameService.bind(name, adder);
			Console.WriteLine("server running");
			Console.ReadLine();

			// unpublish with external name service
                        nameService.unbind(name);
		}
Example #4
0
 public CargoHostEndPoint(string ipAdr, int ipPort)
 {
     IPAddress = ipAdr; /*ensure value*/
     IPPort = ipPort; /*ensure value*/
     _iiopChannel = new IiopChannel(0);
     _ncHost = new NameComponent[] { new NameComponent("cargo", "context"), new NameComponent("host", "object") };
     _ncXi = new NameComponent[] { new NameComponent("cargo", "context"), new NameComponent("xi", "object") };
 }
Example #5
0
 public void SetupEnvironment() {
     // register the channel
     IDictionary props = new Hashtable();
     props[IiopServerChannel.PORT_KEY] = 0;
     m_channel = new IiopChannel(props);
     ChannelServices.RegisterChannel(m_channel, false);
     // get the reference to the test-service
     m_testService = (TestService)RemotingServices.Connect(typeof(TestService), "corbaloc:iiop:1.2@localhost:8087/test");
 }
Example #6
0
	public static void Main(string[] args)
	{
		if(args.Length != 1)
		{
			Console.WriteLine("Usage: client.exe server.ior");
			return;
		}

		MappingConfiguration.Instance.UseBoxedInAny = false;

		IDictionary props = new Hashtable();
		IiopChannel channel = new IiopChannel(props);
		ChannelServices.RegisterChannel(channel, false);

		StreamReader sr = new StreamReader(args[0]);
		string ior = sr.ReadLine();

		Test test = (Test)RemotingServices.Connect(typeof(Test), ior);
		object[] p = new object[2];
		for(int i = 0; i < p.Length; ++i)
		{
			Container container;
			Inner inner;
            inner.value1 = 1 + i;
            inner.value2 = 2 + i;
            inner.value3 = 3 + i;
            inner.value4 = 4 + i;
            inner.value5 = 5 + i;
			container.contents = inner;
			p[i] = container;
		}

		try
		{
			p = test.RunTest(p);

			for(int i = 0; i < p.Length; ++i)
			{
				if(p[i] is Container)
				{
					Inner inner = (Inner)((Container)p[i]).contents;
					Console.WriteLine("[{0}]: {1} {2} {3} {4} {5}", i,
						inner.value1, inner.value2, inner.value3, inner.value4, inner.value5);
				}
			}
            test.shutdown ();
		}
		catch(Exception ex)
		{
			Console.WriteLine("Invoke failed: {0}", ex.ToString());
		}
	}
 public static void Main(string[] args) {
     // register the channel
     int port = 8087;
     IiopChannel chan = new IiopChannel(port);
     ChannelServices.RegisterChannel(chan, false);
 
     AdderImpl adder = new AdderImpl();
     string objectURI = "adder";
     RemotingServices.Marshal(adder, objectURI);
     
     Console.WriteLine("server running");
     Console.ReadLine();
 }
Example #8
0
        public static void Initialize()
        {
            lock (_channelLock)
            {
                if (_channel == null)
                {
                    // チャンネルを登録する
                    _channel = new IiopChannel(0); // 自動的にポートを割り当てる
                    ChannelServices.RegisterChannel(_channel, false);
                }

            }
        }
Example #9
0
        public static void Main(String[] args) {
            // register the channel
            int port = 8087;
            IiopChannel chan = new IiopChannel(port);
            ChannelServices.RegisterChannel(chan, false);

            TestService test = new TestService();
            string objectURI = "test";
            RemotingServices.Marshal(test, objectURI);
            
            Console.WriteLine("server running");
            Thread.Sleep(Timeout.Infinite);
        }
Example #10
0
 public void SetupEnvironment() {
     // register the channel
     if (m_channel == null) {
         // the remote proxy for this url is bound to a certain sink chain for some time ->
         // don't recreate channel; otherwise, is no more bidirectional for another run.
         IDictionary props = new Hashtable();
         props[IiopServerChannel.PORT_KEY] = 0;
         props[IiopChannel.BIDIR_KEY] = true;
         m_channel = new IiopChannel(props);
     }
     ChannelServices.RegisterChannel(m_channel, false);
     // get the reference to the test-service
     m_testService = (TestService)RemotingServices.Connect(typeof(TestService), "corbaloc:iiop:1.2@localhost:8087/test");
 }
Example #11
0
        public static void Main(string[] args) {
            // register the channel
            int port = 8087;
            IiopChannel chan = new IiopChannel(port);
            ChannelServices.RegisterChannel(chan, false);

            // publish the storage service manager
            Manager manager = new Manager();
            string objectURI = "storagemanager";
            RemotingServices.Marshal(manager, objectURI);
			
            Console.WriteLine("server running");
            Console.WriteLine("press any key to terminate....");
            Console.ReadLine();
        }
Example #12
0
		public static void Main(string[] args) {
			// register the channel
			int port = 8087;
                        if (args.Length > 0) {
                            port = Int32.Parse(args[0]);
                        }
			IiopChannel chan = new IiopChannel(port);
			ChannelServices.RegisterChannel(chan, false);
		
			ChatroomImpl chatroom = new ChatroomImpl();
			string objectURI = "chatroom";
			RemotingServices.Marshal(chatroom, objectURI);
			
			Console.WriteLine("server running");
			Console.ReadLine();
		}
Example #13
0
		public static void Main(string[] args) {
			// register the channel
			int port = 8087;
                        if (args.Length > 0) {
                            port = Int32.Parse(args[0]);
                        }
			IiopChannel chan = new IiopChannel(port);
			ChannelServices.RegisterChannel(chan, false);
		
			AdderImpl adder = new AdderImpl();
			string objectURI = "adder";
			RemotingServices.Marshal(adder, objectURI);
			
			Console.WriteLine("server running");
			Thread.Sleep(Timeout.Infinite);
		}
Example #14
0
        public void SetupEnvironment(string serviceUrl, string nsUrl, NameComponent[] name,
                                     string endian) {
            // register the channel
            int port = 0;
            IDictionary dict = new Hashtable();
            dict["port"] = port;
            dict["endian"] = endian;
            m_channel = new IiopChannel(dict);
            ChannelServices.RegisterChannel(m_channel, false);

            m_testService = (TestService)RemotingServices.Connect(typeof(TestService), serviceUrl);
            m_testServiceIorUrl = (TestService)
                omg.org.CORBA.OrbServices.GetSingleton().string_to_object(serviceUrl);

            m_testServiceFromNs = TryGetServiceFromNs(nsUrl, name);
        }
Example #15
0
        static void Main(string[] args)
        {
            CorbaInit orb = CorbaInit.GetInit();
            IiopClientChannel clientChannel = new IiopClientChannel();
            //ChannelServices.RegisterChannel(clientChannel, false);

            IiopChannel iiop = new IiopChannel(8807);
            ChannelServices.RegisterChannel(iiop, false);

            NamingContext nc = InitialRefLineParser.getNamingServiceForArgs(args);

            if (nc == null)
                Console.WriteLine("Cannot connet to Naming Service");

            Console.WriteLine(Thread.CurrentThread.ManagedThreadId);

            DFServer dfs = new DFServer(Directory.GetCurrentDirectory() );
            DFSAccess dfa = new DFSAccess(dfs, "DFSAccess", nc);
            DFSManager dfm = new DFSManager(dfs, "DFSManager", nc);
            dfs.getServerWaitHandle().WaitOne();
        }
    public static void Main(string[] args)
    {
        try
        {
        IiopChannel channel = new IiopChannel(0);
        ChannelServices.RegisterChannel(channel, false);

        CorbaInit init = CorbaInit.GetInit();
        NamingContext nc = (NamingContext)RemotingServices.Connect(
            typeof(NamingContext), args[0]);
        PingImpl pingable = new PingImpl();
        nc.rebind(new NameComponent[] {
            new NameComponent("test"),
            new NameComponent("ExamplePing")
        }, pingable);
        Thread.Sleep(Timeout.Infinite);
        }
        catch (Exception e)
        {
        Console.WriteLine(e);
        }
    }
Example #17
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);
        }
    }
Example #18
0
        public static void Main(string[] args) {
            // register the channel            
            IDictionary props = new Hashtable();
            props[IiopChannel.CHANNEL_NAME_KEY] = "securedServerIiopChannel";            
            props[IiopServerChannel.PORT_KEY] = "8087";            
            props[IiopChannel.TRANSPORT_FACTORY_KEY] = 
                "Ch.Elca.Iiop.Security.Ssl.SslTransportFactory,SSLPlugin";
 
            props[SslTransportFactory.SERVER_REQUIRED_OPTS] = "96";
            props[SslTransportFactory.SERVER_SUPPORTED_OPTS] = "96";
            props[SslTransportFactory.SERVER_AUTHENTICATION] = 
                "Ch.Elca.Iiop.Security.Ssl.DefaultServerAuthenticationImpl,SSLPlugin";

            props[DefaultServerAuthenticationImpl.SERVER_CERTIFICATE] = 
                "5f4abc1aad19e53857be2a4bbec9297091f0082c";
            props[DefaultServerAuthenticationImpl.STORE_LOCATION] = "CurrentUser";

            IiopChannel chan = new IiopChannel(props);
            ChannelServices.RegisterChannel(chan, false);
        
            AdderImpl adder = new AdderImpl();
            string objectURI = "adder";
            RemotingServices.Marshal(adder, objectURI);
            
            // write out ior to file
            OrbServices orb = OrbServices.GetSingleton();
            string ior = orb.object_to_string(adder);

            TextWriter writer = new StreamWriter(@"ior");
            writer.WriteLine(ior);
            writer.Close();
            Console.WriteLine("server ior: " + ior.ToString());

            Console.WriteLine("server running");
            Thread.Sleep(Timeout.Infinite);
        }
Example #19
0
        public static void Main(string[] args) {
            try {

                string ejbNameServiceHost = "localhost";
                int ejbNameServicePort = 7001;
                if (args.Length > 0) {
                    ejbNameServiceHost = args[0];
                }
                if (args.Length > 1) {
                    ejbNameServicePort = Int32.Parse(args[1]);
                }

                // the port the callback is listening on
                int callbackPort = 0; // auto assign
                if (args.Length > 2) {
                    callbackPort = Int32.Parse(args[2]);
                }
            
                IiopChannel channel = new IiopChannel(callbackPort);
                ChannelServices.RegisterChannel(channel, false);

                RmiIiopInit init = new RmiIiopInit(ejbNameServiceHost, ejbNameServicePort);
                NamingContext nameService = init.GetNameService();

                NameComponent[] name = new NameComponent[] { new NameComponent("demo", ""),
                                                             new NameComponent("chatroomHome", "") };
                // get the chatroom home interface
                ChatroomHome home = (ChatroomHome) nameService.resolve(name);
                Chatroom chatroom = home.create();

                Application.Run(new Chatform(chatroom));

            } catch (Exception e) {
                Console.WriteLine("exception: " + e);
            }
        }
Example #20
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.");
			}

		}
Example #21
0
        public void SetupEnvironment() {
            MappingConfiguration.Instance.UseBoxedInAny = false; // disable boxing of string/arrays in any's
            // register the channel
            // register the channel
            if (m_channel == null) {
                // the remote proxy for this url is bound to a certain sink chain for some time ->
                // don't recreate channel; otherwise, is no more bidirectional for another run.
                IDictionary props = new Hashtable();
                props[IiopServerChannel.PORT_KEY] = 0;
                props[IiopChannel.BIDIR_KEY] = true;
                m_channel = new IiopChannel(props);
            }
            ChannelServices.RegisterChannel(m_channel, false);

            NamingContext nameService = GetNameService();
            NameComponent[] name = new NameComponent[] { new NameComponent("test", "") };
            // get the reference to the test-service
            m_testService = (TestService)nameService.resolve(name);
        }
Example #22
0
        public void RebindToNameService()
        {
            try
            {
                if (/*exists (avoid first try exceptions)?*/ _nameService != null)
                    _nameService.rebind(_ncXi, new XiManagerCallback());
            }
            catch
            {
                _nameService = null;
#if false
                // HACK! ChannelServices.UnregisterChannel hangs.
                ChannelServices.UnregisterChannel(_iiopChannel);
#endif
                throw;
            }
            finally
            {
                _nameService = null;
                _iiopChannel = null;
            }
        }
Example #23
0
 private void SetupChannel(int callbackPort) {
     m_channel = new IiopChannel(callbackPort);
     ChannelServices.RegisterChannel(m_channel, false);
 }
Example #24
0
        public void RebindToNameService()
        {
            try { _NameService.rebind(_ncXi, new XiManagerCallback()); }
            catch
            {
                _NameService = null;
#if false
                // HACK! ChannelServices.UnregisterChannel hangs.
                ChannelServices.UnregisterChannel(_IiopChannel);
#endif
                _IiopChannel = null;
                throw;
            }
        }
 public void TearDown()
 {
     if (m_channel != null)
     {
         ChannelServices.UnregisterChannel(m_channel);
     }
     m_channel = null;
 }
        public void SetUp()
        {
            m_orb = OrbServices.GetSingleton();

            m_channel = new IiopChannel(TEST_PORT);
            ChannelServices.RegisterChannel(m_channel, false);
        }
        public void TestLocationForwardOnIsA() {
            // tests location forward, if we forward on is_a call
            IiopChannel chan = new IiopChannel(8090);
            ChannelServices.RegisterChannel(chan, false);
            // publish location fwd target
            TestService target = new TestService();
            string fwdTargetUri = "testuriFwdForIsA";
            RemotingServices.Marshal(target, fwdTargetUri);
 
            // request msg the reply is for
            MethodInfo methodToCall = typeof(omg.org.CORBA.IObject).GetMethod("_is_a");
            object[] args = new object[] { "IDL:Ch/Elca/Iiop/Tests/TestService:1.0" };
            string origUrl = "iiop://localhost:8090/testuri"; // Giop 1.2 will be used because no version spec in uri
            TestMessage requestMsg = new TestMessage(methodToCall, args, origUrl);
            // prepare connection desc
            GiopClientConnectionDesc conDesc = new GiopClientConnectionDesc(null, null, new GiopRequestNumberGenerator(), null);
 
            try {
                Stream locFwdStream = PrepareLocationFwdStream("localhost", 8090,
                                                               target);
 
                IMessage resultMsg =
                    m_handler.ParseIncomingReplyMessage(locFwdStream, requestMsg, conDesc);
                MarshalByRefObject fwdToTarget;
                bool isFwd = GiopMessageHandler.IsLocationForward(resultMsg, out fwdToTarget);
                Assert.IsTrue(isFwd, "is a forward?");
                Assert.NotNull(fwdToTarget,"new target reference null?");
                ReturnMessage result = (ReturnMessage)
                    m_handler.ForwardRequest(requestMsg, fwdToTarget);
                Assert.AreEqual(true, result.ReturnValue);
                Assert.AreEqual(0, result.OutArgCount);
            } finally {
                // unpublish target + channel
                RemotingServices.Disconnect(target);
                chan.StopListening(null);
                ChannelServices.UnregisterChannel(chan);
            }

 
 
        }
Example #28
0
        public void Close()
        {
            IsConnected = false;
            try
            {
                if (_NameService != null)
                    _NameService.unbind(_ncXi);
            }
            catch { }
            finally { _NameService = null; }
#if false
            // HACK! ChannelServices.UnregisterChannel hangs.
            ChannelServices.UnregisterChannel(_IiopChannel);
#endif
            _IiopChannel = null;
        }
Example #29
0
        public static void Destroy()
        {
            ChannelServices.UnregisterChannel(_channel);

            _channel = null;
        }
Example #30
-1
        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));                       
        }