예제 #1
0
        static void Main(string[] args)
        {
            MiddTec.CORBA.ORB oOrb = MiddTec.CORBA._ORB.init(args, null);

            // Get the ROOT-POA
            MiddTec.PortableServer.POA oRootPOA
                = MiddTec.PortableServer.POAHelper.narrow(
                      oOrb.resolve_initial_references("RootPOA"));

            // Activate POA
            oRootPOA.the_POAManager.activate();

            // Our implementation of the Greetings Interface
            GreetingsImpl oGreetings = new GreetingsImpl();

            // Create CORBA object reference
            MiddTec.CORBA.Object obj = oRootPOA.servant_to_reference(oGreetings);

            // Write IOR-File
            MiddTec.CORBA._ORB.wrIORtoFile("c:\\hello.ior", obj);

            System.Console.WriteLine("Server is running ...\n");

            try
            {
                // Workup Requests
                oOrb.run();
            }
            catch (System.Exception)
            {
                // Destroy the ORB Resources
                oOrb.destroy();
            }
        }
예제 #2
0
파일: hello.cs 프로젝트: parrol/CorbaC-Java
 public static Greetings narrow(MiddTec.CORBA.Object obj)
 {
     if (obj == null)
     {
         return(null);
     }
     if (obj is Greetings)
     {
         return((Greetings)obj);
     }
     if (obj._is_a(id()))
     {
         _GreetingsStub stub = new _GreetingsStub();
         stub._set_delegate(((MiddTec.CORBA.portable.ObjectImpl)obj)._get_delegate());
         return(stub);
     }
     throw new MiddTec.CORBA.BAD_PARAM("Narrow failed");
 }