Skip to content

Commit 61c3d3b

Browse files
convert java CDK dependencies submodule to kotlin (#36446)
convert java CDK dependencies submodule to kotlin fix compiler errors
1 parent e7f2fc3 commit 61c3d3b

File tree

314 files changed

+13788
-13042
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

314 files changed

+13788
-13042
lines changed

airbyte-cdk/java/airbyte-cdk/core/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ dependencies {
5757
api 'com.zaxxer:HikariCP:5.1.0'
5858
api 'org.jooq:jooq:3.16.23'
5959
api 'org.apache.commons:commons-csv:1.10.0'
60-
api 'io.github.oshai:kotlin-logging-jvm:5.1.0'
6160

6261
implementation project(':airbyte-cdk:java:airbyte-cdk:dependencies')
6362

airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/BaseConnector.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ abstract class BaseConnector : Integration {
1818
* - any exception.
1919
*/
2020
@Throws(Exception::class)
21-
override fun spec(): ConnectorSpecification? {
21+
override fun spec(): ConnectorSpecification {
2222
// return a JsonSchema representation of the spec for the integration.
2323
val resourceString = MoreResources.readResource("spec.json")
2424
return Jsons.deserialize(resourceString, ConnectorSpecification::class.java)

airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/base/Integration.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ interface Integration {
1515
* @throws Exception
1616
* - any exception.
1717
*/
18-
@Throws(Exception::class) fun spec(): ConnectorSpecification?
18+
@Throws(Exception::class) fun spec(): ConnectorSpecification
1919

2020
/**
2121
* Check whether, given the current configuration, the integration can connect to the

airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/base/Source.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ interface Source : Integration {
2121
* @throws Exception
2222
* - any exception.
2323
*/
24-
@Throws(Exception::class) fun discover(config: JsonNode): AirbyteCatalog?
24+
@Throws(Exception::class) fun discover(config: JsonNode): AirbyteCatalog
2525

2626
/**
2727
* Return a iterator of messages pulled from the source.

airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/base/errors/messages/ErrorMessage.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ object ErrorMessage {
1111
// errorCode exists
1212
@JvmStatic
1313
fun getErrorMessage(
14-
stateCode: String,
14+
stateCode: String?,
1515
errorCode: Int,
1616
message: String?,
1717
exception: Exception
@@ -23,7 +23,7 @@ object ErrorMessage {
2323
}
2424
}
2525

26-
private fun configMessage(stateCode: String, errorCode: Int, message: String?): String {
26+
private fun configMessage(stateCode: String?, errorCode: Int, message: String?): String {
2727
val stateCodePart =
2828
if (Objects.isNull(stateCode)) "" else String.format("State code: %s; ", stateCode)
2929
val errorCodePart = if (errorCode == 0) "" else String.format("Error code: %s; ", errorCode)

airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/base/spec_modification/SpecModifyingDestination.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ import java.util.function.Consumer
1515

1616
abstract class SpecModifyingDestination(private val destination: Destination) : Destination {
1717
@Throws(Exception::class)
18-
abstract fun modifySpec(originalSpec: ConnectorSpecification?): ConnectorSpecification?
18+
abstract fun modifySpec(originalSpec: ConnectorSpecification): ConnectorSpecification
1919

2020
@Throws(Exception::class)
21-
override fun spec(): ConnectorSpecification? {
21+
override fun spec(): ConnectorSpecification {
2222
return modifySpec(destination.spec())
2323
}
2424

airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/base/spec_modification/SpecModifyingSource.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ import io.airbyte.protocol.models.v0.*
1515
*/
1616
abstract class SpecModifyingSource(private val source: Source) : Source {
1717
@Throws(Exception::class)
18-
abstract fun modifySpec(originalSpec: ConnectorSpecification?): ConnectorSpecification?
18+
abstract fun modifySpec(originalSpec: ConnectorSpecification): ConnectorSpecification
1919

2020
@Throws(Exception::class)
21-
override fun spec(): ConnectorSpecification? {
21+
override fun spec(): ConnectorSpecification {
2222
return modifySpec(source.spec())
2323
}
2424

@@ -28,7 +28,7 @@ abstract class SpecModifyingSource(private val source: Source) : Source {
2828
}
2929

3030
@Throws(Exception::class)
31-
override fun discover(config: JsonNode): AirbyteCatalog? {
31+
override fun discover(config: JsonNode): AirbyteCatalog {
3232
return source.discover(config)
3333
}
3434

airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/base/ssh/SshHelpers.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ object SshHelpers {
2929
@JvmOverloads
3030
@Throws(IOException::class)
3131
fun injectSshIntoSpec(
32-
connectorSpecification: ConnectorSpecification?,
32+
connectorSpecification: ConnectorSpecification,
3333
group: Optional<String> = Optional.empty()
34-
): ConnectorSpecification? {
34+
): ConnectorSpecification {
3535
val originalSpec = Jsons.clone(connectorSpecification)
3636
val propNode = originalSpec!!.connectionSpecification["properties"] as ObjectNode
3737
val tunnelMethod =

airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/base/ssh/SshTunnel.kt

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -422,11 +422,7 @@ constructor(
422422

423423
const val TIMEOUT_MILLIS: Int = 15000 // 15 seconds
424424

425-
fun getInstance(
426-
config: JsonNode,
427-
hostKey: List<String>?,
428-
portKey: List<String>?
429-
): SshTunnel {
425+
fun getInstance(config: JsonNode, hostKey: List<String>, portKey: List<String>): SshTunnel {
430426
val tunnelMethod =
431427
Jsons.getOptional(config, "tunnel_method", "tunnel_method")
432428
.map { method: JsonNode ->
@@ -490,7 +486,7 @@ constructor(
490486
}
491487

492488
@Throws(Exception::class)
493-
fun getInstance(config: JsonNode, endPointKey: String?): SshTunnel {
489+
fun getInstance(config: JsonNode, endPointKey: String): SshTunnel {
494490
val tunnelMethod =
495491
Jsons.getOptional(config, "tunnel_method", "tunnel_method")
496492
.map { method: JsonNode ->
@@ -522,8 +518,8 @@ constructor(
522518
@Throws(Exception::class)
523519
fun sshWrap(
524520
config: JsonNode,
525-
hostKey: List<String>?,
526-
portKey: List<String>?,
521+
hostKey: List<String>,
522+
portKey: List<String>,
527523
wrapped: CheckedConsumer<JsonNode?, Exception?>
528524
) {
529525
sshWrap<Any?>(config, hostKey, portKey) { configInTunnel: JsonNode? ->
@@ -535,7 +531,7 @@ constructor(
535531
@Throws(Exception::class)
536532
fun sshWrap(
537533
config: JsonNode,
538-
endPointKey: String?,
534+
endPointKey: String,
539535
wrapped: CheckedConsumer<JsonNode?, Exception?>
540536
) {
541537
sshWrap<Any?>(config, endPointKey) { configInTunnel: JsonNode? ->
@@ -547,8 +543,8 @@ constructor(
547543
@Throws(Exception::class)
548544
fun <T> sshWrap(
549545
config: JsonNode,
550-
hostKey: List<String>?,
551-
portKey: List<String>?,
546+
hostKey: List<String>,
547+
portKey: List<String>,
552548
wrapped: CheckedFunction<JsonNode, T, Exception?>
553549
): T {
554550
getInstance(config, hostKey, portKey).use { sshTunnel ->
@@ -559,7 +555,7 @@ constructor(
559555
@Throws(Exception::class)
560556
fun <T> sshWrap(
561557
config: JsonNode,
562-
endPointKey: String?,
558+
endPointKey: String,
563559
wrapped: CheckedFunction<JsonNode, T, Exception?>
564560
): T {
565561
getInstance(config, endPointKey).use { sshTunnel ->

airbyte-cdk/java/airbyte-cdk/core/src/main/kotlin/io/airbyte/cdk/integrations/base/ssh/SshWrappedDestination.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,22 @@ class SshWrappedDestination : Destination {
3232
private val portKey: List<String>?
3333
private val endPointKey: String?
3434

35-
constructor(delegate: Destination, hostKey: List<String>?, portKey: List<String>?) {
35+
constructor(delegate: Destination, hostKey: List<String>, portKey: List<String>) {
3636
this.delegate = delegate
3737
this.hostKey = hostKey
3838
this.portKey = portKey
3939
this.endPointKey = null
4040
}
4141

42-
constructor(delegate: Destination, endPointKey: String?) {
42+
constructor(delegate: Destination, endPointKey: String) {
4343
this.delegate = delegate
4444
this.endPointKey = endPointKey
4545
this.portKey = null
4646
this.hostKey = null
4747
}
4848

4949
@Throws(Exception::class)
50-
override fun spec(): ConnectorSpecification? {
50+
override fun spec(): ConnectorSpecification {
5151
// inject the standard ssh configuration into the spec.
5252
val originalSpec = delegate.spec()
5353
val propNode = originalSpec!!.connectionSpecification["properties"] as ObjectNode
@@ -73,8 +73,8 @@ class SshWrappedDestination : Destination {
7373
else
7474
SshTunnel.Companion.sshWrap<AirbyteConnectionStatus?>(
7575
config,
76-
hostKey,
77-
portKey,
76+
hostKey!!,
77+
portKey!!,
7878
CheckedFunction<JsonNode, AirbyteConnectionStatus?, Exception?> {
7979
config: JsonNode ->
8080
delegate.check(config)
@@ -165,7 +165,7 @@ class SshWrappedDestination : Destination {
165165
@Throws(Exception::class)
166166
protected fun getTunnelInstance(config: JsonNode): SshTunnel {
167167
return if ((endPointKey != null)) SshTunnel.Companion.getInstance(config, endPointKey)
168-
else SshTunnel.Companion.getInstance(config, hostKey, portKey)
168+
else SshTunnel.Companion.getInstance(config, hostKey!!, portKey!!)
169169
}
170170

171171
override val isV2Destination: Boolean

0 commit comments

Comments
 (0)