KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > joram > client > jms > admin > Subscription


1 /*
2  * JORAM: Java(TM) Open Reliable Asynchronous Messaging
3  * Copyright (C) 2004 - 2006 ScalAgent Distributed Technologies
4  * Copyright (C) 2004 Bull SA
5  * Copyright (C) 1996 - 2000 Dyade
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20  * USA.
21  *
22  * Initial developer(s): Frederic Maistre (Bull SA),
23  * Nicolas Tachker (ScalAgent Distributed Technologies)
24  * Contributor(s): ScalAgent Distributed Technologies
25  */

26 package org.objectweb.joram.client.jms.admin;
27
28 /**
29  * The <code>Subscription</code> class is a utility class needed to show
30  * information about client subscription.<p>
31  * Be careful, contrary to user, queue or topic administration object, the
32  * <code>Subscription</code> object is just a data structure; it is initialized
33  * by <code>user.getSubscription()</code> methods and no longer keep consistent
34  * with the real state of subscription.
35  */

36 public class Subscription {
37   /**
38    * Name of the subscription.
39    */

40   private String JavaDoc name;
41
42   /**
43    * Related topic unique identification.
44    */

45   private String JavaDoc topicId;
46
47   /**
48    * Number of pending messages for this subscription.
49    */

50   private int messageCount;
51
52   /**
53    * True if the subscription is durable.
54    */

55   private boolean durable;
56
57   /**
58    * Creates a new <code>Subscription</code> object.
59    */

60   public Subscription(String JavaDoc name,
61                       String JavaDoc topicId,
62                       int messageCount,
63                       boolean durable) {
64     this.name = name;
65     this.topicId = topicId;
66     this.messageCount = messageCount;
67     this.durable = durable;
68   }
69
70   /**
71    * Returns the subscription's name.
72    *
73    * @return the subscription's name.
74    */

75   public final String JavaDoc getName() {
76     return name;
77   }
78
79   /**
80    * Returns the related topic unique identification.
81    *
82    * @return the related topic unique identification.
83    */

84   public final String JavaDoc getTopicId() {
85     return topicId;
86   }
87
88   /**
89    * Returns the number of pending messages.
90    *
91    * @return the number of pending messages.
92    */

93   public final int getMessageCount() {
94     return messageCount;
95   }
96
97   /**
98    * Returns true if the subscription is durable, false otherwise.
99    *
100    * @return true if the subscription is durable, false otherwise.
101    */

102   public final boolean isDurable() {
103     return durable;
104   }
105
106   /**
107    * Returns a String image of the subscription.
108    */

109   public String JavaDoc toString() {
110     StringBuffer JavaDoc buff = new StringBuffer JavaDoc();
111     buff.append("Subscription(");
112     buff.append("name=");
113     buff.append(name);
114     buff.append(",topicId=");
115     buff.append(topicId);
116     buff.append(",messageCount=");
117     buff.append(messageCount);
118     buff.append(",durable=");
119     buff.append(durable);
120     buff.append(")");
121     return buff.toString();
122   }
123 }
124
Popular Tags