1 45 package org.exolab.jms.net.orb; 46 47 import java.rmi.NoSuchObjectException ; 48 import java.rmi.StubNotFoundException ; 49 import java.rmi.server.ExportException ; 50 51 import org.exolab.jms.net.proxy.Proxy; 52 53 60 public abstract class UnicastObject { 61 62 65 private ORB _orb; 66 67 71 private final String _uri; 72 73 76 private Proxy _proxy; 77 78 79 86 protected UnicastObject(ORB orb) 87 throws ExportException , StubNotFoundException { 88 this(orb, null); 89 } 90 91 100 protected UnicastObject(ORB orb, String uri) 101 throws ExportException , StubNotFoundException { 102 this(orb, uri, false); 103 } 104 105 118 protected UnicastObject(ORB orb, String uri, boolean exportTo) 119 throws ExportException , StubNotFoundException { 120 if (orb == null) { 121 throw new IllegalArgumentException ("Argument 'orb' is null"); 122 } 123 if (!exportTo) { 124 _proxy = orb.exportObject(this, uri); 125 } else if (uri != null) { 126 _proxy = orb.exportObjectTo(this, uri); 127 } else { 128 _proxy = orb.exportObjectTo(this); 129 } 130 _orb = orb; 131 _uri = uri; 132 } 133 134 139 public Proxy getProxy() { 140 return _proxy; 141 } 142 143 148 public void unexportObject() throws NoSuchObjectException { 149 _orb.unexportObject(this); 150 } 151 152 157 protected ORB getORB() { 158 return _orb; 159 } 160 161 167 protected String getURI() { 168 return _uri; 169 } 170 } 171 | Popular Tags |