Inheritance diagram for FullCorbaMediator::
Public Methods | |
FullCorbaMediator (String[] args) | |
boolean | createInProcServer () |
boolean | createInProcServer (int port) |
boolean | useDefaultServer () |
boolean | useServer (String name) |
boolean | useServerRef (String name) |
boolean | hasInProcServer () |
boolean | hasLocalServer () |
boolean | isServerObject (org.omg.CORBA.Object obj) |
returns true if it is an object created in our server. More... | |
org.omg.CORBA.ORB | orb () |
String | object_to_string (org.omg.CORBA.Object obj) |
org.omg.CORBA.Object | string_to_object (String ref) |
org.omg.CORBA.Object | activateServant (Servant servant) |
void | deactivateServant (Servant servant) |
String | registerApp (HxCorba.AppOperations appOper, String prefix) |
void | unregisterApp (String name) |
boolean | isAlive (org.omg.CORBA.Object obj) |
RgbTransferManager | createRgbTxMgr (int size, org.omg.CORBA.Object src) |
org.omg.CORBA.Object | getInitialObject (String name) |
org.omg.CORBA.Object | getService (String name) |
The connection to the ORB is made used on the properties of the Java application (properties are set via an external shell script). Possibly, a connection to the Horus C++ server is made based on command line arguments.
|
00030 { 00031 try { 00032 setOrbacusProperties(System.getProperties()); 00033 _orb = org.omg.CORBA.ORB.init(args, null); 00034 if(!(_orb instanceof com.ooc.CORBA.ORB)) 00035 ErrorStreamArea.println("Not ORBacus ORB!"); 00036 00037 parseArgs(args); 00038 if(_server == null) _server = new DefaultImageServer(_orb); 00039 00040 }catch(Exception e) { 00041 ErrorStreamArea.println(" "+e); 00042 e.printStackTrace(); 00043 _orb = null; 00044 } 00045 } |
|
00049 { 00050 InProcImageServer s = new InProcImageServer(); 00051 if(!s.success()) { 00052 ErrorStreamArea.println("Error initializing server"); 00053 return false; 00054 } 00055 00056 _server = s; 00057 00058 return true; 00059 } |
|
00062 { 00063 InProcImageServer s = new InProcImageServer(port); 00064 if(!s.success()) { 00065 ErrorStreamArea.println("Error initializing server"); 00066 return false; 00067 } 00068 00069 _server = s; 00070 return true; 00071 } |
|
00074 { 00075 _server = new DefaultImageServer(_orb); 00076 return true; 00077 } |
|
00080 { 00081 RegisteredImageServer s = new RegisteredImageServer(name); 00082 if(!s.success()) { 00083 ErrorStreamArea.println("Error connecting to server "+name); 00084 return false; 00085 } 00086 00087 _server = s; 00088 return true; 00089 } |
|
00092 { 00093 RegisteredImageServer s = new RegisteredImageServer(name, _orb); 00094 if(!s.success()) { 00095 ErrorStreamArea.println("Error connecting to server "+name); 00096 return false; 00097 } 00098 00099 _server = s; 00100 return true; 00101 } |
|
Reimplemented from CorbaMediator.
00104 { 00105 return (_server instanceof InProcImageServer); 00106 } |
|
Reimplemented from CorbaMediator.
00109 { 00110 if (_server instanceof InProcImageServer) return true; 00111 00112 try { 00113 HxCorba.Constructor cons = _server.constructor(); 00114 String name = StubRepository.getStubInfo(cons).getItem("Host"); 00115 InetAddress addr = InetAddress.getByName(name); 00116 00117 return addr.equals(InetAddress.getLocalHost()) || 00118 addr.equals(InetAddress.getByName("localhost")); 00119 } 00120 catch(Exception e){ 00121 return false; 00122 } 00123 } |
|
returns true if it is an object created in our server.
Reimplemented from CorbaMediator.
00127 { 00128 try { 00129 HxCorba.Constructor cons = _server.constructor(); 00130 00131 StubInfo info1 = StubRepository.getStubInfo(cons); 00132 StubInfo info2 = StubRepository.getStubInfo(obj); 00133 00134 return (info1.getItem("Host").equals(info2.getItem("Host")) && 00135 info1.getItem("Port").equals(info2.getItem("Port"))); 00136 } 00137 catch(Exception e){ 00138 return false; 00139 } 00140 } |
|
Reimplemented from CorbaMediator.
00143 { 00144 return _orb; 00145 } |
|
Reimplemented from CorbaMediator.
00148 { 00149 return _orb.object_to_string(obj); 00150 } |
|
Reimplemented from CorbaMediator.
00153 { 00154 return _orb.string_to_object(ref); 00155 } |
|
00158 { 00159 org.omg.CORBA.Object result = null; 00160 try { 00161 POA poa = POAHelper.narrow(_orb.resolve_initial_references("RootPOA")); 00162 POAManager manager = poa.the_POAManager(); 00163 00164 poa.activate_object(servant); 00165 result = poa.servant_to_reference(servant); 00166 00167 if(_orbRunThread == null) { 00168 manager.activate(); 00169 _orbRunThread = new Thread() { 00170 public void run() { _orb.run(); } 00171 }; 00172 _orbRunThread.start(); 00173 } 00174 00175 }catch(Exception e) { 00176 ErrorStreamArea.println(" "+e); 00177 e.printStackTrace(); 00178 } 00179 00180 return result; 00181 } |
|
00184 { 00185 try { 00186 POA poa = POAHelper.narrow(_orb.resolve_initial_references("RootPOA")); 00187 byte[] oid = poa.servant_to_id(servant); 00188 poa.deactivate_object(oid); 00189 }catch(Exception e) { 00190 } 00191 } |
|
Reimplemented from CorbaMediator.
00194 { 00195 Servant servant = new HxCorba.AppPOATie(appOper); 00196 org.omg.CORBA.Object app = activateServant(servant); 00197 ApplicationsManager appMgr = ApplicationsManager.defaultAppMgr(); 00198 if(appMgr == null) return null; 00199 00200 String name = appMgr.putApplication("Clients", prefix, app); 00201 try { 00202 if(hasInProcServer()) { 00203 HxCorba.Constructor cons = _server.constructor(); 00204 appMgr.bindApplication("Servers", name, cons); 00205 } 00206 }catch(org.omg.CosNaming.NamingContextPackage.AlreadyBound e) { 00207 ErrorStreamArea.println("Cannot register server "+name); 00208 } 00209 00210 return name; 00211 } |
|
Reimplemented from CorbaMediator.
00214 { 00215 ApplicationsManager appMgr = ApplicationsManager.defaultAppMgr(); 00216 00217 appMgr.removeApplication("Clients", name); 00218 if(hasInProcServer()) 00219 appMgr.removeApplication("Servers", name); 00220 } |
|
Reimplemented from CorbaMediator.
00223 { 00224 String something = "IDL:HxCorba/Checking/Object:99.9"; 00225 if(obj == null) return false; 00226 try { 00227 obj._is_a(something); 00228 return true; 00229 }catch(Exception e) { 00230 return false; 00231 } 00232 } |
|
Reimplemented from CorbaMediator.
00235 { 00236 if(src == null) return new NoBufferTxManager(); 00237 00238 if(hasInProcServer() && isServerObject(src)) 00239 return new InProcBufferTxManager(); 00240 else 00241 return new LocalBufferTxManager(size); 00242 } |
|
Reimplemented from CorbaMediator.
00246 { 00247 try { 00248 return _server.getInitialObject(name); 00249 } 00250 catch(org.omg.CORBA.ORBPackage.InvalidName e) { 00251 //ErrorStreamArea.println("No \""+name+"\" in server"); 00252 return null; 00253 } 00254 } |
|
Reimplemented from CorbaMediator.
00257 { 00258 //if(_applet != null) obj = _orb.string_to_object(_services.getProperty(name)); 00259 00260 try { 00261 return _orb.resolve_initial_references(name); 00262 } 00263 catch(org.omg.CORBA.ORBPackage.InvalidName e) { 00264 //ErrorStreamArea.println("\""+name+"\" not found in configuration file"); 00265 return null; 00266 } 00267 } |