1 package org.apache.ojb.broker.core.proxy; 2 3 17 18 import java.io.ObjectStreamException ; 19 import java.io.Serializable ; 20 21 import org.apache.ojb.broker.util.logging.Logger; 22 import org.apache.ojb.broker.util.logging.LoggerFactory; 23 24 31 public class OJBSerializableProxy implements Serializable 32 { 33 34 private static final long serialVersionUID = 568312334450175549L; 35 private Logger logger = LoggerFactory.getLogger(OJBSerializableProxy.class); 36 37 private Class classObject; 38 39 private IndirectionHandler indirectionHandler; 40 41 public OJBSerializableProxy(Class proxyClass, IndirectionHandler indirectionHandler) 42 { 43 this.classObject = proxyClass; 44 this.indirectionHandler = indirectionHandler; 45 } 46 47 private Object readResolve() throws ObjectStreamException 48 { 49 try 50 { 51 return ProxyHelper.getProxyFactory().createProxy(classObject, indirectionHandler); 52 } catch (Throwable e) 53 { 54 logger.warn("Unable to create a new Proxy of type '" + classObject.getName() + "' due to a '" + e.getClass().getName() + "'."); 57 return null; 58 } 59 } 60 61 } 62 | Popular Tags |