Skip to content

Commit

Permalink
Moving or removing unused traits (#1051)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidsloan committed Mar 19, 2024
1 parent 9f96469 commit 302a6e1
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ case class S3SinkConfigDefBuilder(props: Map[String, String])
with CloudSinkConfigDefBuilder
with ErrorPolicySettings
with NumberRetriesSettings
with UserSettings
with ConnectionSettings
with DeleteModeSettings {

def getParsedValues: Map[String, _] = values().asScala.toMap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ case class DatalakeSinkConfigDefBuilder(props: Map[String, String])
with CloudSinkConfigDefBuilder
with ErrorPolicySettings
with NumberRetriesSettings
with UserSettings
with ConnectionSettings
with AuthModeSettings {

def getParsedValues: Map[String, _] = values().asScala.toMap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@
package io.lenses.streamreactor.connect.cloud.common.source.config

import io.lenses.streamreactor.common.config.base.traits.BaseConfig
import io.lenses.streamreactor.common.config.base.traits.ConnectionSettings
import io.lenses.streamreactor.common.config.base.traits.ErrorPolicySettings
import io.lenses.streamreactor.common.config.base.traits.KcqlSettings
import io.lenses.streamreactor.common.config.base.traits.NumberRetriesSettings
import io.lenses.streamreactor.common.config.base.traits.UserSettings
import io.lenses.streamreactor.connect.cloud.common.config.CompressionCodecSettings
import org.apache.kafka.common.config.ConfigDef

Expand All @@ -33,6 +31,4 @@ abstract class CloudSourceConfigDefBuilder(
with KcqlSettings
with ErrorPolicySettings
with NumberRetriesSettings
with UserSettings
with ConnectionSettings
with CompressionCodecSettings {}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ import io.lenses.streamreactor.common.config.base.const.TraitConfigConst.USERNAM
* stream-reactor
*/
trait UserSettings extends BaseSettings {
val passwordConst = s"$connectorPrefix.$PASSWORD_SUFFIX"
val usernameConst = s"$connectorPrefix.$USERNAME_SUFFIX"
private val passwordConst = s"$connectorPrefix.$PASSWORD_SUFFIX"
private val usernameConst = s"$connectorPrefix.$USERNAME_SUFFIX"

def getSecret = getPassword(passwordConst)
def getUsername = getString(usernameConst)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ case class GCPStorageSinkConfigDefBuilder(props: Map[String, String])
with CloudSinkConfigDefBuilder
with ErrorPolicySettings
with NumberRetriesSettings
with UserSettings
with ConnectionSettings
with AuthModeSettings
with UploadSettings {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,4 +288,4 @@ case class JMSConfig(props: Map[String, String])
with ErrorPolicySettings
with NumberRetriesSettings
with UserSettings
with ConnectionSettings
with UrlSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright 2017-2024 Lenses.io Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.lenses.streamreactor.connect.jms.config

/**
* Created by [email protected] on 31/07/2017.
* stream-reactor
*/

import io.lenses.streamreactor.common.config.base.const.TraitConfigConst._
import io.lenses.streamreactor.common.config.base.traits.BaseSettings
import org.apache.kafka.common.config.ConfigException

trait UrlSettings extends BaseSettings {
private val urlConst = s"$connectorPrefix.$URL_SUFFIX"

def getUrl: String = {
val url = getString(urlConst)
if (url == null || url.trim.isEmpty) {
throw new ConfigException(s"$urlConst has not been set")
}
url
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.lenses.streamreactor.common.config.base.traits
package io.lenses.streamreactor.connect.mqtt.config

/**
* Created by [email protected] on 31/07/2017.
* stream-reactor
*/

import io.lenses.streamreactor.common.config.base.const.TraitConfigConst._
import io.lenses.streamreactor.common.config.base.traits.BaseSettings
import org.apache.kafka.common.config.ConfigException

trait ConnectionSettings extends BaseSettings {
val urlConst = s"$connectorPrefix.$URL_SUFFIX"
val hostConst = s"$connectorPrefix.$CONNECTION_HOST_SUFFIX"
val hostsConst = s"$connectorPrefix.$CONNECTION_HOSTS_SUFFIX"
val portConst = s"$connectorPrefix.$CONNECTION_PORT_SUFFIX"

def getPort = getInt(portConst)

def getUrl: String = {
val url = getString(urlConst)
if (url == null || url.trim.isEmpty) {
throw new ConfigException(s"$urlConst has not been set")
}
url
}
trait HostSettings extends BaseSettings {
private val hostsConst = s"$connectorPrefix.$CONNECTION_HOSTS_SUFFIX"

def getHosts: String = {
val connection = getString(hostsConst)
Expand All @@ -48,12 +36,4 @@ trait ConnectionSettings extends BaseSettings {
connection
}

def getHost: String = {
val connection = getString(hostConst)

if (connection == null || connection.trim.isEmpty) {
throw new ConfigException(s"$hostsConst is not provided!")
}
connection
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -303,5 +303,5 @@ trait MqttConfigBase
with NumberRetriesSettings
with ErrorPolicySettings
with SSLSettings
with ConnectionSettings
with HostSettings
with UserSettings

0 comments on commit 302a6e1

Please sign in to comment.