From 3ea9770d0d43fbe45449ac4531ec4b0a374d98ea Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 8 Nov 2018 21:16:19 +0300 Subject: Drop legacy notification server --- .../configuration/APNSConfiguration.java | 18 ------ .../components/configuration/GCMConfiguration.java | 19 ------ .../JuickServerWebsocketConfiguration.java | 75 ---------------------- .../configuration/MPNSConfiguration.java | 18 ------ 4 files changed, 130 deletions(-) delete mode 100644 juick-notifications/src/main/java/com/juick/components/configuration/APNSConfiguration.java delete mode 100644 juick-notifications/src/main/java/com/juick/components/configuration/GCMConfiguration.java delete mode 100644 juick-notifications/src/main/java/com/juick/components/configuration/JuickServerWebsocketConfiguration.java delete mode 100644 juick-notifications/src/main/java/com/juick/components/configuration/MPNSConfiguration.java (limited to 'juick-notifications/src/main/java/com/juick/components/configuration') diff --git a/juick-notifications/src/main/java/com/juick/components/configuration/APNSConfiguration.java b/juick-notifications/src/main/java/com/juick/components/configuration/APNSConfiguration.java deleted file mode 100644 index fbc17bc9..00000000 --- a/juick-notifications/src/main/java/com/juick/components/configuration/APNSConfiguration.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.juick.components.configuration; - -import com.juick.components.APNSManager; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * Created by vital on 28.03.2017. - */ -@Configuration -@ConditionalOnProperty(name = "ios_p8_key") -public class APNSConfiguration { - @Bean - public APNSManager apnsManager() { - return new APNSManager(); - } -} diff --git a/juick-notifications/src/main/java/com/juick/components/configuration/GCMConfiguration.java b/juick-notifications/src/main/java/com/juick/components/configuration/GCMConfiguration.java deleted file mode 100644 index 68d9f017..00000000 --- a/juick-notifications/src/main/java/com/juick/components/configuration/GCMConfiguration.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.juick.components.configuration; - -import com.juick.components.FirebaseManager; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * Created by vital on 29.03.2017. - */ -@Configuration -@ConditionalOnProperty(name = "gcm_key") -public class GCMConfiguration { - - @Bean - public FirebaseManager firebaseManager() { - return new FirebaseManager(); - } -} diff --git a/juick-notifications/src/main/java/com/juick/components/configuration/JuickServerWebsocketConfiguration.java b/juick-notifications/src/main/java/com/juick/components/configuration/JuickServerWebsocketConfiguration.java deleted file mode 100644 index deb0cb5b..00000000 --- a/juick-notifications/src/main/java/com/juick/components/configuration/JuickServerWebsocketConfiguration.java +++ /dev/null @@ -1,75 +0,0 @@ -package com.juick.components.configuration; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.juick.components.NotificationsManager; -import org.apache.commons.lang3.StringUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.HttpMethod; -import org.springframework.http.ResponseEntity; -import org.springframework.http.client.ClientHttpRequestInterceptor; -import org.springframework.http.client.InterceptingClientHttpRequestFactory; -import org.springframework.http.client.support.BasicAuthorizationInterceptor; -import org.springframework.scheduling.TaskScheduler; -import org.springframework.scheduling.annotation.EnableScheduling; -import org.springframework.scheduling.concurrent.ConcurrentTaskScheduler; -import org.springframework.web.client.HttpClientErrorException; -import org.springframework.web.client.RestTemplate; -import org.springframework.web.socket.client.WebSocketConnectionManager; -import org.springframework.web.socket.client.standard.StandardWebSocketClient; -import org.springframework.web.util.UriComponentsBuilder; - -import javax.inject.Inject; -import java.util.Collections; -import java.util.List; - -@Configuration -@EnableScheduling -public class JuickServerWebsocketConfiguration { - private static final Logger logger = LoggerFactory.getLogger(JuickServerWebsocketConfiguration.class); - @Value("${websocket_url:ws://localhost:8080/ws/}") - private String baseUri; - @Value("${api_user:juick}") - private String serviceUser; - @Value("${api_password:secret}") - private String servicePassword; - @Inject - ObjectMapper jsonMapper; - @Inject - private NotificationsManager notificationsManager; - @Bean - public RestTemplate rest() { - RestTemplate rest = new RestTemplate(); - List interceptors = Collections.singletonList( - new BasicAuthorizationInterceptor(serviceUser, servicePassword)); - - rest.setRequestFactory(new InterceptingClientHttpRequestFactory(rest.getRequestFactory(), interceptors)); - return rest; - } - @Bean - public WebSocketConnectionManager connectionManager() { - String hash = StringUtils.EMPTY; - try { - ResponseEntity response = rest().exchange("https://api.juick.com/auth", - HttpMethod.GET, null, String.class); - hash = response.getBody(); - } catch (HttpClientErrorException e) { - logger.warn("service component is not authenticated", e); - } - String websocketURI = UriComponentsBuilder.fromUriString(baseUri) - .queryParam("hash", hash).build().toUriString(); - WebSocketConnectionManager manager = new WebSocketConnectionManager(client(), notificationsManager, websocketURI); - return manager; - } - @Bean - public StandardWebSocketClient client() { - return new StandardWebSocketClient(); - } - @Bean - public TaskScheduler taskScheduler() { - return new ConcurrentTaskScheduler(); - } -} diff --git a/juick-notifications/src/main/java/com/juick/components/configuration/MPNSConfiguration.java b/juick-notifications/src/main/java/com/juick/components/configuration/MPNSConfiguration.java deleted file mode 100644 index 4235486c..00000000 --- a/juick-notifications/src/main/java/com/juick/components/configuration/MPNSConfiguration.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.juick.components.configuration; - -import com.juick.components.MPNSManager; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * Created by vital on 29.03.2017. - */ -@Configuration -@ConditionalOnProperty(name = "wns_application_sip") -public class MPNSConfiguration { - @Bean - public MPNSManager mpnsClient() { - return new MPNSManager(); - } -} -- cgit v1.2.3