Skip to content
Permalink
Browse files

Fixing typos

  • Loading branch information...
atooni committed Mar 16, 2019
1 parent 190fdd1 commit ee34bdd399cb4ea3a0b3f8843557da1d3402fda8
@@ -62,20 +62,25 @@ object BrokerConfig {

val resolve : String => Try[Any] = value => idSvc.resolvePropertyString(value)

val v = vendor(resolve)(cfg).getOrElse("activemq")
val p = provider(resolve)(cfg).getOrElse("activemq")

val jmsConfig : BlendedJMSConnectionConfig = BlendedJMSConnectionConfig.fromConfig(resolve)(v, p, cfg)

BrokerConfig(
vendor = vendor(resolve)(cfg).getOrElse("activemq"),
provider = provider(resolve)(cfg).getOrElse("activemq"),
clientId = clientId(resolve)(cfg).get,
jmxEnabled = jmxEnabled(cfg),
pingEnabled = pingEnabled(cfg),
pingTolerance = pingTolerance(cfg),
pingDestination = destination(cfg),
pingInterval = pingInterval(cfg),
pingTimeout = pingTimeout(cfg),
minReconnect = minReconnect(cfg),
maxReconnectTimeout = maxReconnectTimeout(cfg),
properties = properties(resolve)(cfg).get,
retryInterval = retryInterval(cfg),
vendor = jmsConfig.vendor,
provider = jmsConfig.provider,
clientId = jmsConfig.clientId,
jmxEnabled = jmsConfig.jmxEnabled,
pingEnabled = jmsConfig.pingEnabled,
pingTolerance = jmsConfig.pingTolerance,
pingDestination = jmsConfig.pingDestination,
pingInterval = jmsConfig.pingInterval,
pingTimeout = jmsConfig.pingTimeout,
minReconnect = jmsConfig.minReconnect,
maxReconnectTimeout = jmsConfig.maxReconnectTimeout,
properties = jmsConfig.properties,
retryInterval = jmsConfig.retryInterval,

brokerName = name(resolve)(cfg).getOrElse(brokerName),
file = file(resolve)(cfg).getOrElse(s"$brokerName.amq"),
@@ -36,41 +36,41 @@ object BlendedJMSConnectionConfig {
jmsClassloader = None
)

val enabled : Config => Boolean = cfg => cfg.getBoolean("enabled", defaultConfig.enabled)
val jmxEnabled : Config => Boolean = cfg => cfg.getBoolean("jmxEnabled", defaultConfig.jmxEnabled)
val pingEnabled : Config => Boolean = cfg => cfg.getBoolean("pingEnabled", defaultConfig.pingEnabled)
val pingTolerance : Config => Int = cfg => cfg.getInt("pingTolerance", defaultConfig.pingTolerance)
val pingInterval : Config => FiniteDuration = cfg => cfg.getDuration("pingInterval", defaultConfig.pingInterval)
val pingTimeout : Config => FiniteDuration = cfg => cfg.getDuration("pingTimeout", defaultConfig.pingTimeout)
val retryInterval : Config => FiniteDuration = cfg => cfg.getDuration("retryInterval", defaultConfig.retryInterval)
val minReconnect : Config => FiniteDuration = cfg => cfg.getDuration("minReconnect", defaultConfig.minReconnect)
val maxReconnectTimeout : Config => Option[FiniteDuration] = cfg => cfg.getDurationOption("maxReconnectTimeout")
def fromConfig(stringResolver : String => Try[Any])(vendor: String, provider: String, cfg: Config) : BlendedJMSConnectionConfig = {

val defaultUser : Config => Option[String] = cfg => cfg.getStringOption(DEFAULT_USER)
val defaultPasswd : Config => Option[String] = cfg => cfg.getStringOption(DEFAULT_PWD)
val destination : Config => String = cfg => cfg.getString("destination", defaultConfig.pingDestination)
val enabled : Config => Boolean = cfg => cfg.getBoolean("enabled", defaultConfig.enabled)
val jmxEnabled : Config => Boolean = cfg => cfg.getBoolean("jmxEnabled", defaultConfig.jmxEnabled)
val pingEnabled : Config => Boolean = cfg => cfg.getBoolean("pingEnabled", defaultConfig.pingEnabled)
val pingTolerance : Config => Int = cfg => cfg.getInt("pingTolerance", defaultConfig.pingTolerance)
val pingInterval : Config => FiniteDuration = cfg => cfg.getDuration("pingInterval", defaultConfig.pingInterval)
val pingTimeout : Config => FiniteDuration = cfg => cfg.getDuration("pingTimeout", defaultConfig.pingTimeout)
val retryInterval : Config => FiniteDuration = cfg => cfg.getDuration("retryInterval", defaultConfig.retryInterval)
val minReconnect : Config => FiniteDuration = cfg => cfg.getDuration("minReconnect", defaultConfig.minReconnect)
val maxReconnectTimeout : Config => Option[FiniteDuration] = cfg => cfg.getDurationOption("maxReconnectTimeout")

val properties : (String => Try[Any]) => Config => Try[Map[String, String]] = stringResolver => cfg => Try {
ConfigPropertyMapConverter.getKeyAsPropertyMap(cfg, "properties", Option(() => defaultConfig.properties))
.mapValues { v =>
stringResolver(v) match {
case Failure(t) => throw t
case Success(s) => s.toString()
}
}
}
val defaultUser : Config => Option[String] = cfg => cfg.getStringOption(DEFAULT_USER).map{ u => stringResolver(u).get }.map(_.toString)
val defaultPasswd : Config => Option[String] = cfg => cfg.getStringOption(DEFAULT_PWD).map{ p => stringResolver(p).get }.map(_.toString)
val destination : Config => String = cfg => cfg.getString("destination", defaultConfig.pingDestination)

val jndiName : Config => Option[String] = cfg => cfg.getStringOption(CF_JNDI_NAME)
val useJndi : Config => Boolean = cfg => cfg.getBoolean(USE_JNDI, defaultConfig.useJndi)
val properties : (String => Try[Any]) => Config => Try[Map[String, String]] = stringResolver => cfg => Try {
ConfigPropertyMapConverter.getKeyAsPropertyMap(cfg, "properties", Option(() => defaultConfig.properties))
.mapValues { v =>
stringResolver(v) match {
case Failure(t) => throw t
case Success(s) => s.toString()
}
}
}

val clientId : (String => Try[Any]) => Config => Try[String] = stringResolver => cfg => Try {
cfg.getStringOption("clientId") match {
case None => defaultConfig.clientId
case Some(s) => stringResolver(s).map(_.toString).get
val clientId : Config => Try[String] = cfg => Try {
cfg.getStringOption("clientId") match {
case None => defaultConfig.clientId
case Some(s) => stringResolver(s).map(_.toString).get
}
}
}

def fromConfig(stringResolver : String => Try[Any])(vendor: String, provider: String, cfg: Config) : BlendedJMSConnectionConfig = {
val jndiName : Config => Option[String] = cfg => cfg.getStringOption(CF_JNDI_NAME)
val useJndi : Config => Boolean = cfg => cfg.getBoolean(USE_JNDI, defaultConfig.useJndi)

BlendedJMSConnectionConfig(
vendor = vendor,
@@ -84,7 +84,7 @@ object BlendedJMSConnectionConfig {
retryInterval = retryInterval(cfg),
minReconnect = minReconnect(cfg),
maxReconnectTimeout = maxReconnectTimeout(cfg),
clientId = clientId(stringResolver)(cfg).get,
clientId = clientId(cfg).get,
defaultUser = defaultUser(cfg),
defaultPassword = defaultPasswd(cfg),
pingDestination = destination(cfg),
@@ -46,7 +46,9 @@ class CertificateActivator extends DominoActivator with TypesafeConfigWatching {
}
}

val distinctProviderNames : List[String] = mgrConfig.certConfigs.map(_.provider).distinct
val distinctProviderNames : List[String] =
(mgrConfig.providerList ::: mgrConfig.certConfigs.map(_.provider)).distinct

waitForProvider(distinctProviderNames, Map.empty)
}

@@ -42,6 +42,7 @@ case class CertificateManagerConfig(
clientOnly : Boolean,
maintainTruststore : Boolean,
keystoreCfg : Option[KeystoreConfig],
providerList : List[String],
certConfigs: List[CertificateConfig],
refresherConfig: Option[RefresherConfig],
skipInitialCheck: Boolean,
@@ -66,6 +67,8 @@ object CertificateManagerConfig {
Some(KeystoreConfig.fromConfig(cfg, hasher))
}

val providers : List[String] = cfg.getStringList("providerList", List.empty)

val certConfigs = cfg.getConfigMap("certificates", Map.empty).map {
case (k, v) =>
CertificateConfig.fromConfig(k, v, idSvc)
@@ -84,6 +87,7 @@ object CertificateManagerConfig {
certConfigs = certConfigs,
refresherConfig = refresherConfig,
skipInitialCheck = skipInitialCheck,
providerList = providers,
validCypherSuites = cyphers
)
}

0 comments on commit ee34bdd

Please sign in to comment.
You can’t perform that action at this time.