001    /** 
002     * 
003     * Copyright 2004 Protique Ltd
004     * 
005     * Licensed under the Apache License, Version 2.0 (the "License"); 
006     * you may not use this file except in compliance with the License. 
007     * You may obtain a copy of the License at 
008     * 
009     * http://www.apache.org/licenses/LICENSE-2.0
010     * 
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS, 
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
014     * See the License for the specific language governing permissions and 
015     * limitations under the License. 
016     * 
017     **/
018    package org.activemq.service;
019    
020    import org.activemq.broker.BrokerClient;
021    import org.activemq.filter.Filter;
022    import org.activemq.message.ActiveMQDestination;
023    import org.activemq.message.ConsumerInfo;
024    
025    import java.util.Iterator;
026    import java.util.Set;
027    
028    /**
029     * Represents a possibly persistent container of subscription objects
030     *
031     * @version $Revision: 1.1.1.1 $
032     */
033    public interface SubscriptionContainer {
034    
035        /**
036         * Gets the current subscription for the given consumerId if it is available
037         *
038         * @param consumerId
039         * @return
040         */
041        public Subscription getSubscription(String consumerId);
042    
043        public Subscription removeSubscription(String consumerId);
044    
045        /**
046         * @return an iterator through the subscriptions
047         */
048        public Iterator subscriptionIterator();
049    
050    
051        /**
052         * Creates a subscription (which could be a previous subscription
053         * reconecting) and adds it to this container
054         *
055         * @param dispatcher
056         * @param client
057         * @param info
058         * @param filter
059         * @return
060         */
061        public Subscription makeSubscription(Dispatcher dispatcher, BrokerClient client,ConsumerInfo info, Filter filter);
062    
063        /**
064         * @param destination
065         * @return a collection of subscriptions for the given destination
066         */
067        public Set getSubscriptions(ActiveMQDestination destination);
068    }