1 18 19 package org.objectweb.jac.core; 20 21 import java.io.IOException ; 22 import java.io.ObjectOutputStream ; 23 import java.io.OutputStream ; 24 import org.apache.log4j.Logger; 25 import org.objectweb.jac.core.rtti.MethodItem; 26 27 48 49 public class JacObjectOutputStream extends ObjectOutputStream { 50 static Logger logger = Logger.getLogger("serialization"); 51 52 57 public JacObjectOutputStream(OutputStream os) throws IOException { 58 super(os); 59 enableReplaceObject(true); 60 } 61 62 75 76 protected Object replaceObject(Object obj) throws IOException { 77 if (obj instanceof Wrappee) { 78 SerializedJacObject sjo = 79 new SerializedJacObject(obj.getClass().getName()); 80 if (obj.getClass().getName().startsWith("org.objectweb.jac.lib.java.util")) { 81 sjo.disableForwarding(); 82 } 83 ((ACManager)ACManager.get()).whenSerialized((Wrappee)obj,sjo); 84 return sjo; 85 } else if (obj instanceof AspectComponent) { 86 SerializedJacObject sjo = 87 new SerializedJacObject(obj.getClass().getName()); 88 return sjo; 89 } else if (obj instanceof MethodItem) { 90 return new SerializedMethodItem((MethodItem)obj); 91 } else if (obj.getClass().getName().equals("org.objectweb.jac.aspects.gui.DisplayContext")) { 92 logger.debug("replaceObject "+obj+" -> null"); 94 return null; 95 } 97 return obj; 98 } 99 100 } 101 | Popular Tags |