diff options
-rw-r--r-- | build.gradle | 2 | ||||
-rw-r--r-- | juick-server/build.gradle | 4 | ||||
-rw-r--r-- | juick-server/src/main/java/com/juick/server/CleaningUp.java (renamed from juick-xmpp/src/main/java/com/juick/components/CleaningUp.java) | 2 | ||||
-rw-r--r-- | juick-server/src/main/java/com/juick/server/XMPPBot.java (renamed from juick-xmpp/src/main/java/com/juick/components/JuickBot.java) | 8 | ||||
-rw-r--r-- | juick-server/src/main/java/com/juick/server/XMPPConnection.java (renamed from juick-xmpp/src/main/java/com/juick/components/XMPPConnection.java) | 7 | ||||
-rw-r--r-- | juick-server/src/main/java/com/juick/server/XMPPServer.java (renamed from juick-xmpp/src/main/java/com/juick/components/XMPPServer.java) | 12 | ||||
-rw-r--r-- | juick-server/src/main/java/com/juick/server/api/Index.java | 14 | ||||
-rw-r--r-- | juick-server/src/main/java/com/juick/server/configuration/ApiAppConfiguration.java | 30 | ||||
-rw-r--r-- | juick-server/src/main/java/com/juick/xmpp/extensions/JuickMessage.java (renamed from juick-xmpp/src/main/java/com/juick/xmpp/extensions/JuickMessage.java) | 0 | ||||
-rw-r--r-- | juick-server/src/main/java/com/juick/xmpp/extensions/JuickUser.java (renamed from juick-xmpp/src/main/java/com/juick/xmpp/extensions/JuickUser.java) | 0 | ||||
-rw-r--r-- | juick-server/src/main/java/com/juick/xmpp/helpers/JidConverter.java (renamed from juick-xmpp/src/main/java/com/juick/xmpp/helpers/JidConverter.java) | 0 | ||||
-rw-r--r-- | juick-server/src/main/java/com/juick/xmpp/helpers/XMPPStatus.java (renamed from juick-xmpp/src/main/java/com/juick/components/controllers/helpers/XMPPStatus.java) | 6 | ||||
-rw-r--r-- | juick-server/src/main/java/com/juick/xmpp/s2s/BasicXmppSession.java (renamed from juick-xmpp/src/main/java/com/juick/components/s2s/BasicXmppSession.java) | 2 | ||||
-rw-r--r-- | juick-server/src/main/java/com/juick/xmpp/s2s/CacheEntry.java (renamed from juick-xmpp/src/main/java/com/juick/components/s2s/CacheEntry.java) | 2 | ||||
-rw-r--r-- | juick-server/src/main/java/com/juick/xmpp/s2s/Connection.java (renamed from juick-xmpp/src/main/java/com/juick/components/s2s/Connection.java) | 4 | ||||
-rw-r--r-- | juick-server/src/main/java/com/juick/xmpp/s2s/ConnectionIn.java (renamed from juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionIn.java) | 4 | ||||
-rw-r--r-- | juick-server/src/main/java/com/juick/xmpp/s2s/ConnectionListener.java (renamed from juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionListener.java) | 2 | ||||
-rw-r--r-- | juick-server/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java (renamed from juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionOut.java) | 4 | ||||
-rw-r--r-- | juick-server/src/main/java/com/juick/xmpp/s2s/DNSQueries.java (renamed from juick-xmpp/src/main/java/com/juick/components/s2s/DNSQueries.java) | 3 | ||||
-rw-r--r-- | juick-server/src/main/java/com/juick/xmpp/s2s/StanzaListener.java (renamed from juick-xmpp/src/main/java/com/juick/components/s2s/StanzaListener.java) | 2 | ||||
-rw-r--r-- | juick-server/src/main/java/com/juick/xmpp/s2s/util/DialbackUtils.java (renamed from juick-xmpp/src/main/java/com/juick/components/s2s/util/DialbackUtils.java) | 2 | ||||
-rw-r--r-- | juick-server/src/main/resources/juick.png (renamed from juick-xmpp/src/main/resources/juick.png) | bin | 2324 -> 2324 bytes | |||
-rw-r--r-- | juick-server/src/test/java/com/juick/server/tests/XMPPServerTests.java (renamed from juick-xmpp/src/test/java/com/juick/xmpp/server/XMPPServerTests.java) | 13 | ||||
-rw-r--r-- | juick-xmpp-wip/build.gradle | 2 | ||||
-rw-r--r-- | juick-xmpp-wip/src/main/java/com/juick/components/XMPPRouter.java | 2 | ||||
-rw-r--r-- | juick-xmpp-wip/src/test/java/com/juick/xmpp/XMPPTests.java | 4 | ||||
-rw-r--r-- | juick-xmpp/build.gradle | 29 | ||||
-rw-r--r-- | juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java | 70 | ||||
-rw-r--r-- | juick-xmpp/src/main/java/com/juick/components/configuration/XmppInitializer.java | 58 | ||||
-rw-r--r-- | juick-xmpp/src/main/java/com/juick/components/controllers/StatusController.java | 46 | ||||
-rw-r--r-- | juick-xmpp/src/main/webapp/WEB-INF/web.xml | 7 | ||||
-rw-r--r-- | settings.gradle | 2 |
32 files changed, 87 insertions, 256 deletions
diff --git a/build.gradle b/build.gradle index 5b3155b8..a5d2e440 100644 --- a/build.gradle +++ b/build.gradle @@ -46,7 +46,6 @@ apply plugin: 'org.akhikhl.gretty' farm { webapp ':juick-www' - webapp ':juick-xmpp' webapp ':juick-server' @@ -59,7 +58,6 @@ repositories { dependencies { testCompile project(':juick-core') testCompile project(':juick-www') - testCompile project(':juick-xmpp') testCompile "org.json:json:20180130" testCompile "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}" diff --git a/juick-server/build.gradle b/juick-server/build.gradle index f0d29f98..5710ef21 100644 --- a/juick-server/build.gradle +++ b/juick-server/build.gradle @@ -20,6 +20,10 @@ dependencies { compile 'org.springframework.social:spring-social-twitter:1.1.2.RELEASE' compile 'org.apache.commons:commons-email:1.5' compile 'org.imgscalr:imgscalr-lib:4.2' + compile ('com.github.juick:com.juick.xmpp:658f8cf751') { + exclude group: 'xmlpull' + } + providedCompile 'xpp3:xpp3:1.1.4c' testCompile project(path: ':juick-core', configuration: 'testArtifacts') testCompile project(path: ':juick-server-web', configuration: 'testArtifacts') diff --git a/juick-xmpp/src/main/java/com/juick/components/CleaningUp.java b/juick-server/src/main/java/com/juick/server/CleaningUp.java index a96b7c35..6acd4bba 100644 --- a/juick-xmpp/src/main/java/com/juick/components/CleaningUp.java +++ b/juick-server/src/main/java/com/juick/server/CleaningUp.java @@ -15,7 +15,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package com.juick.components; +package com.juick.server; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/juick-xmpp/src/main/java/com/juick/components/JuickBot.java b/juick-server/src/main/java/com/juick/server/XMPPBot.java index ad21b577..21138607 100644 --- a/juick-xmpp/src/main/java/com/juick/components/JuickBot.java +++ b/juick-server/src/main/java/com/juick/server/XMPPBot.java @@ -15,11 +15,11 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package com.juick.components; +package com.juick.server; import com.juick.Tag; import com.juick.User; -import com.juick.components.s2s.StanzaListener; +import com.juick.xmpp.s2s.StanzaListener; import com.juick.formatters.PlainTextFormatter; import com.juick.server.helpers.TagStats; import com.juick.server.protocol.annotation.UserCommand; @@ -52,9 +52,9 @@ import java.util.stream.Collectors; * @author ugnich */ @Component -public class JuickBot implements StanzaListener, AutoCloseable { +public class XMPPBot implements StanzaListener, AutoCloseable { - private static final Logger logger = LoggerFactory.getLogger(JuickBot.class); + private static final Logger logger = LoggerFactory.getLogger(XMPPBot.class); @Inject private XMPPServer xmpp; diff --git a/juick-xmpp/src/main/java/com/juick/components/XMPPConnection.java b/juick-server/src/main/java/com/juick/server/XMPPConnection.java index 6bca282c..f5448880 100644 --- a/juick-xmpp/src/main/java/com/juick/components/XMPPConnection.java +++ b/juick-server/src/main/java/com/juick/server/XMPPConnection.java @@ -15,11 +15,11 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package com.juick.components; +package com.juick.server; import com.juick.Attachment; import com.juick.User; -import com.juick.components.s2s.BasicXmppSession; +import com.juick.xmpp.s2s.BasicXmppSession; import com.juick.server.helpers.UserInfo; import com.juick.service.MessagesService; import com.juick.service.SubscriptionService; @@ -31,7 +31,6 @@ 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.DependsOn; import org.springframework.stereotype.Component; import rocks.xmpp.addr.Jid; import rocks.xmpp.core.XmppException; @@ -81,7 +80,7 @@ public class XMPPConnection implements AutoCloseable { private ExternalComponent router; @Inject - private JuickBot bot; + private XMPPBot bot; @Value("${componentname:localhost}") private String componentName; diff --git a/juick-xmpp/src/main/java/com/juick/components/XMPPServer.java b/juick-server/src/main/java/com/juick/server/XMPPServer.java index 6206914b..01437232 100644 --- a/juick-xmpp/src/main/java/com/juick/components/XMPPServer.java +++ b/juick-server/src/main/java/com/juick/server/XMPPServer.java @@ -15,9 +15,9 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package com.juick.components; +package com.juick.server; -import com.juick.components.s2s.*; +import com.juick.xmpp.s2s.*; import com.juick.service.UserService; import com.juick.xmpp.extensions.JuickMessage; import com.juick.xmpp.extensions.StreamError; @@ -54,8 +54,6 @@ import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.ExecutorService; import java.util.concurrent.atomic.AtomicBoolean; -import static com.juick.components.s2s.Connection.NS_TLS; - /** * @author ugnich */ @@ -308,7 +306,7 @@ public class XMPPServer implements ConnectionListener, AutoCloseable { @Override public void starttls(ConnectionIn connection) { logger.info("stream {} securing", connection.streamID); - connection.sendStanza("<proceed xmlns=\"" + NS_TLS + "\" />"); + connection.sendStanza("<proceed xmlns=\"" + Connection.NS_TLS + "\" />"); try { connection.setSocket(sc.getSocketFactory().createSocket(connection.getSocket(), connection.getSocket().getInetAddress().getHostAddress(), connection.getSocket().getPort(), true)); @@ -319,7 +317,7 @@ public class XMPPServer implements ConnectionListener, AutoCloseable { connection.restartParser(); } catch (XmlPullParserException | IOException sex) { logger.warn("stream {} ssl error {}", connection.streamID, sex); - connection.sendStanza("<failed xmlns\"" + NS_TLS + "\" />"); + connection.sendStanza("<failed xmlns\"" + Connection.NS_TLS + "\" />"); removeConnectionIn(connection); connection.closeConnection(); } @@ -340,7 +338,7 @@ public class XMPPServer implements ConnectionListener, AutoCloseable { connection.sendOpenStream(); } catch (NoSuchElementException | XmlPullParserException | IOException sex) { logger.error("s2s ssl error: {} {}, error {}", connection.to, connection.getStreamID(), sex); - connection.send("<failed xmlns\"" + NS_TLS + "\" />"); + connection.send("<failed xmlns\"" + Connection.NS_TLS + "\" />"); removeConnectionOut(connection); connection.logoff(); } diff --git a/juick-server/src/main/java/com/juick/server/api/Index.java b/juick-server/src/main/java/com/juick/server/api/Index.java index dba8357d..b1d87f67 100644 --- a/juick-server/src/main/java/com/juick/server/api/Index.java +++ b/juick-server/src/main/java/com/juick/server/api/Index.java @@ -19,6 +19,8 @@ package com.juick.server.api; import com.juick.Status; import com.juick.server.WebsocketManager; +import com.juick.server.XMPPServer; +import com.juick.xmpp.helpers.XMPPStatus; import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; @@ -39,16 +41,26 @@ import java.net.URI; public class Index { @Inject private WebsocketManager wsHandler; + @Inject + private XMPPServer xmpp; @RequestMapping(value = "/", method = RequestMethod.GET, headers = "Connection!=Upgrade") public ResponseEntity<Void> description() { URI redirectUri = ServletUriComponentsBuilder.fromCurrentRequestUri().path("/swagger-ui.html").build().toUri(); return ResponseEntity.status(HttpStatus.MOVED_PERMANENTLY).location(redirectUri).build(); } - @RequestMapping(value = "/api/status", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE, headers = "Connection!=Upgrade") public Status status() { return Status.getStatus(String.valueOf(wsHandler.getClients().size())); } + @RequestMapping(method = RequestMethod.GET, value = "/xmpp/status", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + public XMPPStatus xmppStatus() { + XMPPStatus status = new XMPPStatus(); + if (xmpp != null) { + status.setInbound(xmpp.getInConnections()); + status.setOutbound(xmpp.getOutConnections().keySet()); + } + return status; + } } diff --git a/juick-server/src/main/java/com/juick/server/configuration/ApiAppConfiguration.java b/juick-server/src/main/java/com/juick/server/configuration/ApiAppConfiguration.java index 3839248d..21c1238b 100644 --- a/juick-server/src/main/java/com/juick/server/configuration/ApiAppConfiguration.java +++ b/juick-server/src/main/java/com/juick/server/configuration/ApiAppConfiguration.java @@ -22,8 +22,12 @@ import com.juick.server.WebsocketManager; import com.juick.server.component.JuickServerComponent; import com.juick.server.component.JuickServerReconnectManager; import com.juick.service.UserService; +import com.juick.xmpp.helpers.JidConverter; +import com.juick.xmpp.s2s.BasicXmppSession; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.*; +import org.springframework.core.convert.ConversionService; +import org.springframework.format.support.DefaultFormattingConversionService; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; @@ -36,6 +40,9 @@ import org.springframework.web.socket.config.annotation.WebSocketConfigurer; import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry; import org.springframework.web.socket.server.standard.ServletServerContainerFactoryBean; import org.springframework.web.util.UriComponentsBuilder; +import rocks.xmpp.core.session.Extension; +import rocks.xmpp.core.session.XmppSessionConfiguration; +import rocks.xmpp.core.session.debug.LogbackDebugger; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.service.ApiInfo; @@ -46,6 +53,8 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; import javax.annotation.Nonnull; import javax.inject.Inject; import java.util.Collections; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; /** * Created by aalexeev on 11/12/16. @@ -120,6 +129,27 @@ public class ApiAppConfiguration extends BaseWebConfiguration implements WebSock container.setMaxBinaryMessageBufferSize(8192); return container; } + @Value("${hostname}") + private String hostname; + + @Bean + public ExecutorService service() { + return Executors.newCachedThreadPool(); + } + @Bean + public BasicXmppSession session() { + XmppSessionConfiguration configuration = XmppSessionConfiguration.builder() + .extensions(Extension.of(com.juick.Message.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; + } @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { configurer.enable(); diff --git a/juick-xmpp/src/main/java/com/juick/xmpp/extensions/JuickMessage.java b/juick-server/src/main/java/com/juick/xmpp/extensions/JuickMessage.java index c28eee14..c28eee14 100644 --- a/juick-xmpp/src/main/java/com/juick/xmpp/extensions/JuickMessage.java +++ b/juick-server/src/main/java/com/juick/xmpp/extensions/JuickMessage.java diff --git a/juick-xmpp/src/main/java/com/juick/xmpp/extensions/JuickUser.java b/juick-server/src/main/java/com/juick/xmpp/extensions/JuickUser.java index 10d2b564..10d2b564 100644 --- a/juick-xmpp/src/main/java/com/juick/xmpp/extensions/JuickUser.java +++ b/juick-server/src/main/java/com/juick/xmpp/extensions/JuickUser.java diff --git a/juick-xmpp/src/main/java/com/juick/xmpp/helpers/JidConverter.java b/juick-server/src/main/java/com/juick/xmpp/helpers/JidConverter.java index 253c50f8..253c50f8 100644 --- a/juick-xmpp/src/main/java/com/juick/xmpp/helpers/JidConverter.java +++ b/juick-server/src/main/java/com/juick/xmpp/helpers/JidConverter.java diff --git a/juick-xmpp/src/main/java/com/juick/components/controllers/helpers/XMPPStatus.java b/juick-server/src/main/java/com/juick/xmpp/helpers/XMPPStatus.java index c5a7f6e3..a7fa1bce 100644 --- a/juick-xmpp/src/main/java/com/juick/components/controllers/helpers/XMPPStatus.java +++ b/juick-server/src/main/java/com/juick/xmpp/helpers/XMPPStatus.java @@ -15,10 +15,10 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package com.juick.components.controllers.helpers; +package com.juick.xmpp.helpers; -import com.juick.components.s2s.ConnectionIn; -import com.juick.components.s2s.ConnectionOut; +import com.juick.xmpp.s2s.ConnectionIn; +import com.juick.xmpp.s2s.ConnectionOut; import java.util.List; import java.util.Set; diff --git a/juick-xmpp/src/main/java/com/juick/components/s2s/BasicXmppSession.java b/juick-server/src/main/java/com/juick/xmpp/s2s/BasicXmppSession.java index bf352f8c..856d757b 100644 --- a/juick-xmpp/src/main/java/com/juick/components/s2s/BasicXmppSession.java +++ b/juick-server/src/main/java/com/juick/xmpp/s2s/BasicXmppSession.java @@ -15,7 +15,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package com.juick.components.s2s; +package com.juick.xmpp.s2s; import rocks.xmpp.addr.Jid; import rocks.xmpp.core.XmppException; diff --git a/juick-xmpp/src/main/java/com/juick/components/s2s/CacheEntry.java b/juick-server/src/main/java/com/juick/xmpp/s2s/CacheEntry.java index c8eeab53..580682cb 100644 --- a/juick-xmpp/src/main/java/com/juick/components/s2s/CacheEntry.java +++ b/juick-server/src/main/java/com/juick/xmpp/s2s/CacheEntry.java @@ -15,7 +15,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package com.juick.components.s2s; +package com.juick.xmpp.s2s; import rocks.xmpp.addr.Jid; diff --git a/juick-xmpp/src/main/java/com/juick/components/s2s/Connection.java b/juick-server/src/main/java/com/juick/xmpp/s2s/Connection.java index 8157e046..638e3b58 100644 --- a/juick-xmpp/src/main/java/com/juick/components/s2s/Connection.java +++ b/juick-server/src/main/java/com/juick/xmpp/s2s/Connection.java @@ -15,10 +15,10 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package com.juick.components.s2s; +package com.juick.xmpp.s2s; import com.fasterxml.jackson.annotation.JsonIgnore; -import com.juick.components.XMPPServer; +import com.juick.server.XMPPServer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.xmlpull.v1.XmlPullParser; diff --git a/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionIn.java b/juick-server/src/main/java/com/juick/xmpp/s2s/ConnectionIn.java index 16f207a7..94da89d2 100644 --- a/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionIn.java +++ b/juick-server/src/main/java/com/juick/xmpp/s2s/ConnectionIn.java @@ -15,9 +15,9 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package com.juick.components.s2s; +package com.juick.xmpp.s2s; -import com.juick.components.XMPPServer; +import com.juick.server.XMPPServer; import com.juick.xmpp.extensions.StreamError; import com.juick.xmpp.utils.XmlUtils; import org.apache.commons.lang3.StringUtils; diff --git a/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionListener.java b/juick-server/src/main/java/com/juick/xmpp/s2s/ConnectionListener.java index 3b191974..76bc8bdc 100644 --- a/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionListener.java +++ b/juick-server/src/main/java/com/juick/xmpp/s2s/ConnectionListener.java @@ -1,4 +1,4 @@ -package com.juick.components.s2s; +package com.juick.xmpp.s2s; import com.juick.xmpp.extensions.StreamError; diff --git a/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionOut.java b/juick-server/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java index 9578a831..6c8c9782 100644 --- a/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionOut.java +++ b/juick-server/src/main/java/com/juick/xmpp/s2s/ConnectionOut.java @@ -15,9 +15,9 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package com.juick.components.s2s; +package com.juick.xmpp.s2s; -import com.juick.components.s2s.util.DialbackUtils; +import com.juick.xmpp.s2s.util.DialbackUtils; import com.juick.xmpp.Stream; import com.juick.xmpp.extensions.StreamError; import com.juick.xmpp.extensions.StreamFeatures; diff --git a/juick-xmpp/src/main/java/com/juick/components/s2s/DNSQueries.java b/juick-server/src/main/java/com/juick/xmpp/s2s/DNSQueries.java index 0cd356b0..47b01d7e 100644 --- a/juick-xmpp/src/main/java/com/juick/components/s2s/DNSQueries.java +++ b/juick-server/src/main/java/com/juick/xmpp/s2s/DNSQueries.java @@ -15,14 +15,13 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package com.juick.components.s2s; +package com.juick.xmpp.s2s; import org.apache.commons.lang3.math.NumberUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.net.InetSocketAddress; -import java.net.UnknownHostException; import java.util.Hashtable; import java.util.Random; import javax.naming.NamingException; diff --git a/juick-xmpp/src/main/java/com/juick/components/s2s/StanzaListener.java b/juick-server/src/main/java/com/juick/xmpp/s2s/StanzaListener.java index 39253d3f..324a0aa8 100644 --- a/juick-xmpp/src/main/java/com/juick/components/s2s/StanzaListener.java +++ b/juick-server/src/main/java/com/juick/xmpp/s2s/StanzaListener.java @@ -15,7 +15,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package com.juick.components.s2s; +package com.juick.xmpp.s2s; import rocks.xmpp.core.stanza.model.Stanza; diff --git a/juick-xmpp/src/main/java/com/juick/components/s2s/util/DialbackUtils.java b/juick-server/src/main/java/com/juick/xmpp/s2s/util/DialbackUtils.java index fc08c5d6..a7646deb 100644 --- a/juick-xmpp/src/main/java/com/juick/components/s2s/util/DialbackUtils.java +++ b/juick-server/src/main/java/com/juick/xmpp/s2s/util/DialbackUtils.java @@ -15,7 +15,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -package com.juick.components.s2s.util; +package com.juick.xmpp.s2s.util; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.HmacUtils; diff --git a/juick-xmpp/src/main/resources/juick.png b/juick-server/src/main/resources/juick.png Binary files differindex c85ef2c4..c85ef2c4 100644 --- a/juick-xmpp/src/main/resources/juick.png +++ b/juick-server/src/main/resources/juick.png diff --git a/juick-xmpp/src/test/java/com/juick/xmpp/server/XMPPServerTests.java b/juick-server/src/test/java/com/juick/server/tests/XMPPServerTests.java index 7c5a1a98..5a3c8e69 100644 --- a/juick-xmpp/src/test/java/com/juick/xmpp/server/XMPPServerTests.java +++ b/juick-server/src/test/java/com/juick/server/tests/XMPPServerTests.java @@ -1,12 +1,13 @@ -package com.juick.xmpp.server; +package com.juick.server.tests; import com.fasterxml.jackson.core.JsonProcessingException; import com.juick.Tag; import com.juick.User; -import com.juick.components.JuickBot; -import com.juick.components.XMPPServer; -import com.juick.components.configuration.XmppAppConfiguration; import com.juick.configuration.RepositoryConfiguration; +import com.juick.server.XMPPBot; +import com.juick.server.XMPPServer; +import com.juick.server.configuration.ApiAppConfiguration; +import com.juick.server.configuration.ApiSecurityConfig; import com.juick.service.MessagesService; import com.juick.service.SubscriptionService; import com.juick.service.TagService; @@ -43,7 +44,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers. @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration @ContextConfiguration(classes = { - XmppAppConfiguration.class, RepositoryConfiguration.class + ApiAppConfiguration.class, ApiSecurityConfig.class, RepositoryConfiguration.class }) @TestPropertySource(properties = {"broken_ssl_hosts=localhost,serverstorageisfull.tld"}) public class XMPPServerTests extends AbstractJUnit4SpringContextTests { @@ -52,7 +53,7 @@ public class XMPPServerTests extends AbstractJUnit4SpringContextTests { @Inject private XMPPServer server; @Inject - private JuickBot bot; + private XMPPBot bot; @Inject private UserService userService; @Inject diff --git a/juick-xmpp-wip/build.gradle b/juick-xmpp-wip/build.gradle index 75870140..65d84755 100644 --- a/juick-xmpp-wip/build.gradle +++ b/juick-xmpp-wip/build.gradle @@ -5,7 +5,7 @@ apply plugin: 'org.akhikhl.gretty' dependencies { compile project(':juick-server-jdbc') compile project(':juick-server-web') - compile project(':juick-xmpp') + compile project(':juick-server') testCompile project(path: ':juick-core', configuration: 'testArtifacts') testCompile project(path: ':juick-server-web', configuration: 'testArtifacts') diff --git a/juick-xmpp-wip/src/main/java/com/juick/components/XMPPRouter.java b/juick-xmpp-wip/src/main/java/com/juick/components/XMPPRouter.java index 47e76cd8..0fad892d 100644 --- a/juick-xmpp-wip/src/main/java/com/juick/components/XMPPRouter.java +++ b/juick-xmpp-wip/src/main/java/com/juick/components/XMPPRouter.java @@ -17,7 +17,7 @@ package com.juick.components; -import com.juick.components.s2s.BasicXmppSession; +import com.juick.xmpp.s2s.BasicXmppSession; import com.juick.xmpp.Message; import com.juick.xmpp.StreamComponentServer; import com.juick.xmpp.StreamListener; diff --git a/juick-xmpp-wip/src/test/java/com/juick/xmpp/XMPPTests.java b/juick-xmpp-wip/src/test/java/com/juick/xmpp/XMPPTests.java index 971e849a..1f7107bf 100644 --- a/juick-xmpp-wip/src/test/java/com/juick/xmpp/XMPPTests.java +++ b/juick-xmpp-wip/src/test/java/com/juick/xmpp/XMPPTests.java @@ -18,11 +18,11 @@ package com.juick.xmpp; import com.gargoylesoftware.htmlunit.WebClient; -import com.juick.components.XMPPConnection; import com.juick.components.XMPPRouter; -import com.juick.components.configuration.XmppAppConfiguration; import com.juick.configuration.MockDataConfiguration; +import com.juick.server.XMPPConnection; import com.juick.server.configuration.BaseWebConfiguration; +import com.juick.server.configuration.XmppAppConfiguration; import com.juick.service.PrivacyQueriesService; import com.juick.service.ShowQueriesService; import org.junit.Before; diff --git a/juick-xmpp/build.gradle b/juick-xmpp/build.gradle deleted file mode 100644 index 6d7ca2e8..00000000 --- a/juick-xmpp/build.gradle +++ /dev/null @@ -1,29 +0,0 @@ -apply plugin: 'java' -apply plugin: 'war' -apply plugin: 'org.akhikhl.gretty' - -dependencies { - compile project(':juick-server-jdbc') - compile project(':juick-server-web') - compile ('com.github.juick:com.juick.xmpp:658f8cf751') { - exclude group: 'xmlpull' - } - providedCompile 'xpp3:xpp3:1.1.4c' - testCompile project(path: ':juick-core', configuration: 'testArtifacts') - testCompile project(path: ':juick-server-web', configuration: 'testArtifacts') - testCompile project(path: ':juick-server-jdbc', configuration: 'testArtifacts') -} - -compileJava.options.encoding = 'UTF-8' - -gretty { - httpPort = 8080 - contextPath = '/s2s' - servletContainer = 'tomcat8' -} - -configurations { - all*.exclude module: 'commons-logging' - all*.exclude module: 'slf4j-nop' -} - diff --git a/juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java b/juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java deleted file mode 100644 index f14b2b23..00000000 --- a/juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java +++ /dev/null @@ -1,70 +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.components.configuration; - -/** - * Created by aalexeev on 11/12/16. - */ - -import com.juick.components.s2s.BasicXmppSession; -import com.juick.server.configuration.BaseWebConfiguration; -import com.juick.xmpp.helpers.JidConverter; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; -import org.springframework.core.convert.ConversionService; -import org.springframework.format.support.DefaultFormattingConversionService; -import org.springframework.scheduling.annotation.EnableScheduling; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import rocks.xmpp.core.session.Extension; -import rocks.xmpp.core.session.XmppSessionConfiguration; -import rocks.xmpp.core.session.debug.LogbackDebugger; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -@Configuration -@ComponentScan(basePackages = {"com.juick.components"}) -@PropertySource("classpath:juick.conf") -@EnableScheduling -@EnableWebMvc -public class XmppAppConfiguration extends BaseWebConfiguration { - @Value("${hostname}") - private String hostname; - - @Bean - public ExecutorService service() { - return Executors.newCachedThreadPool(); - } - @Bean - public BasicXmppSession session() { - XmppSessionConfiguration configuration = XmppSessionConfiguration.builder() - .extensions(Extension.of(com.juick.Message.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-xmpp/src/main/java/com/juick/components/configuration/XmppInitializer.java b/juick-xmpp/src/main/java/com/juick/components/configuration/XmppInitializer.java deleted file mode 100644 index 38dc05d4..00000000 --- a/juick-xmpp/src/main/java/com/juick/components/configuration/XmppInitializer.java +++ /dev/null @@ -1,58 +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.components.configuration; - -import com.juick.configuration.DataConfiguration; -import com.juick.server.configuration.StorageConfiguration; -import org.apache.commons.codec.CharEncoding; -import org.springframework.web.filter.CharacterEncodingFilter; -import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; - -import javax.servlet.Filter; - -/** - * Created by vt on 09/02/16. - */ -public class XmppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer { - - @Override - protected Class<?>[] getRootConfigClasses() { - return new Class<?>[]{ XmppAppConfiguration.class, DataConfiguration.class, StorageConfiguration.class}; - } - - @Override - protected Class<?>[] getServletConfigClasses() { - return null; - } - - @Override - protected String[] getServletMappings() { - return new String[]{"/"}; - } - - @Override - protected Filter[] getServletFilters() { - CharacterEncodingFilter characterEncodingFilter = new CharacterEncodingFilter(CharEncoding.UTF_8); - return new Filter[]{characterEncodingFilter}; - } - - @Override - protected String getServletName() { - return "XMPP dispatcher servlet"; - } -} diff --git a/juick-xmpp/src/main/java/com/juick/components/controllers/StatusController.java b/juick-xmpp/src/main/java/com/juick/components/controllers/StatusController.java deleted file mode 100644 index f20fc76a..00000000 --- a/juick-xmpp/src/main/java/com/juick/components/controllers/StatusController.java +++ /dev/null @@ -1,46 +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.components.controllers; - -import com.juick.components.XMPPServer; -import com.juick.components.controllers.helpers.XMPPStatus; -import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; - -import javax.inject.Inject; - -/** - * Created by vitalyster on 24.10.2016. - */ -@RestController -public class StatusController { - @Inject - private XMPPServer xmpp; - - @RequestMapping(method = RequestMethod.GET, value = "/status", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) - public XMPPStatus status() { - XMPPStatus status = new XMPPStatus(); - if (xmpp != null) { - status.setInbound(xmpp.getInConnections()); - status.setOutbound(xmpp.getOutConnections().keySet()); - } - return status; - } -} diff --git a/juick-xmpp/src/main/webapp/WEB-INF/web.xml b/juick-xmpp/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index a57cceb9..00000000 --- a/juick-xmpp/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<web-app xmlns="http://java.sun.com/xml/ns/javaee" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" - version="3.0"> - -</web-app>
\ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 07848f53..005d592b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,4 @@ rootProject.name = "Juick" -include ':juick-core', ':juick-server-core', ':juick-server-jdbc', ':juick-server-web', ':juick-server', ':juick-www', ':juick-rss', ':juick-notifications', ':juick-xmpp', ':juick-xmpp-wip' +include ':juick-core', ':juick-server-core', ':juick-server-jdbc', ':juick-server-web', ':juick-server', ':juick-www', ':juick-rss', ':juick-notifications', ':juick-xmpp-wip' |