From 20e19b4242f888aafe3c55f9dabe3af46728cbab Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 31 Oct 2017 01:32:13 +0300 Subject: gradle: farm configuration --- juick-xmpp-wip/build.gradle | 2 +- .../src/main/java/com/juick/components/XMPPRouter.java | 2 +- .../juick/components/controllers/StatusController.java | 12 +++++++----- .../components/controllers/helpers/RouterStatus.java | 17 +++++++++++++++++ 4 files changed, 26 insertions(+), 7 deletions(-) create mode 100644 juick-xmpp-wip/src/main/java/com/juick/components/controllers/helpers/RouterStatus.java (limited to 'juick-xmpp-wip') diff --git a/juick-xmpp-wip/build.gradle b/juick-xmpp-wip/build.gradle index 13c564b3..cf8b8a29 100644 --- a/juick-xmpp-wip/build.gradle +++ b/juick-xmpp-wip/build.gradle @@ -17,7 +17,7 @@ compileJava.options.encoding = 'UTF-8' gretty { httpPort = 8080 - contextPath = '' + contextPath = '/router' servletContainer = 'tomcat8' } 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 a39358c5..47e76cd8 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 @@ -163,7 +163,7 @@ public class XMPPRouter implements Message.MessageListener, AutoCloseable, Strea } - private List getConnections() { + public List getConnections() { return connections; } diff --git a/juick-xmpp-wip/src/main/java/com/juick/components/controllers/StatusController.java b/juick-xmpp-wip/src/main/java/com/juick/components/controllers/StatusController.java index 350669b8..e57d0a82 100644 --- a/juick-xmpp-wip/src/main/java/com/juick/components/controllers/StatusController.java +++ b/juick-xmpp-wip/src/main/java/com/juick/components/controllers/StatusController.java @@ -17,8 +17,8 @@ package com.juick.components.controllers; -import com.juick.components.XMPPBot; -import com.juick.Status; +import com.juick.components.XMPPRouter; +import com.juick.components.controllers.helpers.RouterStatus; import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @@ -34,10 +34,12 @@ import javax.inject.Inject; @ResponseBody public class StatusController { @Inject - private XMPPBot xmpp; + private XMPPRouter router; @RequestMapping(method = RequestMethod.GET, value = "/", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) - public Status status() { - return xmpp != null ? Status.OK : Status.ERROR; + public RouterStatus status() { + RouterStatus status = new RouterStatus(); + status.setConnections(router.getConnections()); + return status; } } diff --git a/juick-xmpp-wip/src/main/java/com/juick/components/controllers/helpers/RouterStatus.java b/juick-xmpp-wip/src/main/java/com/juick/components/controllers/helpers/RouterStatus.java new file mode 100644 index 00000000..11148dd7 --- /dev/null +++ b/juick-xmpp-wip/src/main/java/com/juick/components/controllers/helpers/RouterStatus.java @@ -0,0 +1,17 @@ +package com.juick.components.controllers.helpers; + +import com.juick.xmpp.StreamComponentServer; + +import java.util.List; + +public class RouterStatus { + private List connections; + + public List getConnections() { + return connections; + } + + public void setConnections(List connections) { + this.connections = connections; + } +} -- cgit v1.2.3