diff --git a/akka-actor/src/main/scala/akka/actor/ActorPath.scala b/akka-actor/src/main/scala/akka/actor/ActorPath.scala index f9bf5c4dcd..03a0a761ab 100644 --- a/akka-actor/src/main/scala/akka/actor/ActorPath.scala +++ b/akka-actor/src/main/scala/akka/actor/ActorPath.scala @@ -8,6 +8,47 @@ import akka.japi.Util.immutableSeq import java.net.MalformedURLException import java.lang.{ StringBuilder ⇒ JStringBuilder } +/** + * Java API + */ +object ActorPaths { + // static forwarders to `object ActorPath`, since `trait ActorPath` + // could not be changed to `abstract ActorPath` in a binary compatible way + + /** + * Parse string as actor path; throws java.net.MalformedURLException if unable to do so. + */ + def fromString(s: String): ActorPath = ActorPath.fromString(s) + + /** + * Validates the given actor path element and throws an [[InvalidActorNameException]] if invalid. + * See [[#isValidPathElement]] for a non-throwing version. + * + * @param element actor path element to be validated + */ + final def validatePathElement(element: String): Unit = ActorPath.validatePathElement(element) + + /** + * Validates the given actor path element and throws an [[InvalidActorNameException]] if invalid. + * See [[#isValidPathElement]] for a non-throwing version. + * + * @param element actor path element to be validated + * @param fullPath optional fullPath element that may be included for better error messages; null if not given + */ + final def validatePathElement(element: String, fullPath: String): Unit = + ActorPath.validatePathElement(element, fullPath) + + /** + * This method is used to validate a path element (Actor Name). + * Since Actors form a tree, it is addressable using an URL, therefore an Actor Name has to conform to: + * RFC-2396. + * + * User defined Actor names may not start from a `$` sign - these are reserved for system names. + */ + final def isValidPathElement(s: String): Boolean = ActorPath.isValidPathElement(s) + +} + object ActorPath { /** * Parse string as actor path; throws java.net.MalformedURLException if unable to do so. @@ -108,7 +149,7 @@ object ActorPath { * when comparing actor paths. */ @SerialVersionUID(1L) -sealed abstract class ActorPath extends Comparable[ActorPath] with Serializable { +sealed trait ActorPath extends Comparable[ActorPath] with Serializable { /** * The Address under which this path can be reached; walks up the tree to * the RootActorPath. diff --git a/project/MiMa.scala b/project/MiMa.scala index f0b5962f14..0d48c14227 100644 --- a/project/MiMa.scala +++ b/project/MiMa.scala @@ -486,12 +486,6 @@ object MiMa extends AutoPlugin { ProblemFilters.exclude[MissingMethodProblem]("akka.actor.ActorSystem.terminate"), ProblemFilters.exclude[MissingMethodProblem]("akka.actor.ActorSystem.whenTerminated"), ProblemFilters.exclude[MissingMethodProblem]("akka.actor.ExtendedActorSystem.logFilter"), - // the type hierarchy of class akka.actor.ChildActorPath has changed in new version. Missing types {akka.actor.ActorPath} - ProblemFilters.exclude[MissingTypesProblem]("akka.actor.ChildActorPath"), - // the type hierarchy of class akka.actor.RootActorPath has changed in new version. Missing types {akka.actor.ActorPath} - ProblemFilters.exclude[MissingTypesProblem]("akka.actor.RootActorPath"), - // declaration of trait akka.actor.ActorPath has changed to class akka.actor.ActorPath in new version; changing trait to class breaks client code - ProblemFilters.exclude[IncompatibleTemplateDefProblem]("akka.actor.ActorPath"), ProblemFilters.exclude[MissingMethodProblem]("akka.actor.ActorPath.ValidSymbols"), ProblemFilters.exclude[MissingMethodProblem]("akka.actor.LocalActorRefProvider.terminationPromise"), ProblemFilters.exclude[MissingClassProblem]("akka.actor.UntypedActorFactoryConsumer"),