Packages

  • package root

    Akka based micro service proving general leaderboard functionality for applications such as back-end game servers.

    Leaderboard Micro Service

    Akka based micro service proving general leaderboard functionality for applications such as back-end game servers.

    Overview

    Definition Classes
    root
  • package net
    Definition Classes
    root
  • package kolotyluk
    Definition Classes
    net
  • package scala
    Definition Classes
    kolotyluk
  • package extras

    Extra utilities for Scala developers.

    Extra Utilities

    Extra utilities for Scala developers.

    Some things it might have been nice to see in the standard Scala libraries, but are offered here instead. For example:

    object Main
      extends App
        with Configuration
        with Environment
        with Logging {
    
      // Safest way to indicate something is happening, don't rely on logging yet
      println(s"Starting ${getClass.getName}...")
    
      println("Reporting environment and configuration for troubleshooting purposes")
      println(environment.getEnvironmentReport())
      println(config.getConfigurationReport())
    
      // If logging is broken, hopefully there is enough output now for a diagnosis
      logger.info("Logging started")
    }

    Base 64 URL Identifiers

    Sometimes it's nice to encode a 128-bit UUID as a 22-character Base 64 URL String, such as "keAoZQECSwm0h7v6yw_3WQ". Normally a UUID is expressed as a 36-character string such as "91e02865-0102-4b09-b487-bbfacb0ff759", so this is a simple way of saving 14 characters in URL encoding. For example

    curl http://localhost/foo/keAoZQECSwm0h7v6yw_3WQ

    Would internally refer to a resource for "foo/91e02865-0102-4b09-b487-bbfacb0ff759"

    Definition Classes
    scala
  • Configuration
  • Environment
  • Identity
  • Internalized
  • InvalidBase64UrlToUuidException
  • Logging
t

net.kolotyluk.scala.extras

Configuration

trait Configuration extends Logging

Enhanced Typesafe Config

Extra features for Typesafe Config

It is recommended that you extend this trait in your app, in the same style, but for local configuration. For example:

trait Configuration extends net.kolotyluk.scala.extras.Configuration {

  config.setPathBase("net.flybynight.myapp")

  implicit class LocalConfiguration(val config: com.typesafe.config.Config) extends Logging  {
    import com.typesafe.config.Config

    // net.flybynight.myapp.akka.system.name
    def getAkkaSystemName(default: Some[String] = Some("myapp")): String  = config.getDefaultString("akka.system.name", default)
    def getRestAddress(default: Some[String] = Some("0.0.0.0")) : String = config.getDefaultString("rest.address", default)
    def getRestPort(default: Some[Int] = Some(8080)) : Int = config.getDefaultInt("rest.port", default, 0 to 65535)
  }
}

Good Separation of Concerns practice would be to make your configuration code as robust as possible. You main application should not handle any configuration problems, rather all configuration troubleshooting should be in your Configuration trait. In the main body of code you might use:

val akkaSystemName = config.getAkkaSystemName()
val restAddress = config.getRestAddress()
val restPort = config.getRestPort()
Linear Supertypes
Logging, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Configuration
  2. Logging
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. class ConfigurationError extends Error

    Indicates and unrecoverable configuration problem was encountered.

    Fatal Configuration Error

    Indicates and unrecoverable configuration problem was encountered.

    A ConfigurationError indicates an unrecoverable condition was encountered during configuration, and that the application or service should be terminated. Configuration problems are usually human error when initially setting up an application or service, so it's generally best to fail big, and fail early, so that the problem can be remedied.

  2. implicit class ExtraConfiguration extends Logging

    Implicit Local Configuration

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate() @throws( ... )
  6. val config: Config

    The basic Typesafe Config with extra implicit members defined on it.

    Enhanced Typesafe Config

    The basic Typesafe Config with extra implicit members defined on it.

  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  9. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  11. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  12. lazy val logger: Logger

    The Grizzled Logger so that we can use lazy Scala String Interpolation For example:

    Grizzled Logger

    The Grizzled Logger so that we can use lazy Scala String Interpolation For example:

    val foo = "foo"
    val bar = 2
    logger.debug(s"@foo $bar")

    Where s"$foo $bar" is only evaluated if logging level is "DEBUG" or higher

    This is lazy so that startup messaging can work without logging failures disrupting things. For example net.kolotyluk.scala.extras.

    Definition Classes
    Logging
  13. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  15. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  16. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  17. def toString(): String
    Definition Classes
    AnyRef → Any
  18. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  20. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. object PathBase extends Logging

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @Deprecated @deprecated @throws( classOf[java.lang.Throwable] )
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from Logging

Inherited from AnyRef

Inherited from Any

Ungrouped