ZEPPELIN-206: provide shell genthrift.sh to generate java code and auto insert license header

This commit is contained in:
caofangkun 2015-08-07 10:49:53 +08:00
parent 9186b2186d
commit 498ad4d836
7 changed files with 1421 additions and 266 deletions

View file

@ -1,5 +1,22 @@
/**
* Autogenerated by Thrift Compiler (0.9.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.
*/
/**
* Autogenerated by Thrift Compiler (0.9.2)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
@ -15,6 +32,8 @@ import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
@ -27,10 +46,13 @@ import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteInterpreterContext, RemoteInterpreterContext._Fields>, java.io.Serializable, Cloneable {
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-8-7")
public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteInterpreterContext, RemoteInterpreterContext._Fields>, java.io.Serializable, Cloneable, Comparable<RemoteInterpreterContext> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RemoteInterpreterContext");
private static final org.apache.thrift.protocol.TField NOTE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("noteId", org.apache.thrift.protocol.TType.STRING, (short)1);
@ -579,83 +601,120 @@ public class RemoteInterpreterContext implements org.apache.thrift.TBase<RemoteI
@Override
public int hashCode() {
return 0;
List<Object> list = new ArrayList<Object>();
boolean present_noteId = true && (isSetNoteId());
list.add(present_noteId);
if (present_noteId)
list.add(noteId);
boolean present_paragraphId = true && (isSetParagraphId());
list.add(present_paragraphId);
if (present_paragraphId)
list.add(paragraphId);
boolean present_paragraphTitle = true && (isSetParagraphTitle());
list.add(present_paragraphTitle);
if (present_paragraphTitle)
list.add(paragraphTitle);
boolean present_paragraphText = true && (isSetParagraphText());
list.add(present_paragraphText);
if (present_paragraphText)
list.add(paragraphText);
boolean present_config = true && (isSetConfig());
list.add(present_config);
if (present_config)
list.add(config);
boolean present_gui = true && (isSetGui());
list.add(present_gui);
if (present_gui)
list.add(gui);
boolean present_runners = true && (isSetRunners());
list.add(present_runners);
if (present_runners)
list.add(runners);
return list.hashCode();
}
@Override
public int compareTo(RemoteInterpreterContext other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
RemoteInterpreterContext typedOther = (RemoteInterpreterContext)other;
lastComparison = Boolean.valueOf(isSetNoteId()).compareTo(typedOther.isSetNoteId());
lastComparison = Boolean.valueOf(isSetNoteId()).compareTo(other.isSetNoteId());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetNoteId()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.noteId, typedOther.noteId);
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.noteId, other.noteId);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetParagraphId()).compareTo(typedOther.isSetParagraphId());
lastComparison = Boolean.valueOf(isSetParagraphId()).compareTo(other.isSetParagraphId());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetParagraphId()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.paragraphId, typedOther.paragraphId);
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.paragraphId, other.paragraphId);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetParagraphTitle()).compareTo(typedOther.isSetParagraphTitle());
lastComparison = Boolean.valueOf(isSetParagraphTitle()).compareTo(other.isSetParagraphTitle());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetParagraphTitle()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.paragraphTitle, typedOther.paragraphTitle);
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.paragraphTitle, other.paragraphTitle);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetParagraphText()).compareTo(typedOther.isSetParagraphText());
lastComparison = Boolean.valueOf(isSetParagraphText()).compareTo(other.isSetParagraphText());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetParagraphText()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.paragraphText, typedOther.paragraphText);
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.paragraphText, other.paragraphText);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetConfig()).compareTo(typedOther.isSetConfig());
lastComparison = Boolean.valueOf(isSetConfig()).compareTo(other.isSetConfig());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetConfig()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.config, typedOther.config);
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.config, other.config);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetGui()).compareTo(typedOther.isSetGui());
lastComparison = Boolean.valueOf(isSetGui()).compareTo(other.isSetGui());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetGui()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gui, typedOther.gui);
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gui, other.gui);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetRunners()).compareTo(typedOther.isSetRunners());
lastComparison = Boolean.valueOf(isSetRunners()).compareTo(other.isSetRunners());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetRunners()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.runners, typedOther.runners);
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.runners, other.runners);
if (lastComparison != 0) {
return lastComparison;
}

View file

@ -1,5 +1,22 @@
/**
* Autogenerated by Thrift Compiler (0.9.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.
*/
/**
* Autogenerated by Thrift Compiler (0.9.2)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
@ -15,6 +32,8 @@ import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
@ -27,10 +46,13 @@ import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RemoteInterpreterEvent implements org.apache.thrift.TBase<RemoteInterpreterEvent, RemoteInterpreterEvent._Fields>, java.io.Serializable, Cloneable {
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-8-7")
public class RemoteInterpreterEvent implements org.apache.thrift.TBase<RemoteInterpreterEvent, RemoteInterpreterEvent._Fields>, java.io.Serializable, Cloneable, Comparable<RemoteInterpreterEvent> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RemoteInterpreterEvent");
private static final org.apache.thrift.protocol.TField TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("type", org.apache.thrift.protocol.TType.I32, (short)1);
@ -300,33 +322,45 @@ public class RemoteInterpreterEvent implements org.apache.thrift.TBase<RemoteInt
@Override
public int hashCode() {
return 0;
List<Object> list = new ArrayList<Object>();
boolean present_type = true && (isSetType());
list.add(present_type);
if (present_type)
list.add(type.getValue());
boolean present_data = true && (isSetData());
list.add(present_data);
if (present_data)
list.add(data);
return list.hashCode();
}
@Override
public int compareTo(RemoteInterpreterEvent other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
RemoteInterpreterEvent typedOther = (RemoteInterpreterEvent)other;
lastComparison = Boolean.valueOf(isSetType()).compareTo(typedOther.isSetType());
lastComparison = Boolean.valueOf(isSetType()).compareTo(other.isSetType());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetType()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, typedOther.type);
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, other.type);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetData()).compareTo(typedOther.isSetData());
lastComparison = Boolean.valueOf(isSetData()).compareTo(other.isSetData());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetData()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.data, typedOther.data);
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.data, other.data);
if (lastComparison != 0) {
return lastComparison;
}
@ -411,7 +445,7 @@ public class RemoteInterpreterEvent implements org.apache.thrift.TBase<RemoteInt
switch (schemeField.id) {
case 1: // TYPE
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.type = RemoteInterpreterEventType.findByValue(iprot.readI32());
struct.type = org.apache.zeppelin.interpreter.thrift.RemoteInterpreterEventType.findByValue(iprot.readI32());
struct.setTypeIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
@ -488,7 +522,7 @@ public class RemoteInterpreterEvent implements org.apache.thrift.TBase<RemoteInt
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
struct.type = RemoteInterpreterEventType.findByValue(iprot.readI32());
struct.type = org.apache.zeppelin.interpreter.thrift.RemoteInterpreterEventType.findByValue(iprot.readI32());
struct.setTypeIsSet(true);
}
if (incoming.get(1)) {

View file

@ -1,5 +1,22 @@
/**
* Autogenerated by Thrift Compiler (0.9.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.
*/
/**
* Autogenerated by Thrift Compiler (0.9.2)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated

View file

@ -1,5 +1,22 @@
/**
* Autogenerated by Thrift Compiler (0.9.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.
*/
/**
* Autogenerated by Thrift Compiler (0.9.2)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
@ -15,6 +32,8 @@ import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import org.apache.thrift.async.AsyncMethodCallback;
import org.apache.thrift.server.AbstractNonblockingServer.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
@ -27,10 +46,13 @@ import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import javax.annotation.Generated;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RemoteInterpreterResult implements org.apache.thrift.TBase<RemoteInterpreterResult, RemoteInterpreterResult._Fields>, java.io.Serializable, Cloneable {
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-8-7")
public class RemoteInterpreterResult implements org.apache.thrift.TBase<RemoteInterpreterResult, RemoteInterpreterResult._Fields>, java.io.Serializable, Cloneable, Comparable<RemoteInterpreterResult> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("RemoteInterpreterResult");
private static final org.apache.thrift.protocol.TField CODE_FIELD_DESC = new org.apache.thrift.protocol.TField("code", org.apache.thrift.protocol.TType.STRING, (short)1);
@ -461,63 +483,90 @@ public class RemoteInterpreterResult implements org.apache.thrift.TBase<RemoteIn
@Override
public int hashCode() {
return 0;
List<Object> list = new ArrayList<Object>();
boolean present_code = true && (isSetCode());
list.add(present_code);
if (present_code)
list.add(code);
boolean present_type = true && (isSetType());
list.add(present_type);
if (present_type)
list.add(type);
boolean present_msg = true && (isSetMsg());
list.add(present_msg);
if (present_msg)
list.add(msg);
boolean present_config = true && (isSetConfig());
list.add(present_config);
if (present_config)
list.add(config);
boolean present_gui = true && (isSetGui());
list.add(present_gui);
if (present_gui)
list.add(gui);
return list.hashCode();
}
@Override
public int compareTo(RemoteInterpreterResult other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
RemoteInterpreterResult typedOther = (RemoteInterpreterResult)other;
lastComparison = Boolean.valueOf(isSetCode()).compareTo(typedOther.isSetCode());
lastComparison = Boolean.valueOf(isSetCode()).compareTo(other.isSetCode());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetCode()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.code, typedOther.code);
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.code, other.code);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetType()).compareTo(typedOther.isSetType());
lastComparison = Boolean.valueOf(isSetType()).compareTo(other.isSetType());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetType()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, typedOther.type);
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.type, other.type);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetMsg()).compareTo(typedOther.isSetMsg());
lastComparison = Boolean.valueOf(isSetMsg()).compareTo(other.isSetMsg());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetMsg()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.msg, typedOther.msg);
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.msg, other.msg);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetConfig()).compareTo(typedOther.isSetConfig());
lastComparison = Boolean.valueOf(isSetConfig()).compareTo(other.isSetConfig());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetConfig()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.config, typedOther.config);
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.config, other.config);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetGui()).compareTo(typedOther.isSetGui());
lastComparison = Boolean.valueOf(isSetGui()).compareTo(other.isSetGui());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetGui()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gui, typedOther.gui);
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.gui, other.gui);
if (lastComparison != 0) {
return lastComparison;
}

View file

@ -0,0 +1,28 @@
#!/usr/bin/env bash
#/**
# * 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.
# */
rm -rf gen-java
rm -rf ../java/org/apache/zeppelin/interpreter/thrift
thrift --gen java RemoteInterpreterService.thrift
for file in gen-java/org/apache/zeppelin/interpreter/thrift/* ; do
cat java_license_header.txt ${file} > ${file}.tmp
mv -f ${file}.tmp ${file}
done
mv gen-java/org/apache/zeppelin/interpreter/thrift ../java/org/apache/zeppelin/interpreter/thrift
rm -rf gen-java

View file

@ -0,0 +1,17 @@
/**
* 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.
*/