aboutsummaryrefslogtreecommitdiff
path: root/juick-xmpp/src/main/java/com/juick/components/configuration
diff options
context:
space:
mode:
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.java45
1 files changed, 18 insertions, 27 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 92506cbd..02b1556d 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
@@ -21,50 +21,41 @@ package com.juick.components.configuration;
* Created by aalexeev on 11/12/16.
*/
-import com.juick.components.XMPPConnection;
-import com.juick.components.XMPPServer;
-import com.juick.components.s2s.CleaningUp;
-import com.juick.components.s2s.JuickBot;
+import com.juick.components.s2s.BasicXmppSession;
import com.juick.server.configuration.BaseWebConfiguration;
-import org.apache.commons.lang3.BooleanUtils;
-import org.springframework.context.annotation.*;
-import org.springframework.core.env.Environment;
+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.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 javax.inject.Inject;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@Configuration
-@ComponentScan(basePackages = {"com.juick.components.controllers"})
+@ComponentScan(basePackages = {"com.juick.components"})
@PropertySource("classpath:juick.conf")
@EnableScheduling
@EnableWebMvc
public class XmppAppConfiguration extends BaseWebConfiguration {
- @Inject
- private Environment env;
-
- @Bean
- public XMPPServer xmpp() {
- return new XMPPServer(env, service());
- }
+ @Value("${hostname}")
+ private String hostname;
@Bean
public ExecutorService service() {
return Executors.newCachedThreadPool();
}
@Bean
- public CleaningUp cleaningUp() {
- return new CleaningUp();
- }
- @Bean
- public JuickBot bot() {
- return new JuickBot(xmpp());
- }
- @Bean
- public XMPPConnection router() {
- boolean disabled = BooleanUtils.toBoolean(env.getProperty("xmpp_disabled", "false"));
- return disabled ? null : new XMPPConnection();
+ public BasicXmppSession session() {
+ XmppSessionConfiguration configuration = XmppSessionConfiguration.builder()
+ .extensions(Extension.of(com.juick.Message.class))
+ .debugger(LogbackDebugger.class)
+ .build();
+ return BasicXmppSession.create(hostname, configuration);
}
}