/*
 * Created on 31.05.2005
 */
package scm.hivemind.statefulservice;

import javax.servlet.http.HttpSession;



/**
 * Provides storage for stateful (long-lived) services. Should normally use
 * a HTTP-Session which must be provided to it externally (by some Filter).
 * For testing outside of a servlet-container it can also use an own,
 * Map-based implementation.
 * 
 * @author Marcus Schulte
 */
public interface ClientStateStorage {
	/**
	 * provides the current user's session to the Storage. should be called
	 * by a filter at the beginning of each request.
	 * 
	 * @param session
	 */
	void provideSession( HttpSession session );
	
	
	/**
	 * store a service.
	 * 
	 * @param key
	 * @param obj
	 */
	void store( String key, StateStorageClearanceListener obj);
	
	/**
	 * retrieve a service.
	 * 
	 * @param key
	 * @return
	 */
	StateStorageClearanceListener retrieve( String key );
	
	
	/**
	 * <b> testing only </b> clears the client store with the given Id
	 * 
	 * @param clientId
	 */
	void clear( String clientId );

	/**
	 * <b> testing only </b> sets the client store to the one 
	 * with the given Id, creating it as needed.
	 * 
	 * @param clientId
	 */
	void setClientId(String clientId);
}

  • No labels