diff options
author | Jannis Harder <harder@informatik.uni-luebeck.de> | 2011-06-20 04:03:32 +0200 |
---|---|---|
committer | Jannis Harder <harder@informatik.uni-luebeck.de> | 2011-06-20 04:03:32 +0200 |
commit | f37219cfbf4db6a5ee5d62909155c5b1e47e1085 (patch) | |
tree | 47e8afe6dc36d984bce4d62f8e67e559a43bef48 | |
parent | 338f2c1c421db1c9712d0c522703437ecdf625df (diff) | |
download | JRummikub-f37219cfbf4db6a5ee5d62909155c5b1e47e1085.tar JRummikub-f37219cfbf4db6a5ee5d62909155c5b1e47e1085.zip |
Include libs and dedicated server
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@505 72836036-5685-4462-b002-a69064685172
-rw-r--r-- | .classpath | 11 | ||||
-rw-r--r-- | lib/smack/smack.jar | bin | 0 -> 306803 bytes | |||
-rw-r--r-- | lib/smack/smackx.jar | bin | 0 -> 666328 bytes | |||
-rw-r--r-- | lib/vysper/commons-codec-1.4.jar | bin | 0 -> 58160 bytes | |||
-rw-r--r-- | lib/vysper/commons-lang-2.5.jar | bin | 0 -> 279193 bytes | |||
-rw-r--r-- | lib/vysper/mina-core-2.0.2.jar | bin | 0 -> 641543 bytes | |||
-rw-r--r-- | lib/vysper/nbxml-0.7.jar | bin | 0 -> 53299 bytes | |||
-rw-r--r-- | lib/vysper/slf4j-api-1.6.1.jar | bin | 0 -> 25496 bytes | |||
-rw-r--r-- | lib/vysper/slf4j-simple-1.6.1.jar | bin | 0 -> 7669 bytes | |||
-rw-r--r-- | lib/vysper/vysper-core-0.7.jar | bin | 0 -> 445619 bytes | |||
-rw-r--r-- | lib/vysper/xep0045-muc-0.7.jar | bin | 0 -> 71154 bytes | |||
-rw-r--r-- | src/jrummikub/resource/bogus_mina_tls.cert | bin | 0 -> 937 bytes | |||
-rw-r--r-- | src/jrummikub/server/DedicatedServer.java | 84 |
13 files changed, 94 insertions, 1 deletions
@@ -5,6 +5,15 @@ <classpathentry kind="src" path="mock"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/> - <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Smack"/> + <classpathentry kind="lib" path="lib/smack/smack.jar"/> + <classpathentry kind="lib" path="lib/smack/smackx.jar"/> + <classpathentry kind="lib" path="lib/vysper/commons-codec-1.4.jar"/> + <classpathentry kind="lib" path="lib/vysper/commons-lang-2.5.jar"/> + <classpathentry kind="lib" path="lib/vysper/mina-core-2.0.2.jar"/> + <classpathentry kind="lib" path="lib/vysper/nbxml-0.7.jar"/> + <classpathentry kind="lib" path="lib/vysper/slf4j-api-1.6.1.jar"/> + <classpathentry kind="lib" path="lib/vysper/slf4j-simple-1.6.1.jar"/> + <classpathentry kind="lib" path="lib/vysper/vysper-core-0.7.jar"/> + <classpathentry kind="lib" path="lib/vysper/xep0045-muc-0.7.jar"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/lib/smack/smack.jar b/lib/smack/smack.jar Binary files differnew file mode 100644 index 0000000..22b9780 --- /dev/null +++ b/lib/smack/smack.jar diff --git a/lib/smack/smackx.jar b/lib/smack/smackx.jar Binary files differnew file mode 100644 index 0000000..231a9aa --- /dev/null +++ b/lib/smack/smackx.jar diff --git a/lib/vysper/commons-codec-1.4.jar b/lib/vysper/commons-codec-1.4.jar Binary files differnew file mode 100644 index 0000000..458d432 --- /dev/null +++ b/lib/vysper/commons-codec-1.4.jar diff --git a/lib/vysper/commons-lang-2.5.jar b/lib/vysper/commons-lang-2.5.jar Binary files differnew file mode 100644 index 0000000..ae491da --- /dev/null +++ b/lib/vysper/commons-lang-2.5.jar diff --git a/lib/vysper/mina-core-2.0.2.jar b/lib/vysper/mina-core-2.0.2.jar Binary files differnew file mode 100644 index 0000000..ca90a4c --- /dev/null +++ b/lib/vysper/mina-core-2.0.2.jar diff --git a/lib/vysper/nbxml-0.7.jar b/lib/vysper/nbxml-0.7.jar Binary files differnew file mode 100644 index 0000000..6fff5e1 --- /dev/null +++ b/lib/vysper/nbxml-0.7.jar diff --git a/lib/vysper/slf4j-api-1.6.1.jar b/lib/vysper/slf4j-api-1.6.1.jar Binary files differnew file mode 100644 index 0000000..42e0ad0 --- /dev/null +++ b/lib/vysper/slf4j-api-1.6.1.jar diff --git a/lib/vysper/slf4j-simple-1.6.1.jar b/lib/vysper/slf4j-simple-1.6.1.jar Binary files differnew file mode 100644 index 0000000..d894d96 --- /dev/null +++ b/lib/vysper/slf4j-simple-1.6.1.jar diff --git a/lib/vysper/vysper-core-0.7.jar b/lib/vysper/vysper-core-0.7.jar Binary files differnew file mode 100644 index 0000000..a311013 --- /dev/null +++ b/lib/vysper/vysper-core-0.7.jar diff --git a/lib/vysper/xep0045-muc-0.7.jar b/lib/vysper/xep0045-muc-0.7.jar Binary files differnew file mode 100644 index 0000000..d05d07c --- /dev/null +++ b/lib/vysper/xep0045-muc-0.7.jar diff --git a/src/jrummikub/resource/bogus_mina_tls.cert b/src/jrummikub/resource/bogus_mina_tls.cert Binary files differnew file mode 100644 index 0000000..d34502d --- /dev/null +++ b/src/jrummikub/resource/bogus_mina_tls.cert 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(); + } + } + +} |