package org.menacheri.convert.flex;

import flex.messaging.io.SerializationContext;

/**
 * This class provides threadlocal contexts on demand to the serializer and
 * deserializer class. This context object is necessary for blazeds to do
 * serialization.
 * 
 * @author Abraham Menacherry
 * 
 */
public class SerializationContextProvider {

	public SerializationContext get()
	{
		// Threadlocal SerializationContent
		SerializationContext serializationContext = SerializationContext
				.getSerializationContext();
		serializationContext.enableSmallMessages = true;
		serializationContext.instantiateTypes = true;
		// use _remoteClass field
		serializationContext.supportRemoteClass = true;
		// false Legacy Flex 1.5 behavior was to return a java.util.Collection
		// for Array, New Flex 2+ behavior is to return Object[] for AS3 Array
		serializationContext.legacyCollection = false;
		// false Legacy flash.xml.XMLDocument Type
		serializationContext.legacyMap = false;
		// true New E4X XML Type
		serializationContext.legacyXMLDocument = false;
		// determines whether the constructed Document is name-space aware
		//serializationContext.legacyXMLNamespaces = false;
		serializationContext.legacyThrowable = false;
		serializationContext.legacyBigNumbers = false;
		serializationContext.restoreReferences = false;
		serializationContext.logPropertyErrors = false;
		serializationContext.ignorePropertyErrors = true;
		return serializationContext;
	}
}

@@ -28,17 +28,19 @@
 rt.flex;
-%0A
+%0D%0A%0D
 %0Aimport 
@@ -82,13 +82,16 @@
 ext;
-%0A
+%0D%0A%0D
 %0A/**
+%0D
 %0A * 
@@ -162,16 +162,17 @@
 izer and
+%0D
 %0A * dese
@@ -237,16 +237,17 @@
 ds to do
+%0D
 %0A * seri
@@ -256,20 +256,22 @@
 ization.
+%0D
 %0A * 
+%0D
 %0A * @aut
@@ -296,16 +296,19 @@
 erry
+%0D
 %0A * 
+%0D
 %0A */
+%0D
 %0Apub
@@ -347,17 +347,19 @@
 ovider %7B
-%0A
+%0D%0A%0D
 %0A%09public
@@ -389,11 +389,13 @@
 et()
+%0D
 %0A%09%7B
+%0D
 %0A%09%09/
@@ -428,16 +428,17 @@
 nContent
+%0D
 %0A%09%09Seria
@@ -496,16 +496,17 @@
 nContext
+%0D
 %0A%09%09%09%09.ge
@@ -529,16 +529,17 @@
 ntext();
+%0D
 %0A%09%09seria
@@ -581,16 +581,17 @@
  = true;
+%0D
 %0A%09%09seria
@@ -626,24 +626,25 @@
 ypes = true;
+%0D
 %0A%09%09// use _r
@@ -659,16 +659,17 @@
 ss field
+%0D
 %0A%09%09seria
@@ -710,16 +710,17 @@
  = true;
+%0D
 %0A%09%09// fa
@@ -784,16 +784,17 @@
 llection
+%0D
 %0A%09%09// fo
@@ -858,16 +858,17 @@
 S3 Array
+%0D
 %0A%09%09seria
@@ -904,24 +904,25 @@
 ion = false;
+%0D
 %0A%09%09// false 
@@ -950,24 +950,25 @@
 ocument Type
+%0D
 %0A%09%09serializa
@@ -993,24 +993,25 @@
 Map = false;
+%0D
 %0A%09%09// true N
@@ -1025,16 +1025,17 @@
 XML Type
+%0D
 %0A%09%09seria
@@ -1076,16 +1076,17 @@
 = false;
+%0D
 %0A%09%09// de
@@ -1146,21 +1146,20 @@
 ce aware
+%0D
 %0A%09%09
-//
 serializ
@@ -1191,32 +1191,33 @@
 espaces = false;
+%0D
 %0A%09%09serialization
@@ -1240,32 +1240,33 @@
 rowable = false;
+%0D
 %0A%09%09serialization
@@ -1290,32 +1290,33 @@
 Numbers = false;
+%0D
 %0A%09%09serialization
@@ -1341,32 +1341,33 @@
 erences = false;
+%0D
 %0A%09%09serialization
@@ -1400,16 +1400,17 @@
 = false;
+%0D
 %0A%09%09seria
@@ -1453,16 +1453,17 @@
  = true;
+%0D
 %0A%09%09retur
@@ -1489,10 +1489,13 @@
 ext;
+%0D
 %0A%09%7D
+%0D
 %0A%7D
+%0D
 %0A

Put back in the serialization context