2011-12-07 16:29:12 +01:00
|
|
|
/**
|
|
|
|
|
* Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
|
|
|
|
|
*/
|
|
|
|
|
package akka.remote
|
|
|
|
|
|
|
|
|
|
import akka.actor._
|
|
|
|
|
import akka.event.EventStream
|
|
|
|
|
import com.typesafe.config._
|
|
|
|
|
import akka.config.ConfigurationException
|
|
|
|
|
|
2011-12-12 23:31:15 +01:00
|
|
|
case class RemoteScope(node: UnparsedSystemAddress[UnparsedTransportAddress]) extends Scope
|
2011-12-07 16:29:12 +01:00
|
|
|
|
2011-12-09 20:19:59 +01:00
|
|
|
class RemoteDeployer(_settings: ActorSystem.Settings) extends Deployer(_settings) {
|
2011-12-07 16:29:12 +01:00
|
|
|
|
2011-12-09 20:19:59 +01:00
|
|
|
override protected def parseConfig(path: String, config: Config): Option[Deploy] = {
|
2011-12-07 16:29:12 +01:00
|
|
|
import scala.collection.JavaConverters._
|
|
|
|
|
import akka.util.ReflectiveAccess._
|
|
|
|
|
|
2011-12-09 20:19:59 +01:00
|
|
|
val deployment = config.withFallback(default)
|
2011-12-07 16:29:12 +01:00
|
|
|
|
2011-12-09 20:19:59 +01:00
|
|
|
val transform: Deploy ⇒ Deploy =
|
|
|
|
|
if (deployment.hasPath("remote")) deployment.getString("remote") match {
|
|
|
|
|
case RemoteAddressExtractor(r) ⇒ (d ⇒ d.copy(scope = RemoteScope(r)))
|
2011-12-11 20:00:26 +01:00
|
|
|
case x ⇒ identity
|
2011-12-09 20:19:59 +01:00
|
|
|
}
|
|
|
|
|
else identity
|
2011-12-07 16:29:12 +01:00
|
|
|
|
2011-12-09 20:19:59 +01:00
|
|
|
super.parseConfig(path, config) map transform
|
2011-12-07 16:29:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|