openamf/src/java/org/openamf/io AMFSerializer.java,1.31,1.32

[email protected]
Newsgroups gmane.comp.java.openamf.cvs
Message-ID <[email protected]>
Update of /cvsroot/openamf/openamf/src/java/org/openamf/io
In directory sc8-pr-cvs1:/tmp/cvs-serv3315/src/java/org/openamf/io

Modified Files:
	AMFSerializer.java 
Log Message:
added the ability to map AMF Custom Classes to Java Classes

Index: AMFSerializer.java
===================================================================
RCS file: /cvsroot/openamf/openamf/src/java/org/openamf/io/AMFSerializer.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** AMFSerializer.java	5 Jul 2003 19:50:48 -0000	1.31
--- AMFSerializer.java	6 Jul 2003 17:27:34 -0000	1.32
***************
*** 21,24 ****
--- 21,25 ----
  import org.openamf.AMFMessage;
  import org.openamf.ASObject;
+ import org.openamf.config.OpenAMFConfig;
  import org.openamf.recordset.ASRecordSet;
  import org.openamf.util.XMLUtils;
***************
*** 28,32 ****
  public class AMFSerializer {
  
! 	protected static Log log = LogFactory.getLog(AMFSerializer.class);
  
  	private static final int MILLS_PER_HOUR = 60000;
--- 29,33 ----
  public class AMFSerializer {
  
! 	private static Log log = LogFactory.getLog(AMFSerializer.class);
  
  	private static final int MILLS_PER_HOUR = 60000;
***************
*** 40,60 ****
  
  	public void serializeMessage(AMFMessage message) throws IOException {
! 		
  		log.info("Serializing Message, for more info turn on debug level");
! 		
  		//version ?
  		outputStream.writeShort(0);
! 		
  		outputStream.writeShort(message.getHeaderCount());
  		Iterator headers = message.getHeaders();
  		while (headers.hasNext()) {
! 			AMFHeader header = (AMFHeader)headers.next();
  			writeHeader(header);
  		}
! 		
  		outputStream.writeShort(message.getBodyCount());
  		Iterator bodies = message.getBodies();
  		while (bodies.hasNext()) {
! 			AMFBody body = (AMFBody)bodies.next();
  			writeBody(body);
  		}
--- 41,61 ----
  
  	public void serializeMessage(AMFMessage message) throws IOException {
! 
  		log.info("Serializing Message, for more info turn on debug level");
! 
  		//version ?
  		outputStream.writeShort(0);
! 
  		outputStream.writeShort(message.getHeaderCount());
  		Iterator headers = message.getHeaders();
  		while (headers.hasNext()) {
! 			AMFHeader header = (AMFHeader) headers.next();
  			writeHeader(header);
  		}
! 
  		outputStream.writeShort(message.getBodyCount());
  		Iterator bodies = message.getBodies();
  		while (bodies.hasNext()) {
! 			AMFBody body = (AMFBody) bodies.next();
  			writeBody(body);
  		}
***************
*** 124,128 ****
  
  		log.debug("Writting Object");
! 		outputStream.writeByte(AMFBody.DATA_TYPE_OBJECT);
  		try {
  			PropertyDescriptor[] properties =
--- 125,138 ----
  
  		log.debug("Writting Object");
! 		String customClassName =
! 			OpenAMFConfig.getInstance().getCustomClassName(
! 				object.getClass().getName());
! 		log.debug("customClassName :" + customClassName);
! 		if (customClassName == null) {
! 			outputStream.writeByte(AMFBody.DATA_TYPE_OBJECT);
! 		} else {
! 			outputStream.writeByte(AMFBody.DATA_TYPE_CUSTOM_CLASS);
! 			outputStream.writeUTF(customClassName);
! 		}
  		try {
  			PropertyDescriptor[] properties =
***************
*** 134,138 ****
  					Object propertyValue = null;
  					if (readMethod == null) {
! 						log.error("unable to find readMethod for : " + propertyName + " writting null!");
  					} else {
  						propertyValue =
--- 144,151 ----
  					Object propertyValue = null;
  					if (readMethod == null) {
! 						log.error(
! 							"unable to find readMethod for : "
! 								+ propertyName
! 								+ " writting null!");
  					} else {
  						propertyValue =
***************
*** 168,178 ****
  	protected void writeIterator(Object value) throws IOException {
  		Iterator iterator = (Iterator) value;
! 		
  		ArrayList list = new ArrayList();
! 		
  		while (iterator.hasNext()) {
  			list.add(iterator.next());
  		}
! 		
  		writeCollection(list);
  	}
--- 181,191 ----
  	protected void writeIterator(Object value) throws IOException {
  		Iterator iterator = (Iterator) value;
! 
  		ArrayList list = new ArrayList();
! 
  		while (iterator.hasNext()) {
  			list.add(iterator.next());
  		}
! 
  		writeCollection(list);
  	}




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.