1 29 30 package com.caucho.iiop.orb; 31 32 import com.caucho.vfs.*; 33 import com.caucho.iiop.*; 34 35 import org.omg.CORBA.*; 36 37 import java.applet.Applet ; 38 import java.lang.reflect.Proxy ; 39 import java.util.Properties ; 40 import java.util.logging.Logger ; 41 import javax.rmi.PortableRemoteObject ; 42 import java.io.IOException ; 43 44 public class ORBImpl extends org.omg.CORBA.ORB 45 { 46 public static final Logger log 47 = Logger.getLogger(ORBImpl.class.getName()); 48 49 private String _host; 50 private int _port; 51 52 private Path _path; 53 54 private final StubDelegateImpl _stubDelegate; 55 56 public ORBImpl() 57 { 58 _stubDelegate = new StubDelegateImpl(this); 59 } 60 61 StubDelegateImpl getStubDelegate() 62 { 63 return _stubDelegate; 64 } 65 66 WriteStream openWriter() 67 { 68 try { 69 ReadWritePair pair = _path.openReadWrite(); 70 71 return pair.getWriteStream(); 72 } catch (IOException e) { 73 throw new RuntimeException (e); 74 } 75 } 76 77 ReadWritePair openReadWrite() 78 { 79 try { 80 return _path.openReadWrite(); 81 } catch (IOException e) { 82 throw new RuntimeException (e); 83 } 84 } 85 86 public TypeCode create_alias_tc(String id, String name, TypeCode original) 87 { 88 throw new UnsupportedOperationException (); 89 } 90 91 public Any create_any() 92 { 93 throw new UnsupportedOperationException (); 94 } 95 96 public TypeCode create_array_tc(int length, TypeCode element_type) 97 { 98 throw new UnsupportedOperationException (); 99 } 100 101 public ContextList create_context_list() 102 { 103 throw new UnsupportedOperationException (); 104 } 105 106 public TypeCode create_enum_tc(String id, String name, String []members) 107 { 108 throw new UnsupportedOperationException (); 109 } 110 111 public Environment create_environment() 112 { 113 throw new UnsupportedOperationException (); 114 } 115 116 public ExceptionList create_exception_list() 117 { 118 throw new UnsupportedOperationException (); 119 } 120 121 public TypeCode create_exception_tc(String id, 122 String name, 123 StructMember []members) 124 { 125 throw new UnsupportedOperationException (); 126 } 127 128 public TypeCode create_interface_tc(String id, 129 String name) 130 { 131 throw new UnsupportedOperationException (); 132 } 133 134 public NVList create_list(int count) 135 { 136 throw new UnsupportedOperationException (); 137 } 138 139 public NamedValue create_named_value(String s, Any any, int flags) 140 { 141 throw new UnsupportedOperationException (); 142 } 143 144 public TypeCode create_native_tc(String id, String name) 145 { 146 throw new UnsupportedOperationException (); 147 } 148 149 public org.omg.CORBA.portable.OutputStream create_output_stream() 150 { 151 throw new UnsupportedOperationException (); 152 } 153 154 @Deprecated 155 public TypeCode create_recursive_sequence_tc(int bound, int offset) 156 { 157 throw new UnsupportedOperationException (); 158 } 159 160 public TypeCode create_sequence_tc(int bound, TypeCode element_type) 161 { 162 throw new UnsupportedOperationException (); 163 } 164 165 public TypeCode create_string_tc(int bound) 166 { 167 throw new UnsupportedOperationException (); 168 } 169 170 public TypeCode create_struct_tc(String id, 171 String name, 172 StructMember []members) 173 { 174 throw new UnsupportedOperationException (); 175 } 176 177 public TypeCode create_union_tc(String id, 178 String name, 179 TypeCode discriminator_type, 180 UnionMember []members) 181 { 182 throw new UnsupportedOperationException (); 183 } 184 185 public TypeCode create_wstring_tc(int bound) 186 { 187 throw new UnsupportedOperationException (); 188 } 189 190 public Context get_default_context() 191 { 192 throw new UnsupportedOperationException (); 193 } 194 195 public Request get_next_response() 196 { 197 throw new UnsupportedOperationException (); 198 } 199 200 public TypeCode get_primitive_tc(org.omg.CORBA.TCKind tcKind) 201 { 202 throw new UnsupportedOperationException (); 203 } 204 205 public String []list_initial_services() 206 { 207 return new String [0]; 208 } 209 210 @Override 211 public String object_to_string(org.omg.CORBA.Object obj) 212 { 213 throw new UnsupportedOperationException (); 214 } 215 216 public boolean poll_next_response() 217 { 218 throw new UnsupportedOperationException (); 219 } 220 221 public org.omg.CORBA.Object resolve_initial_references(String object_name) 222 { 223 try { 224 Thread thread = Thread.currentThread(); 225 ClassLoader loader = thread.getContextClassLoader(); 226 227 Iiop10Writer writer = new Iiop10Writer(); 228 229 ReadWritePair pair = openReadWrite(); 230 231 MessageWriter out = new StreamMessageWriter(pair.getWriteStream()); 232 233 IiopReader in = new IiopReader(pair.getReadStream()); 234 in.setOrb(this); 235 236 writer.init(out, new IiopReader(pair.getReadStream())); 237 238 byte []oid = new byte[] { 'I', 'N', 'I', 'T' }; 239 240 writer.startRequest(oid, 0, oid.length, "get", 1); 241 242 writer.writeString(object_name); 243 244 in = writer._call(); 245 in.setOrb(this); 246 247 org.omg.CORBA.Object value = in.read_Object(); 248 249 in.close(); 250 251 return value; 252 } catch (Exception e) { 253 throw new RuntimeException (e); 254 } 255 } 256 257 public void send_multiple_requests_deferred(Request []req) 258 { 259 throw new UnsupportedOperationException (); 260 } 261 262 public void send_multiple_requests_oneway(Request []req) 263 { 264 throw new UnsupportedOperationException (); 265 } 266 267 public void set_parameters(Applet app, Properties props) 268 { 269 throw new UnsupportedOperationException (); 270 } 271 272 public void set_parameters(String []args, Properties props) 273 { 274 if (props != null) { 275 java.lang.Object port = props.get("org.omg.CORBA.ORBInitialPort"); 276 java.lang.Object host = props.get("org.omg.CORBA.ORBInitialHost"); 277 278 if (host != null) 279 _host = String.valueOf(host); 280 281 if (port == null) { 282 } 283 else if (port instanceof Number ) 284 _port = ((Number ) port).intValue(); 285 else 286 _port = Integer.parseInt(String.valueOf(port)); 287 288 _path = Vfs.lookup("tcp://" + _host + ":" + port); 289 } 290 } 291 292 public org.omg.CORBA.Object string_to_object(String str) 293 { 294 throw new UnsupportedOperationException (); 295 } 296 297 public String toString() 298 { 299 if (_host != null) 300 return "ORBImpl[" + _host + ", " + _port + "]"; 301 else 302 return "ORBImpl[]"; 303 } 304 } 305 | Popular Tags |