Skip to content

Commit

Permalink
Add missing @Override
Browse files Browse the repository at this point in the history
  • Loading branch information
vpavic committed Oct 27, 2017
1 parent 5df555c commit f8583bb
Show file tree
Hide file tree
Showing 49 changed files with 273 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ static class SecuritySessionDestroyedListener
* @see org.springframework.context.ApplicationListener#onApplicationEvent(org.
* springframework.context.ApplicationEvent)
*/
@Override
public void onApplicationEvent(SessionDestroyedEvent event) {
this.event = event;
}
Expand Down
1 change: 1 addition & 0 deletions docs/src/test/java/docs/websocket/WebSocketConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
@EnableWebSocketMessageBroker
public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {

@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/messages").withSockJS();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
public class SecurityConfig extends WebSecurityConfigurerAdapter {

@Bean
@Override
public UserDetailsService userDetailsService() {
InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
manager.createUser(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public SessionDetailsFilter(DatabaseReader reader) {
}

// tag::dofilterinternal[]
@Override
public void doFilterInternal(HttpServletRequest request, HttpServletResponse response,
FilterChain chain) throws IOException, ServletException {
chain.doFilter(request, response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
public class SecurityConfig extends WebSecurityConfigurerAdapter {

@Bean
@Override
public UserDetailsService userDetailsService() {
InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
manager.createUser(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
public class SecurityConfig extends WebSecurityConfigurerAdapter {

@Bean
@Override
public UserDetailsService userDetailsService() {
InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
manager.createUser(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ private ObjectMapper objectMapper() {
* org.springframework.beans.factory.BeanClassLoaderAware#setBeanClassLoader(java.lang
* .ClassLoader)
*/
@Override
public void setBeanClassLoader(ClassLoader classLoader) {
this.loader = classLoader;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
public class SecurityConfig extends WebSecurityConfigurerAdapter {

@Bean
@Override
public UserDetailsService userDetailsService() {
InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
manager.createUser(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

@Bean
@Override
public UserDetailsService userDetailsService() {
InMemoryUserDetailsManager manager = new InMemoryUserDetailsManager();
manager.createUser(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@
public class WebSocketConfig
extends AbstractSessionWebSocketMessageBrokerConfigurer<Session> { // <1>

@Override
protected void configureStompEndpoints(StompEndpointRegistry registry) { // <2>
registry.addEndpoint("/messages").withSockJS();
}

@Override
public void configureMessageBroker(MessageBrokerRegistry registry) {
registry.enableSimpleBroker("/queue/", "/topic/");
registry.setApplicationDestinationPrefixes("/app");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public UserRepositoryUserDetailsService(UserRepository userRepository) {
* org.springframework.security.core.userdetails.UserDetailsService#loadUserByUsername
* (java.lang.String)
*/
@Override
public UserDetails loadUserByUsername(String username)
throws UsernameNotFoundException {
User user = this.userRepository.findByEmail(username);
Expand All @@ -64,26 +65,32 @@ private CustomUserDetails(User user) {
super(user);
}

@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
return AuthorityUtils.createAuthorityList("ROLE_USER");
}

@Override
public String getUsername() {
return getEmail();
}

@Override
public boolean isAccountNonExpired() {
return true;
}

@Override
public boolean isAccountNonLocked() {
return true;
}

@Override
public boolean isCredentialsNonExpired() {
return true;
}

@Override
public boolean isEnabled() {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public WebSocketConnectHandler(SimpMessageSendingOperations messagingTemplate,
this.repository = repository;
}

@Override
public void onApplicationEvent(SessionConnectEvent event) {
MessageHeaders headers = event.getMessage().getHeaders();
Principal user = SimpMessageHeaderAccessor.getUser(headers);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public WebSocketDisconnectHandler(SimpMessageSendingOperations messagingTemplate
this.repository = repository;
}

@Override
public void onApplicationEvent(SessionDisconnectEvent event) {
String id = event.getSessionId();
if (id == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,20 @@
*
*/
public class ObjectStreamSerializer implements StreamSerializer<Object> {
@Override
public int getTypeId() {
return 2;
}

@Override
public void write(ObjectDataOutput objectDataOutput, Object object)
throws IOException {
ObjectOutputStream out = new ObjectOutputStream((OutputStream) objectDataOutput);
out.writeObject(object);
out.flush();
}

@Override
public Object read(ObjectDataInput objectDataInput) throws IOException {
ObjectInputStream in = new ObjectInputStream((InputStream) objectDataInput);
try {
Expand All @@ -57,6 +60,7 @@ public Object read(ObjectDataInput objectDataInput) throws IOException {
}
}

@Override
public void destroy() {
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

public class H2ConsoleInitializer implements WebApplicationInitializer {

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
servletContext.addServlet("h2Console", new WebServlet()).addMapping("/h2-console/*");
}
Expand Down
2 changes: 2 additions & 0 deletions samples/misc/hazelcast/src/main/java/sample/Initializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class Initializer implements ServletContextListener {

private HazelcastInstance instance;

@Override
public void contextInitialized(ServletContextEvent sce) {
this.instance = createHazelcastInstance();
Map<String, Session> sessions = this.instance.getMap(SESSION_MAP_NAME);
Expand All @@ -55,6 +56,7 @@ public void contextInitialized(ServletContextEvent sce) {
fr.addMappingForUrlPatterns(EnumSet.of(DispatcherType.REQUEST), true, "/*");
}

@Override
public void contextDestroyed(ServletContextEvent sce) {
this.instance.shutdown();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public void setDefaultMaxInactiveInterval(int defaultMaxInactiveInterval) {
this.defaultMaxInactiveInterval = defaultMaxInactiveInterval;
}

@Override
public Mono<Void> save(MapSession session) {
return Mono.fromRunnable(() -> {
if (!session.getId().equals(session.getOriginalId())) {
Expand All @@ -81,6 +82,7 @@ public Mono<Void> save(MapSession session) {
});
}

@Override
public Mono<MapSession> findById(String id) {
// @formatter:off
return Mono.defer(() -> Mono.justOrEmpty(this.sessions.get(id))
Expand All @@ -90,10 +92,12 @@ public Mono<MapSession> findById(String id) {
// @formatter:on
}

@Override
public Mono<Void> deleteById(String id) {
return Mono.fromRunnable(() -> this.sessions.remove(id));
}

@Override
public Mono<MapSession> createSession() {
return Mono.defer(() -> {
MapSession result = new MapSession();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,17 @@ public MapSession(Session session) {
this.maxInactiveInterval = session.getMaxInactiveInterval();
}

@Override
public void setLastAccessedTime(Instant lastAccessedTime) {
this.lastAccessedTime = lastAccessedTime;
}

@Override
public Instant getCreationTime() {
return this.creationTime;
}

@Override
public String getId() {
return this.id;
}
Expand All @@ -127,24 +130,29 @@ void setOriginalId(String originalId) {
this.originalId = originalId;
}

@Override
public String changeSessionId() {
String changedId = generateId();
setId(changedId);
return changedId;
}

@Override
public Instant getLastAccessedTime() {
return this.lastAccessedTime;
}

@Override
public void setMaxInactiveInterval(Duration interval) {
this.maxInactiveInterval = interval;
}

@Override
public Duration getMaxInactiveInterval() {
return this.maxInactiveInterval;
}

@Override
public boolean isExpired() {
return isExpired(Instant.now());
}
Expand All @@ -156,15 +164,18 @@ boolean isExpired(Instant now) {
return now.minus(this.maxInactiveInterval).compareTo(this.lastAccessedTime) >= 0;
}

@Override
@SuppressWarnings("unchecked")
public <T> T getAttribute(String attributeName) {
return (T) this.sessionAttrs.get(attributeName);
}

@Override
public Set<String> getAttributeNames() {
return this.sessionAttrs.keySet();
}

@Override
public void setAttribute(String attributeName, Object attributeValue) {
if (attributeValue == null) {
removeAttribute(attributeName);
Expand All @@ -174,6 +185,7 @@ public void setAttribute(String attributeName, Object attributeValue) {
}
}

@Override
public void removeAttribute(String attributeName) {
this.sessionAttrs.remove(attributeName);
}
Expand All @@ -198,10 +210,12 @@ public void setId(String id) {
this.id = id;
}

@Override
public boolean equals(Object obj) {
return obj instanceof Session && this.id.equals(((Session) obj).getId());
}

@Override
public int hashCode() {
return this.id.hashCode();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public void setDefaultMaxInactiveInterval(int defaultMaxInactiveInterval) {
this.defaultMaxInactiveInterval = defaultMaxInactiveInterval;
}

@Override
public void save(MapSession session) {
if (!session.getId().equals(session.getOriginalId())) {
this.sessions.remove(session.getOriginalId());
Expand All @@ -77,6 +78,7 @@ public void save(MapSession session) {
this.sessions.put(session.getId(), new MapSession(session));
}

@Override
public MapSession findById(String id) {
Session saved = this.sessions.get(id);
if (saved == null) {
Expand All @@ -89,10 +91,12 @@ public MapSession findById(String id) {
return new MapSession(saved);
}

@Override
public void deleteById(String id) {
this.sessions.remove(id);
}

@Override
public MapSession createSession() {
MapSession result = new MapSession();
if (this.defaultMaxInactiveInterval != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,14 @@ public SpringSessionBackedSessionRegistry(
this.sessionRepository = sessionRepository;
}

@Override
public List<Object> getAllPrincipals() {
throw new UnsupportedOperationException("SpringSessionBackedSessionRegistry does "
+ "not support retrieving all principals, since Spring Session provides "
+ "no way to obtain that information");
}

@Override
public List<SessionInformation> getAllSessions(Object principal,
boolean includeExpiredSessions) {
Collection<S> sessions = this.sessionRepository.findByIndexNameAndIndexValue(
Expand All @@ -77,6 +79,7 @@ public List<SessionInformation> getAllSessions(Object principal,
return infos;
}

@Override
public SessionInformation getSessionInformation(String sessionId) {
S session = this.sessionRepository.findById(sessionId);
if (session != null) {
Expand All @@ -89,18 +92,21 @@ public SessionInformation getSessionInformation(String sessionId) {
/*
* This is a no-op, as we don't administer sessions ourselves.
*/
@Override
public void refreshLastRequest(String sessionId) {
}

/*
* This is a no-op, as we don't administer sessions ourselves.
*/
@Override
public void registerNewSession(String sessionId, Object principal) {
}

/*
* This is a no-op, as we don't administer sessions ourselves.
*/
@Override
public void removeSessionInformation(String sessionId) {
}

Expand Down
Loading

0 comments on commit f8583bb

Please sign in to comment.