From 5fe27b523b4ed6885daa2323a89787403e226e50 Mon Sep 17 00:00:00 2001 From: Roland Date: Mon, 27 Feb 2012 10:28:20 +0100 Subject: [PATCH] rename AddressExtractor to AddressFromURIString, see #1865 --- akka-actor/src/main/scala/akka/actor/Address.scala | 8 ++++---- .../src/main/scala/akka/cluster/ClusterSettings.scala | 4 ++-- .../code/akka/docs/jrouting/RouterViaProgramExample.java | 4 ++-- .../akka/docs/remoting/RemoteDeploymentDocTestBase.java | 4 ++-- .../code/akka/docs/remoting/RemoteDeploymentDocSpec.scala | 4 ++-- .../code/akka/docs/routing/RouterViaProgramExample.scala | 4 ++-- .../src/main/scala/akka/remote/RemoteDeployer.scala | 4 ++-- .../src/main/scala/akka/remote/RemoteSettings.scala | 2 +- .../src/main/scala/akka/remote/RemoteTransport.scala | 4 ++-- .../src/main/scala/akka/routing/RemoteRouterConfig.scala | 2 +- .../src/test/scala/akka/remote/RemoteRouterSpec.scala | 8 ++++---- 11 files changed, 24 insertions(+), 24 deletions(-) diff --git a/akka-actor/src/main/scala/akka/actor/Address.scala b/akka-actor/src/main/scala/akka/actor/Address.scala index e5335bcac1..d70d90151d 100644 --- a/akka-actor/src/main/scala/akka/actor/Address.scala +++ b/akka-actor/src/main/scala/akka/actor/Address.scala @@ -61,7 +61,7 @@ object RelativeActorPath { /** * This object serves as extractor for Scala and as address parser for Java. */ -object AddressExtractor { +object AddressFromURIString { def unapply(addr: String): Option[Address] = try { val uri = new URI(addr) @@ -87,8 +87,8 @@ object AddressExtractor { * Try to construct an Address from the given String or throw a java.net.MalformedURLException. */ def apply(addr: String): Address = addr match { - case AddressExtractor(address) ⇒ address - case _ ⇒ throw new MalformedURLException + case AddressFromURIString(address) ⇒ address + case _ ⇒ throw new MalformedURLException } /** @@ -102,7 +102,7 @@ object ActorPathExtractor { try { val uri = new URI(addr) if (uri.getPath == null) None - else AddressExtractor.unapply(uri) match { + else AddressFromURIString.unapply(uri) match { case None ⇒ None case Some(addr) ⇒ Some((addr, ActorPath.split(uri.getPath).drop(1))) } diff --git a/akka-cluster/src/main/scala/akka/cluster/ClusterSettings.scala b/akka-cluster/src/main/scala/akka/cluster/ClusterSettings.scala index e88c3ae72c..dc081623bc 100644 --- a/akka-cluster/src/main/scala/akka/cluster/ClusterSettings.scala +++ b/akka-cluster/src/main/scala/akka/cluster/ClusterSettings.scala @@ -9,7 +9,7 @@ import java.util.concurrent.TimeUnit.MILLISECONDS import akka.config.ConfigurationException import scala.collection.JavaConverters._ import akka.actor.Address -import akka.actor.AddressExtractor +import akka.actor.AddressFromURIString class ClusterSettings(val config: Config, val systemName: String) { import config._ @@ -21,6 +21,6 @@ class ClusterSettings(val config: Config, val systemName: String) { val InitialDelayForGossip = Duration(getMilliseconds("akka.cluster.gossip.initial-delay"), MILLISECONDS) val GossipFrequency = Duration(getMilliseconds("akka.cluster.gossip.frequency"), MILLISECONDS) val SeedNodes = Set.empty[Address] ++ getStringList("akka.cluster.seed-nodes").asScala.collect { - case AddressExtractor(addr) ⇒ addr + case AddressFromURIString(addr) ⇒ addr } } diff --git a/akka-docs/java/code/akka/docs/jrouting/RouterViaProgramExample.java b/akka-docs/java/code/akka/docs/jrouting/RouterViaProgramExample.java index 52a721ed0d..44984c3ec7 100644 --- a/akka-docs/java/code/akka/docs/jrouting/RouterViaProgramExample.java +++ b/akka-docs/java/code/akka/docs/jrouting/RouterViaProgramExample.java @@ -11,7 +11,7 @@ import akka.actor.Props; import akka.actor.UntypedActor; import akka.actor.ActorSystem; import akka.actor.Address; -import akka.actor.AddressExtractor; +import akka.actor.AddressFromURIString; import java.util.Arrays; public class RouterViaProgramExample { @@ -73,7 +73,7 @@ public class RouterViaProgramExample { //#remoteRoutees Address addr1 = new Address("akka", "remotesys", "otherhost", 1234); - Address addr2 = AddressExtractor.parse("akka://othersys@anotherhost:1234"); + Address addr2 = AddressFromURIString.parse("akka://othersys@anotherhost:1234"); Address[] addresses = new Address[] { addr1, addr2 }; ActorRef routerRemote = system.actorOf(new Props(ExampleActor.class) .withRouter(new RemoteRouterConfig(new RoundRobinRouter(5), addresses))); diff --git a/akka-docs/java/code/akka/docs/remoting/RemoteDeploymentDocTestBase.java b/akka-docs/java/code/akka/docs/remoting/RemoteDeploymentDocTestBase.java index 373bcf0c44..b105e2b42a 100644 --- a/akka-docs/java/code/akka/docs/remoting/RemoteDeploymentDocTestBase.java +++ b/akka-docs/java/code/akka/docs/remoting/RemoteDeploymentDocTestBase.java @@ -10,7 +10,7 @@ import org.junit.Test; //#import import akka.actor.ActorRef; import akka.actor.Address; -import akka.actor.AddressExtractor; +import akka.actor.AddressFromURIString; import akka.actor.Deploy; import akka.actor.Props; import akka.actor.ActorSystem; @@ -35,7 +35,7 @@ public class RemoteDeploymentDocTestBase { public void demonstrateDeployment() { //#make-address Address addr = new Address("akka", "sys", "host", 1234); - addr = AddressExtractor.parse("akka://sys@host:1234"); // the same + addr = AddressFromURIString.parse("akka://sys@host:1234"); // the same //#make-address //#deploy ActorRef ref = system.actorOf(new Props(RemoteDeploymentDocSpec.Echo.class).withDeploy(new Deploy(new RemoteScope(addr)))); diff --git a/akka-docs/scala/code/akka/docs/remoting/RemoteDeploymentDocSpec.scala b/akka-docs/scala/code/akka/docs/remoting/RemoteDeploymentDocSpec.scala index a8d75512c5..0c65b3dc76 100644 --- a/akka-docs/scala/code/akka/docs/remoting/RemoteDeploymentDocSpec.scala +++ b/akka-docs/scala/code/akka/docs/remoting/RemoteDeploymentDocSpec.scala @@ -6,7 +6,7 @@ package akka.docs.remoting import akka.actor.{ ExtendedActorSystem, ActorSystem, Actor, ActorRef } import akka.testkit.{ AkkaSpec, ImplicitSender } //#import -import akka.actor.{ Props, Deploy, Address, AddressExtractor } +import akka.actor.{ Props, Deploy, Address, AddressFromURIString } import akka.remote.RemoteScope //#import @@ -43,7 +43,7 @@ class RemoteDeploymentDocSpec extends AkkaSpec(""" "demonstrate address extractor" in { //#make-address - val one = AddressExtractor("akka://sys@host:1234") + val one = AddressFromURIString("akka://sys@host:1234") val two = Address("akka", "sys", "host", 1234) // this gives the same //#make-address one must be === two diff --git a/akka-docs/scala/code/akka/docs/routing/RouterViaProgramExample.scala b/akka-docs/scala/code/akka/docs/routing/RouterViaProgramExample.scala index 3750e42635..50b141e7b7 100644 --- a/akka-docs/scala/code/akka/docs/routing/RouterViaProgramExample.scala +++ b/akka-docs/scala/code/akka/docs/routing/RouterViaProgramExample.scala @@ -42,10 +42,10 @@ object RoutingProgrammaticallyExample extends App { 1 to 6 foreach { i ⇒ router3 ! Message1(i) } //#remoteRoutees - import akka.actor.{ Address, AddressExtractor } + import akka.actor.{ Address, AddressFromURIString } val addresses = Seq( Address("akka", "remotesys", "otherhost", 1234), - AddressExtractor("akka://othersys@anotherhost:1234")) + AddressFromURIString("akka://othersys@anotherhost:1234")) val routerRemote = system.actorOf(Props[ExampleActor1].withRouter( RemoteRouterConfig(RoundRobinRouter(5), addresses))) //#remoteRoutees diff --git a/akka-remote/src/main/scala/akka/remote/RemoteDeployer.scala b/akka-remote/src/main/scala/akka/remote/RemoteDeployer.scala index 61a3459e9d..0858c66405 100644 --- a/akka-remote/src/main/scala/akka/remote/RemoteDeployer.scala +++ b/akka-remote/src/main/scala/akka/remote/RemoteDeployer.scala @@ -20,10 +20,10 @@ class RemoteDeployer(_settings: ActorSystem.Settings, _pm: DynamicAccess) extend super.parseConfig(path, config) match { case d @ Some(deploy) ⇒ deploy.config.getString("remote") match { - case AddressExtractor(r) ⇒ Some(deploy.copy(scope = RemoteScope(r))) + case AddressFromURIString(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 map (AddressExtractor(_)) + val nodes = deploy.config.getStringList("target.nodes").asScala map (AddressFromURIString(_)) if (nodes.isEmpty || deploy.routerConfig == NoRouter) d else Some(deploy.copy(routerConfig = RemoteRouterConfig(deploy.routerConfig, nodes))) } diff --git a/akka-remote/src/main/scala/akka/remote/RemoteSettings.scala b/akka-remote/src/main/scala/akka/remote/RemoteSettings.scala index 5c29d22161..ef30206a42 100644 --- a/akka-remote/src/main/scala/akka/remote/RemoteSettings.scala +++ b/akka-remote/src/main/scala/akka/remote/RemoteSettings.scala @@ -10,7 +10,7 @@ import java.net.InetAddress import akka.config.ConfigurationException import scala.collection.JavaConverters._ import akka.actor.Address -import akka.actor.AddressExtractor +import akka.actor.AddressFromURIString class RemoteSettings(val config: Config, val systemName: String) { import config._ diff --git a/akka-remote/src/main/scala/akka/remote/RemoteTransport.scala b/akka-remote/src/main/scala/akka/remote/RemoteTransport.scala index 2937ac233b..0a5088adcd 100644 --- a/akka-remote/src/main/scala/akka/remote/RemoteTransport.scala +++ b/akka-remote/src/main/scala/akka/remote/RemoteTransport.scala @@ -5,7 +5,7 @@ package akka.remote import scala.reflect.BeanProperty -import akka.actor.{ Terminated, LocalRef, InternalActorRef, AutoReceivedMessage, AddressExtractor, Address, ActorSystemImpl, ActorSystem, ActorRef } +import akka.actor.{ Terminated, LocalRef, InternalActorRef, AutoReceivedMessage, AddressFromURIString, Address, ActorSystemImpl, ActorSystem, ActorRef } import akka.dispatch.SystemMessage import akka.event.{ LoggingAdapter, Logging } import akka.AkkaException @@ -284,7 +284,7 @@ trait RemoteMarshallingOps { case r: RemoteRef ⇒ if (provider.remoteSettings.LogReceive) log.debug("received remote-destined message {}", remoteMessage) remoteMessage.originalReceiver match { - case AddressExtractor(address) if address == provider.transport.address ⇒ + case AddressFromURIString(address) if address == provider.transport.address ⇒ // if it was originally addressed to us but is in fact remote from our point of view (i.e. remote-deployed) r.!(remoteMessage.payload)(remoteMessage.sender) case r ⇒ log.error("dropping message {} for non-local recipient {} at {} local is {}", remoteMessage.payload, r, address, provider.transport.address) diff --git a/akka-remote/src/main/scala/akka/routing/RemoteRouterConfig.scala b/akka-remote/src/main/scala/akka/routing/RemoteRouterConfig.scala index 45e059dab6..c9bb6dba0f 100644 --- a/akka-remote/src/main/scala/akka/routing/RemoteRouterConfig.scala +++ b/akka-remote/src/main/scala/akka/routing/RemoteRouterConfig.scala @@ -12,7 +12,7 @@ import akka.actor.InternalActorRef import akka.actor.Props import akka.config.ConfigurationException import akka.remote.RemoteScope -import akka.actor.AddressExtractor +import akka.actor.AddressFromURIString import akka.actor.SupervisorStrategy import akka.actor.Address diff --git a/akka-remote/src/test/scala/akka/remote/RemoteRouterSpec.scala b/akka-remote/src/test/scala/akka/remote/RemoteRouterSpec.scala index acf7ba4f40..4b090a0e79 100644 --- a/akka-remote/src/test/scala/akka/remote/RemoteRouterSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/RemoteRouterSpec.scala @@ -133,7 +133,7 @@ akka.actor.deployment { "deploy remote routers based on explicit deployment" in { val router = system.actorOf(Props[Echo].withRouter(RoundRobinRouter(2)) - .withDeploy(Deploy(scope = RemoteScope(AddressExtractor("akka://remote_sys@localhost:12347")))), "remote-blub2") + .withDeploy(Deploy(scope = RemoteScope(AddressFromURIString("akka://remote_sys@localhost:12347")))), "remote-blub2") router.path.address.toString must be("akka://remote_sys@localhost:12347") val replies = for (i ← 1 to 5) yield { router ! "" @@ -150,7 +150,7 @@ akka.actor.deployment { "let remote deployment be overridden by local configuration" in { val router = system.actorOf(Props[Echo].withRouter(RoundRobinRouter(2)) - .withDeploy(Deploy(scope = RemoteScope(AddressExtractor("akka://remote_sys@localhost:12347")))), "local-blub") + .withDeploy(Deploy(scope = RemoteScope(AddressFromURIString("akka://remote_sys@localhost:12347")))), "local-blub") router.path.address.toString must be("akka://RemoteRouterSpec") val replies = for (i ← 1 to 5) yield { router ! "" @@ -167,7 +167,7 @@ akka.actor.deployment { "let remote deployment router be overridden by local configuration" in { val router = system.actorOf(Props[Echo].withRouter(RoundRobinRouter(2)) - .withDeploy(Deploy(scope = RemoteScope(AddressExtractor("akka://remote_sys@localhost:12347")))), "local-blub2") + .withDeploy(Deploy(scope = RemoteScope(AddressFromURIString("akka://remote_sys@localhost:12347")))), "local-blub2") router.path.address.toString must be("akka://remote_sys@localhost:12347") val replies = for (i ← 1 to 5) yield { router ! "" @@ -184,7 +184,7 @@ akka.actor.deployment { "let remote deployment be overridden by remote configuration" in { val router = system.actorOf(Props[Echo].withRouter(RoundRobinRouter(2)) - .withDeploy(Deploy(scope = RemoteScope(AddressExtractor("akka://remote_sys@localhost:12347")))), "remote-override") + .withDeploy(Deploy(scope = RemoteScope(AddressFromURIString("akka://remote_sys@localhost:12347")))), "remote-override") router.path.address.toString must be("akka://remote_sys@localhost:12347") val replies = for (i ← 1 to 5) yield { router ! ""