aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main/java/com/juick/www/WebApp.java
diff options
context:
space:
mode:
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/WebApp.java')
-rw-r--r--juick-www/src/main/java/com/juick/www/WebApp.java60
1 files changed, 1 insertions, 59 deletions
diff --git a/juick-www/src/main/java/com/juick/www/WebApp.java b/juick-www/src/main/java/com/juick/www/WebApp.java
index f254b5fa..94c12528 100644
--- a/juick-www/src/main/java/com/juick/www/WebApp.java
+++ b/juick-www/src/main/java/com/juick/www/WebApp.java
@@ -18,21 +18,10 @@ package com.juick.www;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
-import com.juick.Message;
import com.juick.Tag;
import com.juick.service.TagService;
import org.apache.commons.io.IOUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.DisposableBean;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
-import rocks.xmpp.addr.Jid;
-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;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
@@ -49,25 +38,11 @@ import java.util.stream.Stream;
* @author Ugnich Anton
*/
@Component
-public class WebApp implements DisposableBean {
- private static Logger logger = LoggerFactory.getLogger(WebApp.class);
-
- private ExternalComponent xmpp;
-
+public class WebApp {
@Inject
private TagService tagService;
@Inject
private ObjectMapper jsonMapper;
- @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;
- @Value("${xmpp_disabled:false}")
- private boolean isXmppDisabled;
private String scriptsUrl;
private String styleUrl;
@@ -80,39 +55,6 @@ public class WebApp implements DisposableBean {
new TypeReference<HashMap<String, String>>() {});
scriptsUrl = manifest.get("scripts.js");
styleUrl = manifest.get("style.css");
- if (!isXmppDisabled) {
- setupXmppComponent(Jid.of(xmppJid),
- xmppPassword, xmppPort);
- }
- }
-
- @Override
- public void destroy() {
- try {
- if (xmpp != null)
- xmpp.close();
- logger.error("ExternalComponent on WWW destroyed");
- } catch (Exception e) {
- logger.error("exception on destroy", e);
- }
- }
-
- public void setupXmppComponent(final Jid componentJid, final String password, final int port) {
- XmppSessionConfiguration configuration = XmppSessionConfiguration.builder()
- .extensions(Extension.of(Message.class))
- .debugger(LogbackDebugger.class)
- .build();
- xmpp = ExternalComponent.create(componentJid.toString(), password, configuration, xmppHost, port);
- xmpp.addConnectionListener(e -> logger.error(e.toString(), e.getCause()));
- try {
- xmpp.connect();
- } catch (XmppException e) {
- logger.error("xmpp extension", e);
- }
- }
-
- public ExternalComponent getXmpp() {
- return xmpp;
}
public List<Tag> parseTags(String tagsStr) {