KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > mq > sm > StateManager


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software 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 software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.mq.sm;
23
24 import java.util.Collection JavaDoc;
25 import javax.jms.JMSException JavaDoc;
26 import org.jboss.mq.SpyTopic;
27 import org.jboss.mq.DurableSubscriptionID;
28 import org.jboss.mq.server.JMSDestinationManager;
29
30 /**
31  * Interface for StateManager.
32  *
33  * A StateManager is a manager that manages states that has to do with clients/
34  * users and durable subscription.
35  *
36  * A state manager most know how to persist information regarding durable
37  * subscriptions.
38  *
39  * It should also hold all current clientID's that are connected to the server.
40  *
41  * It may also support basic autentication, which is what the old
42  * default StateManager did.
43  *
44  * @author <a HREF="pra@tim.se">Peter Antman</a>
45  * @author <a HREF="Norbert.Lataille@m4x.org">Norbert Lataille</a>
46  * @author <a HREF="hiram.chirino@jboss.org">Hiram Chirino</a>
47  * @version $Revision: 37459 $
48  */

49
50 public interface StateManager {
51    
52   /**
53     * Ad, change or delete a durable subsciption.
54     *
55     * The contract is that the StateManager, must physically create the durable
56     * subscription. And when the method returns the information must be persisted.
57     *
58     *
59     * @param server The JMSServer
60     * @param sub The id of the durable subscription
61     * @param topic The topic to subscribe durable on, if null
62     * the subscription will be removed.
63     * @exception JMSException Description of Exception
64     */

65    public void setDurableSubscription(JMSDestinationManager server, DurableSubscriptionID sub, SpyTopic topic) throws JMSException JavaDoc;
66
67    /**
68     * Get the destination a subscription is for.
69     */

70    public SpyTopic getDurableTopic(DurableSubscriptionID sub) throws JMSException JavaDoc;
71    
72    /**
73     * Check if a user has a preconfigured clientID and return it.
74     *
75     * If the user has a preconfigured clienID it will be added to the current
76     * logged in clientID's and returned.
77     *
78     * The state manager may also use this method to authenticate a user.
79     * If a SecurityManager is installed this is not necesarry.
80     *
81     * @param login user name
82     * @param passwd password
83     * @return a preconfigured clientID.
84     * @exception JMSException if the user
85     * @exception JMSSecurityException if the clientID is already loged in.
86     */

87    public String JavaDoc checkUser(String JavaDoc login, String JavaDoc passwd) throws JMSException JavaDoc;
88
89    /**
90     * Ad a logged in clientID to the statemanager.
91     *
92     * The clientID must not be active.
93     *
94     * The StateManager should somehow assure that a clientID that is
95     * preconfigured for a user is not allowed to be added this way.
96     *
97     * @param ID a clientID
98     * @exception JMSException Description of Exception
99     * @exception InvalidClientIDException if the clientID wass already logged in.
100     */

101    public void addLoggedOnClientId(String JavaDoc ID) throws JMSException JavaDoc;
102
103    /**
104     * Remove the logged in clientID.
105     *
106     * @param ID clientID.
107     */

108    public void removeLoggedOnClientId(String JavaDoc ID);
109
110    /**
111     * Get all configured durable subscriptions for a particular topic.
112     *
113     * @param topic the topic.
114     * @return a collection of DurableSubscriptionID
115     * @exception JMSException Description of Exception
116     */

117    public Collection JavaDoc getDurableSubscriptionIdsForTopic(SpyTopic topic)
118       throws JMSException JavaDoc;
119 } // StateManager
120

121
122
123
Popular Tags