1 28 29 30 package org.objectweb.ccm.logdemo; 31 32 import org.objectweb.corba.runtime.*; 33 34 37 public class LogDemo 38 implements Runnable 39 { 40 private ORBService _orb_service; 42 43 public 44 LogDemo(ORBService orbs) 45 { 46 _orb_service = orbs; 48 } 49 50 54 final public void 55 run() 56 { 57 try { 58 RegistrationService regs = org.objectweb.corba.runtime.Runtime.getRegistrationService(); 60 INSRegistrationScheme scheme = (INSRegistrationScheme)regs.get_scheme(INSRegistrationScheme.SCHEME_ID); 61 62 System.err.println("## Obtain homes"); 64 ClientHome chome = ClientHomeHelper.narrow(scheme.lookup("ClientHome", _orb_service)); 65 ServerHome shome = ServerHomeHelper.narrow(scheme.lookup("ServerHome", _orb_service)); 66 AsyncServerHome ashome = AsyncServerHomeHelper.narrow(scheme.lookup("AsyncServerHome", _orb_service)); 67 68 System.err.println("## Create components"); 70 Client client1 = chome.create(); 71 Client client2 = chome.create(); 72 Server server = shome.create(); 73 AsyncServer aserver = ashome.create(); 74 75 System.err.println("## Configure components"); 77 client1.name("Mathieu"); 78 client2.name("Vincent"); 79 server.name("Pascal"); 80 aserver.name("Async Pascal"); 81 System.err.println("## Connect client/server"); 83 SynchronousDisplay dis = server.provide_display(); 84 client1.connect_display(dis); 85 client2.connect_display(dis); 86 System.err.println("## Connect client/asyncserver"); 88 AsyncMessageConsumer cons = aserver.get_consumer_async_display(); 89 client1.connect_async_display(cons); 90 client2.connect_async_display(cons); 91 92 System.err.println("## Complete configuration"); 94 client1.configuration_complete(); 95 client2.configuration_complete(); 96 server.configuration_complete(); 97 aserver.configuration_complete(); 98 } catch (Exception ex) { 99 throw new Error (ex.getMessage()); 100 } 101 102 System.out.println("Again ...."); 103 System.exit(1); 104 } 105 106 static public Runnable 107 main(ORBService orbs) 108 { 109 return new LogDemo(orbs); 110 } 111 } 112 113 114 115 116 117 118 119 | Popular Tags |