diff options
author | Vitaly Takmazov | 2018-04-25 13:54:25 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2018-04-25 19:04:07 +0300 |
commit | 2bf63fc8d2a4b84e051d28e670c7c74b039e2545 (patch) | |
tree | afceff82288a45649156b0a8428999a00464ba59 /juick-www/src/main/java/com/juick/www/configuration | |
parent | 003ff7221782c4f0cf4a5660832e40c7ac386618 (diff) |
www: no more xmpp
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/configuration')
4 files changed, 20 insertions, 66 deletions
diff --git a/juick-www/src/main/java/com/juick/www/configuration/EmbeddedAPIConfig.java b/juick-www/src/main/java/com/juick/www/configuration/EmbeddedAPIConfig.java new file mode 100644 index 00000000..6ceb140b --- /dev/null +++ b/juick-www/src/main/java/com/juick/www/configuration/EmbeddedAPIConfig.java @@ -0,0 +1,19 @@ +package com.juick.www.configuration; + +import com.juick.server.configuration.PostConfig; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ConditionalOnClass(name = "com.juick.server.api.Post") +public class EmbeddedAPIConfig { + @Bean + public ConfigurableApplicationContext apiContext() { + return new SpringApplicationBuilder() + .sources(PostConfig.class) + .run("--server.port=8081"); + } +} diff --git a/juick-www/src/main/java/com/juick/www/configuration/EmbeddedXMPPConfig.java b/juick-www/src/main/java/com/juick/www/configuration/EmbeddedXMPPConfig.java deleted file mode 100644 index a54b76a1..00000000 --- a/juick-www/src/main/java/com/juick/www/configuration/EmbeddedXMPPConfig.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.juick.www.configuration; - -import com.juick.server.XMPPConnection; -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import rocks.xmpp.extensions.component.accept.ExternalComponent; - -import javax.inject.Inject; - -@Configuration -@ConditionalOnClass(name = "com.juick.server.xmpp.router.XMPPRouter") -@ComponentScan(basePackages = "com.juick.server") -public class EmbeddedXMPPConfig { - @Inject - private XMPPConnection xmppConnection; - @Bean - public ExternalComponent xmpp() { - return xmppConnection.getRouter(); - } -} diff --git a/juick-www/src/main/java/com/juick/www/configuration/WwwAppConfiguration.java b/juick-www/src/main/java/com/juick/www/configuration/WwwAppConfiguration.java index 13a394cb..edee3b87 100644 --- a/juick-www/src/main/java/com/juick/www/configuration/WwwAppConfiguration.java +++ b/juick-www/src/main/java/com/juick/www/configuration/WwwAppConfiguration.java @@ -51,7 +51,7 @@ import java.util.Collections; @Configuration @EnableCaching @Import({ BaseWebConfiguration.class, WebSecurityConfig.class, SapeConfiguration.class, - StorageConfiguration.class, XMPPConfiguration.class}) + StorageConfiguration.class}) public class WwwAppConfiguration implements WebMvcConfigurer { @Inject private UserService userService; diff --git a/juick-www/src/main/java/com/juick/www/configuration/XMPPConfiguration.java b/juick-www/src/main/java/com/juick/www/configuration/XMPPConfiguration.java deleted file mode 100644 index 8afddf2d..00000000 --- a/juick-www/src/main/java/com/juick/www/configuration/XMPPConfiguration.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.juick.www.configuration; - -import com.juick.Message; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import rocks.xmpp.core.XmppException; -import rocks.xmpp.core.session.Extension; -import rocks.xmpp.core.session.XmppSessionConfiguration; -import rocks.xmpp.core.session.debug.LogbackDebugger; -import rocks.xmpp.extensions.component.accept.ExternalComponent; - -@Configuration -public class XMPPConfiguration { - private static Logger logger = LoggerFactory.getLogger(XMPPConfiguration.class); - @Value("${xmpp_host:localhost}") - private String xmppHost; - @Value("${xmpp_password:secret}") - private String xmppPassword; - @Value("${www_xmpp_jid:www.juick.local}") - private String xmppJid; - @Value("${xmpp_port:5347}") - private int xmppPort; - @Bean - @ConditionalOnMissingBean(type = "rocks.xmpp.extensions.component.accept.ExternalComponent") - public ExternalComponent xmpp() { - XmppSessionConfiguration configuration = XmppSessionConfiguration.builder() - .extensions(Extension.of(Message.class)) - .debugger(LogbackDebugger.class) - .build(); - ExternalComponent xmpp = ExternalComponent.create(xmppJid, xmppPassword, configuration, xmppHost, xmppPort); - xmpp.addConnectionListener(e -> logger.error(e.toString(), e.getCause())); - try { - xmpp.connect(); - } catch (XmppException e) { - logger.error("xmpp extension", e); - } - return xmpp; - } -} |