From 9383db80fbf0de88608fe6bfbe5edf62471f4abb Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 14 Dec 2016 17:32:01 +0300 Subject: juick-core: api objects should live in core --- .../java/com/juick/api/controllers/Messages.java | 2 +- .../com/juick/api/controllers/Notifications.java | 4 +-- juick-core/src/main/java/com/juick/Status.java | 32 ++++++++++++++++++++++ juick-core/src/main/java/com/juick/TokensList.java | 30 ++++++++++++++++++++ .../components/controllers/StatusController.java | 2 +- juick-notifications/build.gradle | 9 ++++++ .../main/java/com/juick/components/CleanUp.java | 2 +- .../components/controllers/StatusController.java | 2 +- .../main/java/com/juick/server/helpers/Status.java | 32 ---------------------- .../java/com/juick/server/helpers/TokensList.java | 30 -------------------- .../com/juick/ws/controllers/ApiController.java | 2 +- .../components/controllers/StatusController.java | 2 +- .../components/controllers/StatusController.java | 2 +- .../components/controllers/StatusController.java | 2 +- 14 files changed, 81 insertions(+), 72 deletions(-) create mode 100644 juick-core/src/main/java/com/juick/Status.java create mode 100644 juick-core/src/main/java/com/juick/TokensList.java delete mode 100644 juick-server/src/main/java/com/juick/server/helpers/Status.java delete mode 100644 juick-server/src/main/java/com/juick/server/helpers/TokensList.java diff --git a/juick-api/src/main/java/com/juick/api/controllers/Messages.java b/juick-api/src/main/java/com/juick/api/controllers/Messages.java index 75d38c92..2ccdcf9a 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Messages.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Messages.java @@ -3,7 +3,7 @@ package com.juick.api.controllers; import com.juick.Tag; import com.juick.User; import com.juick.api.ApiServer; -import com.juick.server.helpers.Status; +import com.juick.Status; import com.juick.server.util.HttpBadRequestException; import com.juick.server.util.HttpForbiddenException; import com.juick.service.MessagesService; diff --git a/juick-api/src/main/java/com/juick/api/controllers/Notifications.java b/juick-api/src/main/java/com/juick/api/controllers/Notifications.java index 24cb67f3..48db64be 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Notifications.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Notifications.java @@ -4,8 +4,8 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.databind.ObjectMapper; import com.juick.Message; import com.juick.User; -import com.juick.server.helpers.Status; -import com.juick.server.helpers.TokensList; +import com.juick.Status; +import com.juick.TokensList; import com.juick.server.util.HttpBadRequestException; import com.juick.server.util.HttpForbiddenException; import com.juick.service.MessagesService; diff --git a/juick-core/src/main/java/com/juick/Status.java b/juick-core/src/main/java/com/juick/Status.java new file mode 100644 index 00000000..794f1c9e --- /dev/null +++ b/juick-core/src/main/java/com/juick/Status.java @@ -0,0 +1,32 @@ +package com.juick; + +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Created by vitalyster on 25.07.2016. + */ +public class Status { + private final String value; + + public static final Status OK = new Status("ok"); + public static final Status FAIL = new Status("Fail"); + public static final Status ERROR = new Status("Error"); + + public static Status getStatus(final String stringStatus) { + return new Status(stringStatus); + } + + private Status(String value) { + this.value = value; + } + + @JsonProperty("status") + public String getValue() { + return value; + } + + @Override + public String toString() { + return "value = " + value; + } +} diff --git a/juick-core/src/main/java/com/juick/TokensList.java b/juick-core/src/main/java/com/juick/TokensList.java new file mode 100644 index 00000000..de5158c7 --- /dev/null +++ b/juick-core/src/main/java/com/juick/TokensList.java @@ -0,0 +1,30 @@ +package com.juick; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +/** + * Created by vitalyster on 22.11.2016. + */ +public class TokensList { + private String type; + private List tokens; + + @JsonProperty("type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public List getTokens() { + return tokens; + } + + public void setTokens(List tokens) { + this.tokens = tokens; + } +} diff --git a/juick-crosspost/src/main/java/com/juick/components/controllers/StatusController.java b/juick-crosspost/src/main/java/com/juick/components/controllers/StatusController.java index 589a6145..d6f5331a 100644 --- a/juick-crosspost/src/main/java/com/juick/components/controllers/StatusController.java +++ b/juick-crosspost/src/main/java/com/juick/components/controllers/StatusController.java @@ -1,7 +1,7 @@ package com.juick.components.controllers; import com.juick.components.Crosspost; -import com.juick.server.helpers.Status; +import com.juick.Status; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; diff --git a/juick-notifications/build.gradle b/juick-notifications/build.gradle index 1e81e6fc..e7806c00 100644 --- a/juick-notifications/build.gradle +++ b/juick-notifications/build.gradle @@ -12,6 +12,15 @@ dependencies { compile "javax.inject:javax.inject:1" + compile "ch.qos.logback:logback-classic:${rootProject.logbackVersion}" + compile "ch.qos.logback:logback-core:${rootProject.logbackVersion}" + compile "ch.qos.logback:logback-access:${rootProject.logbackVersion}" + + compile "org.slf4j:slf4j-api:${rootProject.slf4jVersion}" + compile "org.slf4j:jcl-over-slf4j:${rootProject.slf4jVersion}" + compile "org.slf4j:log4j-over-slf4j:${rootProject.slf4jVersion}" + compile "org.slf4j:jul-to-slf4j:${rootProject.slf4jVersion}" + compile "org.apache.httpcomponents:httpclient:4.5.2" compile "org.apache.commons:commons-lang3:3.5" compile "org.bitbucket.sco0ter.babbler:xmpp-core-client:0ba6c0e2f9" diff --git a/juick-notifications/src/main/java/com/juick/components/CleanUp.java b/juick-notifications/src/main/java/com/juick/components/CleanUp.java index 924d6134..c78b3f77 100644 --- a/juick-notifications/src/main/java/com/juick/components/CleanUp.java +++ b/juick-notifications/src/main/java/com/juick/components/CleanUp.java @@ -1,6 +1,6 @@ package com.juick.components; -import com.juick.server.helpers.TokensList; +import com.juick.TokensList; import com.notnoop.apns.ApnsService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/juick-notifications/src/main/java/com/juick/components/controllers/StatusController.java b/juick-notifications/src/main/java/com/juick/components/controllers/StatusController.java index d05b3ecc..76435ef9 100644 --- a/juick-notifications/src/main/java/com/juick/components/controllers/StatusController.java +++ b/juick-notifications/src/main/java/com/juick/components/controllers/StatusController.java @@ -1,7 +1,7 @@ package com.juick.components.controllers; +import com.juick.Status; import com.juick.components.Notifications; -import com.juick.server.helpers.Status; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; diff --git a/juick-server/src/main/java/com/juick/server/helpers/Status.java b/juick-server/src/main/java/com/juick/server/helpers/Status.java deleted file mode 100644 index 3c344193..00000000 --- a/juick-server/src/main/java/com/juick/server/helpers/Status.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.juick.server.helpers; - -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * Created by vitalyster on 25.07.2016. - */ -public class Status { - private final String value; - - public static final Status OK = new Status("ok"); - public static final Status FAIL = new Status("Fail"); - public static final Status ERROR = new Status("Error"); - - public static Status getStatus(final String stringStatus) { - return new Status(stringStatus); - } - - private Status(String value) { - this.value = value; - } - - @JsonProperty("status") - public String getValue() { - return value; - } - - @Override - public String toString() { - return "value = " + value; - } -} diff --git a/juick-server/src/main/java/com/juick/server/helpers/TokensList.java b/juick-server/src/main/java/com/juick/server/helpers/TokensList.java deleted file mode 100644 index cb331e04..00000000 --- a/juick-server/src/main/java/com/juick/server/helpers/TokensList.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.juick.server.helpers; - -import com.fasterxml.jackson.annotation.JsonProperty; - -import java.util.List; - -/** - * Created by vitalyster on 22.11.2016. - */ -public class TokensList { - private String type; - private List tokens; - - @JsonProperty("type") - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public List getTokens() { - return tokens; - } - - public void setTokens(List tokens) { - this.tokens = tokens; - } -} diff --git a/juick-ws/src/main/java/com/juick/ws/controllers/ApiController.java b/juick-ws/src/main/java/com/juick/ws/controllers/ApiController.java index 21572637..70b324dd 100644 --- a/juick-ws/src/main/java/com/juick/ws/controllers/ApiController.java +++ b/juick-ws/src/main/java/com/juick/ws/controllers/ApiController.java @@ -1,6 +1,6 @@ package com.juick.ws.controllers; -import com.juick.server.helpers.Status; +import com.juick.Status; import com.juick.ws.WebsocketComponent; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/juick-xmpp-bot/src/main/java/com/juick/components/controllers/StatusController.java b/juick-xmpp-bot/src/main/java/com/juick/components/controllers/StatusController.java index cbd49009..53963d38 100644 --- a/juick-xmpp-bot/src/main/java/com/juick/components/controllers/StatusController.java +++ b/juick-xmpp-bot/src/main/java/com/juick/components/controllers/StatusController.java @@ -1,7 +1,7 @@ package com.juick.components.controllers; import com.juick.components.XMPPBot; -import com.juick.server.helpers.Status; +import com.juick.Status; import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/juick-xmpp-ft/src/main/java/com/juick/components/controllers/StatusController.java b/juick-xmpp-ft/src/main/java/com/juick/components/controllers/StatusController.java index c89c1cfe..eeff36f8 100644 --- a/juick-xmpp-ft/src/main/java/com/juick/components/controllers/StatusController.java +++ b/juick-xmpp-ft/src/main/java/com/juick/components/controllers/StatusController.java @@ -1,7 +1,7 @@ package com.juick.components.controllers; import com.juick.components.XMPPFTServer; -import com.juick.server.helpers.Status; +import com.juick.Status; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; 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 afe566d8..68168c16 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.server.helpers.Status; +import com.juick.Status; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; -- cgit v1.2.3