aboutsummaryrefslogtreecommitdiff
path: root/juick-notifications/src/main/java/com/juick/components/configuration
diff options
context:
space:
mode:
Diffstat (limited to 'juick-notifications/src/main/java/com/juick/components/configuration')
-rw-r--r--juick-notifications/src/main/java/com/juick/components/configuration/APNSConfiguration.java18
-rw-r--r--juick-notifications/src/main/java/com/juick/components/configuration/GCMConfiguration.java19
-rw-r--r--juick-notifications/src/main/java/com/juick/components/configuration/JuickServerWebsocketConfiguration.java75
-rw-r--r--juick-notifications/src/main/java/com/juick/components/configuration/MPNSConfiguration.java18
4 files changed, 0 insertions, 130 deletions
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<ClientHttpRequestInterceptor> 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<String> 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();
- }
-}