package io.vamp.workflow_driver

import akka.actor.{ ActorRef, ActorSystem }
import akka.util.Timeout
import io.vamp.common.{ ClassProvider, Config, Namespace }
import io.vamp.common.akka.{ ActorBootstrap, IoC }
import io.vamp.workflow_driver.notification.{ UnsupportedWorkflowDriverError, WorkflowDriverNotificationProvider }

import scala.concurrent.{ ExecutionContext, Future }

class WorkflowDriverBootstrap extends ActorBootstrap with WorkflowDriverNotificationProvider {

  def createActors(implicit actorSystem: ActorSystem, namespace: Namespace, timeout: Timeout) = {
    implicit val ec: ExecutionContext = actorSystem.dispatcher
    val types = Config.string("vamp.workflow-driver.type")().toLowerCase.split(',').map(_.trim).toList

    val drivers: Future[List[ActorRef]] = Future.sequence(types.map { name ⇒
      ClassProvider.find[WorkflowDriver](name) match {
        case Some(clazz) ⇒ IoC.createActor(clazz)
        case None        ⇒ throwException(UnsupportedWorkflowDriverError(name))
      }
    })

    types.foreach { t ⇒ info(s"Workflow driver: $t") }
    drivers.flatMap(IoC.createActor[WorkflowDriverActor](_)).map(_ :: Nil)
  }
}

package io.vamp.workflow_driver

import akka.actor.{ActorRef, ActorSystem}
import akka.util.Timeout
import com.typesafe.scalalogging.LazyLogging
import io.vamp.common.{ClassProvider, Config, Namespace}
import io.vamp.common.akka.{ActorBootstrap, IoC}
import io.vamp.workflow_driver.notification.{UnsupportedWorkflowDriverError, WorkflowDriverNotificationProvider}

import scala.concurrent.{ExecutionContext, Future}

class WorkflowDriverBootstrap extends ActorBootstrap with WorkflowDriverNotificationProvider with LazyLogging {

  def createActors(implicit actorSystem: ActorSystem, namespace: Namespace, timeout: Timeout) = {
    implicit val ec: ExecutionContext = actorSystem.dispatcher
    val types = Config.string("vamp.workflow-driver.type")().toLowerCase.split(',').map(_.trim).toList

    val drivers: Future[List[ActorRef]] = Future.sequence(types.map { name ⇒
      ClassProvider.find[WorkflowDriver](name) match {
        case Some(clazz) ⇒ IoC.createActor(clazz)
        case None        ⇒ {
          logger.info(s"UnsupportedWorkflowDriverError : ${name}")
          throwException(UnsupportedWorkflowDriverError(name))
        }
      }
    })

    types.foreach { t ⇒ info(s"Workflow driver: $t") }
    drivers.flatMap(IoC.createActor[WorkflowDriverActor](_)).map(_ :: Nil)
  }
}

Add log to Worfflow Driver Bootstrap
Add log to Worfflow Driver Bootstrap
