Author: chirino
Date: Tue Nov 30 18:08:43 2010
New Revision: 1040665
URL: http://svn.apache.org/viewvc?rev=1040665&view=rev
Log:
Renaming Path to Part and wrapping the Part[] in a Path. Makes the api a little
easier to work with and safer.
Added:
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/Part.java
Modified:
activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Binding.scala
activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Destinations.scala
activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Router.scala
activemq/activemq-apollo/trunk/apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/DestinationConfigurationTest.scala
activemq/activemq-apollo/trunk/apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/perf/BrokerPerfSupport.scala
activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/AnyChildPathNode.java
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/Path.java
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathFilter.java
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathMap.java
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathMapNode.java
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathNode.java
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathParser.java
activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/path/PathMapMemoryTest.java
activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/path/PathMapTest.java
Modified:
activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Binding.scala
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Binding.scala?rev=1040665&r1=1040664&r2=1040665&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Binding.scala
(original)
+++
activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Binding.scala
Tue Nov 30 18:08:43 2010
@@ -19,10 +19,10 @@ package org.apache.activemq.apollo.broke
import org.fusesource.hawtbuf.{Buffer, AsciiBuffer}
import org.apache.activemq.apollo.selector.SelectorParser
import org.apache.activemq.apollo.filter.{ConstantExpression,
BooleanExpression}
-import org.apache.activemq.apollo.util.path.Path
import Buffer._
import org.apache.activemq.apollo.dto._
import org.apache.activemq.apollo.util.{OptionSupport, ClassFinder}
+import org.apache.activemq.apollo.util.path.{Path, Part}
/**
* <p>
@@ -65,15 +65,6 @@ object BindingFactory {
}
-object Binding {
- val destination_parser = new DestinationParser
-
- def encode(value:Array[Path]):String = destination_parser.toString(value)
- def decode(value:String):Array[Path] =
destination_parser.parsePath(ascii(value))
-}
-
-import Binding._
-
/**
* <p>
* </p>
@@ -104,14 +95,14 @@ trait Binding {
def message_filter:BooleanExpression = ConstantExpression.TRUE
def matches(config:QueueDTO):Boolean = {
- import Binding.destination_parser._
+ import DestinationParser.default._
import OptionSupport._
var rc = (o(config.destination).map{ x=>
parseFilter(ascii(x)).matches(destination) }.getOrElse(true))
rc = rc && (o(config.kind).map{ x=> x == binding_kind.toString
}.getOrElse(true))
rc
}
- def destination:Array[Path]
+ def destination:Path
}
object PointToPointBinding {
@@ -152,7 +143,7 @@ class PointToPointBindingFactory extends
*/
class PointToPointBinding(val binding_data:Buffer, val
binding_dto:PointToPointBindingDTO) extends Binding {
- val destination = Binding.decode(binding_dto.destination)
+ val destination = DestinationParser.decode_path(binding_dto.destination)
def binding_kind = POINT_TO_POINT_KIND
def unbind(node: RoutingNode, queue: Queue) = {
@@ -211,7 +202,7 @@ class DurableSubBindingFactory extends B
*/
class DurableSubBinding(val binding_data:Buffer, val
binding_dto:DurableSubscriptionBindingDTO) extends Binding {
- val destination = Binding.decode(binding_dto.destination)
+ val destination = DestinationParser.decode_path(binding_dto.destination)
def binding_kind = DURABLE_SUB_KIND
Modified:
activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Destinations.scala
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Destinations.scala?rev=1040665&r1=1040664&r2=1040665&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Destinations.scala
(original)
+++
activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Destinations.scala
Tue Nov 30 18:08:43 2010
@@ -18,15 +18,28 @@ package org.apache.activemq.apollo.broke
import _root_.org.fusesource.hawtbuf._
import BufferConversions._
-import org.apache.activemq.apollo.util.path.{Path, PathParser}
import Buffer._
+import org.apache.activemq.apollo.util.path.{Path, Part, PathParser}
/**
*/
trait Destination {
def domain:AsciiBuffer = null
- def name:Array[Path] = null
+ def name:Path = null
def destinations:List[Destination] = null
+
+ override def toString = DestinationParser.default.toString(this)
+}
+
+object DestinationParser {
+
+ val default = new DestinationParser
+
+ def encode_path(value:Path):String = default.toString(value)
+ def decode_path(value:String):Path = default.parsePath(ascii(value))
+
+ def encode_destination(value:Destination):String = default.toString(value)
+ def decode_destination(value:String):Destination =
default.parse(ascii(value))
}
/**
@@ -67,7 +80,7 @@ class DestinationParser extends PathPars
case Router.TEMP_TOPIC_DOMAIN =>
baos.write(temp_topic_prefix)
}
- this.write(value.name.toArray, baos)
+ this.write(value.name, baos)
}
}
write(value)
@@ -75,6 +88,8 @@ class DestinationParser extends PathPars
}
}
+ def toString(value:Destination) = toBuffer(value).toString
+
/**
* Parses a destination which may or may not be a composite.
*
@@ -101,21 +116,21 @@ class DestinationParser extends PathPars
} else {
if (queue_prefix != null && value.startsWith(queue_prefix)) {
var name = value.slice(queue_prefix.length, value.length).ascii();
- return new SingleDestination(Router.QUEUE_DOMAIN,
parsePath(name).toList);
+ return new SingleDestination(Router.QUEUE_DOMAIN, parsePath(name));
} else if (topic_prefix != null && value.startsWith(topic_prefix)) {
var name = value.slice(topic_prefix.length, value.length).ascii();
- return new SingleDestination(Router.TOPIC_DOMAIN,
parsePath(name).toList);
+ return new SingleDestination(Router.TOPIC_DOMAIN, parsePath(name));
} else if (temp_queue_prefix != null &&
value.startsWith(temp_queue_prefix)) {
var name = value.slice(temp_queue_prefix.length, value.length).ascii();
- return new SingleDestination(Router.TEMP_QUEUE_DOMAIN,
parsePath(name).toList);
+ return new SingleDestination(Router.TEMP_QUEUE_DOMAIN,
parsePath(name));
} else if (temp_topic_prefix != null &&
value.startsWith(temp_topic_prefix)) {
var name = value.slice(temp_topic_prefix.length, value.length).ascii();
- return new SingleDestination(Router.TEMP_TOPIC_DOMAIN,
parsePath(name).toList);
+ return new SingleDestination(Router.TEMP_TOPIC_DOMAIN,
parsePath(name));
} else {
if (default_domain == null) {
return null;
}
- return new SingleDestination(default_domain, parsePath(value).toList);
+ return new SingleDestination(default_domain, parsePath(value));
}
}
}
@@ -124,14 +139,9 @@ class DestinationParser extends PathPars
/**
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
-case class SingleDestination(override val domain: AsciiBuffer, val path:
List[Path]) extends Destination {
- override def toString() = "" + domain + ":" + name.mkString(".")
- override val name = path.toArray[Path]
-}
+case class SingleDestination(override val domain: AsciiBuffer, override val
name: Path) extends Destination
/**
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
-case class MultiDestination(override val destinations: List[Destination])
extends Destination {
- override def toString() = destinations.mkString(",")
-}
+case class MultiDestination(override val destinations: List[Destination])
extends Destination
Modified:
activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Router.scala
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Router.scala?rev=1040665&r1=1040664&r2=1040665&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Router.scala
(original)
+++
activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Router.scala
Tue Nov 30 18:08:43 2010
@@ -27,9 +27,10 @@ import org.apache.activemq.apollo.util._
import collection.mutable.{ListBuffer, HashMap}
import scala.collection.immutable.List
import org.apache.activemq.apollo.store.{StoreUOW, QueueRecord}
-import org.apache.activemq.apollo.util.path.{Path, PathMap, PathParser}
import Buffer._
import org.apache.activemq.apollo.dto.{QueueDTO, PointToPointBindingDTO,
BindingDTO}
+import org.apache.activemq.apollo.util.path.{Path, Part, PathMap, PathParser}
+import java.util.ArrayList
/**
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
@@ -84,9 +85,15 @@ class Router(val host:VirtualHost) exten
}
}
- def routing_nodes:Iterable[RoutingNode] =
JavaConversions.asIterable(destinations.get(Array(PathParser.ANY_DESCENDANT)))
+ private val ALL = new Path({
+ val rc = new ArrayList[Part](1)
+ rc.add(Part.ANY_DESCENDANT)
+ rc
+ })
+
+ def routing_nodes:Iterable[RoutingNode] =
JavaConversions.asIterable(destinations.get(ALL))
- def
create_destination_or(destination:Array[Path])(func:(RoutingNode)=>Unit):RoutingNode
= {
+ def
create_destination_or(destination:Path)(func:(RoutingNode)=>Unit):RoutingNode =
{
// We can't create a wild card destination.. only wild card subscriptions.
assert( !PathParser.containsWildCards(destination) )
@@ -113,7 +120,7 @@ class Router(val host:VirtualHost) exten
rc
}
- def get_destination_matches(destination:Array[Path]) = {
+ def get_destination_matches(destination:Path) = {
import JavaConversions._
asIterable(destinations.get( destination ))
}
@@ -243,7 +250,7 @@ class Router(val host:VirtualHost) exten
// Looking up the queue will cause it to get created if it does not
exist.
val queue = if( !topic ) {
val dto = new PointToPointBindingDTO
- dto.destination = Binding.encode(destination.name)
+ dto.destination = DestinationParser.encode_path(destination.name)
_create_queue(dto)
} else {
None
@@ -277,7 +284,7 @@ class Router(val host:VirtualHost) exten
/**
* Tracks state associated with a destination name.
*/
-class RoutingNode(val router:Router, val name:Array[Path]) {
+class RoutingNode(val router:Router, val name:Path) {
val id = router.destination_id_counter.incrementAndGet
@@ -288,7 +295,7 @@ class RoutingNode(val router:Router, val
val unified = {
import collection.JavaConversions._
import OptionSupport._
- import Binding.destination_parser._
+ import DestinationParser.default._
val t= router.host.config.destinations.find( x=>
parseFilter(ascii(x.path)).matches(name) )
t.flatMap(x=> o(x.unified)).getOrElse(false)
Modified:
activemq/activemq-apollo/trunk/apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/DestinationConfigurationTest.scala
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/DestinationConfigurationTest.scala?rev=1040665&r1=1040664&r2=1040665&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/DestinationConfigurationTest.scala
(original)
+++
activemq/activemq-apollo/trunk/apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/DestinationConfigurationTest.scala
Tue Nov 30 18:08:43 2010
@@ -79,7 +79,7 @@ class DestinationConfigurationTest exten
p
}
- def dest(v:String) = Binding.destination_parser.parsePath(ascii(v))
+ def dest(v:String) = DestinationParser.decode_path(v)
expect(true) {
router.destinations.chooseValue(dest("unified.a")).unified
}
Modified:
activemq/activemq-apollo/trunk/apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/perf/BrokerPerfSupport.scala
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/perf/BrokerPerfSupport.scala?rev=1040665&r1=1040664&r2=1040665&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/perf/BrokerPerfSupport.scala
(original)
+++
activemq/activemq-apollo/trunk/apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/perf/BrokerPerfSupport.scala
Tue Nov 30 18:08:43 2010
@@ -216,7 +216,7 @@ abstract class BrokerPerfSupport extends
for (i <- 0 until destCount) {
val domain = if (PTP) {Router.QUEUE_DOMAIN} else {Router.TOPIC_DOMAIN}
val name = new AsciiBuffer("dest" + (i + 1))
- var bean = new SingleDestination(domain, parser.parsePath(name).toList)
+ var bean = new SingleDestination(domain, parser.parsePath(name))
dests(i) = bean
// if (PTP) {
// sendBroker.defaultVirtualHost.createQueue(dests(i))
Modified:
activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala?rev=1040665&r1=1040664&r2=1040665&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala
(original)
+++
activemq/activemq-apollo/trunk/apollo-stomp/src/main/scala/org/apache/activemq/apollo/stomp/StompProtocol.scala
Tue Nov 30 18:08:43 2010
@@ -743,7 +743,7 @@ class StompProtocolHandler extends Proto
// way again)
if (topic) {
val rc = new DurableSubscriptionBindingDTO
- rc.destination = Binding.encode(destination.name)
+ rc.destination = DestinationParser.encode_path(destination.name)
// TODO:
// rc.client_id =
rc.subscription_id = if( persistent ) id else null
@@ -751,7 +751,7 @@ class StompProtocolHandler extends Proto
rc
} else {
val rc = new PointToPointBindingDTO
- rc.destination = Binding.encode(destination.name)
+ rc.destination = DestinationParser.encode_path(destination.name)
rc
}
}
Modified:
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/AnyChildPathNode.java
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/AnyChildPathNode.java?rev=1040665&r1=1040664&r2=1040665&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/AnyChildPathNode.java
(original)
+++
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/AnyChildPathNode.java
Tue Nov 30 18:08:43 2010
@@ -20,8 +20,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Set;
-import org.fusesource.hawtbuf.AsciiBuffer;
-
/**
* An implementation of {...@link PathNode} which navigates all the children
of the given node
* ignoring the name of the current path (so for navigating using * in a
wildcard).
@@ -34,16 +32,16 @@ public class AnyChildPathNode<Value> imp
this.node = node;
}
- public void appendMatchingValues(Set<Value> answer, Path[] paths, int
startIndex) {
+ public void appendMatchingValues(Set<Value> answer, Path path, int
startIndex) {
for (PathNode<Value> child : getChildNodes()) {
- child.appendMatchingValues(answer, paths, startIndex);
+ child.appendMatchingValues(answer, path, startIndex);
}
}
- public void appendMatchingWildcards(Set<Value> answer, Path[] paths, int
startIndex) {
+ public void appendMatchingWildcards(Set<Value> answer, Path path, int
startIndex) {
for (PathNode<Value> child : getChildNodes()) {
- child.appendMatchingWildcards(answer, paths, startIndex);
+ child.appendMatchingWildcards(answer, path, startIndex);
}
}
@@ -54,10 +52,10 @@ public class AnyChildPathNode<Value> imp
}
}
- public PathNode<Value> getChild(Path path) {
+ public PathNode<Value> getChild(Part part) {
final Collection<PathNode<Value>> list = new
ArrayList<PathNode<Value>>();
for (PathNode<Value> child : getChildNodes()) {
- PathNode<Value> answer = child.getChild(path);
+ PathNode<Value> answer = child.getChild(part);
if (answer != null) {
list.add(answer);
}
Added:
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/Part.java
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/Part.java?rev=1040665&view=auto
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/Part.java
(added)
+++
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/Part.java
Tue Nov 30 18:08:43 2010
@@ -0,0 +1,85 @@
+package org.apache.activemq.apollo.util.path;
+
+import org.fusesource.hawtbuf.AsciiBuffer;
+
+/**
+ * Holds the delimiters used to parse paths.
+ *
+ * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
+ */
+abstract public class Part {
+
+ public boolean matches(Part p) {
+ return true;
+ }
+
+ abstract public String toString(PathParser parser);
+
+ public boolean isLiteral() {
+ return false;
+ }
+
+ public static final RootPart ROOT = new RootPart();
+ public static final AnyDescendantPart ANY_DESCENDANT = new
AnyDescendantPart();
+ public static final AnyChildPart ANY_CHILD = new AnyChildPart();
+
+ private static class RootPart extends Part {
+ public String toString(PathParser parser) {
+ return "";
+ }
+ public boolean matches(Part p) {
+ return p == ROOT;
+ }
+ }
+
+ private static class AnyChildPart extends Part {
+ public String toString(PathParser parser) {
+ return parser.any_child_wildcard.toString();
+ }
+ }
+
+ private static class AnyDescendantPart extends Part {
+ public String toString(PathParser parser) {
+ return parser.any_descendant_wildcard.toString();
+ }
+ }
+
+ static class LiteralPart extends Part {
+
+ private final AsciiBuffer value;
+
+ public LiteralPart(AsciiBuffer value) {
+ this.value = value;
+ }
+ public boolean isLiteral() {
+ return true;
+ }
+
+ public String toString(PathParser parser) {
+ return value.toString();
+ }
+
+ public boolean matches(Part p) {
+ if( p.isLiteral() ) {
+ return ((LiteralPart)p).value.equals(value);
+ }
+ // we match any type of wildcard..
+ return true;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ LiteralPart that = (LiteralPart) o;
+ return value.equals(that.value);
+ }
+
+ @Override
+ public int hashCode() {
+ return value.hashCode();
+ }
+ }
+
+}
Modified:
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/Path.java
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/Path.java?rev=1040665&r1=1040664&r2=1040665&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/Path.java
(original)
+++
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/Path.java
Tue Nov 30 18:08:43 2010
@@ -1,20 +1,56 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.apache.activemq.apollo.util.path;
+import java.util.ArrayList;
+
/**
- * Holds the delimiters used to parse paths.
+ * <p>
+ * </p>
*
* @author <a href="http://hiramchirino.com">Hiram Chirino</a>
*/
-abstract public class Path {
+public class Path {
+
+ final public ArrayList<Part> parts;
- public boolean matches(Path p) {
- return true;
+ public Path(ArrayList<Part> parts) {
+ this.parts = parts;
}
- abstract public String toString(PathParser parser);
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ Path path = (Path) o;
+ return parts.equals(path.parts);
+ }
- public boolean isLiteral() {
- return false;
+ @Override
+ public int hashCode() {
+ return parts.hashCode();
}
+
+ public String toString() {
+ return toString(PathParser.DEFAULT);
+ }
+
+ public String toString(PathParser pp) {
+ return pp.toString(this);
+ }
}
Modified:
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathFilter.java
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathFilter.java?rev=1040665&r1=1040664&r2=1040665&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathFilter.java
(original)
+++
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathFilter.java
Tue Nov 30 18:08:43 2010
@@ -17,10 +17,6 @@
package org.apache.activemq.apollo.util.path;
-import java.util.ArrayList;
-
-import org.fusesource.hawtbuf.AsciiBuffer;
-
/**
* Represents a filter which only operates on a path
@@ -29,6 +25,6 @@ import org.fusesource.hawtbuf.AsciiBuffe
*/
public interface PathFilter {
- public boolean matches(Path[] path);
+ public boolean matches(Path path);
}
Modified:
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathMap.java
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathMap.java?rev=1040665&r1=1040664&r2=1040665&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathMap.java
(original)
+++
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathMap.java
Tue Nov 30 18:08:43 2010
@@ -16,9 +16,7 @@
*/
package org.apache.activemq.apollo.util.path;
-import java.util.ArrayList;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
@@ -52,19 +50,19 @@ public class PathMap<Value> {
* @return a List of matching values or an empty list if there are no
* matching values.
*/
- public Set<Value> get(Path[] key) {
+ public Set<Value> get(Path key) {
return findWildcardMatches(key);
}
- public void put(Path[] key, Value value) {
+ public void put(Path key, Value value) {
root.add(key, 0, value);
}
/**
* Removes the value from the associated path
*/
- public void remove(Path[] paths, Value value) {
- root.remove(paths, 0, value);
+ public void remove(Path path, Value value) {
+ root.remove(path, 0, value);
}
@@ -74,9 +72,9 @@ public class PathMap<Value> {
// Implementation methods
//
-------------------------------------------------------------------------
- protected Set<Value> findWildcardMatches(Path[] paths) {
+ protected Set<Value> findWildcardMatches(Path path) {
HashSet<Value> answer = new HashSet<Value>();
- root.appendMatchingValues(answer, paths, 0);
+ root.appendMatchingValues(answer, path, 0);
return answer;
}
@@ -84,7 +82,7 @@ public class PathMap<Value> {
* @param key
* @return
*/
- public Set<Value> removeAll(Path[] key) {
+ public Set<Value> removeAll(Path key) {
HashSet<Value> rc = new HashSet<Value>();
root.removeAll(rc, key, 0);
return rc;
@@ -98,7 +96,7 @@ public class PathMap<Value> {
* @param path the path to find the value for
* @return the largest matching value or null if no value matches
*/
- public Value chooseValue(Path[] path) {
+ public Value chooseValue(Path path) {
Set<Value> set = get(path);
if (set == null || set.isEmpty()) {
return null;
Modified:
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathMapNode.java
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathMapNode.java?rev=1040665&r1=1040664&r2=1040665&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathMapNode.java
(original)
+++
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathMapNode.java
Tue Nov 30 18:08:43 2010
@@ -34,8 +34,8 @@ public class PathMapNode<Value> implemen
// we synchronize at the PathMap level
private PathMapNode<Value> parent;
private List<Value> values = new ArrayList<Value>();
- private Map<Path, PathNode<Value>> childNodes = new HashMap<Path,
PathNode<Value>>();
- private Path path = PathParser.ROOT;
+ private Map<Part, PathNode<Value>> childNodes = new HashMap<Part,
PathNode<Value>>();
+ private Part part = Part.ROOT;
private int pathLength;
public PathMapNode(PathMapNode<Value> parent) {
@@ -51,8 +51,8 @@ public class PathMapNode<Value> implemen
* Returns the child node for the given named path or null if it does not
* exist
*/
- public PathMapNode<Value> getChild(Path path) {
- return (PathMapNode<Value>)childNodes.get(path);
+ public PathMapNode<Value> getChild(Part part) {
+ return (PathMapNode<Value>)childNodes.get(part);
}
/**
@@ -70,12 +70,12 @@ public class PathMapNode<Value> implemen
* Returns the child node for the given named path, lazily creating one if
* it does not yet exist
*/
- public PathMapNode<Value> getChildOrCreate(Path path) {
- PathMapNode<Value> answer = (PathMapNode<Value>)childNodes.get(path);
+ public PathMapNode<Value> getChildOrCreate(Part part) {
+ PathMapNode<Value> answer = (PathMapNode<Value>)childNodes.get(part);
if (answer == null) {
answer = createChildNode();
- answer.path = path;
- childNodes.put(path, answer);
+ answer.part = part;
+ childNodes.put(part, answer);
}
return answer;
}
@@ -120,8 +120,8 @@ public class PathMapNode<Value> implemen
return answer;
}
- public void add(Path[] paths, int idx, Value value) {
- if (idx >= paths.length) {
+ public void add(Path path, int idx, Value value) {
+ if (idx >= path.parts.size()) {
values.add(value);
} else {
// if (idx == paths.size() - 1) {
@@ -130,12 +130,12 @@ public class PathMapNode<Value> implemen
// else {
// getAnyChildNode().add(paths, idx + 1, value);
// }
- getChildOrCreate(paths[idx]).add(paths, idx + 1, value);
+ getChildOrCreate(path.parts.get(idx)).add(path, idx + 1, value);
}
}
- public void remove(Path[] paths, int idx, Value value) {
- if (idx >= paths.length) {
+ public void remove(Path path, int idx, Value value) {
+ if (idx >= path.parts.size()) {
values.remove(value);
pruneIfEmpty();
} else {
@@ -145,27 +145,27 @@ public class PathMapNode<Value> implemen
// else {
// getAnyChildNode().remove(paths, idx + 1, value);
// }
- getChildOrCreate(paths[idx]).remove(paths, ++idx, value);
+ getChildOrCreate(path.parts.get(idx)).remove(path, ++idx, value);
}
}
- public void removeAll(Set<Value> answer, Path[] paths, int startIndex) {
+ public void removeAll(Set<Value> answer, Path path, int startIndex) {
PathNode<Value> node = this;
- int size = paths.length;
+ int size = path.parts.size();
for (int i = startIndex; i < size && node != null; i++) {
- Path path = paths[i];
- if (path == PathParser.ANY_DESCENDANT) {
+ Part part = path.parts.get(i);
+ if (part == Part.ANY_DESCENDANT) {
answer.addAll(node.removeDesendentValues());
break;
}
- node.appendMatchingWildcards(answer, paths, i);
- if (path == PathParser.ANY_CHILD ) {
+ node.appendMatchingWildcards(answer, path, i);
+ if (part == Part.ANY_CHILD ) {
// node = node.getAnyChildNode();
node = new AnyChildPathNode<Value>(node);
} else {
- node = node.getChild(path);
+ node = node.getChild(part);
}
}
@@ -199,45 +199,45 @@ public class PathMapNode<Value> implemen
/**
* Matches any entries in the map containing wildcards
*/
- public void appendMatchingWildcards(Set<Value> answer, Path[] paths, int
idx) {
+ public void appendMatchingWildcards(Set<Value> answer, Path parts, int
idx) {
if (idx - 1 > pathLength) {
return;
}
- PathMapNode<Value> wildCardNode = getChild(PathParser.ANY_CHILD);
+ PathMapNode<Value> wildCardNode = getChild(Part.ANY_CHILD);
if (wildCardNode != null) {
- wildCardNode.appendMatchingValues(answer, paths, idx + 1);
+ wildCardNode.appendMatchingValues(answer, parts, idx + 1);
}
- wildCardNode = getChild(PathParser.ANY_DESCENDANT);
+ wildCardNode = getChild(Part.ANY_DESCENDANT);
if (wildCardNode != null) {
answer.addAll(wildCardNode.getDesendentValues());
}
}
- public void appendMatchingValues(Set<Value> answer, Path[] paths, int
startIndex) {
+ public void appendMatchingValues(Set<Value> answer, Path path, int
startIndex) {
PathNode<Value> node = this;
boolean couldMatchAny = true;
- int size = paths.length;
+ int size = path.parts.size();
for (int i = startIndex; i < size && node != null; i++) {
- Path path = paths[i];
- if (path.equals(PathParser.ANY_DESCENDANT)) {
+ Part part = path.parts.get(i);
+ if (part.equals(Part.ANY_DESCENDANT)) {
answer.addAll(node.getDesendentValues());
couldMatchAny = false;
break;
}
- node.appendMatchingWildcards(answer, paths, i);
+ node.appendMatchingWildcards(answer, path, i);
- if (path.equals(PathParser.ANY_CHILD)) {
+ if (part.equals(Part.ANY_CHILD)) {
node = new AnyChildPathNode<Value>(node);
} else {
- node = node.getChild(path);
+ node = node.getChild(part);
}
}
if (node != null) {
answer.addAll(node.getValues());
if (couldMatchAny) {
// lets allow FOO.BAR to match the FOO.BAR.> entry in the map
- PathNode<Value> child =
node.getChild(PathParser.ANY_DESCENDANT);
+ PathNode<Value> child = node.getChild(Part.ANY_DESCENDANT);
if (child != null) {
answer.addAll(child.getValues());
}
@@ -245,8 +245,8 @@ public class PathMapNode<Value> implemen
}
}
- public Path getPath() {
- return path;
+ public Part getPart() {
+ return part;
}
protected void pruneIfEmpty() {
@@ -256,7 +256,7 @@ public class PathMapNode<Value> implemen
}
protected void removeChild(PathMapNode<Value> node) {
- childNodes.remove(node.getPath());
+ childNodes.remove(node.getPart());
pruneIfEmpty();
}
}
Modified:
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathNode.java
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathNode.java?rev=1040665&r1=1040664&r2=1040665&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathNode.java
(original)
+++
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathNode.java
Tue Nov 30 18:08:43 2010
@@ -16,26 +16,23 @@
*/
package org.apache.activemq.apollo.util.path;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Set;
-import org.fusesource.hawtbuf.AsciiBuffer;
-
/**
* Represents a node in the {...@link PathMap} tree
*
*/
public interface PathNode<Value> {
- void appendMatchingValues(Set<Value> answer, Path[] paths, int startIndex);
+ void appendMatchingValues(Set<Value> answer, Path path, int startIndex);
- void appendMatchingWildcards(Set<Value> answer, Path[] paths, int
startIndex);
+ void appendMatchingWildcards(Set<Value> answer, Path path, int startIndex);
void appendDescendantValues(Set<Value> answer);
Collection<Value> getDesendentValues();
- PathNode<Value> getChild(Path path);
+ PathNode<Value> getChild(Part part);
Collection<Value> getValues();
Modified:
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathParser.java
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathParser.java?rev=1040665&r1=1040664&r2=1040665&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathParser.java
(original)
+++
activemq/activemq-apollo/trunk/apollo-util/src/main/scala/org/apache/activemq/apollo/util/path/PathParser.java
Tue Nov 30 18:08:43 2010
@@ -3,10 +3,12 @@ package org.apache.activemq.apollo.util.
import org.fusesource.hawtbuf.AsciiBuffer;
import org.fusesource.hawtbuf.ByteArrayOutputStream;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedList;
+import static org.apache.activemq.apollo.util.path.Part.*;
/**
* Holds the delimiters used to parse paths.
@@ -15,75 +17,16 @@ import java.util.LinkedList;
*/
public class PathParser {
- public static final RootPath ROOT = new RootPath();
- public static final AnyDescendantPath ANY_DESCENDANT = new
AnyDescendantPath();
- public static final AnyChildPath ANY_CHILD = new AnyChildPath();
+ public static final PathParser DEFAULT = new PathParser();
public AsciiBuffer any_descendant_wildcard = new AsciiBuffer("**");
public AsciiBuffer any_child_wildcard = new AsciiBuffer("*");
public AsciiBuffer path_seperator = new AsciiBuffer(".");
- private static class RootPath extends Path {
- public String toString(PathParser parser) {
- return "";
- }
- public boolean matches(Path p) {
- return p == ROOT;
- }
- }
-
- private static class AnyChildPath extends Path {
- public String toString(PathParser parser) {
- return parser.any_child_wildcard.toString();
- }
- }
-
- private static class AnyDescendantPath extends Path {
- public String toString(PathParser parser) {
- return parser.any_descendant_wildcard.toString();
- }
- }
-
- class LiteralPath extends Path {
-
- private final AsciiBuffer value;
-
- public LiteralPath(AsciiBuffer value) {
- this.value = value;
- }
- public boolean isLiteral() {
- return true;
- }
- public String toString(PathParser parser) {
- return value.toString();
- }
-
- public boolean matches(Path p) {
- if( p.isLiteral() ) {
- return ((LiteralPath)p).value.equals(value);
- }
- // we match any type of wildcard..
- return true;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- LiteralPath that = (LiteralPath) o;
- return value.equals(that.value);
- }
-
- @Override
- public int hashCode() {
- return value.hashCode();
- }
- }
- public Path[] parsePath(AsciiBuffer subject) {
- ArrayList<Path> list = new ArrayList<Path>(10);
+ public Path parsePath(AsciiBuffer subject) {
+ ArrayList<Part> list = new ArrayList<Part>(10);
int previous = 0;
int lastIndex = subject.getLength() - 1;
while (true) {
@@ -97,63 +40,65 @@ public class PathParser {
list.add(parsePart(buffer));
previous = idx + 1;
}
- return list.toArray(new Path[list.size()]);
+ return new Path(new ArrayList(list));
}
- private Path parsePart(AsciiBuffer value) {
+ private Part parsePart(AsciiBuffer value) {
if( value.equals(any_child_wildcard) ) {
return ANY_CHILD;
} else if( value.equals(any_descendant_wildcard) ) {
return ANY_DESCENDANT;
} else {
- return new LiteralPath(value);
+ return new LiteralPart(value);
}
}
/**
- * Converts the paths back to the string representation.
- *
- * @param paths
+ * Converts the path back to the string representation.
* @return
*/
- public String toString(Path[] paths) {
+ public String toString(Path path) {
StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < paths.length; i++) {
- if (i > 0) {
+ boolean first=true;
+ for(Part p : path.parts) {
+ if( !first ) {
buffer.append(path_seperator);
}
- buffer.append(paths[i].toString(this));
+ buffer.append(p.toString(this));
+ first = false;
}
return buffer.toString();
}
- public void write(Path[] paths, ByteArrayOutputStream os) {
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < paths.length; i++) {
- if (i > 0) {
- buffer.append(path_seperator);
+
+ public void write(Path path, ByteArrayOutputStream os) throws IOException {
+ boolean first=true;
+ for(Part p : path.parts) {
+ if( !first ) {
+ path_seperator.writeTo(os);
}
- buffer.append(paths[i].toString(this));
+ new AsciiBuffer(p.toString(this)).writeTo(os);
+ first = false;
}
}
static interface PartFilter {
- public boolean matches(LinkedList<Path> remaining);
+ public boolean matches(LinkedList<Part> remaining);
}
class LitteralPathFilter implements PartFilter {
private final PartFilter next;
- private final LiteralPath path;
+ private final LiteralPart path;
- public LitteralPathFilter(PartFilter next, LiteralPath path) {
+ public LitteralPathFilter(PartFilter next, LiteralPart path) {
this.next = next;
this.path = path;
}
- public boolean matches(LinkedList<Path> remaining) {
+ public boolean matches(LinkedList<Part> remaining) {
if( !remaining.isEmpty() ) {
- Path p = remaining.removeFirst();
+ Part p = remaining.removeFirst();
if( !path.matches(p) ) {
return false;
}
@@ -174,9 +119,9 @@ public class PathParser {
public AnyChildPathFilter(PartFilter next) {
this.next = next;
}
- public boolean matches(LinkedList<Path> remaining) {
+ public boolean matches(LinkedList<Part> remaining) {
if( !remaining.isEmpty() ) {
- Path p = remaining.removeFirst();
+ Part p = remaining.removeFirst();
if( next!=null ) {
return next.matches(remaining);
} else {
@@ -194,7 +139,7 @@ public class PathParser {
public AnyDecendentPathFilter(PartFilter next) {
this.next = next;
}
- public boolean matches(LinkedList<Path> remaining) {
+ public boolean matches(LinkedList<Part> remaining) {
if( !remaining.isEmpty() ) {
remaining.clear();
return true;
@@ -205,12 +150,12 @@ public class PathParser {
}
public PathFilter parseFilter(AsciiBuffer path) {
- Path[] paths = parsePath(path);
- Collections.reverse(Arrays.asList(paths));
+ ArrayList<Part> parts = new ArrayList<Part>(parsePath(path).parts);
+ Collections.reverse(parts);
PartFilter last = null;
- for( Path p: paths ) {
+ for( Part p: parts) {
if( p.isLiteral() ) {
- last = new LitteralPathFilter(last, (LiteralPath)p);
+ last = new LitteralPathFilter(last, (LiteralPart)p);
} else if( p == ANY_CHILD ) {
last = new AnyChildPathFilter(last);
} else if( p == ANY_DESCENDANT ) {
@@ -219,14 +164,14 @@ public class PathParser {
}
final PartFilter filter = last;
return new PathFilter() {
- public boolean matches(Path[] path) {
- return filter.matches(new LinkedList(Arrays.asList(path)));
+ public boolean matches(Path path) {
+ return filter.matches(new LinkedList(path.parts));
}
};
}
- static public boolean containsWildCards(Path[] paths) {
- for(Path p:paths) {
+ static public boolean containsWildCards(Path path) {
+ for(Part p: path.parts) {
if( p==ANY_DESCENDANT || p==ANY_CHILD) {
return true;
}
Modified:
activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/path/PathMapMemoryTest.java
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/path/PathMapMemoryTest.java?rev=1040665&r1=1040664&r2=1040665&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/path/PathMapMemoryTest.java
(original)
+++
activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/path/PathMapMemoryTest.java
Tue Nov 30 18:08:43 2010
@@ -30,13 +30,13 @@ public class PathMapMemoryTest {
PathParser parser = new PathParser();
- protected Path[] createDestination(String name) {
+ protected Path createDestination(String name) {
return parser.parsePath(new AsciiBuffer(name));
}
@Test()
public void testLongPath() throws Exception {
- Path[] d1 =
createDestination("1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18");
+ Path d1 =
createDestination("1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18");
PathMap<String> map = new PathMap<String>();
map.put(d1, "test");
}
@@ -51,7 +51,7 @@ public class PathMapMemoryTest {
}
// System.out.println("Checking: " + name);
try {
- Path[] d1 = createDestination(name);
+ Path d1 = createDestination(name);
PathMap<String> map = new PathMap<String>();
map.put(d1, "test");
} catch (Throwable e) {
@@ -66,11 +66,11 @@ public class PathMapMemoryTest {
Object value = new Object();
int count = 1000;
for (int i = 0; i < count; i++) {
- Path[] queue = createDestination("connection:"+i);
+ Path queue = createDestination("connection:"+i);
map.put(queue, value);
}
for (int i = 0; i < count; i++) {
- Path[] queue = createDestination("connection:"+i);
+ Path queue = createDestination("connection:"+i);
map.remove(queue, value);
Set<Object> set = map.get(queue);
assertTrue(set.isEmpty());
Modified:
activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/path/PathMapTest.java
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/path/PathMapTest.java?rev=1040665&r1=1040664&r2=1040665&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/path/PathMapTest.java
(original)
+++
activemq/activemq-apollo/trunk/apollo-util/src/test/scala/org/apache/activemq/apollo/util/path/PathMapTest.java
Tue Nov 30 18:08:43 2010
@@ -35,9 +35,9 @@ public class PathMapTest {
PathParser parser = new PathParser();
- protected Path[] d1 = createDestination("TEST.D1");
- protected Path[] d2 = createDestination("TEST.BAR.D2");
- protected Path[] d3 = createDestination("TEST.BAR.D3");
+ protected Path d1 = createDestination("TEST.D1");
+ protected Path d2 = createDestination("TEST.BAR.D2");
+ protected Path d3 = createDestination("TEST.BAR.D3");
protected String v1 = "value1";
protected String v2 = "value2";
@@ -48,8 +48,8 @@ public class PathMapTest {
@Test()
public void testCompositePaths() throws Exception {
- Path[] d1 = createDestination("TEST.BAR.D2");
- Path[] d2 = createDestination("TEST.BAR.D3");
+ Path d1 = createDestination("TEST.BAR.D2");
+ Path d2 = createDestination("TEST.BAR.D3");
PathMap<String> map = new PathMap<String>();
map.put(d1, v1);
map.put(d2, v2);
@@ -340,17 +340,17 @@ public class PathMapTest {
}
protected void remove(PathMap<String> map, String name, String value) {
- Path[] destination = createDestination(name);
+ Path destination = createDestination(name);
map.remove(destination, value);
}
protected void assertMapValue(PathMap<String> map, String destinationName,
Object... expected) {
- Path[] destination = createDestination(destinationName);
+ Path destination = createDestination(destinationName);
assertMapValue(map, destination, expected);
}
@SuppressWarnings("unchecked")
- protected void assertMapValue(PathMap<String> map, Path[] destination,
Object... expected) {
+ protected void assertMapValue(PathMap<String> map, Path destination,
Object... expected) {
List expectedList = Arrays.asList(expected);
Collections.sort(expectedList);
Set actualSet = map.get(destination);
@@ -359,7 +359,7 @@ public class PathMapTest {
assertEquals(("map value for destinationName: " + destination),
expectedList, actual);
}
- protected Path[] createDestination(String name) {
+ protected Path createDestination(String name) {
return parser.parsePath(new AsciiBuffer(name));
}
}