diff options
author | Vitaly Takmazov | 2017-02-06 15:35:36 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2017-02-06 15:35:36 +0300 |
commit | ac9df0dd46640179869cc8285b9aadff0e88e242 (patch) | |
tree | 6166fc235b347dc6be819a9c98c07861434608a0 /juick-xmpp/src/main/java/com/juick/components/configuration | |
parent | 2fb5e8bd6e1af340fa9fa703906e95cd0e698db1 (diff) |
juick-xmpp: spring-managed ConnectionRouter
Diffstat (limited to 'juick-xmpp/src/main/java/com/juick/components/configuration')
-rw-r--r-- | juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java | 10 |
1 files changed, 10 insertions, 0 deletions
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 index 50bce7b9..9d6fc041 100644 --- a/juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java +++ b/juick-xmpp/src/main/java/com/juick/components/configuration/XmppAppConfiguration.java @@ -6,8 +6,11 @@ package com.juick.components.configuration; import com.juick.components.XMPPServer; import com.juick.components.s2s.CleaningUp; +import com.juick.components.s2s.ConnectionRouter; import com.juick.components.s2s.JuickBot; import com.juick.configuration.DataConfiguration; +import org.apache.commons.lang3.BooleanUtils; +import org.apache.commons.lang3.math.NumberUtils; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -44,4 +47,11 @@ public class XmppAppConfiguration { public JuickBot bot() { return new JuickBot(xmpp()); } + @Bean + public ConnectionRouter router() { + boolean disabled = BooleanUtils.toBoolean(env.getProperty("xmpp_disabled", "false")); + return disabled ? null : new ConnectionRouter(xmpp(), env.getProperty("componentname"), + NumberUtils.toInt(env.getProperty("component_port"), 5347), + env.getProperty("xmpp_password")); + } } |