2011-12-07 16:29:12 +01:00
|
|
|
/**
|
|
|
|
|
* Copyright (C) 2009-2011 Typesafe Inc. <http://www.typesafe.com>
|
|
|
|
|
*/
|
|
|
|
|
package akka.remote
|
|
|
|
|
|
|
|
|
|
import akka.actor._
|
2011-12-13 01:09:05 +01:00
|
|
|
import akka.routing._
|
2011-12-07 16:29:12 +01:00
|
|
|
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._
|
|
|
|
|
|
2011-12-13 01:09:05 +01:00
|
|
|
super.parseConfig(path, config) match {
|
|
|
|
|
case d @ Some(deploy) ⇒
|
|
|
|
|
deploy.config.getString("remote") match {
|
|
|
|
|
case RemoteAddressExtractor(r) ⇒ Some(deploy.copy(scope = RemoteScope(r)))
|
|
|
|
|
case str ⇒
|
|
|
|
|
if (!str.isEmpty) throw new ConfigurationException("unparseable remote node name " + str)
|
|
|
|
|
val nodes = deploy.config.getStringList("target.nodes").asScala
|
|
|
|
|
if (nodes.isEmpty || deploy.routing == NoRouter) d
|
2012-01-17 14:48:46 +01:00
|
|
|
else Some(deploy.copy(routing = new RemoteRouterConfig(deploy.routing, nodes)))
|
2011-12-13 01:09:05 +01:00
|
|
|
}
|
|
|
|
|
case None ⇒ None
|
|
|
|
|
}
|
2011-12-07 16:29:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|