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-common/src/main/java/com | |
parent | 003ff7221782c4f0cf4a5660832e40c7ac386618 (diff) |
www: no more xmpp
Diffstat (limited to 'juick-common/src/main/java/com')
8 files changed, 3 insertions, 162 deletions
diff --git a/juick-common/src/main/java/com/juick/server/configuration/BaseWebConfiguration.java b/juick-common/src/main/java/com/juick/server/configuration/BaseWebConfiguration.java index 5880fd5c..9063e665 100644 --- a/juick-common/src/main/java/com/juick/server/configuration/BaseWebConfiguration.java +++ b/juick-common/src/main/java/com/juick/server/configuration/BaseWebConfiguration.java @@ -21,22 +21,13 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jdk8.Jdk8Module; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; -import com.juick.server.xmpp.JidConverter; -import com.juick.server.xmpp.iq.MessageQuery; -import com.juick.server.xmpp.s2s.BasicXmppSession; -import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.core.convert.ConversionService; -import org.springframework.format.support.DefaultFormattingConversionService; import org.springframework.scheduling.annotation.SchedulingConfigurer; import org.springframework.scheduling.config.ScheduledTaskRegistrar; import org.springframework.web.servlet.config.annotation.PathMatchConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.resource.ResourceUrlEncodingFilter; -import rocks.xmpp.core.session.Extension; -import rocks.xmpp.core.session.XmppSessionConfiguration; -import rocks.xmpp.core.session.debug.LogbackDebugger; import java.util.concurrent.Executor; import java.util.concurrent.ExecutorService; @@ -78,25 +69,9 @@ public class BaseWebConfiguration implements WebMvcConfigurer, SchedulingConfigu public Executor taskExecutor() { return Executors.newScheduledThreadPool(100); } - @Value("${hostname:localhost}") - private String hostname; @Bean public ExecutorService executorService() { return Executors.newCachedThreadPool(); } - @Bean - public BasicXmppSession session() { - XmppSessionConfiguration configuration = XmppSessionConfiguration.builder() - .extensions(Extension.of(com.juick.Message.class), Extension.of(MessageQuery.class)) - .debugger(LogbackDebugger.class) - .build(); - return BasicXmppSession.create(hostname, configuration); - } - @Bean - public static ConversionService conversionService() { - DefaultFormattingConversionService cs = new DefaultFormattingConversionService(); - cs.addConverter(new JidConverter()); - return cs; - } } diff --git a/juick-common/src/main/java/com/juick/server/helpers/CommandResult.java b/juick-common/src/main/java/com/juick/server/helpers/CommandResult.java index a772153b..a5baaee0 100644 --- a/juick-common/src/main/java/com/juick/server/helpers/CommandResult.java +++ b/juick-common/src/main/java/com/juick/server/helpers/CommandResult.java @@ -1,5 +1,6 @@ package com.juick.server.helpers; +import com.fasterxml.jackson.annotation.JsonInclude; import com.juick.Message; import java.util.Optional; @@ -17,7 +18,7 @@ public class CommandResult { } public Optional<Message> getNewMessage() { - return Optional.of(newMessage); + return Optional.ofNullable(newMessage); } public static CommandResult build(Message newMessage, String text, String markdown) { CommandResult result = new CommandResult(); diff --git a/juick-common/src/main/java/com/juick/server/util/HttpBadRequestException.java b/juick-common/src/main/java/com/juick/server/util/HttpBadRequestException.java index 1c3b4e66..242f2b09 100644 --- a/juick-common/src/main/java/com/juick/server/util/HttpBadRequestException.java +++ b/juick-common/src/main/java/com/juick/server/util/HttpBadRequestException.java @@ -27,6 +27,6 @@ import org.springframework.web.bind.annotation.ResponseStatus; @ResponseStatus(value = HttpStatus.BAD_REQUEST) public class HttpBadRequestException extends RuntimeException { public HttpBadRequestException() { - super(StringUtils.EMPTY, null, false, false); + super("the request was bad", null, false, false); } } diff --git a/juick-common/src/main/java/com/juick/server/xmpp/JidConverter.java b/juick-common/src/main/java/com/juick/server/xmpp/JidConverter.java deleted file mode 100644 index e9a9707e..00000000 --- a/juick-common/src/main/java/com/juick/server/xmpp/JidConverter.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.juick.server.xmpp; - -import org.springframework.core.convert.converter.Converter; -import org.springframework.lang.Nullable; -import rocks.xmpp.addr.Jid; - -public class JidConverter implements Converter<String, Jid> { - @Nullable - @Override - public Jid convert(String jidStr) { - return Jid.of(jidStr); - } -} diff --git a/juick-common/src/main/java/com/juick/server/xmpp/iq/MessageQuery.java b/juick-common/src/main/java/com/juick/server/xmpp/iq/MessageQuery.java deleted file mode 100644 index 7500cbf8..00000000 --- a/juick-common/src/main/java/com/juick/server/xmpp/iq/MessageQuery.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.juick.server.xmpp.iq; - -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "query") -public class MessageQuery { - private MessageQuery() { - - } -} diff --git a/juick-common/src/main/java/com/juick/server/xmpp/iq/package-info.java b/juick-common/src/main/java/com/juick/server/xmpp/iq/package-info.java deleted file mode 100644 index dada8289..00000000 --- a/juick-common/src/main/java/com/juick/server/xmpp/iq/package-info.java +++ /dev/null @@ -1,8 +0,0 @@ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlSchema(namespace = "http://juick.com/query#messages", elementFormDefault = XmlNsForm.QUALIFIED) -package com.juick.server.xmpp.iq; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlNsForm; -import javax.xml.bind.annotation.XmlSchema;
\ No newline at end of file diff --git a/juick-common/src/main/java/com/juick/server/xmpp/s2s/BasicXmppSession.java b/juick-common/src/main/java/com/juick/server/xmpp/s2s/BasicXmppSession.java deleted file mode 100644 index 647f2717..00000000 --- a/juick-common/src/main/java/com/juick/server/xmpp/s2s/BasicXmppSession.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2008-2017, Juick - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package com.juick.server.xmpp.s2s; - -import rocks.xmpp.addr.Jid; -import rocks.xmpp.core.XmppException; -import rocks.xmpp.core.session.ConnectionConfiguration; -import rocks.xmpp.core.session.XmppSession; -import rocks.xmpp.core.session.XmppSessionConfiguration; -import rocks.xmpp.core.stanza.model.IQ; -import rocks.xmpp.core.stanza.model.Message; -import rocks.xmpp.core.stanza.model.Presence; -import rocks.xmpp.core.stanza.model.server.ServerIQ; -import rocks.xmpp.core.stanza.model.server.ServerMessage; -import rocks.xmpp.core.stanza.model.server.ServerPresence; -import rocks.xmpp.core.stream.model.StreamElement; - -/** - * Created by vitalyster on 06.02.2017. - */ -public class BasicXmppSession extends XmppSession { - protected BasicXmppSession(String xmppServiceDomain, XmppSessionConfiguration configuration, ConnectionConfiguration... connectionConfigurations) { - super(xmppServiceDomain, configuration, connectionConfigurations); - } - - public static BasicXmppSession create(String xmppServiceDomain, XmppSessionConfiguration configuration) { - BasicXmppSession session = new BasicXmppSession(xmppServiceDomain, configuration); - notifyCreationListeners(session); - return session; - } - - @Override - public void connect(Jid from) throws XmppException { - - } - - @Override - public Jid getConnectedResource() { - return null; - } - - @Override - protected StreamElement prepareElement(StreamElement element) { - if (element instanceof Message) { - element = ServerMessage.from((Message) element); - } else if (element instanceof Presence) { - element = ServerPresence.from((Presence) element); - } else if (element instanceof IQ) { - element = ServerIQ.from((IQ) element); - } - - return element; - } -} diff --git a/juick-common/src/main/java/com/juick/service/BaseRestService.java b/juick-common/src/main/java/com/juick/service/BaseRestService.java deleted file mode 100644 index 13604a89..00000000 --- a/juick-common/src/main/java/com/juick/service/BaseRestService.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2008-2017, Juick - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package com.juick.service; - -import org.springframework.web.client.RestTemplate; - -/** - * Created by vitalyster on 15.12.2016. - */ -public abstract class BaseRestService { - private RestTemplate rest; - - public BaseRestService(RestTemplate rest) { - this.rest = rest; - } - - public RestTemplate getRest() { - return rest; - } -} |