You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2014/11/09 01:59:17 UTC

[3/8] thrift git commit: THRIFT-2644 Haxe support Client: Haxe Patch: Jens Geyer

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/lib/haxe/src/org/apache/thrift/protocol/TList.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TList.hx b/lib/haxe/src/org/apache/thrift/protocol/TList.hx
new file mode 100644
index 0000000..d6c15c1
--- /dev/null
+++ b/lib/haxe/src/org/apache/thrift/protocol/TList.hx
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ 
+package org.apache.thrift.protocol;
+  
+class TList {
+
+    public var elemType : Int;
+    public var size : Int;
+  
+      public function new(t : Int = 0, s : Int = 0) {
+        elemType = t;
+        size = s;
+      }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/lib/haxe/src/org/apache/thrift/protocol/TMap.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TMap.hx b/lib/haxe/src/org/apache/thrift/protocol/TMap.hx
new file mode 100644
index 0000000..5af8c4e
--- /dev/null
+++ b/lib/haxe/src/org/apache/thrift/protocol/TMap.hx
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ 
+package org.apache.thrift.protocol;
+
+class TMap {
+    
+    public var keyType : Int;
+    public var valueType : Int;
+    public var size : Int;
+  
+    public function new(k : Int = 0, v : Int = 0, s : Int = 0) {
+      keyType = k;
+      valueType = v;
+      size = s;
+    }
+ 
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/lib/haxe/src/org/apache/thrift/protocol/TMessage.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TMessage.hx b/lib/haxe/src/org/apache/thrift/protocol/TMessage.hx
new file mode 100644
index 0000000..98c883b
--- /dev/null
+++ b/lib/haxe/src/org/apache/thrift/protocol/TMessage.hx
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ 
+package org.apache.thrift.protocol;
+  
+class TMessage {
+    
+    public var name : String;
+    public var type : Int;
+    public var seqid : Int;
+  
+    public function new(n : String = "", t : Int = 0, s : Int = 0) {
+      name = n;
+      type = t;
+      seqid = s;
+    }
+    
+    public function toString() : String {
+      return "<TMessage name:'" + name + "' type: " + type + " seqid:" + seqid + ">";
+    }
+    
+    public function equals(other:TMessage) : Bool {
+      return name == other.name && type == other.type && seqid == other.seqid;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/lib/haxe/src/org/apache/thrift/protocol/TMessageType.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TMessageType.hx b/lib/haxe/src/org/apache/thrift/protocol/TMessageType.hx
new file mode 100644
index 0000000..b141940
--- /dev/null
+++ b/lib/haxe/src/org/apache/thrift/protocol/TMessageType.hx
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ 
+package org.apache.thrift.protocol;
+  
+class TMessageType {
+    public static inline var CALL      : Int = 1;
+    public static inline var REPLY 	   : Int = 2;
+    public static inline var EXCEPTION : Int = 3;
+    public static inline var ONEWAY    : Int = 4;
+}

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/lib/haxe/src/org/apache/thrift/protocol/TProtocol.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TProtocol.hx b/lib/haxe/src/org/apache/thrift/protocol/TProtocol.hx
new file mode 100644
index 0000000..58873da
--- /dev/null
+++ b/lib/haxe/src/org/apache/thrift/protocol/TProtocol.hx
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.thrift.protocol;
+
+import haxe.io.Bytes;
+import org.apache.thrift.TException;
+import org.apache.thrift.transport.TTransport;
+
+/**
+* Protocol interface definition
+*/
+interface TProtocol {
+  
+    function getTransport() : TTransport;
+
+    /**
+     * Writing methods.
+     */
+    function writeMessageBegin(message:TMessage) : Void;
+    function writeMessageEnd() : Void;
+    function writeStructBegin(struct:TStruct) : Void;
+    function writeStructEnd() : Void;
+    function writeFieldBegin(field:TField) : Void;
+    function writeFieldEnd() : Void;
+    function writeFieldStop() : Void;    
+    function writeMapBegin(map:TMap) : Void;    
+    function writeMapEnd() : Void;    
+    function writeListBegin(list:TList) : Void;    
+    function writeListEnd() : Void;    
+    function writeSetBegin(set:TSet) : Void;    
+    function writeSetEnd() : Void;    
+    function writeBool(b : Bool) : Void;    
+    function writeByte(b : Int) : Void;    
+    function writeI16(i16 : Int) : Void;    
+    function writeI32(i32 : Int) : Void;    
+    function writeI64(i64 : haxe.Int64) : Void;    
+    function writeDouble(dub : Float) : Void;    
+    function writeString(str : String) : Void;    
+    function writeBinary(bin : Bytes) : Void;    
+	
+    /**
+     * Reading methods.
+     */
+    function readMessageBegin():TMessage;   
+    function readMessageEnd() : Void;    
+    function readStructBegin():TStruct;    
+    function readStructEnd() : Void;    
+    function readFieldBegin():TField;    
+    function readFieldEnd() : Void;    
+    function readMapBegin():TMap;    
+    function readMapEnd() : Void;    
+    function readListBegin():TList;    
+    function readListEnd() : Void;    
+    function readSetBegin():TSet;    
+    function readSetEnd() : Void;    
+    function readBool() : Bool;    
+    function readByte() : Int;    
+    function readI16() : Int;    
+    function readI32() : Int;    
+    function readI64() : haxe.Int64;     
+    function readDouble() : Float;    
+    function readString() : String;    
+    function readBinary() : Bytes;
+
+}

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/lib/haxe/src/org/apache/thrift/protocol/TProtocolException.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TProtocolException.hx b/lib/haxe/src/org/apache/thrift/protocol/TProtocolException.hx
new file mode 100644
index 0000000..dbbcb8c
--- /dev/null
+++ b/lib/haxe/src/org/apache/thrift/protocol/TProtocolException.hx
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.thrift.protocol;
+  
+import org.apache.thrift.TException;
+
+class TProtocolException extends TException {
+    
+    public static inline var UNKNOWN : Int = 0;
+    public static inline var INVALID_DATA : Int = 1;
+    public static inline var NEGATIVE_SIZE : Int = 2;
+    public static inline var SIZE_LIMIT : Int = 3;
+    public static inline var BAD_VERSION : Int = 4;
+    public static inline var NOT_IMPLEMENTED : Int = 5;
+    public static inline var DEPTH_LIMIT : Int = 6;
+  
+    public function new(error : Int = UNKNOWN, message : String = "") {
+      super(message, error);
+    }
+    
+  
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/lib/haxe/src/org/apache/thrift/protocol/TProtocolFactory.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TProtocolFactory.hx b/lib/haxe/src/org/apache/thrift/protocol/TProtocolFactory.hx
new file mode 100644
index 0000000..d231dbe
--- /dev/null
+++ b/lib/haxe/src/org/apache/thrift/protocol/TProtocolFactory.hx
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.thrift.protocol;
+
+import org.apache.thrift.transport.TTransport;
+  
+interface TProtocolFactory {
+     function getProtocol(trans:TTransport):TProtocol;
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/lib/haxe/src/org/apache/thrift/protocol/TProtocolUtil.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TProtocolUtil.hx b/lib/haxe/src/org/apache/thrift/protocol/TProtocolUtil.hx
new file mode 100644
index 0000000..794e397
--- /dev/null
+++ b/lib/haxe/src/org/apache/thrift/protocol/TProtocolUtil.hx
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.thrift.protocol;
+
+import org.apache.thrift.*;
+
+  /**
+   * Utility class with static methods for interacting with protocol data
+   * streams.
+   *
+   */
+class TProtocolUtil {
+
+    /**
+     * The maximum recursive depth the skip() function will traverse before
+     * throwing a TException.
+     */
+    private static var maxSkipDepth : Int = Limits.I32_MAX;
+
+    /**
+     * Specifies the maximum recursive depth that the skip function will
+     * traverse before throwing a TException.  This is a global setting, so
+     * any call to skip in this JVM will enforce this value.
+     *
+     * @param depth  the maximum recursive depth.  A value of 2 would allow
+     *    the skip function to skip a structure or collection with basic children,
+     *    but it would not permit skipping a struct that had a field containing
+     *    a child struct.  A value of 1 would only allow skipping of simple
+     *    types and empty structs/collections.
+     */
+    public function setMaxSkipDepth(depth : Int) : Void {
+      maxSkipDepth = depth;
+    }
+
+    /**
+     * Skips over the next data element from the provided input TProtocol object.
+     *
+     * @param prot  the protocol object to read from
+     * @param type  the next value will be intepreted as this TType value.
+     */
+    public static function skip(prot:TProtocol, type : Int) : Void {
+      skipMaxDepth(prot, type, maxSkipDepth);
+    }
+
+     /**
+     * Skips over the next data element from the provided input TProtocol object.
+     *
+     * @param prot  the protocol object to read from
+     * @param type  the next value will be intepreted as this TType value.
+     * @param maxDepth  this function will only skip complex objects to this
+     *   recursive depth, to prevent Java stack overflow.
+     */
+    public static function skipMaxDepth(prot:TProtocol, type : Int, maxDepth : Int) : Void {
+      if (maxDepth <= 0) {
+        throw new TException("Maximum skip depth exceeded");
+      }
+      switch (type) {
+        case TType.BOOL: {
+          prot.readBool();
+        }
+        case TType.BYTE: {
+          prot.readByte();
+        }
+        case TType.I16: {
+          prot.readI16();
+        }
+        case TType.I32: {
+          prot.readI32();
+        }
+        case TType.I64: {
+          prot.readI64();
+        }
+        case TType.DOUBLE: {
+          prot.readDouble();
+        }
+        case TType.STRING: {
+          prot.readBinary();
+        }
+        case TType.STRUCT: {
+          prot.readStructBegin();
+          while (true) {
+            var field:TField = prot.readFieldBegin();
+            if (field.type == TType.STOP) {
+              break;
+            }
+            skipMaxDepth(prot, field.type, maxDepth - 1);
+            prot.readFieldEnd();
+          }
+          prot.readStructEnd();
+        }
+        case TType.MAP: {
+          var map:TMap = prot.readMapBegin();
+          for (i in 0 ... map.size) {
+            skipMaxDepth(prot, map.keyType, maxDepth - 1);
+            skipMaxDepth(prot, map.valueType, maxDepth - 1);
+          }
+          prot.readMapEnd();
+        }
+        case TType.SET: {
+          var set:TSet = prot.readSetBegin();
+          for (j in 0 ... set.size) {
+            skipMaxDepth(prot, set.elemType, maxDepth - 1);
+          }
+          prot.readSetEnd();
+        }
+        case TType.LIST: {
+          var list:TList = prot.readListBegin();
+          for (k in 0 ... list.size) {
+            skipMaxDepth(prot, list.elemType, maxDepth - 1);
+          }
+          prot.readListEnd();
+        }
+        default:
+          trace("Unknown field type ",type," in skipMaxDepth()");
+      }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/lib/haxe/src/org/apache/thrift/protocol/TSet.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TSet.hx b/lib/haxe/src/org/apache/thrift/protocol/TSet.hx
new file mode 100644
index 0000000..77806e6
--- /dev/null
+++ b/lib/haxe/src/org/apache/thrift/protocol/TSet.hx
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.thrift.protocol;
+  
+class TSet {
+
+    public var elemType : Int;
+    public var size : Int;
+  
+      public function new(t : Int = 0, s : Int = 0) {
+        elemType = t;
+        size = s;
+      }
+      
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/lib/haxe/src/org/apache/thrift/protocol/TStruct.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TStruct.hx b/lib/haxe/src/org/apache/thrift/protocol/TStruct.hx
new file mode 100644
index 0000000..faeef40
--- /dev/null
+++ b/lib/haxe/src/org/apache/thrift/protocol/TStruct.hx
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.thrift.protocol;
+  
+class TStruct {
+    
+    public var name : String;
+    
+    public function new(n : String = "") {
+      name = n;
+    }
+    
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/lib/haxe/src/org/apache/thrift/protocol/TType.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TType.hx b/lib/haxe/src/org/apache/thrift/protocol/TType.hx
new file mode 100644
index 0000000..0534399
--- /dev/null
+++ b/lib/haxe/src/org/apache/thrift/protocol/TType.hx
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.thrift.protocol;
+  
+class TType {
+    
+    public static inline var STOP : Int   = 0;
+    public static inline var VOID : Int   = 1;
+    public static inline var BOOL : Int   = 2;
+    public static inline var BYTE : Int   = 3;
+    public static inline var DOUBLE : Int = 4;
+    public static inline var I16 : Int    = 6;
+    public static inline var I32 : Int    = 8;
+    public static inline var I64 : Int    = 10;
+    public static inline var STRING : Int = 11;
+    public static inline var STRUCT : Int = 12;
+    public static inline var MAP : Int    = 13;
+    public static inline var SET : Int    = 14;
+    public static inline var LIST : Int   = 15;
+
+}

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/lib/haxe/src/org/apache/thrift/server/TServer.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/server/TServer.hx b/lib/haxe/src/org/apache/thrift/server/TServer.hx
new file mode 100644
index 0000000..9b235f6
--- /dev/null
+++ b/lib/haxe/src/org/apache/thrift/server/TServer.hx
@@ -0,0 +1,105 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.thrift.server;
+
+import org.apache.thrift.*;
+import org.apache.thrift.protocol.*;
+import org.apache.thrift.transport.*;
+import org.apache.thrift.meta_data.*;
+
+class TServer
+{
+    private var processor : TProcessor = null;
+    private var serverTransport : TServerTransport = null;
+    private var inputTransportFactory : TTransportFactory = null;
+    private var outputTransportFactory : TTransportFactory = null;
+    private var inputProtocolFactory : TProtocolFactory = null;
+    private var outputProtocolFactory : TProtocolFactory = null;
+
+	// server events
+	public var serverEventHandler : TServerEventHandler = null;
+
+    // Log delegation
+    private var _logDelegate : Dynamic->Void  = null;
+    public var logDelegate(default,set) : Dynamic->Void;
+	
+    public function new( processor : TProcessor,
+						 serverTransport : TServerTransport,
+						 inputTransportFactory : TTransportFactory = null,
+						 outputTransportFactory : TTransportFactory = null,
+						 inputProtocolFactory : TProtocolFactory = null,
+						 outputProtocolFactory : TProtocolFactory = null,
+						 logDelegate : Dynamic->Void = null)
+    {
+      this.processor = processor;
+      this.serverTransport = serverTransport;
+      this.inputTransportFactory = inputTransportFactory;	
+      this.outputTransportFactory = outputTransportFactory;
+      this.inputProtocolFactory = inputProtocolFactory;
+      this.outputProtocolFactory = outputProtocolFactory;
+      this.logDelegate = logDelegate;
+
+	  ApplyMissingDefaults();
+	}
+	
+	private function ApplyMissingDefaults() {
+		if( processor == null) 
+			throw "Invalid server configuration: processor missing";
+		if( serverTransport == null)
+			throw "Invalid server configuration: serverTransport missing";
+		if( inputTransportFactory == null)
+			inputTransportFactory = new TTransportFactory();
+		if( outputTransportFactory  == null)
+			outputTransportFactory = new TTransportFactory();
+		if( inputProtocolFactory  == null)
+			inputProtocolFactory = new TBinaryProtocolFactory();
+		if( outputProtocolFactory == null)
+			outputProtocolFactory= new TBinaryProtocolFactory();
+		if( logDelegate == null)
+			logDelegate = DefaultLogDelegate;
+    }
+
+
+	private function set_logDelegate(value : Dynamic->Void) : Dynamic->Void {
+		if(value != null) {
+			_logDelegate = value;
+		} else {
+			_logDelegate = DefaultLogDelegate; 
+		}
+		return _logDelegate;
+    }
+    
+		
+	private function DefaultLogDelegate(value : Dynamic) : Void  {
+		trace( value);
+    }
+
+    
+		
+    public function Serve() : Void {
+		throw new AbstractMethodError();
+	}
+		
+	
+    public function Stop() : Void {
+		throw new AbstractMethodError();
+	}
+	
+}

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/lib/haxe/src/org/apache/thrift/server/TServerEventHandler.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/server/TServerEventHandler.hx b/lib/haxe/src/org/apache/thrift/server/TServerEventHandler.hx
new file mode 100644
index 0000000..08f48b2
--- /dev/null
+++ b/lib/haxe/src/org/apache/thrift/server/TServerEventHandler.hx
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.thrift.server;
+
+import org.apache.thrift.*;
+import org.apache.thrift.transport.*;
+import org.apache.thrift.protocol.*;
+
+
+// Interface implemented by server users to handle events from the server
+interface TServerEventHandler {
+
+	// Called before the server begins 
+    function preServe() : Void;
+	
+    // Called when a new client has connected and is about to being processing 
+    function createContext( input : TProtocol, output : TProtocol) : Dynamic;
+    
+	// Called when a client has finished request-handling to delete server context 
+    function deleteContext( serverContext : Dynamic, input : TProtocol, output : TProtocol) : Void;
+    
+	// Called when a client is about to call the processor 
+    function processContext( serverContext : Dynamic, transport : TTransport) : Void;
+}

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/lib/haxe/src/org/apache/thrift/server/TSimpleServer.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/server/TSimpleServer.hx b/lib/haxe/src/org/apache/thrift/server/TSimpleServer.hx
new file mode 100644
index 0000000..20a7195
--- /dev/null
+++ b/lib/haxe/src/org/apache/thrift/server/TSimpleServer.hx
@@ -0,0 +1,125 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.thrift.server;
+
+import org.apache.thrift.*;
+import org.apache.thrift.protocol.*;
+import org.apache.thrift.transport.*;
+import org.apache.thrift.meta_data.*;
+
+// Simple single-threaded server for testing
+class TSimpleServer extends TServer  {
+
+    private var stop : Bool = false;
+
+    public function new( processor : TProcessor,
+						 serverTransport : TServerTransport,
+						 transportFactory : TTransportFactory = null,
+						 protocolFactory : TProtocolFactory = null,
+						 logDelegate : Dynamic->Void = null) {
+      super( processor, serverTransport,
+			 transportFactory, transportFactory,
+			 protocolFactory, protocolFactory,
+			 logDelegate);
+    }
+
+
+	
+    public override function Serve() : Void 
+	{
+		try
+		{
+			serverTransport.Listen();
+		}
+		catch (ttx : TTransportException)
+		{
+			logDelegate(ttx);
+			return;
+		}
+
+		// Fire the preServe server event when server is up, 
+		// but before any client connections
+		if (serverEventHandler != null) {
+			serverEventHandler.preServe();
+		}
+
+		while( ! stop)
+		{
+			var client : TTransport = null;
+			var inputTransport : TTransport = null;
+			var outputTransport : TTransport = null;
+			var inputProtocol : TProtocol = null;
+			var outputProtocol : TProtocol = null;
+			var connectionContext : Dynamic = null;
+			try
+			{
+				client = serverTransport.Accept();
+				if (client != null) {
+					inputTransport = inputTransportFactory.getTransport( client);
+					outputTransport = outputTransportFactory.getTransport( client);
+					inputProtocol = inputProtocolFactory.getProtocol( inputTransport);
+					outputProtocol = outputProtocolFactory.getProtocol( outputTransport);
+
+					// Recover event handler (if any) and fire createContext 
+					// server event when a client connects
+					if (serverEventHandler != null) {
+						connectionContext = serverEventHandler.createContext(inputProtocol, outputProtocol);
+					}
+
+					// Process client requests until client disconnects
+					while( true) {
+						// Fire processContext server event
+						// N.B. This is the pattern implemented in C++ and the event fires provisionally.
+						// That is to say it may be many minutes between the event firing and the client request
+						// actually arriving or the client may hang up without ever makeing a request.
+						if (serverEventHandler != null) {
+							serverEventHandler.processContext(connectionContext, inputTransport);
+						}
+							
+						//Process client request (blocks until transport is readable)
+						if( ! processor.process( inputProtocol, outputProtocol)) {
+							break;
+						}
+					}
+				}
+			}
+			catch( ttx : TTransportException)
+			{
+			  	// Usually a client disconnect, expected
+			}
+			catch( e : Dynamic)
+			{
+				// Unexpected
+			  	logDelegate(e); 
+			}
+
+			// Fire deleteContext server event after client disconnects
+			if (serverEventHandler != null) {
+				serverEventHandler.deleteContext(connectionContext, inputProtocol, outputProtocol);
+			}
+		}
+	}
+
+    public override function Stop() : Void
+    {
+      stop = true;
+      serverTransport.Close();
+    }
+}

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/lib/haxe/src/org/apache/thrift/transport/TFramedTransport.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/transport/TFramedTransport.hx b/lib/haxe/src/org/apache/thrift/transport/TFramedTransport.hx
new file mode 100644
index 0000000..5d77140
--- /dev/null
+++ b/lib/haxe/src/org/apache/thrift/transport/TFramedTransport.hx
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http : //www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.thrift.transport;
+
+import org.apache.thrift.transport.*;
+
+import haxe.io.Bytes;
+import haxe.io.BytesBuffer;
+import haxe.io.BytesOutput;
+import haxe.io.BytesInput;
+
+
+/**
+ * TFramedTransport is a buffered TTransport that ensures a fully read message
+ * every time by preceding messages with a 4-byte frame size.
+ */
+class TFramedTransport extends TTransport
+{
+    public static inline var DEFAULT_MAX_LENGTH = 16384000;
+
+    var maxLength_ :  Int;
+
+    /**
+     * Underlying transport
+     */
+    var transport_ :  TTransport = null;
+
+    /**
+     * Buffer for output
+     */
+    var writeBuffer_ : BytesOutput = new BytesOutput();
+
+    /**
+     * Buffer for input
+     */
+    var readBuffer_ : BytesInput = null;
+
+    /**
+     * Constructor wraps around another transport
+     */
+    public function new( transport : TTransport, maxLength : Int = DEFAULT_MAX_LENGTH) {
+    	transport_ = transport;
+    	maxLength_ = maxLength;
+    }
+
+    public override function open() : Void {
+    	transport_.open();
+    }
+
+    public override function isOpen() : Bool {
+    	return transport_.isOpen();
+    }
+
+    public override function close() : Void {
+    	transport_.close();
+    }
+
+    public override function read(buf : BytesBuffer, off : Int, len : Int) : Int {
+		var data = Bytes.alloc(len);
+		
+    	if (readBuffer_ != null) {
+    		var got : Int = readBuffer_.readBytes(data, off, len);
+    		if (got > 0) {
+				buf.addBytes(data,0,got);
+    			return got;
+    		};
+    	};
+		
+    	// Read another frame of data
+    	readFrame();
+
+    	var got = readBuffer_.readBytes(data, off, len);
+		buf.addBytes(data,0,got);
+		return got;
+    }
+
+
+    function readFrameSize() : Int {
+    	var buffer = new BytesBuffer();
+    	var len = transport_.readAll( buffer, 0, 4);
+    	var inp = new BytesInput( buffer.getBytes(), 0, 4);
+    	inp.bigEndian = true;
+    	return inp.readInt32();
+    }
+
+
+    function readFrame() : Void {
+    	var size : Int = readFrameSize();
+		
+    	if (size < 0) {
+    		throw new TTransportException(TTransportException.UNKNOWN, 'Read a negative frame size ($size)!');
+    	};
+    	if (size > maxLength_) {
+    		throw new TTransportException(TTransportException.UNKNOWN, 'Frame size ($size) larger than max length ($maxLength_)!');
+    	};
+
+    	var buffer = new BytesBuffer();
+    	size = transport_.readAll( buffer, 0, size);
+    	readBuffer_ = new BytesInput( buffer.getBytes(), 0, size);
+    	readBuffer_.bigEndian = true;
+    }
+
+    public override function write(buf : Bytes, off : Int, len : Int) : Void {
+    	writeBuffer_.writeBytes(buf, off, len);
+    }
+
+    function writeFrameSize(len : Int) : Void {
+		var out = new BytesOutput();
+		out.bigEndian = true;
+		out.writeInt32(len);
+		transport_.write(out.getBytes(), 0, 4);
+    }
+
+    public override function flush( callback : Dynamic->Void =null) : Void {
+    	var buf : Bytes = writeBuffer_.getBytes();
+    	var len : Int = buf.length;
+    	writeBuffer_ = new BytesOutput();
+
+		writeFrameSize(len);
+    	transport_.write(buf, 0, len);
+    	transport_.flush();
+    }
+}
+
+

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/lib/haxe/src/org/apache/thrift/transport/TFramedTransportFactory.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/transport/TFramedTransportFactory.hx b/lib/haxe/src/org/apache/thrift/transport/TFramedTransportFactory.hx
new file mode 100644
index 0000000..00127bf
--- /dev/null
+++ b/lib/haxe/src/org/apache/thrift/transport/TFramedTransportFactory.hx
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http : //www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.thrift.transport;
+
+import org.apache.thrift.transport.*;
+
+
+class TFramedTransportFactory extends TTransportFactory {
+
+    var maxLength_ : Int;
+
+    public function new(maxLength : Int = TFramedTransport.DEFAULT_MAX_LENGTH) {
+		super();
+    	maxLength_ = maxLength;
+    }
+
+    public override function getTransport(base : TTransport) : TTransport {
+    	return new TFramedTransport(base, maxLength_);
+    }
+}

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/lib/haxe/src/org/apache/thrift/transport/TFullDuplexHttpClient.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/transport/TFullDuplexHttpClient.hx b/lib/haxe/src/org/apache/thrift/transport/TFullDuplexHttpClient.hx
new file mode 100644
index 0000000..4e898f8
--- /dev/null
+++ b/lib/haxe/src/org/apache/thrift/transport/TFullDuplexHttpClient.hx
@@ -0,0 +1,247 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.thrift.transport;
+
+import flash.errors.EOFError;
+import flash.events.Event;
+import flash.events.IOErrorEvent;
+import flash.events.ProgressEvent;
+import flash.events.SecurityErrorEvent;
+import flash.net.URLLoader;
+import flash.net.URLLoaderDataFormat;
+import flash.net.URLRequest;
+import flash.net.URLRequestMethod;
+import flash.utils.IDataInput;
+import flash.utils.IDataOutput;
+import haxe.io.Bytes;
+import flash.net.Socket;
+import flash.events.EventDispatcher;
+
+
+    /**
+     * HTTP implementation of the TTransport interface. Used for working with a
+     * Thrift web services implementation.
+     * Unlike Http Client, it uses a single POST, and chunk-encoding to transfer all messages.
+     */
+
+    public class TFullDuplexHttpClient extends TTransport
+    {
+        private var socket : Socket = null;
+        private var host  :  String;
+        private var port  :  Int;
+        private var resource  :  String;
+        private var stripped  :  Bool = false;
+        private var obuffer : Bytes = new Bytes();
+        private var input : IDataInput;
+        private var output : IDataOutput;
+        private var bytesInChunk  :  Int = 0;
+        private var CRLF : Bytes = new Bytes();
+        private var ioCallback : TException->Void = null;
+        private var eventDispatcher : EventDispatcher = new EventDispatcher();
+
+        public function new(host  :  String, port  :  Int, resource  :  String)  :  Void
+        {
+            CRLF.writeByte(13);
+            CRLF.writeByte(10);
+            this.host = host;
+            this.port = port;
+            this.resource = resource;
+        }
+
+        public override function close()  :  Void
+        {
+            this.input = null;
+            this.output = null;
+            this.stripped = false;
+            socket.close()
+        }
+
+    	public override function peek()  :  Bool
+    	{
+			if(socket.connected)
+			{
+				trace("Bytes remained:" + socket.bytesAvailable);
+				return socket.bytesAvailable>0;
+			}
+			return false;
+		}
+
+        public override function read(buf : Bytes, off  :  Int, len  :  Int)  :  Int
+        {
+            var n1  :  Int = 0, n2  :  Int = 0, n3  :  Int = 0, n4  :  Int = 0, cidx  :  Int = 2;
+            var chunkSize : Bytes = new Bytes();
+
+            try
+            {
+                while (!stripped)
+                {
+                    n1 = n2;
+                    n2 = n3;
+                    n3 = n4;
+                    n4 = input.readByte();
+                    if ((n1 == 13) && (n2 == 10) && (n3 == 13) && (n4 == 10))
+                    {
+                        stripped = true;
+                    }
+                }
+
+                // read chunk size
+                if (bytesInChunk == 0)
+                {
+                    n1 = input.readByte();
+                    n2 = input.readByte();
+
+                    chunkSize.writeByte(n1);
+                    chunkSize.writeByte(n2);
+
+                    while (!((n1 == 13) && (n2 == 10)))
+                    {
+                        n1 = n2;
+                        n2 = input.readByte();
+                        chunkSize.writeByte(n2);
+                    }
+
+                    bytesInChunk = parseInt(chunkSize.toString(), 16);
+                }
+
+                input.readBytes(buf, off, len);
+                debugBuffer(buf);
+                bytesInChunk -= len;
+
+                if (bytesInChunk == 0)
+                {
+                    // advance the  :  "\r\n"
+                    input.readUTFBytes(2);
+                }
+                return len;
+            }
+            catch (e : EOFError)
+            {
+                trace(e);
+                throw new TTransportException(TTransportException.UNKNOWN, "No more data available.");
+            }
+			catch (e : TException)
+			{
+				trace('TException $e');
+				throw e;
+			}
+            catch (e : Error)
+            {
+                trace(e);
+                throw new TTransportException(TTransportException.UNKNOWN, 'Bad IO error: $e');
+            }
+            catch (e : Dynamic)
+            {
+                trace(e);
+                throw new TTransportException(TTransportException.UNKNOWN, 'Bad IO error: $e');
+            }
+            return 0;
+        }
+
+        public function debugBuffer(buf : Bytes)  :  Void
+        {
+            var debug  :  String = "BUFFER >>";
+            var i  :  Int;
+            for (i = 0; i < buf.length; i++)
+            {
+                debug += buf[i] as int;
+                debug += " ";
+            }
+
+            trace(debug + "<<");
+        }
+
+        public override function write(buf : Bytes, off  :  Int, len  :  Int)  :  Void
+        {
+            obuffer.writeBytes(buf, off, len);
+        }
+
+        public function addEventListener(type  :  String, listener : Function, useCapture  :  Bool = false, priority  :  Int = 0, useWeakReference  :  Bool = false)  :  Void
+        {
+            this.eventDispatcher.addEventListener(type, listener, useCapture, priority, useWeakReference);
+        }
+
+        public override function open()  :  Void
+        {
+            this.socket = new Socket();
+            this.socket.addEventListener(Event.CONNECT, socketConnected);
+            this.socket.addEventListener(IOErrorEvent.IO_ERROR, socketError);
+            this.socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, socketSecurityError);
+            this.socket.addEventListener(ProgressEvent.SOCKET_DATA, socketDataHandler);
+            this.socket.connect(host, port);
+        }
+
+        public function socketConnected(event : Event)  :  Void
+        {
+            this.output = this.socket;
+            this.input = this.socket;
+            this.output.writeUTF("CONNECT " + resource + " HTTP/1.1\n" + "Host :  " + host + ":" + port + "\r\n" + "User-Agent :  BattleNet\r\n" + "Transfer-Encoding :  chunked\r\n" + "content-type :  application/x-thrift\r\n" + "Accept :  */*\r\n\r\n");
+            this.eventDispatcher.dispatchEvent(event);
+        }
+
+        public function socketError(event : IOErrorEvent)  :  Void
+        {
+            trace("Error Connecting:" + event);
+            this.close();
+            if (ioCallback == null)
+            {
+                return;
+            }
+            ioCallback(new TTransportException(TTransportException.UNKNOWN, "IOError :  " + event.text));
+            this.eventDispatcher.dispatchEvent(event);
+        }
+
+        public function socketSecurityError(event : SecurityErrorEvent)  :  Void
+        {
+            trace("Security Error Connecting:" + event);
+            this.close();
+            this.eventDispatcher.dispatchEvent(event);
+        }
+
+        public function socketDataHandler(event : ProgressEvent)  :  Void
+        {
+        	trace("Got Data call:" +ioCallback);
+            if (ioCallback != null)
+            {
+                ioCallback(null);
+            };
+            this.eventDispatcher.dispatchEvent(event);
+        }
+
+        public override function flush(callback : Error->Void = null)  :  Void
+        {
+            trace("set callback:" + callback);
+            this.ioCallback = callback;
+            this.output.writeUTF(this.obuffer.length.toString(16));
+            this.output.writeBytes(CRLF);
+            this.output.writeBytes(this.obuffer);
+            this.output.writeBytes(CRLF);
+            this.socket.flush();
+            // waiting for  new Flex sdk 3.5
+            //this.obuffer.clear();
+            this.obuffer = new Bytes();
+        }
+
+        public override function isOpen()  :  Bool
+        {
+            return (this.socket == null ? false  :  this.socket.connected);
+        }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/lib/haxe/src/org/apache/thrift/transport/THttpClient.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/transport/THttpClient.hx b/lib/haxe/src/org/apache/thrift/transport/THttpClient.hx
new file mode 100644
index 0000000..d2fda79
--- /dev/null
+++ b/lib/haxe/src/org/apache/thrift/transport/THttpClient.hx
@@ -0,0 +1,183 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.thrift.transport;
+
+	
+import haxe.io.Bytes;
+import haxe.io.BytesBuffer;
+import haxe.io.BytesOutput;
+import haxe.io.BytesInput;
+
+#if openfl
+// OpenFL all targets
+import openfl.errors.EOFError;
+import openfl.events.Event;
+import openfl.events.IOErrorEvent;
+import openfl.events.SecurityErrorEvent;
+import openfl.net.URLLoader;
+import openfl.net.URLLoaderDataFormat;
+import openfl.net.URLRequest;
+import openfl.net.URLRequestMethod;
+#elseif flash  
+// Haxe flash, no OpenFL
+import flash.errors.EOFError;
+import flash.events.Event;
+import flash.events.IOErrorEvent;
+import flash.events.SecurityErrorEvent;
+import flash.net.URLLoader;
+import flash.net.URLLoaderDataFormat;
+import flash.net.URLRequest;
+import flash.net.URLRequestMethod;
+#else
+// bare Haxe 
+import haxe.Http;
+#end
+
+
+	
+/**
+* HTTP implementation of the TTransport interface. Used for working with a
+* Thrift web services implementation.
+*/
+	
+class THttpClient extends TTransport {
+
+    private var requestBuffer_  : BytesOutput = new BytesOutput();
+    private var responseBuffer_ : BytesInput = null;
+
+	#if (flash || openfl)
+	private var request_        : URLRequest = null;
+    #else
+	private var request_        : Http = null;
+    #end
+
+    
+	#if (flash || openfl)
+
+	public function new( request : URLRequest) : Void {
+		request.contentType = "application/x-thrift";
+		request_ = request;
+    }
+	
+	#else
+
+	public function new( requestUrl : String) : Void {
+	  	request_ = new Http(requestUrl);
+		request_.addHeader( "contentType", "application/x-thrift");
+    }
+    
+	#end
+    
+    public override function open() : Void {
+    }
+
+    public override function close() : Void {
+    }
+ 
+    public override function isOpen() : Bool {
+      return true;
+    }
+    
+    public override function read(buf:BytesBuffer, off : Int, len : Int) : Int {
+		if (responseBuffer_ == null) {
+        	throw new TTransportException(TTransportException.UNKNOWN, "Response buffer is empty, no request.");
+		}
+		
+		#if flash
+        try {
+			var data = Bytes.alloc(len);
+            responseBuffer_.readBytes(data, off, len);
+            buf.addBytes(data,0,len);
+			return len;
+        } catch (e : EOFError) {
+            throw new TTransportException(TTransportException.UNKNOWN, "No more data available.");
+        }
+			
+		#else
+			
+        var data =Bytes.alloc(len);
+		len = responseBuffer_.readBytes(data, off, len);
+		buf.addBytes(data,0,len);
+		return len;
+		
+		#end
+    }
+
+    public override function write(buf:Bytes, off : Int, len : Int) : Void {
+      requestBuffer_.writeBytes(buf, off, len);
+    }
+
+	
+	#if (flash || openfl)
+		
+    public override function flush(callback:Error->Void = null) : Void {
+		var loader : URLLoader = new URLLoader();
+		
+		if (callback != null) {
+			loader.addEventListener(Event.COMPLETE, function(event:Event) : Void {
+				responseBuffer_ = new URLLoader(event.target).data;
+				callback(null);
+			});
+			loader.addEventListener(IOErrorEvent.IO_ERROR, function(event:IOErrorEvent) : Void {
+				callback(new TTransportException(TTransportException.UNKNOWN, "IOError: " + event.text));
+				responseBuffer_ = null;
+			});
+			loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, function(event:SecurityErrorEvent) : Void {
+				callback(new TTransportException(TTransportException.UNKNOWN, "SecurityError: " + event.text));
+				responseBuffer_ = null;
+			});
+		}
+			
+		request_.method = URLRequestMethod.POST;
+		loader.dataFormat = URLLoaderDataFormat.BINARY;
+		//requestBuffer_.position = 0;
+		request_.data = requestBuffer_;
+		loader.load(request_);
+    }
+
+	#else 
+		
+    public override function flush(callback:Dynamic->Void = null) : Void {
+		
+		var buffer = requestBuffer_;
+		requestBuffer_ = new BytesOutput();
+		responseBuffer_ = null;
+			
+		request_.onData = function(data : String) { 
+			responseBuffer_ = new BytesInput(buffer.getBytes());
+			callback(null);
+		};
+		request_.onError = function(msg : String) {
+			callback(new TTransportException(TTransportException.UNKNOWN, "IOError: " + msg));
+		};
+		
+		#if js
+		request_.setPostData(buffer.getBytes().toString());
+		request_.request(true/*POST*/);
+		#else
+		request_.customRequest( true/*POST*/, buffer);
+		#end
+    }
+		
+	#end
+
+}
+
+	
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/lib/haxe/src/org/apache/thrift/transport/TServerSocket.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/transport/TServerSocket.hx b/lib/haxe/src/org/apache/thrift/transport/TServerSocket.hx
new file mode 100644
index 0000000..1953244
--- /dev/null
+++ b/lib/haxe/src/org/apache/thrift/transport/TServerSocket.hx
@@ -0,0 +1,132 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.thrift.transport;
+
+import haxe.remoting.SocketProtocol;	
+import haxe.io.Bytes;
+import haxe.io.BytesBuffer;
+import haxe.io.BytesInput;
+import haxe.io.BytesOutput;
+import haxe.io.Input;
+import haxe.io.Output;
+import haxe.io.Eof;
+
+//import flash.net.ServerSocket; - not yet available on Haxe 3.1.3
+#if ! (flash || html5) 
+	
+import sys.net.Host;
+
+
+class TServerSocket extends TServerTransport {
+
+	// Underlying server with socket
+	private var _socket : Socket= null;
+
+	// Port to listen on
+	private var _port : Int = 0;
+
+	// Timeout for client sockets from accept
+	private var _clientTimeout : Int = 0;
+
+	// Whether or not to wrap new TSocket connections in buffers
+	private var _useBufferedSockets : Bool = false;
+
+	
+	public function new( port : Int, clientTimeout : Int = 0, useBufferedSockets : Bool = false)
+	{
+		_port = port;
+		_clientTimeout = clientTimeout;
+		_useBufferedSockets = useBufferedSockets;
+
+		try
+		{
+			_socket = new Socket();
+			_socket.bind( new Host('localhost'), port);
+		}
+		catch (e : Dynamic)
+		{
+			_socket = null;
+			throw new TTransportException( TTransportException.UNKNOWN, 'Could not create ServerSocket on port $port: $e');
+		}
+	}
+
+
+	public override function Listen() : Void
+	{
+		// Make sure not to block on accept
+		if (_socket != null)	{
+			try
+			{
+				_socket.listen(1);
+			}
+			catch (e : Dynamic)
+			{
+				trace('Error $e');
+				throw new TTransportException( TTransportException.UNKNOWN, 'Could not accept on listening socket: $e');
+			}
+		}
+	}
+
+	private override function AcceptImpl() : TTransport
+	{
+		if (_socket == null) {
+			throw new TTransportException( TTransportException.NOT_OPEN, "No underlying server socket.");
+		}
+		
+		try
+		{
+			var accepted = _socket.accept();
+			var result = TSocket.fromSocket(accepted);
+			accepted.setTimeout( _clientTimeout);
+
+			if( _useBufferedSockets)
+			{
+				throw "buffered transport not yet supported";  // TODO
+				//result = new TBufferedTransport(result);
+			}
+
+			return result;
+		}
+		catch (e : Dynamic)
+		{
+			trace('Error $e');
+			throw new TTransportException( TTransportException.UNKNOWN, '$e');
+		}
+	}
+
+	public override function Close() : Void
+	{
+		if (_socket != null)
+		{
+			try
+			{
+				_socket.close();
+			}
+			catch (e : Dynamic)
+			{
+				trace('Error $e');
+				throw new TTransportException( TTransportException.UNKNOWN, 'WARNING: Could not close server socket: $e');
+			}
+			_socket = null;
+		}
+	}
+}
+
+#end

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/lib/haxe/src/org/apache/thrift/transport/TServerTransport.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/transport/TServerTransport.hx b/lib/haxe/src/org/apache/thrift/transport/TServerTransport.hx
new file mode 100644
index 0000000..e0ce697
--- /dev/null
+++ b/lib/haxe/src/org/apache/thrift/transport/TServerTransport.hx
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.thrift.transport;
+
+class TServerTransport {
+
+	public function Accept() : TTransport {
+		var transport = AcceptImpl();
+		if (transport == null) {
+		  throw new TTransportException( TTransportException.UNKNOWN, "accept() may not return NULL");
+		}
+		return transport;
+	}
+	
+	public function Listen() : Void {
+		throw new AbstractMethodError();
+	}
+	
+	public function Close() : Void {
+		throw new AbstractMethodError();
+	}
+	
+	private function AcceptImpl() : TTransport {
+		throw new AbstractMethodError();
+	}
+}

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/lib/haxe/src/org/apache/thrift/transport/TSocket.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/transport/TSocket.hx b/lib/haxe/src/org/apache/thrift/transport/TSocket.hx
new file mode 100644
index 0000000..306730d
--- /dev/null
+++ b/lib/haxe/src/org/apache/thrift/transport/TSocket.hx
@@ -0,0 +1,296 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.thrift.transport;
+
+#if flash
+import flash.net.Socket;
+#elseif js
+import js.html.WebSocket;
+#else
+import haxe.remoting.SocketProtocol;	
+#end
+
+import haxe.io.Bytes;
+import haxe.io.BytesBuffer;
+import haxe.io.BytesInput;
+import haxe.io.BytesOutput;
+import haxe.io.Input;
+import haxe.io.Output;
+import haxe.io.Eof;
+
+
+#if ! (flash || js)
+import sys.net.Host;
+#end
+
+
+  /**
+   * Socket implementation of the TTransport interface. Used for working with a
+   * Thrift Socket Server based implementations.
+   */
+
+class TSocket extends TTransport  {
+	
+    #if (flash || js)
+	private var host  :  String;
+	#else
+	private var host  :  Host;
+	#end
+	
+    private var port  :  Int;
+
+	#if js
+    private var socket : WebSocket = null;
+	#else
+    private var socket : Socket = null;
+	#end
+
+	#if js
+    private var input : Dynamic = null;
+    private var output : WebSocket = null;
+	#elseif flash
+    private var input : Socket = null;
+    private var output : Socket = null;
+	#else 
+	private var input : Input = null;
+    private var output : Output = null;
+	#end
+
+	private var obuffer : BytesOutput = new BytesOutput();
+    private var ioCallback : TException->Void = null;
+	private var readCount : Int = 0;
+	
+    public function new(host : String, port  :  Int)  :  Void  {
+		#if (flash || js)
+		this.host = host;
+		#else
+		this.host = new Host(host);
+		#end
+		this.port = port;
+    }
+
+	#if ! (flash || js)
+	// used by TSocketServer
+    public static function fromSocket( socket : Socket) : TSocket  {
+		var result = new TSocket("",0);
+		result.assignSocket(socket);
+		return result;
+    }
+	#end
+
+    public override function close()  :  Void  {
+		input = null;
+		output = null;
+		socket.close();
+    }
+
+    public override function peek()  :  Bool  {
+		if( (input == null) || (socket == null)) {
+			return false;
+		} else {
+			#if flash 
+			return (input.bytesAvailable > 0);
+			#elseif js
+			return true;
+			#else
+			var ready = Socket.select( [socket], null, null, 0);
+			return (ready.read.length > 0);
+			#end
+		}
+    }
+
+	
+	public override function read( buf : BytesBuffer, off : Int, len : Int) : Int   {
+		try
+		{
+			#if flash
+
+			var remaining = len;	
+			while( remaining > 0) {
+				buf.addByte( input.readByte());
+				--remaining;
+			}
+			return len;
+			
+			#elseif js
+			
+			if( input == null) {
+				throw new TTransportException(TTransportException.UNKNOWN, "Still no data ");  // don't block
+			}
+			var nr = len;	
+			while( nr < len) {
+				buf.addByte( input.get(off+nr));
+				++nr;
+			}
+			return len;
+			
+			#else
+			
+			socket.waitForRead();
+			if(readCount < off) {
+				input.read(off-readCount);	
+				readCount = off;
+			}
+			var data = input.read(len);
+			readCount += data.length;
+			buf.add(data);
+			return data.length;
+			
+			#end
+		}
+		catch (e : Eof)
+		{
+			trace('Eof $e');
+			throw new TTransportException(TTransportException.END_OF_FILE, "No more data available.");
+		}
+		catch (e : TException)
+		{
+			trace('TException $e');
+			throw e;
+		}
+		catch (e : Dynamic)
+		{
+			trace('Error $e');
+			throw new TTransportException(TTransportException.UNKNOWN, 'Bad IO error : $e');
+		}
+    }
+		
+	
+    public override function write(buf : Bytes, off  :  Int, len  :  Int)  :  Void
+    {
+		obuffer.writeBytes(buf, off, len);
+    }
+
+
+		
+    public override function flush(callback : Dynamic->Void = null)  :  Void
+    {
+		if( ! isOpen())
+		{
+			throw new TTransportException(TTransportException.NOT_OPEN, "Transport not open");
+		}
+
+		#if flash
+			
+		var bytes = new flash.utils.ByteArray();
+		var data = obuffer.getBytes();
+		var len = 0;
+		while( len < data.length) {
+			bytes.writeByte(data.get(len));
+			++len;
+		}
+
+		#elseif js
+		
+		var data = obuffer.getBytes();
+		var outbuf = new js.html.Int8Array(data.length);
+		var len = 0;
+		while( len < data.length) {
+			outbuf.set( [data.get(len)], len);
+			++len;
+		}
+		var bytes = outbuf.buffer;
+		
+
+		#else
+		
+		var bytes = obuffer.getBytes();
+		var len = bytes.length;
+		
+		#end
+			
+		obuffer = new BytesOutput();
+
+		
+		ioCallback = callback;
+		try {
+			readCount = 0;
+			#if js
+			output.send( bytes);
+			#else
+			output.writeBytes( bytes, 0, bytes.length);
+			#end
+			if(ioCallback != null) {
+				ioCallback(null);  // success call 
+			}
+		}
+		catch (e : TException)
+		{
+			trace('TException $e');
+			if(ioCallback != null) {
+				ioCallback(e);
+			}
+		}
+		catch (e : Dynamic) {
+			trace(e);
+			if(ioCallback != null) {
+				ioCallback(new TTransportException(TTransportException.UNKNOWN, 'Bad IO error : $e'));
+			}
+		}
+    }
+
+    public override function isOpen()  :  Bool
+    {
+		return (socket != null);
+    }
+
+    public override function open()  :  Void
+    {
+		#if js
+		var socket = new WebSocket();
+		socket.onmessage = function( event : js.html.MessageEvent) {
+			this.input = event.data;
+		}
+		
+		#elseif flash
+			
+		var socket = new Socket();
+		socket.connect(host, port);
+
+		#else
+			
+		var socket = new Socket();
+		socket.setBlocking(true);
+		socket.setFastSend(true);
+		socket.connect(host, port);
+
+		#end
+			
+		assignSocket( socket);
+    }
+
+	#if js
+	private function assignSocket( socket : WebSocket)  :  Void
+	#else
+	private function assignSocket( socket : Socket)  :  Void
+	#end
+    {
+		this.socket = socket;
+		
+		#if (flash || js)
+		output = socket;
+      	input = socket;
+		#else
+      	output = socket.output;
+      	input = socket.input;
+		#end
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/lib/haxe/src/org/apache/thrift/transport/TTransport.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/transport/TTransport.hx b/lib/haxe/src/org/apache/thrift/transport/TTransport.hx
new file mode 100644
index 0000000..35303d5
--- /dev/null
+++ b/lib/haxe/src/org/apache/thrift/transport/TTransport.hx
@@ -0,0 +1,133 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.thrift.transport;
+
+import haxe.io.Bytes;
+import haxe.io.BytesBuffer;
+import org.apache.thrift.AbstractMethodError;
+  
+class TTransport {
+
+    /**
+     * Queries whether the transport is open.
+     *
+     * @return True if the transport is open.
+     */
+    public function isOpen() : Bool {
+      	throw new AbstractMethodError();
+    }
+    
+    /**
+     * Is there more data to be read?
+     *
+     * @return True if the remote side is still alive and feeding us
+     */
+    public function peek() : Bool {
+      	return isOpen();
+    }
+
+    /**
+     * Opens the transport for reading/writing.
+     *
+     * @throws TTransportException if the transport could not be opened
+     */
+    public function open() : Void {
+      	throw new AbstractMethodError();
+    }
+
+    /**
+     * Closes the transport.
+     */
+    public function close() : Void {
+      	throw new AbstractMethodError();
+    };
+
+    /**
+     * Reads up to len bytes into buffer buf, starting att offset off.
+     *
+     * @param buf Array to read into
+     * @param off Index to start reading at
+     * @param len Maximum number of bytes to read
+     * @return The bytes count actually read
+     * @throws TTransportException if there was an error reading data
+     */
+     public function read( buf : BytesBuffer, off : Int, len : Int) : Int {
+      	throw new AbstractMethodError();
+     }
+
+    /**
+     * Guarantees that all of len bytes are actually read off the transport.
+     *
+     * @param buf Array to read into
+     * @param off Index to start reading at
+     * @param len Maximum number of bytes to read
+     * @return The number of bytes actually read, which must be equal to len
+     * @throws TTransportException if there was an error reading data
+     */
+    public function readAll(buf : BytesBuffer, off : Int, len : Int) : Int {
+		var got : Int = 0;
+		var ret : Int = 0;
+        while (got < len) {
+            ret = read(buf, off+got, len-got);
+            if (ret <= 0) {
+              throw new TTransportException(TTransportException.UNKNOWN, 
+										"Cannot read. Remote side has closed. Tried to read " 
+										+ len + " bytes, but only got " + got + " bytes.");
+            }
+            got += ret;
+        }
+        return got;
+      }
+
+    /**
+     * Writes the buffer to the output
+     *
+     * @param buf The output data buffer
+     * @throws TTransportException if an error occurs writing data
+     */
+    public function writeAll(buf:Bytes) : Void {
+		write(buf, 0, buf.length);
+    }
+
+    /**
+     * Writes up to len bytes from the buffer.
+     *
+     * @param buf The output data buffer
+     * @param off The offset to start writing from
+     * @param len The number of bytes to write
+     * @throws TTransportException if there was an error writing data
+     */
+    public function write(buf:Bytes, off : Int, len : Int) : Void {
+    	throw new AbstractMethodError();
+    }
+
+    /**
+     * Flush any pending data out of a transport buffer.
+     *
+     * @throws TTransportException if there was an error writing out data.
+     */
+    public function flush(callback:Dynamic->Void =null) : Void {
+    	if(callback != null)
+			callback(new AbstractMethodError());
+		else
+			throw new AbstractMethodError();
+    }
+ 
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/lib/haxe/src/org/apache/thrift/transport/TTransportException.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/transport/TTransportException.hx b/lib/haxe/src/org/apache/thrift/transport/TTransportException.hx
new file mode 100644
index 0000000..3db6456
--- /dev/null
+++ b/lib/haxe/src/org/apache/thrift/transport/TTransportException.hx
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ 
+package org.apache.thrift.transport;
+  
+import org.apache.thrift.TException;
+
+class TTransportException extends TException {
+    
+    public static inline var UNKNOWN : Int = 0;
+    public static inline var NOT_OPEN : Int = 1;
+    public static inline var ALREADY_OPEN : Int = 2;
+    public static inline var TIMED_OUT : Int = 3;
+    public static inline var END_OF_FILE : Int = 4;
+  
+    public function new(error : Int = UNKNOWN, message : String = "") {
+		super(message, error);
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/lib/haxe/src/org/apache/thrift/transport/TTransportFactory.hx
----------------------------------------------------------------------
diff --git a/lib/haxe/src/org/apache/thrift/transport/TTransportFactory.hx b/lib/haxe/src/org/apache/thrift/transport/TTransportFactory.hx
new file mode 100644
index 0000000..f20321f
--- /dev/null
+++ b/lib/haxe/src/org/apache/thrift/transport/TTransportFactory.hx
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.thrift.transport;
+
+/**
+ * Factory class used to create wrapped instance of Transports.
+ * This is used primarily in servers, which get Transports from
+ * a ServerTransport and then may want to mutate them (i.e. create
+ * a BufferedTransport from the underlying base transport)
+ *
+ */
+class TTransportFactory {
+
+	public function new() {
+	}
+
+	/**
+	* Return a wrapped instance of the base Transport.
+	*
+	* @param trans The base transport
+	* @return Wrapped Transport
+	*/
+	public function getTransport( trans : TTransport) : TTransport {
+		return trans;
+	}
+
+}

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/test/Makefile.am
----------------------------------------------------------------------
diff --git a/test/Makefile.am b/test/Makefile.am
index cc1f43d..23ec498 100755
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -49,6 +49,10 @@ if WITH_HASKELL
 SUBDIRS += hs
 endif
 
+if WITH_HAXE
+SUBDIRS += haxe
+endif
+
 if WITH_GO
 SUBDIRS += go
 endif

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/test/haxe/Makefile.am
----------------------------------------------------------------------
diff --git a/test/haxe/Makefile.am b/test/haxe/Makefile.am
new file mode 100644
index 0000000..08c0369
--- /dev/null
+++ b/test/haxe/Makefile.am
@@ -0,0 +1,52 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+THRIFT = $(top_srcdir)/compiler/cpp/thrift
+THRIFTCMD = $(THRIFT) --gen haxe -r
+THRIFTTEST = $(top_srcdir)/test/ThriftTest.thrift
+
+BIN_CPP = bin/Main-debug
+
+gen-haxe/ThriftTest/ThriftTest.hx: $(THRIFTTEST)
+	$(THRIFTCMD) $(THRIFTTEST)
+	
+all-local: $(BIN_CPP)
+	
+$(BIN_CPP):	gen-haxe/ThriftTest/ThriftTest.hx
+	$(HAXE) --cwd .  cpp.hxml
+
+	
+#TODO: other haxe targets
+#	$(HAXE)  --cwd .  csharp
+#	$(HAXE)  --cwd .  flash
+#	$(HAXE)  --cwd .  java
+#	$(HAXE)  --cwd .  javascript
+#	$(HAXE)  --cwd .  neko
+#	$(HAXE)  --cwd .  php
+#	$(HAXE)  --cwd .  python  # needs Haxe 3.1.4
+
+
+clean-local:
+	$(RM) -r gen-haxe bin
+
+check: $(BIN_CPP)
+	timeout 120 $(BIN_CPP) server &
+	sleep 1
+	$(BIN_CPP) client
+

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/test/haxe/cpp.hxml
----------------------------------------------------------------------
diff --git a/test/haxe/cpp.hxml b/test/haxe/cpp.hxml
new file mode 100644
index 0000000..6adb52d
--- /dev/null
+++ b/test/haxe/cpp.hxml
@@ -0,0 +1,41 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+ 
+#integrate files to classpath
+-cp src
+-cp gen-haxe
+-cp ../../lib/haxe/src
+
+#this class wil be used as entry point for your app.
+-main Main
+
+#CPP target
+-cpp bin
+
+#To produce 64 bit binaries the file should define the HXCPP_M64 compile variable:
+#-D HXCPP_M64
+
+#Add debug information
+-debug
+
+#dead code elimination : remove unused code
+#"-dce no" : do not remove unused code
+#"-dce std" : remove unused code in the std lib (default)
+#"-dce full" : remove all unused code
+-dce full
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/test/haxe/csharp.hxml
----------------------------------------------------------------------
diff --git a/test/haxe/csharp.hxml b/test/haxe/csharp.hxml
new file mode 100644
index 0000000..295c017
--- /dev/null
+++ b/test/haxe/csharp.hxml
@@ -0,0 +1,38 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+ 
+#integrate files to classpath
+-cp src
+-cp gen-haxe
+-cp ../../lib/haxe/src
+
+#this class wil be used as entry point for your app.
+-main Main
+
+#CSHARP target
+-cs bin/Tutorial.exe
+
+#Add debug information
+-debug
+
+#dead code elimination : remove unused code
+#"-dce no" : do not remove unused code
+#"-dce std" : remove unused code in the std lib (default)
+#"-dce full" : remove all unused code
+-dce full
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/test/haxe/flash.hxml
----------------------------------------------------------------------
diff --git a/test/haxe/flash.hxml b/test/haxe/flash.hxml
new file mode 100644
index 0000000..a1f0568
--- /dev/null
+++ b/test/haxe/flash.hxml
@@ -0,0 +1,41 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+ 
+#integrate files to classpath
+-cp src
+-cp gen-haxe
+-cp ../../lib/haxe/src
+
+#this class wil be used as entry point for your app.
+-main Main
+
+#Flash target
+-swf bin/Tutorial.swf
+
+#Add debug information
+-debug
+
+# we need some goodies from sys.net
+# --macro allowPackage("sys")
+
+#dead code elimination : remove unused code
+#"-dce no" : do not remove unused code
+#"-dce std" : remove unused code in the std lib (default)
+#"-dce full" : remove all unused code
+-dce full
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/test/haxe/java.hxml
----------------------------------------------------------------------
diff --git a/test/haxe/java.hxml b/test/haxe/java.hxml
new file mode 100644
index 0000000..c615565
--- /dev/null
+++ b/test/haxe/java.hxml
@@ -0,0 +1,38 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+ 
+#integrate files to classpath
+-cp src
+-cp gen-haxe
+-cp ../../lib/haxe/src 
+
+#this class wil be used as entry point for your app.
+-main Main
+
+#Java target
+-java bin/Tutorial.jar
+
+#Add debug information
+-debug
+
+#dead code elimination : remove unused code
+#"-dce no" : do not remove unused code
+#"-dce std" : remove unused code in the std lib (default)
+#"-dce full" : remove all unused code
+-dce full
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/test/haxe/javascript.hxml
----------------------------------------------------------------------
diff --git a/test/haxe/javascript.hxml b/test/haxe/javascript.hxml
new file mode 100644
index 0000000..b2b3876
--- /dev/null
+++ b/test/haxe/javascript.hxml
@@ -0,0 +1,44 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+ 
+#integrate files to classpath
+-cp src
+-cp gen-haxe
+-cp ../../lib/haxe/src
+
+#this class wil be used as entry point for your app.
+-main Main
+
+#JavaScript target
+-js bin/Tutorial.js
+
+#You can use -D source-map-content (requires Haxe 3.1+) to have the .hx 
+#files directly embedded into the map file, this way you only have to 
+#upload it, and it will be always in sync with the compiled .js even if 
+#you modify your .hx files.
+-D source-map-content
+
+#Generate source map and add debug information
+-debug
+
+#dead code elimination : remove unused code
+#"-dce no" : do not remove unused code
+#"-dce std" : remove unused code in the std lib (default)
+#"-dce full" : remove all unused code
+-dce full
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/thrift/blob/bd52f1a1/test/haxe/make_all.bat
----------------------------------------------------------------------
diff --git a/test/haxe/make_all.bat b/test/haxe/make_all.bat
new file mode 100644
index 0000000..eaeba89
--- /dev/null
+++ b/test/haxe/make_all.bat
@@ -0,0 +1,68 @@
+@echo off
+rem /*
+rem  * Licensed to the Apache Software Foundation (ASF) under one
+rem  * or more contributor license agreements. See the NOTICE file
+rem  * distributed with this work for additional information
+rem  * regarding copyright ownership. The ASF licenses this file
+rem  * to you under the Apache License, Version 2.0 (the
+rem  * "License"); you may not use this file except in compliance
+rem  * with the License. You may obtain a copy of the License at
+rem  *
+rem  *   http://www.apache.org/licenses/LICENSE-2.0
+rem  *
+rem  * Unless required by applicable law or agreed to in writing,
+rem  * software distributed under the License is distributed on an
+rem  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+rem  * KIND, either express or implied. See the License for the
+rem  * specific language governing permissions and limitations
+rem  * under the License.
+rem  */
+
+setlocal
+if "%HOMEDRIVE%"=="" goto MISSINGVARS
+if "%HOMEPATH%"=="" goto MISSINGVARS
+if "%HAXEPATH%"=="" goto NOTINSTALLED
+
+set path=%HAXEPATH%;%HAXEPATH%\..\neko;%path%
+
+rem # invoke Thrift comnpiler
+thrift -r -gen haxe   ..\ThriftTest.thrift
+if errorlevel 1 goto STOP
+
+rem # invoke Haxe compiler for all targets
+for %%a in (*.hxml) do (
+	rem * filter Python, as it is not supported by Haxe 3.1.3 (but will be in 3.1.4)
+	if not "%%a"=="python.hxml" (
+		echo --------------------------
+		echo Building %%a ...
+		echo --------------------------
+		haxe  --cwd .  %%a
+	)
+)
+
+
+echo.
+echo done.
+pause
+goto eof
+
+:NOTINSTALLED
+echo FATAL: Either Haxe is not installed, or the HAXEPATH variable is not set.
+pause
+goto eof
+
+:MISSINGVARS
+echo FATAL: Unable to locate home folder.
+echo.
+echo Both HOMEDRIVE and HOMEPATH need to be set to point to your Home folder.
+echo The current values are:
+echo HOMEDRIVE=%HOMEDRIVE%
+echo HOMEPATH=%HOMEPATH%
+pause
+goto eof
+
+:STOP
+pause
+goto eof
+
+:eof