Skip to content
Permalink
Browse files

Applying Scalariform

  • Loading branch information...
atooni committed Jun 4, 2019
1 parent 4810758 commit 4e089866e4ac1dcce6ccc68e6e8a165686f3e619
Showing with 350 additions and 360 deletions.
  1. +3 −3 ...emq.client/src/main/scala/blended/activemq/client/internal/DefaultVerificationFailedHandler.scala
  2. +3 −3 blended.akka.http/src/main/scala/blended/akka/http/HttpContext.scala
  3. +2 −2 blended.dependencies/src/main/scala/Blended.scala
  4. +3 −3 blended.domino/src/main/scala/blended/domino/TypesafeConfigWatching.scala
  5. +14 −14 blended.file/src/main/scala/blended/file/EnvelopeFileDropper.scala
  6. +83 −90 blended.jms.bridge/src/test/scala/blended/jms/bridge/internal/BridgeSpec.scala
  7. +13 −13 blended.jms.utils/src/main/scala/blended/jms/utils/BlendedJMSConnection.scala
  8. +1 −1 blended.launcher/src/main/scala/blended/launcher/LauncherException.scala
  9. +2 −2 blended.launcher/src/main/scala/blended/launcher/internal/ARM.scala
  10. +4 −4 blended.mgmt.mock/src/main/scala/blended/mgmt/mock/clients/ContainerActor.scala
  11. +5 −5 blended.mgmt.repo.rest/src/main/scala/blended/mgmt/repo/rest/internal/ArtifactRepoRoutes.scala
  12. +2 −2 blended.mgmt.repo/src/main/scala/blended/mgmt/repo/WritableArtifactRepo.scala
  13. +3 −3 blended.persistence.h2/src/main/scala/blended/persistence/jdbc/TypeName.scala
  14. +1 −1 ...es/blended.samples.camel/src/main/scala/blended/samples/camel/internal/CamelSampleActivator.scala
  15. +7 −7 blended.security.scep.standalone/src/main/scala/blended/security/scep/standalone/Cmdline.scala
  16. +12 −12 blended.security.ssl/src/test/scala/blended/security/ssl/internal/JavaKeystoreSpec.scala
  17. +6 −6 blended.security/jvm/src/main/scala/blended/security/PasswordCallbackHandler.scala
  18. +23 −29 blended.streams/src/main/scala/blended/streams/message/FlowEnvelope.scala
  19. +69 −67 blended.streams/src/main/scala/blended/streams/message/FlowMessage.scala
  20. +7 −7 blended.testsupport/src/main/scala/blended/testsupport/camel/protocol/protocol.scala
  21. +2 −2 blended.updater.config/jvm/src/main/scala/blended/updater/config/EnvPropertyProvider.scala
  22. +2 −2 blended.updater.config/jvm/src/main/scala/blended/updater/config/SystemPropertyProvider.scala
  23. +6 −6 blended.updater.config/jvm/src/main/scala/blended/updater/config/SystemPropertyResolver.scala
  24. +3 −3 blended.updater.config/jvm/src/main/scala/blended/updater/config/UuidPropertyProvider.scala
  25. +1 −1 ...ded.updater.config/shared/src/main/scala/blended/updater/config/ContainerRegistryResponseOK.scala
  26. +5 −4 blended.updater.config/shared/src/main/scala/blended/updater/config/FeatureRef.scala
  27. +1 −1 blended.updater.config/shared/src/main/scala/blended/updater/config/GeneratedConfig.scala
  28. +3 −3 blended.updater.config/shared/src/main/scala/blended/updater/config/OverlayRef.scala
  29. +2 −2 blended.updater.config/shared/src/main/scala/blended/updater/config/OverlaySet.scala
  30. +4 −4 blended.updater.config/shared/src/main/scala/blended/updater/config/Profile.scala
  31. +4 −4 blended.updater.config/shared/src/main/scala/blended/updater/config/ProfileGroup.scala
  32. +9 −9 blended.updater.config/shared/src/main/scala/blended/updater/config/ResolvedRuntimeConfig.scala
  33. +1 −1 blended.updater.config/shared/src/main/scala/blended/updater/config/SerializationException.scala
  34. +1 −1 blended.updater.config/shared/src/main/scala/blended/updater/config/UpdateContainerInfo.scala
  35. +2 −2 blended.updater.config/shared/src/test/scala/blended/updater/config/ProfileSpec.scala
  36. +3 −3 blended.updater.remote/src/main/scala/blended/updater/remote/ContainerStatePersistor.scala
  37. +2 −2 blended.updater.remote/src/main/scala/blended/updater/remote/OverlayConfigPersistor.scala
  38. +2 −2 blended.updater.remote/src/main/scala/blended/updater/remote/RuntimeConfigPersistor.scala
  39. +4 −4 blended.updater.remote/src/main/scala/blended/updater/remote/TransientContainerStatePersistor.scala
  40. +3 −3 blended.updater.remote/src/main/scala/blended/updater/remote/TransientOverlayConfigPersistor.scala
  41. +3 −3 blended.updater.remote/src/main/scala/blended/updater/remote/TransientRuntimeConfigPersistor.scala
  42. +1 −1 blended.updater/src/main/scala/blended/updater/ProfileActivator.scala
  43. +2 −2 blended.updater/src/main/scala/blended/updater/ProfileId.scala
  44. +2 −2 project/BlendedDependencies.scala
  45. +3 −3 project/BlendedDocsJs.scala
  46. +2 −2 project/BlendedSecurityCrypto.scala
  47. +1 −1 project/BlendedSecurityTest.scala
  48. +1 −1 project/CommonSettings.scala
  49. +4 −4 project/Dependencies.scala
  50. +3 −3 project/PublishConfig.scala
  51. +5 −5 project/RootSettings.scala
@@ -5,11 +5,11 @@ import blended.jms.utils.IdAwareConnectionFactory
import blended.util.logging.Logger
import org.osgi.framework.BundleContext

class DefaultVerificationFailedHandler(bundleContext: BundleContext) extends VerificationFailedHandler {
class DefaultVerificationFailedHandler(bundleContext : BundleContext) extends VerificationFailedHandler {

private val log: Logger = Logger[DefaultVerificationFailedHandler]
private val log : Logger = Logger[DefaultVerificationFailedHandler]

override def verificationFailed(cf: IdAwareConnectionFactory): Unit = {
override def verificationFailed(cf : IdAwareConnectionFactory) : Unit = {
// TODO: shutting down the container is a bit of overkill IMHO (TR), why not just unregister the connection?
log.error(s"Verification for connection [${cf.vendor}:${cf.provider}] has failed. Shutting down container ...")
bundleContext.getBundle(0).stop()
@@ -4,9 +4,9 @@ import akka.http.scaladsl.server.Route

// TODO: think about more advanced options like ranking and the possibility to explicitly allow to extend an existing service
trait HttpContext {
def prefix: String
def route: Route
def prefix : String
def route : Route
}

case class SimpleHttpContext(prefix: String, route: Route) extends HttpContext
case class SimpleHttpContext(prefix : String, route : Route) extends HttpContext

@@ -5,9 +5,9 @@ import sbt._
trait Blended {

// TODO: Find a way to generate the current version
def blendedVersion: String // = version.value
def blendedVersion : String // = version.value

def blended(name: String) = "de.wayofquality.blended" %% name % blendedVersion
def blended(name : String) = "de.wayofquality.blended" %% name % blendedVersion

val activemqBrokerstarter = blended("blended.activemq.brokerstarter")
val activemqClient = blended("blended.activemq.client")
@@ -10,12 +10,12 @@ import org.osgi.framework.BundleContext
trait TypesafeConfigWatching extends DominoImplicits {

/** Dependency */
protected def capsuleContext: CapsuleContext
protected def capsuleContext : CapsuleContext

/** Dependency */
protected def bundleContext: BundleContext
protected def bundleContext : BundleContext

def whenTypesafeConfigAvailable(f: (Config, ContainerIdentifierService) => Unit): Unit = {
def whenTypesafeConfigAvailable(f : (Config, ContainerIdentifierService) => Unit) : Unit = {
val m = new TypesafeConfigCapsule(capsuleContext, f, bundleContext)
capsuleContext.addCapsule(m)
}
@@ -12,21 +12,21 @@ import scala.concurrent.{ExecutionContext, Future, Promise}
import scala.util.{Failure, Success, Try}

class EnvelopeFileDropper(
cfg: FileDropConfig,
cfg : FileDropConfig,
headerConfig : FlowHeaderConfig,
dropActor : ActorRef,
log : Logger
)(implicit system: ActorSystem) extends JmsEnvelopeHeader {
)(implicit system : ActorSystem) extends JmsEnvelopeHeader {

// Get the content of the envelope as a ByteString which we can write to disk
private def extractContent(env: FlowEnvelope): Try[ByteString] = Try {
private def extractContent(env : FlowEnvelope) : Try[ByteString] = Try {
env.flowMessage match {
case tMsg: TextFlowMessage =>
case tMsg : TextFlowMessage =>
val charSet = env.headerWithDefault[String](cfg.charsetHeader, "UTF-8")
log.info(s"Using charset [$charSet] to file drop text message [${env.id}]")
ByteString(tMsg.getText().getBytes(charSet))

case bMsg: BinaryFlowMessage =>
case bMsg : BinaryFlowMessage =>
bMsg.content

case m =>
@@ -38,15 +38,15 @@ class EnvelopeFileDropper(

// Try to get the correlation Id from the message, fall back with the correlation ID from
// the FlowEnvelope, finally fall back with the envelope ID
private[this] def corrId(env: FlowEnvelope): String = {
private[this] def corrId(env : FlowEnvelope) : String = {
env.headerWithDefault[String](
"JMSCorrelationID",
env.headerWithDefault[String](corrIdHeader(headerConfig.prefix), env.id)
)
}

// extract the drop Command from the envelope
private[this] def dropCmd(env: FlowEnvelope)(f: FlowEnvelope => Try[ByteString]): Try[FileDropCommand] = Try {
private[this] def dropCmd(env : FlowEnvelope)(f : FlowEnvelope => Try[ByteString]) : Try[FileDropCommand] = Try {
FileDropCommand(
id = env.id,
content = f(env).get,
@@ -55,24 +55,24 @@ class EnvelopeFileDropper(
compressed = env.headerWithDefault[Boolean](cfg.compressHeader, false),
append = env.headerWithDefault[Boolean](cfg.appendHeader, false),
timestamp = env.headerWithDefault[Long](timestampHeader(headerConfig.prefix), System.currentTimeMillis()),
properties = Map("JMSCorrelationID" -> corrId(env)) ++ env.flowMessage.header.mapValues(_.value),
properties = Map("JMSCorrelationID" -> corrId(env)) ++ env.flowMessage.header.mapValues(_.value)
)
}

private[this] def handleError(env: FlowEnvelope, error: Throwable): FileDropResult = {
private[this] def handleError(env : FlowEnvelope, error : Throwable) : FileDropResult = {
log.error(s"Error dropping envelope [${env.id}] to file : [${error.getMessage()}]")
val cmd = dropCmd(env)(e => Success(ByteString(""))).get
val cmd = dropCmd(env)(_ => Success(ByteString(""))).get
FileDropResult(cmd, Some(error))
}

def dropEnvelope(env: FlowEnvelope): (FileDropCommand, Future[FileDropResult]) = {
def dropEnvelope(env : FlowEnvelope) : (FileDropCommand, Future[FileDropResult]) = {

val p: Promise[FileDropResult] = Promise()
val p : Promise[FileDropResult] = Promise()

dropCmd(env)(extractContent) match {
case Success(cmd) =>
implicit val to: Timeout = Timeout(cfg.dropTimeout)
implicit val eCtxt: ExecutionContext = system.dispatcher
implicit val to : Timeout = Timeout(cfg.dropTimeout)
implicit val eCtxt : ExecutionContext = system.dispatcher

(dropActor ? cmd).mapTo[FileDropResult].onComplete {
case Success(r) => p.complete(Success(r))

0 comments on commit 4e08986

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