1 19 20 package org.apache.cayenne.remote.hessian; 21 22 import java.util.HashMap ; 23 import java.util.Map ; 24 25 import org.apache.cayenne.DataRow; 26 import org.apache.cayenne.util.PersistentObjectList; 27 28 import com.caucho.hessian.io.AbstractSerializerFactory; 29 import com.caucho.hessian.io.Deserializer; 30 import com.caucho.hessian.io.HessianProtocolException; 31 import com.caucho.hessian.io.JavaDeserializer; 32 import com.caucho.hessian.io.Serializer; 33 34 40 class ClientSerializerFactory extends AbstractSerializerFactory { 41 42 private Map deserializers; 43 private Deserializer dataRowDeserializer; 44 45 public Serializer getSerializer(Class cl) throws HessianProtocolException { 46 return null; 47 } 48 49 public Deserializer getDeserializer(Class cl) throws HessianProtocolException { 50 Deserializer deserializer = null; 51 52 if (PersistentObjectList.class.isAssignableFrom(cl)) { 53 54 synchronized (this) { 55 56 if (deserializers != null) { 57 deserializer = (Deserializer) deserializers.get(cl); 58 } 59 60 if (deserializer == null) { 61 deserializer = new JavaDeserializer(cl); 62 63 if (deserializers == null) { 64 deserializers = new HashMap (); 65 } 66 67 deserializers.put(cl, deserializer); 68 } 69 } 70 } 71 else if(DataRow.class.isAssignableFrom(cl)) { 72 if(dataRowDeserializer == null) { 73 dataRowDeserializer = new DataRowDeserializer(); 74 } 75 76 return dataRowDeserializer; 77 } 78 79 return deserializer; 80 } 81 } 82 | Popular Tags |