KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > walend > somnifugi > SomniMessageSelector


1 package net.walend.somnifugi;
2
3 import javax.jms.Message JavaDoc;
4
5 /**
6 A MessageSelector interface.
7 <p>
8 To use your MessageSelector, get a TopicSession from a TopicConnection, cast that TopicSession to a SomniTopicSession, and use the appropriate createSubscriber method.
9 <code>
10                 SomniTopicSession session2 = (SomniTopicSession)connection.createTopicSession(false,Session.AUTO_ACKNOWLEDGE);
11                 TopicSubscriber subscriber2 = session2.createSubscriber(topic,new TestMessageSelector("b"));
12 </code>
13 <p>
14 @author <a HREF="http://walend.net">David Walend</a> <a HREF="mailto:david@walend.net">david@walend.net</a>
15 */

16
17 public interface SomniMessageSelector
18 {
19     /**
20 To stay compatible with String message selectors specified by the JMS specification, just use methods associated with headers, like property methods.
21
22 @throws SomniMessageSelectorException if something goes wrong.
23
24 @return true for Messages that should pass this filter, false for those that don't.
25     */

26     public boolean matches(Message JavaDoc message)
27         throws SomniMessageSelectorException;
28
29     public static final SomniMessageSelector ALLMESSAGESELECTOR = new AllMessageSelector();
30         
31     public static final class AllMessageSelector
32         implements SomniMessageSelector
33     {
34         private AllMessageSelector()
35         {}
36             
37         public boolean matches(Message JavaDoc message)
38             throws SomniMessageSelectorException
39         {
40             return true;
41         }
42     }
43 }
44
45 /*
46 Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 David Walend
47 All rights reserved.
48
49 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
50
51 Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
52
53 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
54
55 Neither the name of the SomnifugiJMS Project, walend.net, nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission from David Walend.
56
57 Credits in redistributions in source or binary forms must include a link to http://somnifugi.sourceforge.net .
58
59 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60 The net.walend.somnifugi.sql92 package is modified code from the openmq project, https://mq.dev.java.net/ , Copyright (c) of Sun, and carries the CDDL license, repeated here: You can obtain a copy of the license at https://glassfish.dev.java.net/public/CDDLv1.0.html. See the License for the specific language governing permissions and limitations under the License.
61
62 =================================================================================
63
64 For more information and the latest version of this software, please see http://somnifugi.sourceforge.net and http://walend.net or email <a HREF="mailto:david@walend.net">david@walend.net</a>.
65
66 */

67
68
69
70
Popular Tags