diff options
author | Jens Geyer <jensg@apache.org> | 2022-06-06 14:29:38 +0200 |
---|---|---|
committer | Jens Geyer <Jens-G@users.noreply.github.com> | 2022-06-07 08:56:54 +0200 |
commit | ce1d314ef3e9c9b3999641da77fdc90f563b3226 (patch) | |
tree | d00dc320810d716920e9c3847d13941317c9f1ca /lib/haxe/src | |
parent | 0b1eb6bcabebe02d61be614eab0eb6c4d2d972c3 (diff) | |
download | thrift-ce1d314ef3e9c9b3999641da77fdc90f563b3226.tar.gz |
THRIFT-5589 Haxe compiler/runtime fixes
Client: hx
Patch: Jens Geyer
Diffstat (limited to 'lib/haxe/src')
10 files changed, 24 insertions, 234 deletions
diff --git a/lib/haxe/src/org/apache/thrift/meta_data/FieldMetaData.hx b/lib/haxe/src/org/apache/thrift/meta_data/FieldMetaData.hx deleted file mode 100644 index 26db1134e..000000000 --- a/lib/haxe/src/org/apache/thrift/meta_data/FieldMetaData.hx +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.meta_data; - -import flash.utils.Dictionary; - -/** -* This class is used to store meta data about thrift fields. Every field in a -* a struct should have a corresponding instance of this class describing it. -* -*/ -class FieldMetaData { - - public var fieldName : String; - public var requirementType : Int; - public var valueMetaData:FieldValueMetaData; - - private static var structMap:Dictionary = new Dictionary(); - - public function FieldMetaData(name : String, req : Int, vMetaData:FieldValueMetaData) { - this.fieldName = name; - this.requirementType = req; - this.valueMetaData = vMetaData; - } - - public static function addStructMetaDataMap(sClass:Class, map:Dictionary) : Void{ - structMap[sClass] = map; - } - - /** - * Returns a map with metadata (i.e. instances of FieldMetaData) that - * describe the fields of the given class. - * - * @param sClass The TBase class for which the metadata map is requested - */ - public static function getStructMetaDataMap(sClass:Class):Dictionary { - return structMap[sClass]; - } -} diff --git a/lib/haxe/src/org/apache/thrift/meta_data/FieldValueMetaData.hx b/lib/haxe/src/org/apache/thrift/meta_data/FieldValueMetaData.hx deleted file mode 100644 index 8879d9156..000000000 --- a/lib/haxe/src/org/apache/thrift/meta_data/FieldValueMetaData.hx +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.meta_data; - -import org.apache.thrift.protocol.TType; - -/** - * FieldValueMetaData and collection of subclasses to store metadata about - * the value(s) of a field - */ -class FieldValueMetaData { - - public var type : Int; - - public function FieldValueMetaData(type : Int) { - this.type = type; - } - - public function isStruct() : Bool { - return type == TType.STRUCT; - } - - public function isContainer() : Bool { - return type == TType.LIST || type == TType.MAP || type == TType.SET; - } -} diff --git a/lib/haxe/src/org/apache/thrift/meta_data/ListMetaData.hx b/lib/haxe/src/org/apache/thrift/meta_data/ListMetaData.hx deleted file mode 100644 index 40ca31bad..000000000 --- a/lib/haxe/src/org/apache/thrift/meta_data/ListMetaData.hx +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.meta_data; - -class ListMetaData extends FieldValueMetaData { - - public var elemMetaData:FieldValueMetaData; - - public function ListMetaData(type : Int, eMetaData:FieldValueMetaData) { - super(type); - this.elemMetaData = eMetaData; - } -} -
\ No newline at end of file diff --git a/lib/haxe/src/org/apache/thrift/meta_data/MapMetaData.hx b/lib/haxe/src/org/apache/thrift/meta_data/MapMetaData.hx deleted file mode 100644 index 5463e6276..000000000 --- a/lib/haxe/src/org/apache/thrift/meta_data/MapMetaData.hx +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.meta_data; - -class MapMetaData extends FieldValueMetaData { - - public var keyMetaData:FieldValueMetaData; - public var valueMetaData:FieldValueMetaData; - - public function MapMetaData(type : Int, kMetaData:FieldValueMetaData, vMetaData:FieldValueMetaData) { - super(type); - this.keyMetaData = kMetaData; - this.valueMetaData = vMetaData; - } -} -
\ No newline at end of file diff --git a/lib/haxe/src/org/apache/thrift/meta_data/SetMetaData.hx b/lib/haxe/src/org/apache/thrift/meta_data/SetMetaData.hx deleted file mode 100644 index a3367f449..000000000 --- a/lib/haxe/src/org/apache/thrift/meta_data/SetMetaData.hx +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.meta_data; - -class SetMetaData extends FieldValueMetaData { - - public var elemMetaData:FieldValueMetaData; - - public function SetMetaData(type : Int, eMetaData:FieldValueMetaData) { - super(type); - this.elemMetaData = eMetaData; - } -} diff --git a/lib/haxe/src/org/apache/thrift/meta_data/StructMetaData.hx b/lib/haxe/src/org/apache/thrift/meta_data/StructMetaData.hx deleted file mode 100644 index 1822dd37f..000000000 --- a/lib/haxe/src/org/apache/thrift/meta_data/StructMetaData.hx +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.meta_data; - -class StructMetaData extends FieldValueMetaData { - - public var structClass:Class; - - public function StructMetaData(type : Int, sClass:Class) { - super(type); - this.structClass = sClass; - } -} diff --git a/lib/haxe/src/org/apache/thrift/protocol/TProtocolDecorator.hx b/lib/haxe/src/org/apache/thrift/protocol/TProtocolDecorator.hx index 011f42b80..08598e647 100644 --- a/lib/haxe/src/org/apache/thrift/protocol/TProtocolDecorator.hx +++ b/lib/haxe/src/org/apache/thrift/protocol/TProtocolDecorator.hx @@ -135,6 +135,10 @@ class TProtocolDecorator implements TProtocol wrapped.writeBinary( value); } + public function writeUuid(value : String ) : Void { + wrapped.writeUuid( value); + } + public function readMessageBegin() : TMessage { return wrapped.readMessageBegin(); } @@ -216,6 +220,10 @@ class TProtocolDecorator implements TProtocol return wrapped.readBinary(); } + public function readUuid() : String { + return wrapped.readUuid(); + } + public function IncrementRecursionDepth() : Void { return wrapped.IncrementRecursionDepth(); } diff --git a/lib/haxe/src/org/apache/thrift/transport/TFileStream.hx b/lib/haxe/src/org/apache/thrift/transport/TFileStream.hx index cd8ad1776..0130cd229 100644 --- a/lib/haxe/src/org/apache/thrift/transport/TFileStream.hx +++ b/lib/haxe/src/org/apache/thrift/transport/TFileStream.hx @@ -18,6 +18,7 @@ */ package org.apache.thrift.transport; +#if sys import haxe.io.Bytes; import haxe.io.BytesBuffer; @@ -98,4 +99,5 @@ class TFileStream implements TStream { } } -
\ No newline at end of file + +#end diff --git a/lib/haxe/src/org/apache/thrift/transport/TFullDuplexHttpClient.hx b/lib/haxe/src/org/apache/thrift/transport/TFullDuplexHttpClient.hx index cc34ec4fa..fe07be960 100644 --- a/lib/haxe/src/org/apache/thrift/transport/TFullDuplexHttpClient.hx +++ b/lib/haxe/src/org/apache/thrift/transport/TFullDuplexHttpClient.hx @@ -18,6 +18,7 @@ */ package org.apache.thrift.transport; +#if swf import flash.errors.EOFError; import flash.events.Event; @@ -35,13 +36,13 @@ 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. - */ +/** + * 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 TEndpointTransport +class TFullDuplexHttpClient extends TEndpointTransport { private var socket : Socket = null; private var host : String; @@ -163,9 +164,9 @@ public class TFullDuplexHttpClient extends TEndpointTransport { var debug : String = "BUFFER >>"; var i : Int; - for (i = 0; i < buf.length; i++) + for (i in 0 ... buf.length) { - debug += buf[i] as int; + debug += buf.get(i); debug += " "; } @@ -254,4 +255,6 @@ public class TFullDuplexHttpClient extends TEndpointTransport return (this.socket != null) && this.socket.connected; } -}
\ No newline at end of file +} + +#end diff --git a/lib/haxe/src/org/apache/thrift/transport/TSocket.hx b/lib/haxe/src/org/apache/thrift/transport/TSocket.hx index a7435437f..2e154c3ab 100644 --- a/lib/haxe/src/org/apache/thrift/transport/TSocket.hx +++ b/lib/haxe/src/org/apache/thrift/transport/TSocket.hx @@ -213,7 +213,7 @@ class TSocket extends TEndpointTransport { #elseif js var data = obuffer.getBytes(); - var outbuf = new js.html.Int8Array(data.length); + var outbuf = new js.lib.Int8Array(data.length); var len = 0; while( len < data.length) { outbuf.set( [data.get(len)], len); |