KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > jms > QueueBrowser


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24
25 package javax.jms;
26
27 import java.util.Enumeration JavaDoc;
28
29 /** A client uses a <CODE>QueueBrowser</CODE> object to look at messages on a
30   * queue without removing them.
31   *
32   * <P>The <CODE>getEnumeration</CODE> method returns a
33   * <CODE>java.util.Enumeration</CODE> that is used to scan
34   * the queue's messages. It may be an enumeration of the entire content of a
35   * queue, or it may contain only the messages matching a message selector.
36   *
37   * <P>Messages may be arriving and expiring while the scan is done. The JMS API
38   * does
39   * not require the content of an enumeration to be a static snapshot of queue
40   * content. Whether these changes are visible or not depends on the JMS
41   * provider.
42   *
43   *<P>A <CODE>QueueBrowser</CODE> can be created from either a
44   * <CODE>Session</CODE> or a <CODE> QueueSession</CODE>.
45   *
46   * @version 1.1 April 9, 2002
47   * @author Mark Hapner
48   * @author Rich Burridge
49   * @author Kate Stout
50   *
51   * @see javax.jms.Session#createBrowser
52   * @see javax.jms.QueueSession#createBrowser
53   * @see javax.jms.QueueReceiver
54   */

55
56 public interface QueueBrowser {
57
58     /** Gets the queue associated with this queue browser.
59       *
60       * @return the queue
61       *
62       * @exception JMSException if the JMS provider fails to get the
63       * queue associated with this browser
64       * due to some internal error.
65       */

66
67     Queue JavaDoc
68     getQueue() throws JMSException JavaDoc;
69
70
71     /** Gets this queue browser's message selector expression.
72       *
73       * @return this queue browser's message selector, or null if no
74       * message selector exists for the message consumer (that is, if
75       * the message selector was not set or was set to null or the
76       * empty string)
77       *
78       * @exception JMSException if the JMS provider fails to get the
79       * message selector for this browser
80       * due to some internal error.
81       */

82
83     String JavaDoc
84     getMessageSelector() throws JMSException JavaDoc;
85
86
87     /** Gets an enumeration for browsing the current queue messages in the
88       * order they would be received.
89       *
90       * @return an enumeration for browsing the messages
91       *
92       * @exception JMSException if the JMS provider fails to get the
93       * enumeration for this browser
94       * due to some internal error.
95       */

96
97     Enumeration JavaDoc
98     getEnumeration() throws JMSException JavaDoc;
99
100
101     /** Closes the <CODE>QueueBrowser</CODE>.
102       *
103       * <P>Since a provider may allocate some resources on behalf of a
104       * QueueBrowser outside the Java virtual machine, clients should close them
105       * when they
106       * are not needed. Relying on garbage collection to eventually reclaim
107       * these resources may not be timely enough.
108       *
109       * @exception JMSException if the JMS provider fails to close this
110       * browser due to some internal error.
111       */

112
113     void
114     close() throws JMSException JavaDoc;
115 }
116
Popular Tags