diff options
-rw-r--r-- | juick-xmpp/src/main/java/com/juick/components/controllers/StatusController.java | 14 | ||||
-rw-r--r-- | juick-xmpp/src/main/java/com/juick/components/controllers/helpers/XMPPStatus.java | 30 |
2 files changed, 37 insertions, 7 deletions
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 index 68168c16..31984a7a 100644 --- a/juick-xmpp/src/main/java/com/juick/components/controllers/StatusController.java +++ b/juick-xmpp/src/main/java/com/juick/components/controllers/StatusController.java @@ -1,7 +1,7 @@ package com.juick.components.controllers; import com.juick.components.XMPPServer; -import com.juick.Status; +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; @@ -17,13 +17,13 @@ public class StatusController { @Inject XMPPServer xmpp; - @RequestMapping(method = RequestMethod.GET, value = "/", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) - public Status status() { + @RequestMapping(method = RequestMethod.GET, value = "/status", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + public XMPPStatus status() { + XMPPStatus status = new XMPPStatus(); if (xmpp != null) { - String status = String.format("s2s in: %d, s2s out: %d, cached: %d", - xmpp.getInConnections().size(), xmpp.getOutConnections().size(), xmpp.getOutCache().size()); - return Status.getStatus(status); + status.setInbound(xmpp.getInConnections()); + status.setOutbound(xmpp.getOutConnections()); } - return Status.ERROR; + return status; } } diff --git a/juick-xmpp/src/main/java/com/juick/components/controllers/helpers/XMPPStatus.java b/juick-xmpp/src/main/java/com/juick/components/controllers/helpers/XMPPStatus.java new file mode 100644 index 00000000..efa59601 --- /dev/null +++ b/juick-xmpp/src/main/java/com/juick/components/controllers/helpers/XMPPStatus.java @@ -0,0 +1,30 @@ +package com.juick.components.controllers.helpers; + +import com.juick.components.s2s.ConnectionIn; +import com.juick.components.s2s.ConnectionOut; + +import java.util.List; + +/** + * Created by vitalyster on 16.02.2017. + */ +public class XMPPStatus { + private List<ConnectionIn> inbound; + private List<ConnectionOut> outbound; + + public List<ConnectionIn> getInbound() { + return inbound; + } + + public void setInbound(List<ConnectionIn> inbound) { + this.inbound = inbound; + } + + public List<ConnectionOut> getOutbound() { + return outbound; + } + + public void setOutbound(List<ConnectionOut> outbound) { + this.outbound = outbound; + } +} |