1 26 27 package org.objectweb.openccm.Deployment; 28 29 public class ServerActivatorMain extends org.objectweb.openccm.corba.ApplicationServer 30 { 31 32 38 41 protected String name_ ="ServerActivator"; 42 43 49 52 public 53 ServerActivatorMain() 54 { 55 } 56 57 58 64 69 public static void 70 main(String args[]) 71 { 72 ServerActivatorMain server = new ServerActivatorMain(); 73 int status = server.start(args); 74 System.exit(status); 75 } 76 77 83 92 public int 93 before_run(String [] args) 94 { 95 name_=name_+args[2]; 97 org.objectweb.openccm.Components.Runtime.init(); 99 100 ServerActivatorImpl afi=null; 102 if(args[1].equalsIgnoreCase("pda_true")) 103 afi = new ServerActivatorImpl(args[2],args[3],true); 104 else afi = new ServerActivatorImpl(args[2],args[3]); 105 106 org.omg.CORBA.Object ref = 108 afi._this_object(org.objectweb.openccm.corba.TheORB.getORB()); 109 110 org.omg.Components.Deployment.ServerActivator serverRef = 111 org.omg.Components.Deployment.ServerActivatorHelper.narrow(ref); 112 113 org.objectweb.openccm.corba.NamingContext ns = 115 org.objectweb.openccm.corba.TheNameService.getNamingContext(); 116 117 ns.rebind(name_, serverRef); 119 120 org.objectweb.openccm.corba.TheORB.save_IOR(serverRef, args[0]); 122 123 try{ 124 org.omg.CosNaming.NameComponent [] ncomp 126 = new org.omg.CosNaming.NameComponent [1]; 127 128 ncomp[0]= new org.omg.CosNaming.NameComponent ("ComponentInstallation"+args[2],""); 129 130 org.omg.CORBA.Object obj = org.objectweb.openccm.corba.TheNameService 131 .getNamingContext().getNamingContext().resolve(ncomp); 132 133 org.omg.Components.Deployment.ComponentInstallation server_inst= 134 org.omg.Components.Deployment.ComponentInstallationHelper.narrow(obj); 135 136 137 server_inst.install("openccm_plugins", "file:"+args[3]+"/jar/OpenCCM_Plugins.jar"); 138 139 TheComponentInstallation.setComponentInstallation(server_inst); 140 } 141 catch(Exception e){ e.printStackTrace();} 142 143 System.out.println("The OpenCCM Server Activator ["+name_+"] 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 } 163 | Popular Tags |