1 23 24 package com.sun.ejb.base.io; 25 26 import java.io.*; 27 import java.security.*; 28 import java.rmi.*; 29 import javax.ejb.*; 30 import javax.naming.*; 31 32 import java.util.logging.*; 33 import com.sun.logging.*; 34 35 import com.sun.ejb.spi.io.J2EEObjectStreamFactory; 36 import com.sun.ejb.spi.io.NonSerializableObjectHandler; 37 38 43 public class J2EEObjectStreamFactoryImpl 44 implements J2EEObjectStreamFactory 45 { 46 47 private static Logger _ejbLogger = 48 LogDomains.getLogger(LogDomains.EJB_LOGGER); 49 50 public J2EEObjectStreamFactoryImpl() { 51 } 52 53 63 public ObjectOutputStream createObjectOutputStream( 64 final OutputStream os, 65 final boolean replaceObject, 66 final NonSerializableObjectHandler handler) 67 throws IOException 68 { 69 ObjectOutputStream oos = null; 72 try { 73 oos = (ObjectOutputStream)AccessController.doPrivileged( 74 new PrivilegedExceptionAction() { 75 public java.lang.Object run() 76 throws Exception 77 { 78 return new EJBObjectOutputStream( 79 os, replaceObject, handler); 80 } 81 }); 82 } catch ( PrivilegedActionException ex ) { 83 throw (IOException) ex.getException(); 84 } 85 return oos; 86 } 87 88 96 public ObjectInputStream createObjectInputStream( 97 final InputStream is, 98 final boolean resolveObject, 99 final ClassLoader loader) 100 throws Exception 101 { 102 ObjectInputStream ois = null; 103 if ( loader != null ) { 104 try { 107 ois = (ObjectInputStream)AccessController.doPrivileged( 108 new PrivilegedExceptionAction() { 109 public java.lang.Object run() 110 throws Exception 111 { 112 return new EJBObjectInputStream( 113 is, loader, resolveObject); 114 } 115 }); 116 } catch ( PrivilegedActionException ex ) { 117 throw (IOException) ex.getException(); 118 } 119 } else { 120 ois = new ObjectInputStream(is); 121 } 122 123 return ois; 124 } 125 126 } 127 | Popular Tags |