001/* 002 * Copyright 2002-2015 the original author or authors. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * https://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 017package org.springframework.messaging.simp.user; 018 019import java.util.Set; 020 021/** 022 * A contract for adding and removing user sessions. 023 * 024 * <p>As of 4.2, this interface is replaced by {@link SimpUserRegistry}, 025 * exposing methods to return all registered users as well as to provide 026 * more extensive information for each user. 027 * 028 * @author Rossen Stoyanchev 029 * @since 4.0 030 * @deprecated in favor of {@link SimpUserRegistry} in combination with 031 * {@link org.springframework.context.ApplicationListener} listening for 032 * {@link org.springframework.web.socket.messaging.AbstractSubProtocolEvent} events. 033 */ 034@Deprecated 035public interface UserSessionRegistry { 036 037 /** 038 * Return the active session ids for the user. 039 * The returned set is a snapshot that will never be modified. 040 * @param userName the user to look up 041 * @return a set with 0 or more session ids, never {@code null}. 042 */ 043 Set<String> getSessionIds(String userName); 044 045 /** 046 * Register an active session id for a user. 047 * @param userName the user name 048 * @param sessionId the session id 049 */ 050 void registerSessionId(String userName, String sessionId); 051 052 /** 053 * Unregister an active session id for a user. 054 * @param userName the user name 055 * @param sessionId the session id 056 */ 057 void unregisterSessionId(String userName, String sessionId); 058 059}