154 155 private ValueHandlerImpl(boolean isInputStream) { 156 this(); 157 useHashtables = false; 158 this.isInputStream = isInputStream; 159 } 160 161 static ValueHandlerImpl getInstance() { 162 return new ValueHandlerImpl(); 163 } 164 165 static ValueHandlerImpl getInstance(boolean isInputStream) { 166 return new ValueHandlerImpl(isInputStream); 167 } 168 169 /** 170 * Writes the value to the stream using java semantics. 171 * @param out The stream to write the value to 172 * @param value The value to be written to the stream 173 **/ 174 public void writeValue(org.omg.CORBA.portable.OutputStream _out, 175 java.io.Serializable value) { 176 writeValueWithVersion(_out, value, STREAM_FORMAT_VERSION_1); 177 } 178 179 private void writeValueWithVersion(org.omg.CORBA.portable.OutputStream _out, 180 java.io.Serializable value, 181 byte streamFormatVersion) { 182 183 org.omg.CORBA_2_3.portable.OutputStream out = 184 (org.omg.CORBA_2_3.portable.OutputStream) _out; 185 186 if (!useHashtables) { 187 if (outputStreamBridge == null) { 188 outputStreamBridge = createOutputStream(); 189 outputStreamBridge.setOrbStream(out); 190 } 191 192 try { 193 outputStreamBridge.increaseRecursionDepth(); 194 writeValueInternal(outputStreamBridge, out, value, streamFormatVersion); 195 } finally { 196 outputStreamBridge.decreaseRecursionDepth(); 223 } 224 } 225 226 private void writeValueInternal(IIOPOutputStream bridge, 227 org.omg.CORBA_2_3.portable.OutputStream out, 228 java.io.Serializable value, 229 byte streamFormatVersion) 230 { 231 Class clazz = value.getClass(); 232 233 if (clazz.isArray()) 234 write_Array(out, value, clazz.getComponentType()); 235 else 236 bridge.simpleWriteObject(value, streamFormatVersion); 237 } 238 239 /** 240 * Reads a value from the stream using java semantics. 241 * @param in The stream to read the value from 242 * @param clazz The type of the value to be read in 243 * @param sender The sending context runtime 244 **/ 245 public java.io.Serializable readValue(org.omg.CORBA.portable.InputStream _in, 246 int offset, 247 java.lang.Class clazz, 248 String repositoryID, 249 org.omg.SendingContext.RunTime _sender) 250 { 251 // Must use narrow rather than a direct cast to a com.sun 252 // class. Fix for bug 4379539. 253 CodeBase sender = CodeBaseHelper.narrow(_sender); 254 255 org.omg.CORBA_2_3.portable.InputStream in = 256 (org.omg.CORBA_2_3.portable.InputStream) _in; 257 258 if (!useHashtables) { 259 if (inputStreamBridge == null) { 260 inputStreamBridge = createInputStream(); 261 inputStreamBridge.setOrbStream(in); 262 inputStreamBridge.setSender(sender); //d11638 263 // backward compatability 4365188 264 inputStreamBridge.setValueHandler(this); 265 } 266 267 java.io.Serializable result = null; 268 269 try { 270 271 inputStreamBridge.increaseRecursionDepth(); 272 result = (java.io.Serializable) readValueInternal(inputStreamBridge, in, offset, clazz, repositoryID, sender); 273 274 } finally { 275 276 if (inputStreamBridge.decreaseRecursionDepth() == 0) { 277 // Indirections are resolved immediately since 278 // the change to the active recursion manager, 279 // so this will never happen. 280 } 281 } 282 283 return result; 284 } 285 286 IIOPInputStream jdkToOrbInputStreamBridge = null; 287 if (inputStreamPairs == null) 288 inputStreamPairs = new Hashtable(); 289 290 jdkToOrbInputStreamBridge = (IIOPInputStream)inputStreamPairs.get(_in); 291 292 if (jdkToOrbInputStreamBridge == null) { 293 294 jdkToOrbInputStreamBridge = createInputStream(); 295 jdkToOrbInputStreamBridge.setOrbStream(in); 296 jdkToOrbInputStreamBridge.setSender(sender); //d11638 297 // backward compatability 4365188 298 jdkToOrbInputStreamBridge.setValueHandler(this); 299 inputStreamPairs.put(_in, jdkToOrbInputStreamBridge); 300 } 301 302 java.io.Serializable result = null; 303 304 try { 305 306 jdkToOrbInputStreamBridge.increaseRecursionDepth(); 307 result = (java.io.Serializable) readValueInternal(jdkToOrbInputStreamBridge, in, offset, clazz, repositoryID, sender); 308 309 } finally { 310 311 if (jdkToOrbInputStreamBridge.decreaseRecursionDepth() == 0) { 312 inputStreamPairs.remove(_in); 313 } 314 } 315 316 return result; 317 } 318 319 private java.io.Serializable readValueInternal(IIOPInputStream bridge, 320 org.omg.CORBA_2_3.portable.InputStream in, 321 int offset, 322 java.lang.Class clazz, 323 String repositoryID, 324 com.sun.org.omg.SendingContext.CodeBase sender) 325 { 326 java.io.Serializable result = null; 327 328 if (clazz == null) { 329 // clazz == null indicates an FVD situation for a nonexistant class 330 if (isArray(repositoryID)){ 331 read_Array(bridge, in, null, sender, offset); 332 } else { | 154 155 private ValueHandlerImpl(boolean isInputStream) { 156 this(); 157 useHashtables = false; 158 this.isInputStream = isInputStream; 159 } 160 161 static ValueHandlerImpl getInstance() { 162 return new ValueHandlerImpl(); 163 } 164 165 static ValueHandlerImpl getInstance(boolean isInputStream) { 166 return new ValueHandlerImpl(isInputStream); 167 } 168 169 /** 170 * Writes the value to the stream using java semantics. 171 * @param out The stream to write the value to 172 * @param value The value to be written to the stream 173 **/ 174 public void writeValue(org.omg.CORBA.portable.OutputStream out, 175 java.io.Serializable value) { 176 writeValueWithVersion(out, value, STREAM_FORMAT_VERSION_1); 177 } 178 179 private void writeValueWithVersion(org.omg.CORBA.portable.OutputStream _out, 180 java.io.Serializable value, 181 byte streamFormatVersion) { 182 183 org.omg.CORBA_2_3.portable.OutputStream out = 184 (org.omg.CORBA_2_3.portable.OutputStream) _out; 185 186 if (!useHashtables) { 187 if (outputStreamBridge == null) { 188 outputStreamBridge = createOutputStream(); 189 outputStreamBridge.setOrbStream(out); 190 } 191 192 try { 193 outputStreamBridge.increaseRecursionDepth(); 194 writeValueInternal(outputStreamBridge, out, value, streamFormatVersion); 195 } finally { 196 outputStreamBridge.decreaseRecursionDepth(); 223 } 224 } 225 226 private void writeValueInternal(IIOPOutputStream bridge, 227 org.omg.CORBA_2_3.portable.OutputStream out, 228 java.io.Serializable value, 229 byte streamFormatVersion) 230 { 231 Class clazz = value.getClass(); 232 233 if (clazz.isArray()) 234 write_Array(out, value, clazz.getComponentType()); 235 else 236 bridge.simpleWriteObject(value, streamFormatVersion); 237 } 238 239 /** 240 * Reads a value from the stream using java semantics. 241 * @param in The stream to read the value from 242 * @param clazz The type of the value to be read in 243 * @param rt The sending context runtime 244 **/ 245 public java.io.Serializable readValue(org.omg.CORBA.portable.InputStream in, 246 int offset, 247 java.lang.Class clazz, 248 String repositoryID, 249 org.omg.SendingContext.RunTime rt) 250 { 251 // Must use narrow rather than a direct cast to a com.sun 252 // class. Fix for bug 4379539. 253 CodeBase sender = CodeBaseHelper.narrow(rt); 254 255 org.omg.CORBA_2_3.portable.InputStream inStream = 256 (org.omg.CORBA_2_3.portable.InputStream) in; 257 258 if (!useHashtables) { 259 if (inputStreamBridge == null) { 260 inputStreamBridge = createInputStream(); 261 inputStreamBridge.setOrbStream(inStream); 262 inputStreamBridge.setSender(sender); //d11638 263 // backward compatability 4365188 264 inputStreamBridge.setValueHandler(this); 265 } 266 267 java.io.Serializable result = null; 268 269 try { 270 271 inputStreamBridge.increaseRecursionDepth(); 272 result = (java.io.Serializable) readValueInternal(inputStreamBridge, inStream, offset, clazz, repositoryID, sender); 273 274 } finally { 275 276 if (inputStreamBridge.decreaseRecursionDepth() == 0) { 277 // Indirections are resolved immediately since 278 // the change to the active recursion manager, 279 // so this will never happen. 280 } 281 } 282 283 return result; 284 } 285 286 IIOPInputStream jdkToOrbInputStreamBridge = null; 287 if (inputStreamPairs == null) 288 inputStreamPairs = new Hashtable(); 289 290 jdkToOrbInputStreamBridge = (IIOPInputStream)inputStreamPairs.get(in); 291 292 if (jdkToOrbInputStreamBridge == null) { 293 294 jdkToOrbInputStreamBridge = createInputStream(); 295 jdkToOrbInputStreamBridge.setOrbStream(inStream); 296 jdkToOrbInputStreamBridge.setSender(sender); //d11638 297 // backward compatability 4365188 298 jdkToOrbInputStreamBridge.setValueHandler(this); 299 inputStreamPairs.put(in, jdkToOrbInputStreamBridge); 300 } 301 302 java.io.Serializable result = null; 303 304 try { 305 306 jdkToOrbInputStreamBridge.increaseRecursionDepth(); 307 result = (java.io.Serializable) readValueInternal(jdkToOrbInputStreamBridge, inStream, offset, clazz, repositoryID, sender); 308 309 } finally { 310 311 if (jdkToOrbInputStreamBridge.decreaseRecursionDepth() == 0) { 312 inputStreamPairs.remove(in); 313 } 314 } 315 316 return result; 317 } 318 319 private java.io.Serializable readValueInternal(IIOPInputStream bridge, 320 org.omg.CORBA_2_3.portable.InputStream in, 321 int offset, 322 java.lang.Class clazz, 323 String repositoryID, 324 com.sun.org.omg.SendingContext.CodeBase sender) 325 { 326 java.io.Serializable result = null; 327 328 if (clazz == null) { 329 // clazz == null indicates an FVD situation for a nonexistant class 330 if (isArray(repositoryID)){ 331 read_Array(bridge, in, null, sender, offset); 332 } else { |