Fix issue 464 (#465)

This commit is contained in:
XuYi 2018-11-29 18:50:43 +08:00 committed by GitHub
parent 34e9a5d24b
commit b1acc3a2eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 1918 additions and 240 deletions

15
codecov.yml Normal file
View File

@ -0,0 +1,15 @@
coverage:
precision: 2
round: down
range: "70...100"
status:
project: yes
patch: no
changes: no
ignore:
- "*/interface/thrift/**/*.java" # ignore thrift-gen folders and all its contents
- "grafana/**/*.java"
- "spark/**/*.java"
- "hadoop/**/*.java"

118
iotdb-cli/pom.xml Normal file
View File

@ -0,0 +1,118 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.edu.tsinghua</groupId>
<artifactId>root</artifactId>
<version>0.8.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>iotdb-cli</artifactId>
<packaging>jar</packaging>
<name>IoTDB Cli</name>
<description>A Client tool.</description>
<url>https://github.com/thulab/iotdb/tree/master/cli</url>
<licenses>
<license>
<name>The Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<properties>
<cli.test.skip>false</cli.test.skip>
<common.cli.version>1.3.1</common.cli.version>
<jline.version>2.14.5</jline.version>
</properties>
<dependencies>
<dependency>
<groupId>cn.edu.tsinghua</groupId>
<artifactId>iotdb-jdbc</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>${common.cli.version}</version>
</dependency>
<dependency>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
<version>${jline.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<filesets>
<fileset>
<directory>${project.basedir}/cli/lib</directory>
<includes>
<include>**/*.jar</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.basedir}/cli/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>copy-native-libraries</id>
<phase>package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<copy todir="${project.basedir}/cli/lib">
<fileset dir="${project.basedir}/target/">
<include name="*.jar" />
</fileset>
</copy>
</target>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<skipTests>${cli.test.skip}</skipTests>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,13 +1,11 @@
package cn.edu.tsinghua.iotdb.client;
import cn.edu.tsinghua.iotdb.conf.TsFileDBConstant;
import cn.edu.tsinghua.iotdb.exception.ArgsErrorException;
import cn.edu.tsinghua.iotdb.jdbc.TsfileDatabaseMetadata;
import cn.edu.tsinghua.iotdb.jdbc.TsfileMetadataResultSet;
import cn.edu.tsinghua.iotdb.tool.ImportCsv;
import cn.edu.tsinghua.service.rpc.thrift.ServerProperties;
import cn.edu.tsinghua.iotdb.jdbc.TsfileConnection;
import cn.edu.tsinghua.iotdb.query.aggregation.AggregationConstant;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Option;
@ -66,16 +64,33 @@ public abstract class AbstractClient {
protected static final String IOTDB_CLI_PREFIX = "IoTDB";
protected static final String SCRIPT_HINT = "./start-client.sh(start-client.bat if Windows)";
private static final String QUIT_COMMAND = "quit";
private static final String EXIT_COMMAND = "exit";
private static final String SHOW_METADATA_COMMAND = "show timeseries";
protected static final String QUIT_COMMAND = "quit";
protected static final String EXIT_COMMAND = "exit";
protected static final String SHOW_METADATA_COMMAND = "show timeseries";
protected static final int MAX_HELP_CONSOLE_WIDTH = 88;
protected static final String TIMESTAMP_STR = "Time";
protected static final int ISO_DATETIME_LEN = 23;
protected static int maxTimeLength = ISO_DATETIME_LEN;
protected static int maxValueLength = 15;
protected static int[] maxValueLengthForShow = new int[]{75, 45, 8, 8};// control the width of columns for 'show timeseries <path>' and 'show storage group'
/**
* control the width of columns for 'show timeseries <path>' and 'show storage group'
* <p> for 'show timeseries <path>':
* <table>
* <tr> <th>Timeseries (width:75)</th> <th>Storage Group (width:45)</th> <th>DataType width:8)</th> <th>Encoding (width:8)</th></tr>
* <tr> <td>root.vehicle.d1.s1</td> <td>root.vehicle</td> <td>INT32</td> <td>PLAIN</td></tr>
* <tr> <td>...</td> <td>...</td> <td>...</td> <td>...</td></tr>
* </table>
* </p>
* <p> for show storage group <path>':
* <table>
* <tr> <th>STORAGE_GROUP (width:75)</th> </tr>
* <tr> <td>root.vehicle</td> </tr>
* <tr> <td>...</td> </tr>
* </table>
* </p>
*/
protected static int[] maxValueLengthForShow = new int[]{75, 45, 8, 8};
protected static String formatTime = "%" + maxTimeLength + "s|";
protected static String formatValue = "%" + maxValueLength + "s|";
@ -95,6 +110,8 @@ public abstract class AbstractClient {
protected static Set<String> keywordSet = new HashSet<>();
protected static ServerProperties properties = null;
protected static void init(){
keywordSet.add("-"+HOST_ARGS);
keywordSet.add("-"+HELP_ARGS);
@ -103,9 +120,6 @@ public abstract class AbstractClient {
keywordSet.add("-"+USERNAME_ARGS);
keywordSet.add("-"+ISO8601_ARGS);
keywordSet.add("-"+MAX_PRINT_ROW_COUNT_ARGS);
AGGREGRATE_TIME_LIST.add(AggregationConstant.MAX_TIME);
AGGREGRATE_TIME_LIST.add(AggregationConstant.MIN_TIME);
}
public static void output(ResultSet res, boolean printToConsole, String statement, DateTimeZone timeZone) throws SQLException {
@ -253,7 +267,7 @@ public abstract class AbstractClient {
System.out.println("Use -help for more information");
throw new ArgsErrorException(msg);
} else if (defaultValue == null){
String msg = String.format("%s: Required values for option '%s' is null", IOTDB_CLI_PREFIX, name);
String msg = String.format("%s: Required values for option '%s' is null.", IOTDB_CLI_PREFIX, name);
throw new ArgsErrorException(msg);
} else {
return defaultValue;
@ -286,13 +300,20 @@ public abstract class AbstractClient {
}
private static void setFetchSize(String fetchSizeString){
long tmp = Long.parseLong(fetchSizeString.trim());
if(tmp > Integer.MAX_VALUE || tmp < 0) {
fetchSize = Integer.MAX_VALUE;
} else {
fetchSize = Integer.parseInt(fetchSizeString.trim());
}
}
protected static void setMaxDisplayNumber(String maxDisplayNum){
maxPrintRowCount = Integer.parseInt(maxDisplayNum.trim());
if (maxPrintRowCount < 0) {
long tmp = Long.parseLong(maxDisplayNum.trim());
if(tmp > Integer.MAX_VALUE || tmp < 0) {
maxPrintRowCount = Integer.MAX_VALUE;
} else {
maxPrintRowCount = Integer.parseInt(maxDisplayNum.trim());
}
}
@ -341,7 +362,7 @@ public abstract class AbstractClient {
System.out.printf("\n");
}
protected static String[] checkPasswordArgs(String[] args) {
protected static String[] removePasswordArgs(String[] args) {
int index = -1;
for(int i = 0; i < args.length; i++){
if(args[i].equals("-"+PASSWORD_ARGS)){
@ -349,7 +370,7 @@ public abstract class AbstractClient {
break;
}
}
if(index > 0){
if(index >= 0){
if((index+1 >= args.length) || (index+1 < args.length && keywordSet.contains(args[index+1]))){
return ArrayUtils.remove(args, index);
}
@ -357,14 +378,14 @@ public abstract class AbstractClient {
return args;
}
protected static void displayLogo(){
protected static void displayLogo(String version){
System.out.println(
" _____ _________ ______ ______ \n" +
"|_ _| | _ _ ||_ _ `.|_ _ \\ \n" +
" | | .--.|_/ | | \\_| | | `. \\ | |_) | \n" +
" | | / .'`\\ \\ | | | | | | | __'. \n" +
" _| |_| \\__. | _| |_ _| |_.' /_| |__) | \n" +
"|_____|'.__.' |_____| |______.'|_______/ version "+TsFileDBConstant.VERSION+"\n" +
"|_____|'.__.' |_____| |______.'|_______/ version "+version+"\n" +
" \n");
}

View File

@ -66,7 +66,7 @@ public class Client extends AbstractClient {
return;
}
init();
args = checkPasswordArgs(args);
args = removePasswordArgs(args);
try {
commandLine = parser.parse(options, args);
if (commandLine.hasOption(HELP_ARGS)) {
@ -111,6 +111,8 @@ public class Client extends AbstractClient {
}
try {
connection = (TsfileConnection) DriverManager.getConnection("jdbc:tsfile://" + host + ":" + port + "/", username, password);
properties = connection.getServerProperties();
AGGREGRATE_TIME_LIST.addAll(properties.getSupportedTimeAggregationOperations());
} catch (SQLException e) {
System.out.println(String.format("%s> %s. Host is %s, port is %s.", IOTDB_CLI_PREFIX, e.getMessage(), host, port));
return;
@ -121,7 +123,7 @@ public class Client extends AbstractClient {
return;
}
displayLogo();
displayLogo(properties.getVersion());
System.out.println(IOTDB_CLI_PREFIX + "> login successfully");
while (true) {

View File

@ -35,7 +35,7 @@ public class WinClient extends AbstractClient {
init();
args = checkPasswordArgs(args);
args = removePasswordArgs(args);
try {
commandLine = parser.parse(options, args);
@ -78,6 +78,8 @@ public class WinClient extends AbstractClient {
try {
connection = (TsfileConnection) DriverManager.getConnection("jdbc:tsfile://" + host + ":" + port + "/", username,
password);
properties = connection.getServerProperties();
AGGREGRATE_TIME_LIST.addAll(properties.getSupportedTimeAggregationOperations());
} catch (SQLException e) {
System.out.println(IOTDB_CLI_PREFIX + "> " + e.getMessage());
return;
@ -87,7 +89,7 @@ public class WinClient extends AbstractClient {
return;
}
displayLogo();
displayLogo(properties.getVersion());
System.out.println(IOTDB_CLI_PREFIX + "> login successfully");
scanner = new Scanner(System.in);

View File

@ -0,0 +1,11 @@
package cn.edu.tsinghua.iotdb.exception;
public class ArgsErrorException extends Exception{
private static final long serialVersionUID = -3614543017182165265L;
public ArgsErrorException(String msg){
super(msg);
}
}

View File

@ -20,6 +20,7 @@ import java.util.Map;
import cn.edu.tsinghua.iotdb.jdbc.TsfileConnection;
import cn.edu.tsinghua.iotdb.jdbc.TsfileJDBCConfig;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.DefaultParser;
@ -30,7 +31,6 @@ import org.apache.commons.cli.ParseException;
import org.apache.commons.io.FileUtils;
import org.apache.thrift.TException;
import cn.edu.tsinghua.iotdb.conf.TsFileDBConstant;
import cn.edu.tsinghua.iotdb.exception.ArgsErrorException;
import jline.console.ConsoleReader;
@ -330,16 +330,18 @@ public class ImportCsv extends AbstractCsvTool{
}
public static void importCsvFromFile(String ip,String port, String username, String password, String filename, String timeZone) throws SQLException{
if (System.getProperty(TsFileDBConstant.IOTDB_HOME) == null) {
String property = System.getProperty("IOTDB_HOME");
if (property == null) {
errorInsertInfo = ERROR_INFO_STR;
} else {
errorInsertInfo = System.getProperty(TsFileDBConstant.IOTDB_HOME) + File.separatorChar + ERROR_INFO_STR;
errorInsertInfo = property + File.separatorChar + ERROR_INFO_STR;
}
try {
Class.forName(TsfileJDBCConfig.JDBC_DRIVER_NAME);
connection = (TsfileConnection) DriverManager.getConnection("jdbc:tsfile://" + ip + ":" + port + "/", username, password);
timeZoneID = timeZone;
setTimeZone();
File file = new File(filename);
if(file.isFile()){
if(file.getName().endsWith(FILE_SUFFIX)){

View File

@ -0,0 +1,185 @@
package cn.edu.tsinghua.iotdb.client;
import static org.junit.Assert.*;
import static org.mockito.Mockito.when;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import cn.edu.tsinghua.iotdb.client.AbstractClient.OPERATION_RESULT;
import cn.edu.tsinghua.iotdb.exception.ArgsErrorException;
import cn.edu.tsinghua.iotdb.jdbc.TsfileConnection;
import cn.edu.tsinghua.iotdb.jdbc.TsfileDatabaseMetadata;
public class AbstractClientTest {
@Mock
private TsfileConnection connection;
@Mock
private TsfileDatabaseMetadata databaseMetadata;
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
when(connection.getMetaData()).thenReturn(databaseMetadata);
when(connection.getTimeZone()).thenReturn("Asia/Shanghai");
when(databaseMetadata.getMetadataInJson()).thenReturn("test metadata");
}
@After
public void tearDown() throws Exception {
}
@Test
public void testInit() {
AbstractClient.init();
String[] keywords = {
AbstractClient.HOST_ARGS,
AbstractClient.HELP_ARGS,
AbstractClient.PORT_ARGS,
AbstractClient.PASSWORD_ARGS,
AbstractClient.USERNAME_ARGS,
AbstractClient.ISO8601_ARGS,
AbstractClient.MAX_PRINT_ROW_COUNT_ARGS,
};
for(String keyword: keywords) {
if(!AbstractClient.keywordSet.contains("-"+keyword)) {
System.out.println(keyword);
fail();
}
}
}
@Test
public void testCheckRequiredArg() throws ParseException, ArgsErrorException {
Options options = AbstractClient.createOptions();
CommandLineParser parser = new DefaultParser();
String[] args = new String[]{"-u", "user1"};
CommandLine commandLine = parser.parse(options, args);
String str = AbstractClient.checkRequiredArg(AbstractClient.USERNAME_ARGS, AbstractClient.USERNAME_NAME, commandLine, true, "root");
assertEquals(str, "user1");
args = new String[]{"-u", "root",};
commandLine = parser.parse(options, args);
str = AbstractClient.checkRequiredArg(AbstractClient.HOST_ARGS, AbstractClient.HOST_NAME, commandLine, false, "127.0.0.1");
assertEquals(str, "127.0.0.1");
try {
str = AbstractClient.checkRequiredArg(AbstractClient.HOST_ARGS, AbstractClient.HOST_NAME, commandLine, true, "127.0.0.1");
} catch (ArgsErrorException e) {
assertEquals(e.getMessage(), "IoTDB: Required values for option 'host' not provided");
}
try {
str = AbstractClient.checkRequiredArg(AbstractClient.HOST_ARGS, AbstractClient.HOST_NAME, commandLine, false, null);
} catch (ArgsErrorException e) {
assertEquals(e.getMessage(), "IoTDB: Required values for option 'host' is null.");
}
}
@Test
public void testRemovePasswordArgs() {
AbstractClient.init();
String[] input = new String[] {"-h", "127.0.0.1", "-p", "6667", "-u", "root", "-pw", "root"};
String[] res = new String[] {"-h", "127.0.0.1", "-p", "6667", "-u", "root", "-pw", "root"};
isTwoStringArrayEqual(res, AbstractClient.removePasswordArgs(input));
input = new String[]{"-h", "127.0.0.1", "-p", "6667", "-pw", "root", "-u", "root"};
res = new String[]{"-h", "127.0.0.1", "-p", "6667", "-pw", "root", "-u", "root"};
isTwoStringArrayEqual(res, AbstractClient.removePasswordArgs(input));
input = new String[]{"-h", "127.0.0.1", "-p", "6667", "root", "-u", "root", "-pw"};
res = new String[]{"-h", "127.0.0.1", "-p", "6667", "root", "-u", "root"};
isTwoStringArrayEqual(res, AbstractClient.removePasswordArgs(input));
input = new String[]{"-h", "127.0.0.1", "-p", "6667", "-pw", "-u", "root"};
res = new String[]{"-h", "127.0.0.1", "-p", "6667", "-u", "root"};
isTwoStringArrayEqual(res, AbstractClient.removePasswordArgs(input));
input = new String[]{"-pw", "-h", "127.0.0.1", "-p", "6667", "root", "-u", "root"};
res = new String[]{"-h", "127.0.0.1", "-p", "6667", "root", "-u", "root"};
isTwoStringArrayEqual(res, AbstractClient.removePasswordArgs(input));
input = new String[]{};
res = new String[]{};
isTwoStringArrayEqual(res, AbstractClient.removePasswordArgs(input));
}
private void isTwoStringArrayEqual(String[] expected, String[] actual) {
for(int i = 0; i < expected.length;i++) {
assertEquals(expected[i], actual[i]);
}
}
@Test
public void testHandleInputInputCmd() {
assertEquals(AbstractClient.handleInputInputCmd(AbstractClient.EXIT_COMMAND, connection), OPERATION_RESULT.RETURN_OPER);
assertEquals(AbstractClient.handleInputInputCmd(AbstractClient.QUIT_COMMAND, connection), OPERATION_RESULT.RETURN_OPER);
assertEquals(AbstractClient.handleInputInputCmd(AbstractClient.SHOW_METADATA_COMMAND, connection), OPERATION_RESULT.CONTINUE_OPER);
assertEquals(AbstractClient.handleInputInputCmd(String.format("%s=", AbstractClient.SET_TIMESTAMP_DISPLAY), connection), OPERATION_RESULT.CONTINUE_OPER);
assertEquals(AbstractClient.handleInputInputCmd(String.format("%s=xxx", AbstractClient.SET_TIMESTAMP_DISPLAY), connection), OPERATION_RESULT.CONTINUE_OPER);
assertEquals(AbstractClient.handleInputInputCmd(String.format("%s=default", AbstractClient.SET_TIMESTAMP_DISPLAY), connection), OPERATION_RESULT.CONTINUE_OPER);
testSetTimeFormat();
assertEquals(AbstractClient.handleInputInputCmd(String.format("%s=", AbstractClient.SET_MAX_DISPLAY_NUM), connection), OPERATION_RESULT.CONTINUE_OPER);
assertEquals(AbstractClient.handleInputInputCmd(String.format("%s=xxx", AbstractClient.SET_MAX_DISPLAY_NUM), connection), OPERATION_RESULT.CONTINUE_OPER);
assertEquals(AbstractClient.handleInputInputCmd(String.format("%s=1", AbstractClient.SET_MAX_DISPLAY_NUM), connection), OPERATION_RESULT.CONTINUE_OPER);
testSetMaxDisplayNumber();
assertEquals(AbstractClient.handleInputInputCmd(AbstractClient.SHOW_TIMEZONE, connection), OPERATION_RESULT.CONTINUE_OPER);
assertEquals(AbstractClient.handleInputInputCmd(AbstractClient.SHOW_TIMESTAMP_DISPLAY, connection), OPERATION_RESULT.CONTINUE_OPER);
assertEquals(AbstractClient.handleInputInputCmd(AbstractClient.SHOW_FETCH_SIZE, connection), OPERATION_RESULT.CONTINUE_OPER);
assertEquals(AbstractClient.handleInputInputCmd(String.format("%s=", AbstractClient.SET_TIME_ZONE), connection), OPERATION_RESULT.CONTINUE_OPER);
assertEquals(AbstractClient.handleInputInputCmd(String.format("%s=+08:00", AbstractClient.SET_TIME_ZONE), connection), OPERATION_RESULT.CONTINUE_OPER);
assertEquals(AbstractClient.handleInputInputCmd(String.format("%s=", AbstractClient.SET_FETCH_SIZE), connection), OPERATION_RESULT.CONTINUE_OPER);
assertEquals(AbstractClient.handleInputInputCmd(String.format("%s=111", AbstractClient.SET_FETCH_SIZE), connection), OPERATION_RESULT.CONTINUE_OPER);
}
private void testSetTimeFormat() {
AbstractClient.setTimeFormat("long");
assertEquals(AbstractClient.maxTimeLength, AbstractClient.maxValueLength);
assertEquals(AbstractClient.formatTime, "%" + AbstractClient.maxTimeLength + "s|");
AbstractClient.setTimeFormat("number");
assertEquals(AbstractClient.maxTimeLength, AbstractClient.maxValueLength);
assertEquals(AbstractClient.formatTime, "%" + AbstractClient.maxTimeLength + "s|");
AbstractClient.setTimeFormat("default");
assertEquals(AbstractClient.maxTimeLength, AbstractClient.ISO_DATETIME_LEN);
assertEquals(AbstractClient.formatTime, "%" + AbstractClient.maxTimeLength + "s|");
AbstractClient.setTimeFormat("iso8601");
assertEquals(AbstractClient.maxTimeLength, AbstractClient.ISO_DATETIME_LEN);
assertEquals(AbstractClient.formatTime, "%" + AbstractClient.maxTimeLength + "s|");
AbstractClient.setTimeFormat("yyyy-MM-dd HH:mm:ssZZ");
assertEquals(AbstractClient.maxTimeLength, "yyyy-MM-dd HH:mm:ssZZ".length());
assertEquals(AbstractClient.formatTime, "%" + AbstractClient.maxTimeLength + "s|");
AbstractClient.setTimeFormat("dd");
assertEquals(AbstractClient.maxTimeLength, AbstractClient.TIMESTAMP_STR.length());
assertEquals(AbstractClient.formatTime, "%" + AbstractClient.maxTimeLength + "s|");
}
private void testSetMaxDisplayNumber() {
AbstractClient.setMaxDisplayNumber("10");
assertEquals(AbstractClient.maxPrintRowCount, 10);
AbstractClient.setMaxDisplayNumber("111111111111111");
assertEquals(AbstractClient.maxPrintRowCount, Integer.MAX_VALUE);
AbstractClient.setMaxDisplayNumber("-10");
assertEquals(AbstractClient.maxPrintRowCount, Integer.MAX_VALUE);
}
}

View File

@ -16,19 +16,28 @@
<url>https://github.com/thulab/iotdb/tree/master/iotdb</url>
<properties>
<common.cli.version>1.3.1</common.cli.version>
<antlr3.version>3.5.2</antlr3.version>
<jline.version>2.14.5</jline.version>
<iotdb.test.skip>false</iotdb.test.skip>
<it.test.includes>**/*Test.java</it.test.includes>
<it.test.excludes>**/NoTest.java</it.test.excludes>
</properties>
<dependencies>
<dependency>
<groupId>cn.edu.tsinghua</groupId>
<artifactId>service-rpc</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>cn.edu.tsinghua</groupId>
<artifactId>tsfile</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>cn.edu.tsinghua</groupId>
<artifactId>iotdb-jdbc</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>cn.edu.fudan.dsm</groupId>
@ -57,11 +66,7 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>${common.cli.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
@ -72,11 +77,6 @@
<artifactId>antlr3-maven-plugin</artifactId>
<version>${antlr3.version}</version>
</dependency>
<dependency>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
<version>${jline.version}</version>
</dependency>
</dependencies>
<build>
@ -124,6 +124,22 @@
</configuration>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<filesets>
<fileset>
<directory>${project.basedir}/iotdb/lib</directory>
<includes>
<include>**/*.jar</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>

View File

@ -36,7 +36,6 @@ import cn.edu.tsinghua.iotdb.engine.filenode.FileNodeManager;
import cn.edu.tsinghua.iotdb.engine.filenode.IntervalFileNode;
import cn.edu.tsinghua.iotdb.engine.filenode.OverflowChangeType;
import cn.edu.tsinghua.iotdb.exception.FileNodeManagerException;
import cn.edu.tsinghua.iotdb.jdbc.TsfileJDBCConfig;
import cn.edu.tsinghua.tsfile.file.metadata.RowGroupMetaData;
import cn.edu.tsinghua.tsfile.file.metadata.TimeSeriesChunkMetaData;
import cn.edu.tsinghua.tsfile.file.metadata.TimeSeriesChunkProperties;
@ -56,7 +55,7 @@ import cn.edu.tsinghua.tsfile.timeseries.read.support.Path;
* @author lta
*/
public class ServerServiceImpl implements ServerService.Iface {
private final String JDBC_DRIVER_NAME = "cn.edu.tsinghua.iotdb.jdbc.TsfileDriver";
private ThreadLocal<String> uuid = new ThreadLocal<String>();
private ThreadLocal<Map<String, List<String>>> fileNodeMap = new ThreadLocal<>(); // String means Storage Group,
// List means the set of new Files(AbsulutePath) in local IoTDB
@ -191,7 +190,7 @@ public class ServerServiceImpl implements ServerService.Iface {
Connection connection = null;
Statement statement = null;
try {
Class.forName(TsfileJDBCConfig.JDBC_DRIVER_NAME);
Class.forName(JDBC_DRIVER_NAME);
connection = DriverManager.getConnection("jdbc:tsfile://localhost:" + tsfileDBConfig.rpcPort + "/",
"root", "root");
statement = connection.createStatement();
@ -349,7 +348,7 @@ public class ServerServiceImpl implements ServerService.Iface {
Connection connection = null;
Statement statement = null;
try {
Class.forName(TsfileJDBCConfig.JDBC_DRIVER_NAME);
Class.forName(JDBC_DRIVER_NAME);
connection = DriverManager.getConnection("jdbc:tsfile://localhost:" + tsfileDBConfig.rpcPort + "/", "root",
"root");
statement = connection.createStatement();
@ -455,7 +454,7 @@ public class ServerServiceImpl implements ServerService.Iface {
Connection connection = null;
Statement statement = null;
try {
Class.forName(TsfileJDBCConfig.JDBC_DRIVER_NAME);
Class.forName(JDBC_DRIVER_NAME);
connection = DriverManager.getConnection("jdbc:tsfile://localhost:" + tsfileDBConfig.rpcPort + "/", "root",
"root");
statement = connection.createStatement();

View File

@ -45,7 +45,6 @@ import org.slf4j.LoggerFactory;
import cn.edu.tsinghua.tsfile.file.metadata.TsDeltaObject;
import cn.edu.tsinghua.tsfile.timeseries.read.TsRandomAccessLocalFileReader;
import cn.edu.tsinghua.iotdb.conf.TsfileDBDescriptor;
import cn.edu.tsinghua.iotdb.jdbc.TsfileJDBCConfig;
import cn.edu.tsinghua.iotdb.postback.conf.PostBackSenderConfig;
import cn.edu.tsinghua.iotdb.postback.conf.PostBackSenderDescriptor;
import cn.edu.tsinghua.iotdb.utils.PostbackUtils;
@ -55,6 +54,7 @@ import cn.edu.tsinghua.iotdb.utils.PostbackUtils;
* @author lta
*/
public class FileSenderImpl implements FileSender{
private final String JDBC_DRIVER_NAME = "cn.edu.tsinghua.iotdb.jdbc.TsfileDriver";
private TTransport transport;
private ServerService.Client clientOfServer;
@ -310,7 +310,7 @@ public class FileSenderImpl implements FileSender{
TsRandomAccessLocalFileReader input = null;
String deleteFormat = "delete from %s.* where time <= %s";
try {
Class.forName(TsfileJDBCConfig.JDBC_DRIVER_NAME);
Class.forName(JDBC_DRIVER_NAME);
connection = DriverManager.getConnection(
"jdbc:tsfile://localhost:" + TsfileDBDescriptor.getInstance().getConfig().rpcPort + "/", "root",
"root");

View File

@ -24,6 +24,8 @@ import cn.edu.tsinghua.iotdb.qp.physical.PhysicalPlan;
import cn.edu.tsinghua.iotdb.qp.physical.crud.IndexQueryPlan;
import cn.edu.tsinghua.iotdb.qp.physical.crud.MultiQueryPlan;
import cn.edu.tsinghua.iotdb.qp.physical.sys.AuthorPlan;
import cn.edu.tsinghua.iotdb.query.aggregation.AggregateFunction;
import cn.edu.tsinghua.iotdb.query.aggregation.AggregationConstant;
import cn.edu.tsinghua.iotdb.query.management.ReadCacheManager;
import cn.edu.tsinghua.iotdb.queryV2.engine.control.QueryJobManager;
import cn.edu.tsinghua.service.rpc.thrift.*;
@ -752,4 +754,14 @@ public class TSServiceImpl implements TSIService.Iface, ServerContext {
TSSetTimeZoneResp resp = new TSSetTimeZoneResp(ts_status);
return resp;
}
@Override
public ServerProperties getProperties() throws TException {
ServerProperties properties = new ServerProperties();
properties.setVersion(TsFileDBConstant.VERSION);
properties.setSupportedTimeAggregationOperations(new ArrayList<>());
properties.getSupportedTimeAggregationOperations().add(AggregationConstant.MAX_TIME);
properties.getSupportedTimeAggregationOperations().add(AggregationConstant.MIN_TIME);
return properties;
}
}

View File

@ -44,11 +44,6 @@
<artifactId>tsfile</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>${joda.version}</version>
</dependency>
<dependency>
<groupId>cn.edu.tsinghua</groupId>
<artifactId>service-rpc</artifactId>
@ -76,6 +71,26 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<!-- this is used for inheritance merges -->
<phase>package</phase>
<!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>

View File

@ -6,6 +6,7 @@ import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransportException;
import org.joda.time.DateTimeZone;
import cn.edu.tsinghua.service.rpc.thrift.ServerProperties;
import cn.edu.tsinghua.service.rpc.thrift.TSCloseSessionReq;
import cn.edu.tsinghua.service.rpc.thrift.TSGetTimeZoneResp;
import cn.edu.tsinghua.service.rpc.thrift.TSIService;
@ -455,6 +456,10 @@ public class TsfileConnection implements Connection {
return resp.getTimeZone();
}
public ServerProperties getServerProperties() throws TException {
return client.getProperties();
}
public static TSIService.Iface newSynchronizedClient(TSIService.Iface client) {
return (TSIService.Iface) Proxy.newProxyInstance(TsfileConnection.class.getClassLoader(),
new Class[] { TSIService.Iface.class }, new SynchronizedHandler(client));

View File

@ -8,6 +8,7 @@ import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import cn.edu.tsinghua.service.rpc.thrift.ServerProperties;
import cn.edu.tsinghua.service.rpc.thrift.TSGetTimeZoneResp;
import cn.edu.tsinghua.service.rpc.thrift.TSIService;
import cn.edu.tsinghua.service.rpc.thrift.TSSetTimeZoneReq;
@ -18,6 +19,9 @@ import cn.edu.tsinghua.service.rpc.thrift.TS_StatusCode;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.List;
import org.apache.thrift.TException;
@ -54,5 +58,19 @@ public class TsfileConnectionTest {
assertEquals(connection.getTimeZone(), timeZone);
}
@Test
public void testGetServerProperties() throws TsfileSQLException, TException {
final String version = "v0.1";
@SuppressWarnings("serial")
final List<String> supportedAggregationTime = new ArrayList<String>() {{
add("max_time");
add("min_time");
}};
when(client.getProperties()).thenReturn(new ServerProperties(version, supportedAggregationTime));
connection.client = client;
assertEquals(connection.getServerProperties().getVersion(), version);
for(int i = 0; i < supportedAggregationTime.size();i++) {
assertEquals(connection.getServerProperties().getSupportedTimeAggregationOperations().get(i), supportedAggregationTime.get(i));
}
}
}

43
pom.xml
View File

@ -96,6 +96,11 @@
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>${joda.version}</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
@ -136,6 +141,7 @@
<module>iotdb</module>
<module>grafana</module>
<module>service-rpc</module>
<module>iotdb-cli</module>
<!-- <module>hadoop</module> -->
<!-- <module>spark</module> -->
</modules>
@ -180,42 +186,7 @@
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.5</version>
<executions>
<execution>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<!--use `mvn cobertura:cobertura` -->
<plugin>
<groupId>org.codehaus.mojo</groupId>

View File

@ -229,6 +229,11 @@ struct TSSetTimeZoneResp {
1: required TS_Status status
}
struct ServerProperties {
1: required string version;
2: required list<string> supportedTimeAggregationOperations;
}
service TSIService {
TSOpenSessionResp openSession(1:TSOpenSessionReq req);
@ -253,4 +258,6 @@ service TSIService {
TSGetTimeZoneResp getTimeZone();
TSSetTimeZoneResp setTimeZone(1:TSSetTimeZoneReq req);
}
ServerProperties getProperties();
}

View File

@ -0,0 +1,526 @@
/**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package cn.edu.tsinghua.service.rpc.thrift;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
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;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ServerProperties implements org.apache.thrift.TBase<ServerProperties, ServerProperties._Fields>, java.io.Serializable, Cloneable, Comparable<ServerProperties> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ServerProperties");
private static final org.apache.thrift.protocol.TField VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("version", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField SUPPORTED_TIME_AGGREGATION_OPERATIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("supportedTimeAggregationOperations", org.apache.thrift.protocol.TType.LIST, (short)2);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new ServerPropertiesStandardSchemeFactory());
schemes.put(TupleScheme.class, new ServerPropertiesTupleSchemeFactory());
}
public String version; // required
public List<String> supportedTimeAggregationOperations; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
VERSION((short)1, "version"),
SUPPORTED_TIME_AGGREGATION_OPERATIONS((short)2, "supportedTimeAggregationOperations");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // VERSION
return VERSION;
case 2: // SUPPORTED_TIME_AGGREGATION_OPERATIONS
return SUPPORTED_TIME_AGGREGATION_OPERATIONS;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.VERSION, new org.apache.thrift.meta_data.FieldMetaData("version", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.SUPPORTED_TIME_AGGREGATION_OPERATIONS, new org.apache.thrift.meta_data.FieldMetaData("supportedTimeAggregationOperations", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ServerProperties.class, metaDataMap);
}
public ServerProperties() {
}
public ServerProperties(
String version,
List<String> supportedTimeAggregationOperations)
{
this();
this.version = version;
this.supportedTimeAggregationOperations = supportedTimeAggregationOperations;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public ServerProperties(ServerProperties other) {
if (other.isSetVersion()) {
this.version = other.version;
}
if (other.isSetSupportedTimeAggregationOperations()) {
List<String> __this__supportedTimeAggregationOperations = new ArrayList<String>(other.supportedTimeAggregationOperations);
this.supportedTimeAggregationOperations = __this__supportedTimeAggregationOperations;
}
}
public ServerProperties deepCopy() {
return new ServerProperties(this);
}
@Override
public void clear() {
this.version = null;
this.supportedTimeAggregationOperations = null;
}
public String getVersion() {
return this.version;
}
public ServerProperties setVersion(String version) {
this.version = version;
return this;
}
public void unsetVersion() {
this.version = null;
}
/** Returns true if field version is set (has been assigned a value) and false otherwise */
public boolean isSetVersion() {
return this.version != null;
}
public void setVersionIsSet(boolean value) {
if (!value) {
this.version = null;
}
}
public int getSupportedTimeAggregationOperationsSize() {
return (this.supportedTimeAggregationOperations == null) ? 0 : this.supportedTimeAggregationOperations.size();
}
public java.util.Iterator<String> getSupportedTimeAggregationOperationsIterator() {
return (this.supportedTimeAggregationOperations == null) ? null : this.supportedTimeAggregationOperations.iterator();
}
public void addToSupportedTimeAggregationOperations(String elem) {
if (this.supportedTimeAggregationOperations == null) {
this.supportedTimeAggregationOperations = new ArrayList<String>();
}
this.supportedTimeAggregationOperations.add(elem);
}
public List<String> getSupportedTimeAggregationOperations() {
return this.supportedTimeAggregationOperations;
}
public ServerProperties setSupportedTimeAggregationOperations(List<String> supportedTimeAggregationOperations) {
this.supportedTimeAggregationOperations = supportedTimeAggregationOperations;
return this;
}
public void unsetSupportedTimeAggregationOperations() {
this.supportedTimeAggregationOperations = null;
}
/** Returns true if field supportedTimeAggregationOperations is set (has been assigned a value) and false otherwise */
public boolean isSetSupportedTimeAggregationOperations() {
return this.supportedTimeAggregationOperations != null;
}
public void setSupportedTimeAggregationOperationsIsSet(boolean value) {
if (!value) {
this.supportedTimeAggregationOperations = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case VERSION:
if (value == null) {
unsetVersion();
} else {
setVersion((String)value);
}
break;
case SUPPORTED_TIME_AGGREGATION_OPERATIONS:
if (value == null) {
unsetSupportedTimeAggregationOperations();
} else {
setSupportedTimeAggregationOperations((List<String>)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case VERSION:
return getVersion();
case SUPPORTED_TIME_AGGREGATION_OPERATIONS:
return getSupportedTimeAggregationOperations();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case VERSION:
return isSetVersion();
case SUPPORTED_TIME_AGGREGATION_OPERATIONS:
return isSetSupportedTimeAggregationOperations();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof ServerProperties)
return this.equals((ServerProperties)that);
return false;
}
public boolean equals(ServerProperties that) {
if (that == null)
return false;
boolean this_present_version = true && this.isSetVersion();
boolean that_present_version = true && that.isSetVersion();
if (this_present_version || that_present_version) {
if (!(this_present_version && that_present_version))
return false;
if (!this.version.equals(that.version))
return false;
}
boolean this_present_supportedTimeAggregationOperations = true && this.isSetSupportedTimeAggregationOperations();
boolean that_present_supportedTimeAggregationOperations = true && that.isSetSupportedTimeAggregationOperations();
if (this_present_supportedTimeAggregationOperations || that_present_supportedTimeAggregationOperations) {
if (!(this_present_supportedTimeAggregationOperations && that_present_supportedTimeAggregationOperations))
return false;
if (!this.supportedTimeAggregationOperations.equals(that.supportedTimeAggregationOperations))
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
@Override
public int compareTo(ServerProperties other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetVersion()).compareTo(other.isSetVersion());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetVersion()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.version, other.version);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetSupportedTimeAggregationOperations()).compareTo(other.isSetSupportedTimeAggregationOperations());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSupportedTimeAggregationOperations()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.supportedTimeAggregationOperations, other.supportedTimeAggregationOperations);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("ServerProperties(");
boolean first = true;
sb.append("version:");
if (this.version == null) {
sb.append("null");
} else {
sb.append(this.version);
}
first = false;
if (!first) sb.append(", ");
sb.append("supportedTimeAggregationOperations:");
if (this.supportedTimeAggregationOperations == null) {
sb.append("null");
} else {
sb.append(this.supportedTimeAggregationOperations);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (version == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'version' was not present! Struct: " + toString());
}
if (supportedTimeAggregationOperations == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'supportedTimeAggregationOperations' was not present! Struct: " + toString());
}
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class ServerPropertiesStandardSchemeFactory implements SchemeFactory {
public ServerPropertiesStandardScheme getScheme() {
return new ServerPropertiesStandardScheme();
}
}
private static class ServerPropertiesStandardScheme extends StandardScheme<ServerProperties> {
public void read(org.apache.thrift.protocol.TProtocol iprot, ServerProperties struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // VERSION
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.version = iprot.readString();
struct.setVersionIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // SUPPORTED_TIME_AGGREGATION_OPERATIONS
if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
{
org.apache.thrift.protocol.TList _list118 = iprot.readListBegin();
struct.supportedTimeAggregationOperations = new ArrayList<String>(_list118.size);
for (int _i119 = 0; _i119 < _list118.size; ++_i119)
{
String _elem120;
_elem120 = iprot.readString();
struct.supportedTimeAggregationOperations.add(_elem120);
}
iprot.readListEnd();
}
struct.setSupportedTimeAggregationOperationsIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, ServerProperties struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.version != null) {
oprot.writeFieldBegin(VERSION_FIELD_DESC);
oprot.writeString(struct.version);
oprot.writeFieldEnd();
}
if (struct.supportedTimeAggregationOperations != null) {
oprot.writeFieldBegin(SUPPORTED_TIME_AGGREGATION_OPERATIONS_FIELD_DESC);
{
oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.supportedTimeAggregationOperations.size()));
for (String _iter121 : struct.supportedTimeAggregationOperations)
{
oprot.writeString(_iter121);
}
oprot.writeListEnd();
}
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class ServerPropertiesTupleSchemeFactory implements SchemeFactory {
public ServerPropertiesTupleScheme getScheme() {
return new ServerPropertiesTupleScheme();
}
}
private static class ServerPropertiesTupleScheme extends TupleScheme<ServerProperties> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, ServerProperties struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeString(struct.version);
{
oprot.writeI32(struct.supportedTimeAggregationOperations.size());
for (String _iter122 : struct.supportedTimeAggregationOperations)
{
oprot.writeString(_iter122);
}
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, ServerProperties struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.version = iprot.readString();
struct.setVersionIsSet(true);
{
org.apache.thrift.protocol.TList _list123 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32());
struct.supportedTimeAggregationOperations = new ArrayList<String>(_list123.size);
for (int _i124 = 0; _i124 < _list123.size; ++_i124)
{
String _elem125;
_elem125 = iprot.readString();
struct.supportedTimeAggregationOperations.add(_elem125);
}
}
struct.setSupportedTimeAggregationOperationsIsSet(true);
}
}
}

View File

@ -60,6 +60,8 @@ public class TSIService {
public TSSetTimeZoneResp setTimeZone(TSSetTimeZoneReq req) throws org.apache.thrift.TException;
public ServerProperties getProperties() throws org.apache.thrift.TException;
}
public interface AsyncIface {
@ -88,6 +90,8 @@ public class TSIService {
public void setTimeZone(TSSetTimeZoneReq req, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
public void getProperties(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException;
}
public static class Client extends org.apache.thrift.TServiceClient implements Iface {
@ -385,6 +389,28 @@ public class TSIService {
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "setTimeZone failed: unknown result");
}
public ServerProperties getProperties() throws org.apache.thrift.TException
{
send_getProperties();
return recv_getProperties();
}
public void send_getProperties() throws org.apache.thrift.TException
{
getProperties_args args = new getProperties_args();
sendBase("getProperties", args);
}
public ServerProperties recv_getProperties() throws org.apache.thrift.TException
{
getProperties_result result = new getProperties_result();
receiveBase(result, "getProperties");
if (result.isSetSuccess()) {
return result.success;
}
throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getProperties failed: unknown result");
}
}
public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface {
public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> {
@ -784,6 +810,35 @@ public class TSIService {
}
}
public void getProperties(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException {
checkReady();
getProperties_call method_call = new getProperties_call(resultHandler, this, ___protocolFactory, ___transport);
this.___currentMethod = method_call;
___manager.call(method_call);
}
public static class getProperties_call extends org.apache.thrift.async.TAsyncMethodCall {
public getProperties_call(org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException {
super(client, protocolFactory, transport, resultHandler, false);
}
public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException {
prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getProperties", org.apache.thrift.protocol.TMessageType.CALL, 0));
getProperties_args args = new getProperties_args();
args.write(prot);
prot.writeMessageEnd();
}
public ServerProperties getResult() throws org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array());
org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport);
return (new Client(prot)).recv_getProperties();
}
}
}
public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor {
@ -809,6 +864,7 @@ public class TSIService {
processMap.put("closeOperation", new closeOperation());
processMap.put("getTimeZone", new getTimeZone());
processMap.put("setTimeZone", new setTimeZone());
processMap.put("getProperties", new getProperties());
return processMap;
}
@ -1052,6 +1108,26 @@ public class TSIService {
}
}
public static class getProperties<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getProperties_args> {
public getProperties() {
super("getProperties");
}
public getProperties_args getEmptyArgsInstance() {
return new getProperties_args();
}
protected boolean isOneway() {
return false;
}
public getProperties_result getResult(I iface, getProperties_args args) throws org.apache.thrift.TException {
getProperties_result result = new getProperties_result();
result.success = iface.getProperties();
return result;
}
}
}
public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> {
@ -1077,6 +1153,7 @@ public class TSIService {
processMap.put("closeOperation", new closeOperation());
processMap.put("getTimeZone", new getTimeZone());
processMap.put("setTimeZone", new setTimeZone());
processMap.put("getProperties", new getProperties());
return processMap;
}
@ -1692,6 +1769,57 @@ public class TSIService {
}
}
public static class getProperties<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getProperties_args, ServerProperties> {
public getProperties() {
super("getProperties");
}
public getProperties_args getEmptyArgsInstance() {
return new getProperties_args();
}
public AsyncMethodCallback<ServerProperties> getResultHandler(final AsyncFrameBuffer fb, final int seqid) {
final org.apache.thrift.AsyncProcessFunction fcall = this;
return new AsyncMethodCallback<ServerProperties>() {
public void onComplete(ServerProperties o) {
getProperties_result result = new getProperties_result();
result.success = o;
try {
fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid);
return;
} catch (Exception e) {
LOGGER.error("Exception writing to internal frame buffer", e);
}
fb.close();
}
public void onError(Exception e) {
byte msgType = org.apache.thrift.protocol.TMessageType.REPLY;
org.apache.thrift.TBase msg;
getProperties_result result = new getProperties_result();
{
msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION;
msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage());
}
try {
fcall.sendResponse(fb,msg,msgType,seqid);
return;
} catch (Exception ex) {
LOGGER.error("Exception writing to internal frame buffer", ex);
}
fb.close();
}
};
}
protected boolean isOneway() {
return false;
}
public void start(I iface, getProperties_args args, org.apache.thrift.async.AsyncMethodCallback<ServerProperties> resultHandler) throws TException {
iface.getProperties(resultHandler);
}
}
}
public static class openSession_args implements org.apache.thrift.TBase<openSession_args, openSession_args._Fields>, java.io.Serializable, Cloneable, Comparable<openSession_args> {
@ -10197,4 +10325,609 @@ public class TSIService {
}
public static class getProperties_args implements org.apache.thrift.TBase<getProperties_args, getProperties_args._Fields>, java.io.Serializable, Cloneable, Comparable<getProperties_args> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getProperties_args");
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new getProperties_argsStandardSchemeFactory());
schemes.put(TupleScheme.class, new getProperties_argsTupleSchemeFactory());
}
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
;
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getProperties_args.class, metaDataMap);
}
public getProperties_args() {
}
/**
* Performs a deep copy on <i>other</i>.
*/
public getProperties_args(getProperties_args other) {
}
public getProperties_args deepCopy() {
return new getProperties_args(this);
}
@Override
public void clear() {
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof getProperties_args)
return this.equals((getProperties_args)that);
return false;
}
public boolean equals(getProperties_args that) {
if (that == null)
return false;
return true;
}
@Override
public int hashCode() {
return 0;
}
@Override
public int compareTo(getProperties_args other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("getProperties_args(");
boolean first = true;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class getProperties_argsStandardSchemeFactory implements SchemeFactory {
public getProperties_argsStandardScheme getScheme() {
return new getProperties_argsStandardScheme();
}
}
private static class getProperties_argsStandardScheme extends StandardScheme<getProperties_args> {
public void read(org.apache.thrift.protocol.TProtocol iprot, getProperties_args struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, getProperties_args struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class getProperties_argsTupleSchemeFactory implements SchemeFactory {
public getProperties_argsTupleScheme getScheme() {
return new getProperties_argsTupleScheme();
}
}
private static class getProperties_argsTupleScheme extends TupleScheme<getProperties_args> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, getProperties_args struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, getProperties_args struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
}
}
}
public static class getProperties_result implements org.apache.thrift.TBase<getProperties_result, getProperties_result._Fields>, java.io.Serializable, Cloneable, Comparable<getProperties_result> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getProperties_result");
private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.STRUCT, (short)0);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new getProperties_resultStandardSchemeFactory());
schemes.put(TupleScheme.class, new getProperties_resultTupleSchemeFactory());
}
public ServerProperties success; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
SUCCESS((short)0, "success");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 0: // SUCCESS
return SUCCESS;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, ServerProperties.class)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getProperties_result.class, metaDataMap);
}
public getProperties_result() {
}
public getProperties_result(
ServerProperties success)
{
this();
this.success = success;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public getProperties_result(getProperties_result other) {
if (other.isSetSuccess()) {
this.success = new ServerProperties(other.success);
}
}
public getProperties_result deepCopy() {
return new getProperties_result(this);
}
@Override
public void clear() {
this.success = null;
}
public ServerProperties getSuccess() {
return this.success;
}
public getProperties_result setSuccess(ServerProperties success) {
this.success = success;
return this;
}
public void unsetSuccess() {
this.success = null;
}
/** Returns true if field success is set (has been assigned a value) and false otherwise */
public boolean isSetSuccess() {
return this.success != null;
}
public void setSuccessIsSet(boolean value) {
if (!value) {
this.success = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case SUCCESS:
if (value == null) {
unsetSuccess();
} else {
setSuccess((ServerProperties)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case SUCCESS:
return getSuccess();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case SUCCESS:
return isSetSuccess();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof getProperties_result)
return this.equals((getProperties_result)that);
return false;
}
public boolean equals(getProperties_result that) {
if (that == null)
return false;
boolean this_present_success = true && this.isSetSuccess();
boolean that_present_success = true && that.isSetSuccess();
if (this_present_success || that_present_success) {
if (!(this_present_success && that_present_success))
return false;
if (!this.success.equals(that.success))
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
@Override
public int compareTo(getProperties_result other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSuccess()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("getProperties_result(");
boolean first = true;
sb.append("success:");
if (this.success == null) {
sb.append("null");
} else {
sb.append(this.success);
}
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
// check for sub-struct validity
if (success != null) {
success.validate();
}
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class getProperties_resultStandardSchemeFactory implements SchemeFactory {
public getProperties_resultStandardScheme getScheme() {
return new getProperties_resultStandardScheme();
}
}
private static class getProperties_resultStandardScheme extends StandardScheme<getProperties_result> {
public void read(org.apache.thrift.protocol.TProtocol iprot, getProperties_result struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 0: // SUCCESS
if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
struct.success = new ServerProperties();
struct.success.read(iprot);
struct.setSuccessIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, getProperties_result struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.success != null) {
oprot.writeFieldBegin(SUCCESS_FIELD_DESC);
struct.success.write(oprot);
oprot.writeFieldEnd();
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class getProperties_resultTupleSchemeFactory implements SchemeFactory {
public getProperties_resultTupleScheme getScheme() {
return new getProperties_resultTupleScheme();
}
}
private static class getProperties_resultTupleScheme extends TupleScheme<getProperties_result> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, getProperties_result struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetSuccess()) {
optionals.set(0);
}
oprot.writeBitSet(optionals, 1);
if (struct.isSetSuccess()) {
struct.success.write(oprot);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, getProperties_result struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(1);
if (incoming.get(0)) {
struct.success = new ServerProperties();
struct.success.read(iprot);
struct.setSuccessIsSet(true);
}
}
}
}
}

View File

@ -153,6 +153,26 @@
<skipTests>${tsfile.test.skip}</skipTests>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<!-- this is used for inheritance merges -->
<phase>package</phase>
<!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- use `mvn COMMAND -Pprifile_id` to enable desired profile-->