1 26 27 package org.objectweb.openccm.Deployment; 28 29 38 39 public class ServerMain 40 extends org.objectweb.openccm.corba.ApplicationServer 41 { 42 48 51 protected String name_ = null; 52 53 59 62 public 63 ServerMain() 64 { 65 } 66 67 73 79 84 public static void 85 main(String args[]) 86 { 87 ServerMain server = new ServerMain(); 88 int status = server.start(args); 89 System.exit(status); 90 } 91 92 98 105 public int 106 before_run(String [] args) 107 { 108 org.objectweb.openccm.Components.Runtime.init(); 110 111 if(args.length < 1) 113 { 114 System.err.println("Usage: java " + 115 getClass().getName() + 116 " <serverName>"); 117 return -1; 118 } 119 120 name_ = args[0]; 122 String fileName = args[1]; 123 124 ServerImpl server = new ServerImpl(); 126 127 org.omg.CORBA.Object ref = 130 server._this_object(org.objectweb.openccm.corba.TheORB.getORB()); 131 Server serverRef = ServerHelper.narrow(ref); 132 133 org.objectweb.openccm.corba.NamingContext ns = 135 org.objectweb.openccm.corba.TheNameService.getNamingContext(); 136 137 ns.rebind(name_, serverRef); 139 140 org.objectweb.openccm.corba.TheORB.save_IOR(serverRef, fileName); 142 143 System.out.println("The OpenCCM Java Component Server is ready."); 145 return 0; 146 } 147 148 151 public void 152 after_run() 153 { 154 org.objectweb.openccm.corba.NamingContext ns = 156 org.objectweb.openccm.corba.TheNameService.getNamingContext(); 157 158 ns.unbind(name_); 160 } 161 } 162 | Popular Tags |