Broadly remove deprecated core classes and methods

Issue: SPR-14430
This commit is contained in:
Juergen Hoeller
2016-07-05 15:52:48 +02:00
parent 0fc0ce78ae
commit b5db5d3aac
119 changed files with 145 additions and 6086 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -255,9 +255,8 @@ public abstract class AbstractMessageConverter implements SmartMessageConverter
* perform the conversion
* @since 4.2
*/
@SuppressWarnings("deprecation")
protected Object convertFromInternal(Message<?> message, Class<?> targetClass, Object conversionHint) {
return convertFromInternal(message, targetClass);
return null;
}
/**
@@ -270,28 +269,7 @@ public abstract class AbstractMessageConverter implements SmartMessageConverter
* cannot perform the conversion
* @since 4.2
*/
@SuppressWarnings("deprecation")
protected Object convertToInternal(Object payload, MessageHeaders headers, Object conversionHint) {
return convertToInternal(payload, headers);
}
/**
* Convert the message payload from serialized form to an Object.
* @deprecated as of Spring 4.2, in favor of {@link #convertFromInternal(Message, Class, Object)}
* (which is also protected instead of public)
*/
@Deprecated
public Object convertFromInternal(Message<?> message, Class<?> targetClass) {
return null;
}
/**
* Convert the payload object to serialized form.
* @deprecated as of Spring 4.2, in favor of {@link #convertFromInternal(Message, Class, Object)}
* (which is also protected instead of public)
*/
@Deprecated
public Object convertToInternal(Object payload, MessageHeaders headers) {
return null;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -76,18 +76,4 @@ public class AnnotationExceptionHandlerMethodResolver extends AbstractExceptionH
return result;
}
/**
* A filter for selecting annotated exception handling methods.
* @deprecated as of Spring 4.2.3, since it isn't used anymore
*/
@Deprecated
public final static MethodFilter EXCEPTION_HANDLER_METHOD_FILTER = new MethodFilter() {
@Override
public boolean matches(Method method) {
return AnnotationUtils.findAnnotation(method, MessageExceptionHandler.class) != null;
}
};
}

View File

@@ -399,18 +399,6 @@ public abstract class AbstractMessageBrokerConfiguration implements ApplicationC
*/
protected abstract SimpUserRegistry createLocalUserRegistry();
/**
* As of 4.2, UserSessionRegistry is deprecated in favor of SimpUserRegistry
* exposing information about all connected users. The MultiServerUserRegistry
* implementation in combination with UserRegistryMessageHandler can be used
* to share user registries across multiple servers.
*/
@Deprecated
@SuppressWarnings("deprecation")
protected org.springframework.messaging.simp.user.UserSessionRegistry userSessionRegistry() {
return null;
}
/**
* Return a {@link org.springframework.validation.Validator}s instance for validating
* {@code @Payload} method arguments.

View File

@@ -1,79 +0,0 @@
/*
* Copyright 2002-2015 the original author or authors.
*
* 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.springframework.messaging.simp.user;
import java.util.Collections;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CopyOnWriteArraySet;
import org.springframework.util.Assert;
/**
* A default thread-safe implementation of {@link UserSessionRegistry}.
*
* @author Rossen Stoyanchev
* @since 4.0
* @deprecated as of 4.2 this class is no longer used, see deprecation notes
* on {@link UserSessionRegistry} for more details.
*/
@Deprecated
@SuppressWarnings({"deprecation", "unused"})
public class DefaultUserSessionRegistry implements UserSessionRegistry {
// userId -> sessionId
private final ConcurrentMap<String, Set<String>> userSessionIds = new ConcurrentHashMap<String, Set<String>>();
private final Object lock = new Object();
@Override
public Set<String> getSessionIds(String user) {
Set<String> set = this.userSessionIds.get(user);
return (set != null ? set : Collections.<String>emptySet());
}
@Override
public void registerSessionId(String user, String sessionId) {
Assert.notNull(user, "User must not be null");
Assert.notNull(sessionId, "Session ID must not be null");
synchronized (this.lock) {
Set<String> set = this.userSessionIds.get(user);
if (set == null) {
set = new CopyOnWriteArraySet<String>();
this.userSessionIds.put(user, set);
}
set.add(sessionId);
}
}
@Override
public void unregisterSessionId(String userName, String sessionId) {
Assert.notNull(userName, "User Name must not be null");
Assert.notNull(sessionId, "Session ID must not be null");
synchronized (lock) {
Set<String> set = this.userSessionIds.get(userName);
if (set != null) {
if (set.remove(sessionId) && set.isEmpty()) {
this.userSessionIds.remove(userName);
}
}
}
}
}

View File

@@ -1,59 +0,0 @@
/*
* Copyright 2002-2015 the original author or authors.
*
* 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.springframework.messaging.simp.user;
import java.util.Set;
/**
* A contract for adding and removing user sessions.
*
* <p>As of 4.2, this interface is replaced by {@link SimpUserRegistry},
* exposing methods to return all registered users as well as to provide
* more extensive information for each user.
*
* @author Rossen Stoyanchev
* @since 4.0
* @deprecated in favor of {@link SimpUserRegistry} in combination with
* {@link org.springframework.context.ApplicationListener} listening for
* {@link org.springframework.web.socket.messaging.AbstractSubProtocolEvent} events.
*/
@Deprecated
public interface UserSessionRegistry {
/**
* Return the active session ids for the user.
* The returned set is a snapshot that will never be modified.
* @param userName the user to look up
* @return a set with 0 or more session ids, never {@code null}.
*/
Set<String> getSessionIds(String userName);
/**
* Register an active session id for a user.
* @param userName the user name
* @param sessionId the session id
*/
void registerSessionId(String userName, String sessionId);
/**
* Unregister an active session id for a user.
* @param userName the user name
* @param sessionId the session id
*/
void unregisterSessionId(String userName, String sessionId);
}

View File

@@ -1,136 +0,0 @@
/*
* Copyright 2002-2016 the original author or authors.
*
* 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.springframework.messaging.simp.user;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.springframework.util.CollectionUtils;
/**
* An adapter that allows a {@code UserSessionRegistry}, which is deprecated in
* favor of {@code SimpUserRegistry}, to be used as a {@code SimpUserRegistry}.
* Due to the more limited information available, methods such as
* {@link #getUsers()} and {@link #findSubscriptions} are not supported.
*
* <p>As of 4.2, this adapter is used only in applications that explicitly
* register a custom {@code UserSessionRegistry} bean by overriding
* {@link org.springframework.messaging.simp.config.AbstractMessageBrokerConfiguration#userSessionRegistry()}.
*
* @author Rossen Stoyanchev
* @since 4.2
*/
@SuppressWarnings("deprecation")
public class UserSessionRegistryAdapter implements SimpUserRegistry {
private final UserSessionRegistry userSessionRegistry;
public UserSessionRegistryAdapter(UserSessionRegistry registry) {
this.userSessionRegistry = registry;
}
@Override
public SimpUser getUser(String userName) {
Set<String> sessionIds = this.userSessionRegistry.getSessionIds(userName);
return (!CollectionUtils.isEmpty(sessionIds) ? new SimpUserAdapter(userName, sessionIds) : null);
}
@Override
public Set<SimpUser> getUsers() {
throw new UnsupportedOperationException("UserSessionRegistry does not expose a listing of users");
}
@Override
public Set<SimpSubscription> findSubscriptions(SimpSubscriptionMatcher matcher) {
throw new UnsupportedOperationException("UserSessionRegistry does not support operations across users");
}
/**
* Expose the only information available from a UserSessionRegistry
* (name and session id's) as a {@code SimpUser}.
*/
private static class SimpUserAdapter implements SimpUser {
private final String name;
private final Map<String, SimpSession> sessions;
public SimpUserAdapter(String name, Set<String> sessionIds) {
this.name = name;
this.sessions = new HashMap<String, SimpSession>(sessionIds.size());
for (String sessionId : sessionIds) {
this.sessions.put(sessionId, new SimpSessionAdapter(sessionId));
}
}
@Override
public String getName() {
return this.name;
}
@Override
public boolean hasSessions() {
return !this.sessions.isEmpty();
}
@Override
public SimpSession getSession(String sessionId) {
return this.sessions.get(sessionId);
}
@Override
public Set<SimpSession> getSessions() {
return new HashSet<SimpSession>(this.sessions.values());
}
}
/**
* Expose the only information available from a UserSessionRegistry
* (session ids but no subscriptions) as a {@code SimpSession}.
*/
private static class SimpSessionAdapter implements SimpSession {
private final String id;
public SimpSessionAdapter(String id) {
this.id = id;
}
@Override
public String getId() {
return this.id;
}
@Override
public SimpUser getUser() {
return null;
}
@Override
public Set<SimpSubscription> getSubscriptions() {
return Collections.<SimpSubscription>emptySet();
}
}
}