From f37219cfbf4db6a5ee5d62909155c5b1e47e1085 Mon Sep 17 00:00:00 2001 From: Jannis Harder Date: Mon, 20 Jun 2011 04:03:32 +0200 Subject: Include libs and dedicated server git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@505 72836036-5685-4462-b002-a69064685172 --- .classpath | 11 +++- lib/smack/smack.jar | Bin 0 -> 306803 bytes lib/smack/smackx.jar | Bin 0 -> 666328 bytes lib/vysper/commons-codec-1.4.jar | Bin 0 -> 58160 bytes lib/vysper/commons-lang-2.5.jar | Bin 0 -> 279193 bytes lib/vysper/mina-core-2.0.2.jar | Bin 0 -> 641543 bytes lib/vysper/nbxml-0.7.jar | Bin 0 -> 53299 bytes lib/vysper/slf4j-api-1.6.1.jar | Bin 0 -> 25496 bytes lib/vysper/slf4j-simple-1.6.1.jar | Bin 0 -> 7669 bytes lib/vysper/vysper-core-0.7.jar | Bin 0 -> 445619 bytes lib/vysper/xep0045-muc-0.7.jar | Bin 0 -> 71154 bytes src/jrummikub/resource/bogus_mina_tls.cert | Bin 0 -> 937 bytes src/jrummikub/server/DedicatedServer.java | 84 +++++++++++++++++++++++++++++ 13 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 lib/smack/smack.jar create mode 100644 lib/smack/smackx.jar create mode 100644 lib/vysper/commons-codec-1.4.jar create mode 100644 lib/vysper/commons-lang-2.5.jar create mode 100644 lib/vysper/mina-core-2.0.2.jar create mode 100644 lib/vysper/nbxml-0.7.jar create mode 100644 lib/vysper/slf4j-api-1.6.1.jar create mode 100644 lib/vysper/slf4j-simple-1.6.1.jar create mode 100644 lib/vysper/vysper-core-0.7.jar create mode 100644 lib/vysper/xep0045-muc-0.7.jar create mode 100644 src/jrummikub/resource/bogus_mina_tls.cert create mode 100644 src/jrummikub/server/DedicatedServer.java diff --git a/.classpath b/.classpath index 713d7da..609b897 100644 --- a/.classpath +++ b/.classpath @@ -5,6 +5,15 @@ - + + + + + + + + + + diff --git a/lib/smack/smack.jar b/lib/smack/smack.jar new file mode 100644 index 0000000..22b9780 Binary files /dev/null and b/lib/smack/smack.jar differ diff --git a/lib/smack/smackx.jar b/lib/smack/smackx.jar new file mode 100644 index 0000000..231a9aa Binary files /dev/null and b/lib/smack/smackx.jar differ diff --git a/lib/vysper/commons-codec-1.4.jar b/lib/vysper/commons-codec-1.4.jar new file mode 100644 index 0000000..458d432 Binary files /dev/null and b/lib/vysper/commons-codec-1.4.jar differ diff --git a/lib/vysper/commons-lang-2.5.jar b/lib/vysper/commons-lang-2.5.jar new file mode 100644 index 0000000..ae491da Binary files /dev/null and b/lib/vysper/commons-lang-2.5.jar differ diff --git a/lib/vysper/mina-core-2.0.2.jar b/lib/vysper/mina-core-2.0.2.jar new file mode 100644 index 0000000..ca90a4c Binary files /dev/null and b/lib/vysper/mina-core-2.0.2.jar differ diff --git a/lib/vysper/nbxml-0.7.jar b/lib/vysper/nbxml-0.7.jar new file mode 100644 index 0000000..6fff5e1 Binary files /dev/null and b/lib/vysper/nbxml-0.7.jar differ diff --git a/lib/vysper/slf4j-api-1.6.1.jar b/lib/vysper/slf4j-api-1.6.1.jar new file mode 100644 index 0000000..42e0ad0 Binary files /dev/null and b/lib/vysper/slf4j-api-1.6.1.jar differ diff --git a/lib/vysper/slf4j-simple-1.6.1.jar b/lib/vysper/slf4j-simple-1.6.1.jar new file mode 100644 index 0000000..d894d96 Binary files /dev/null and b/lib/vysper/slf4j-simple-1.6.1.jar differ diff --git a/lib/vysper/vysper-core-0.7.jar b/lib/vysper/vysper-core-0.7.jar new file mode 100644 index 0000000..a311013 Binary files /dev/null and b/lib/vysper/vysper-core-0.7.jar differ diff --git a/lib/vysper/xep0045-muc-0.7.jar b/lib/vysper/xep0045-muc-0.7.jar new file mode 100644 index 0000000..d05d07c Binary files /dev/null and b/lib/vysper/xep0045-muc-0.7.jar differ diff --git a/src/jrummikub/resource/bogus_mina_tls.cert b/src/jrummikub/resource/bogus_mina_tls.cert new file mode 100644 index 0000000..d34502d Binary files /dev/null and b/src/jrummikub/resource/bogus_mina_tls.cert differ diff --git a/src/jrummikub/server/DedicatedServer.java b/src/jrummikub/server/DedicatedServer.java new file mode 100644 index 0000000..a31c6f5 --- /dev/null +++ b/src/jrummikub/server/DedicatedServer.java @@ -0,0 +1,84 @@ +package jrummikub.server; + +import java.io.IOException; +import java.net.InetAddress; + +import org.apache.vysper.mina.TCPEndpoint; +import org.apache.vysper.storage.OpenStorageProviderRegistry; +import org.apache.vysper.xmpp.addressing.Entity; +import org.apache.vysper.xmpp.authorization.UserAuthorization; +import org.apache.vysper.xmpp.modules.extension.xep0045_muc.MUCModule; +import org.apache.vysper.xmpp.modules.extension.xep0045_muc.storage.InMemoryOccupantStorageProvider; +import org.apache.vysper.xmpp.modules.extension.xep0045_muc.storage.InMemoryRoomStorageProvider; +import org.apache.vysper.xmpp.modules.roster.persistence.MemoryRosterManager; +import org.apache.vysper.xmpp.server.XMPPServer; + +@SuppressWarnings("deprecation") +public class DedicatedServer { + String serverPassword; + String hostName; + + public DedicatedServer(String serverPassword) { + this.serverPassword = serverPassword; + try { + InetAddress addr = InetAddress.getLocalHost(); + hostName = addr.getCanonicalHostName(); + } catch (Exception e) { + hostName = "localhost"; + } + + } + + public String getHostName() { + return hostName; + } + + public void start() throws Exception { + XMPPServer server = new XMPPServer(hostName); + + OpenStorageProviderRegistry providerRegistry = new OpenStorageProviderRegistry(); + providerRegistry.add(new ServerPasswordAuthorization()); + providerRegistry.add(new MemoryRosterManager()); + providerRegistry.add(new InMemoryRoomStorageProvider()); + providerRegistry.add(new InMemoryOccupantStorageProvider()); + + server.setStorageProviderRegistry(providerRegistry); + server.addEndpoint(new TCPEndpoint()); + + server.setTLSCertificateInfo( + getClass().getResource( + "/jrummikub/resource/bogus_mina_tls.cert").openStream(), + "boguspw"); + + server.start(); + MUCModule muc = new MUCModule("play"); + server.addModule(muc); + + } + + public class ServerPasswordAuthorization implements UserAuthorization { + @Override + public boolean verifyCredentials(Entity entity, String password, + Object credentials) { + return password.equals(serverPassword); + } + + @Override + public boolean verifyCredentials(String entity, String password, + Object credentials) { + return password.equals(serverPassword); + } + } + + public static void main(String[] args) { + + DedicatedServer server = new DedicatedServer("password"); + System.out.println("Server hostname is " + server.getHostName()); + try { + server.start(); + } catch (Exception e) { + e.printStackTrace(); + } + } + +} -- cgit v1.2.3