Skip to content

Commit 714f076

Browse files
committed
Add drift-core to replace libthrift
1 parent c0c8ab1 commit 714f076

25 files changed

+2454
-0
lines changed

drift-core/pom.xml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>io.airlift.drift</groupId>
9+
<artifactId>drift-root</artifactId>
10+
<version>1.0-SNAPSHOT</version>
11+
</parent>
12+
13+
<artifactId>drift-core</artifactId>
14+
<description>Core classes for Drift</description>
15+
<packaging>jar</packaging>
16+
17+
<properties>
18+
<air.main.basedir>${project.parent.basedir}</air.main.basedir>
19+
</properties>
20+
21+
<dependencies>
22+
<dependency>
23+
<groupId>io.airlift.drift</groupId>
24+
<artifactId>drift-annotations</artifactId>
25+
</dependency>
26+
27+
<!-- for testing -->
28+
<dependency>
29+
<groupId>org.testng</groupId>
30+
<artifactId>testng</artifactId>
31+
<scope>test</scope>
32+
</dependency>
33+
</dependencies>
34+
35+
<build>
36+
<plugins>
37+
<plugin>
38+
<groupId>com.mycila</groupId>
39+
<artifactId>license-maven-plugin</artifactId>
40+
<configuration>
41+
<header>${project.basedir}/src/license/LICENSE-HEADER.txt</header>
42+
<excludes combine.children="append">
43+
<exclude>src/main/java/io/airlift/drift/protocol/TBinaryProtocol.java</exclude>
44+
<exclude>src/main/java/io/airlift/drift/protocol/TCompactProtocol.java</exclude>
45+
</excludes>
46+
</configuration>
47+
</plugin>
48+
</plugins>
49+
</build>
50+
</project>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Licensed under the Apache License, Version 2.0 (the "License"); you may
2+
not use this file except in compliance with the License. You may obtain
3+
a copy of the License at
4+
5+
http://www.apache.org/licenses/LICENSE-2.0
6+
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10+
License for the specific language governing permissions and limitations
11+
under the License.
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
3+
* not use this file except in compliance with the License. You may obtain
4+
* a copy of the License at
5+
*
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11+
* License for the specific language governing permissions and limitations
12+
* under the License.
13+
*/
14+
package io.airlift.drift;
15+
16+
import io.airlift.drift.annotations.ThriftConstructor;
17+
import io.airlift.drift.annotations.ThriftEnum;
18+
import io.airlift.drift.annotations.ThriftField;
19+
import io.airlift.drift.annotations.ThriftStruct;
20+
21+
@ThriftStruct
22+
public class TApplicationException
23+
extends TException
24+
{
25+
@ThriftEnum
26+
public enum Type
27+
{
28+
UNKNOWN(0),
29+
UNKNOWN_METHOD(1),
30+
INVALID_MESSAGE_TYPE(2),
31+
WRONG_METHOD_NAME(3),
32+
BAD_SEQUENCE_ID(4),
33+
MISSING_RESULT(5),
34+
INTERNAL_ERROR(6),
35+
PROTOCOL_ERROR(7),
36+
INVALID_TRANSFORM(8),
37+
INVALID_PROTOCOL(9),
38+
UNSUPPORTED_CLIENT_TYPE(10);
39+
40+
private final int type;
41+
42+
Type(int type)
43+
{
44+
this.type = type;
45+
}
46+
47+
public int getType()
48+
{
49+
return type;
50+
}
51+
}
52+
53+
private final Type type;
54+
55+
public TApplicationException()
56+
{
57+
this(null, null);
58+
}
59+
60+
@ThriftConstructor
61+
public TApplicationException(Type type, String message)
62+
{
63+
super(message);
64+
this.type = (type != null) ? type : Type.UNKNOWN;
65+
}
66+
67+
@Override
68+
@ThriftField(1)
69+
public String getMessage()
70+
{
71+
return super.getMessage();
72+
}
73+
74+
@ThriftField(2)
75+
public Type getType()
76+
{
77+
return type;
78+
}
79+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
3+
* not use this file except in compliance with the License. You may obtain
4+
* a copy of the License at
5+
*
6+
* http://www.apache.org/licenses/LICENSE-2.0
7+
*
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11+
* License for the specific language governing permissions and limitations
12+
* under the License.
13+
*/
14+
package io.airlift.drift;
15+
16+
public class TException
17+
extends Exception
18+
{
19+
public TException() {}
20+
21+
public TException(String message)
22+
{
23+
super(message);
24+
}
25+
26+
public TException(String message, Throwable cause)
27+
{
28+
super(message, cause);
29+
}
30+
31+
public TException(Throwable cause)
32+
{
33+
super(cause);
34+
}
35+
}

0 commit comments

Comments
 (0)