/** 
 * 
 * Copyright 2004 Protique Ltd
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and 
 * limitations under the License. 
 * 
 **/
package org.codehaus.activemq.service;

import org.codehaus.activemq.broker.BrokerClient;
import org.codehaus.activemq.filter.Filter;
import org.codehaus.activemq.message.ActiveMQDestination;
import org.codehaus.activemq.message.ConsumerInfo;

import java.util.Iterator;
import java.util.Set;

/**
 * Represents a possibly persistent container of subscription objects
 *
 * @version $Revision: 1.1 $
 */
public interface SubscriptionContainer {

    /**
     * Gets the current subscription for the given consumerId if it is available
     *
     * @param consumerId
     * @return
     */
    public Subscription getSubscription(String consumerId);

    public Subscription removeSubscription(String consumerId);

    /**
     * @return an iterator through the subscriptions
     */
    public Iterator subscriptionIterator();


    /**
     * Creates a subscription (which could be a previous subscription
     * reconecting) and adds it to this container
     *
     * @param dispatcher
     * @param client
     * @param info
     * @param filter
     * @return
     */
    public Subscription makeSubscription(Dispatcher dispatcher, BrokerClient client,ConsumerInfo info, Filter filter);

    /**
     * @param destination
     * @return a collection of subscriptions for the given destination
     */
    public Set getSubscriptions(ActiveMQDestination destination);
}
