1 45 package org.exolab.jms.client.net; 46 47 import java.util.Map ; 48 49 import java.rmi.NoSuchObjectException ; 50 import java.rmi.RemoteException ; 51 import java.rmi.StubNotFoundException ; 52 import java.rmi.server.ExportException ; 53 import java.rmi.server.ObjID ; 54 55 import org.exolab.jms.net.connector.CallerListener; 56 import org.exolab.jms.net.connector.Caller; 57 import org.exolab.jms.net.orb.ORB; 58 import org.exolab.jms.net.orb.ORBFactory; 59 import org.exolab.jms.net.proxy.Proxy; 60 import org.exolab.jms.net.registry.LocalRegistry; 61 import org.exolab.jms.net.registry.Registry; 62 63 64 70 public class SharedORB implements ORB { 71 72 75 private final ORB _orb; 76 77 80 private static org.exolab.jms.net.orb.ORB _instance; 81 82 83 88 private SharedORB() throws RemoteException { 89 _orb = ORBFactory.createORB(); 90 } 91 92 99 public void addRoute(String uri, String toURI) throws RemoteException { 100 _orb.addRoute(uri, toURI); 101 } 102 103 109 public LocalRegistry getRegistry() throws RemoteException { 110 return _orb.getRegistry(); 111 } 112 113 120 public Registry getRegistry(Map properties) throws RemoteException { 121 return _orb.getRegistry(properties); 122 } 123 124 132 public Proxy exportObject(Object object) 133 throws ExportException , StubNotFoundException { 134 return _orb.exportObject(object); 135 } 136 137 147 public Proxy exportObject(Object object, String uri) 148 throws ExportException , StubNotFoundException { 149 return _orb.exportObject(object, uri); 150 } 151 152 161 public Proxy exportObject(Object object, ObjID objID) 162 throws ExportException , StubNotFoundException { 163 return _orb.exportObject(object, objID); 164 } 165 166 176 public Proxy exportObject(Object object, ObjID objID, String uri) 177 throws ExportException , StubNotFoundException { 178 return _orb.exportObject(object, objID, uri); 179 } 180 181 190 public Proxy exportObjectTo(Object object) throws ExportException , 191 StubNotFoundException { 192 return _orb.exportObjectTo(object); 193 } 194 195 206 public Proxy exportObjectTo(Object object, String uri) 207 throws ExportException , StubNotFoundException { 208 return _orb.exportObjectTo(object, uri); 209 } 210 211 224 public Proxy exportObjectTo(Object object, String uri, String principal, 225 String credentials) 226 throws ExportException , StubNotFoundException { 227 return _orb.exportObjectTo(object, uri, principal, credentials); 228 } 229 230 236 public void unexportObject(Object object) throws NoSuchObjectException { 237 _orb.unexportObject(object); 238 } 239 240 247 public Caller getCaller() throws RemoteException { 248 return _orb.getCaller(); 249 } 250 251 258 public void addCallerListener(String uri, CallerListener listener) 259 throws RemoteException { 260 _orb.addCallerListener(uri, listener); 261 } 262 263 270 public void removeCallerListener(String uri, CallerListener listener) 271 throws RemoteException { 272 _orb.removeCallerListener(uri, listener); 273 } 274 275 280 public void shutdown() throws RemoteException { 281 _orb.shutdown(); 282 } 283 284 290 public static synchronized ORB getInstance() throws RemoteException { 291 if (_instance == null) { 292 _instance = new SharedORB(); 293 } 294 return _instance; 295 } 296 297 } 298 | Popular Tags |