KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ubermq > jms > common > routing > SourceSpec


1 package com.ubermq.jms.common.routing;
2
3 import java.util.*;
4
5 /**
6  * A source specification that a router will use to determine the list
7  * of destinations that correspond to it, based on its routing table.
8  * <p>
9  *
10  * Objects implementing this interface perform boolean matching operations
11  * against source descriptors that are passed to its <code>matches</code> method.
12  * <p>
13  */

14 public interface SourceSpec
15 {
16     /**
17      * @return a human readable name for this destination.
18      */

19     public String JavaDoc getDisplayName();
20
21     /**
22      * Matches the source spec with a descriptor. This can return true in
23      * different circumstances than equals. For instance, a regex
24      * source spec could indicate a match between "hello" and ".*" but
25      * these two specifications are not equivalent programatically.
26      *
27      * @return true if this source spec matches the specified descriptor.
28      */

29     public boolean matches(SourceDescriptor other);
30     
31     /**
32      * Provides a way for a router to sort source specifications
33      * by specificity, so that the most specific rules are matched first.
34      */

35     public boolean isMoreSpecificThan(SourceSpec other);
36     
37     /**
38      * Indicates if the results of the <code>matches</code> method are idempotent
39      * if the descriptors are equal (according to the <code>equals</code> method).
40      * <p>
41      *
42      * A more rigorous definition follows. Given two SourceDescriptors A and B such that:
43      * <code>
44      * A.equals(B) && B.equals(A)
45      * </code>
46      * this method should return <code>true</code> if and only if:
47      * <code>
48      * this.matches(A) && this.matches(B)
49      * </code>
50      * for all A and B for indefinite time.
51      * <p>
52      *
53      * You should only return false here when absolutely necessary, as it will impact
54      * any route evaluations that involve this matcher.
55      * <p>
56      *
57      * Implementations of <code>SourceDescriptor</code> that return true for <code>equals</code>
58      * are required to return equivalent match values, so if your implementation
59      * relies exclusively on the match value, you can safely return <code>true</code> for this
60      * method.
61      * <p>
62      *
63      * @return true if the matches method returns equal results for equal descriptors
64      * for all time.
65      * @see SourceDescriptor
66      */

67     public boolean isIdempotentForEqualDescriptors();
68 }
69
70
71
72
73
Popular Tags