1 31 package org.objectweb.proactive.ext.security; 32 33 import java.io.IOException ; 34 import java.io.ObjectOutputStream ; 35 import java.io.OutputStream ; 36 37 import java.rmi.Remote ; 38 import java.rmi.server.RemoteObject ; 39 import java.rmi.server.RemoteStub ; 40 41 42 48 public class SecurityOutputStream extends ObjectOutputStream { 49 50 54 public SecurityOutputStream(OutputStream out) throws IOException { 55 super(out); 56 System.out.println( 57 "-*-**-*--*-*-*-**--**-*--*-**- instanciating securtityoutpoutstream"); 58 java.security.AccessController.doPrivileged(new java.security.PrivilegedAction () { 59 public Object run() { 60 enableReplaceObject(true); 61 return null; 62 } 63 }); 64 } 65 66 70 public SecurityOutputStream() throws IOException , SecurityException { 71 super(); 72 } 73 74 79 protected Object replaceObject(Object obj) throws IOException { 80 System.out.println( 81 " */*/*/*/*/*/*/* /*/*/**//**/ Inside replaceObject /*/**/*//*/**//*/*/**//*/*"); 82 if ((obj instanceof Remote ) && !(obj instanceof RemoteStub )) { 83 System.out.println( 84 " */*/*/*/*/*/*/* /*/*/**//**/ found a Remote object " + obj + 85 " /*/**/*//*/**//*/*/**//*/*"); 86 Remote target = RemoteObject.toStub((Remote ) obj); 87 if (target != null) { 88 return target; 89 } 90 } 91 System.out.println(" */*/*/*/*/*/*/* /*/*/**//**/ Normal obj : " + obj + 92 "/*/**/*//*/**//*/*/**//*/*"); 93 return obj; 94 } 95 } 96 | Popular Tags |