From d09041304bee53b86c3ddd098a6ff39db85889f3 Mon Sep 17 00:00:00 2001 From: Jannis Harder Date: Tue, 21 Jun 2011 18:51:23 +0200 Subject: Fixed some comment and metrics warnings git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@552 72836036-5685-4462-b002-a69064685172 --- src/jrummikub/server/DedicatedServer.java | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'src/jrummikub/server') diff --git a/src/jrummikub/server/DedicatedServer.java b/src/jrummikub/server/DedicatedServer.java index 42345a6..e27c74c 100644 --- a/src/jrummikub/server/DedicatedServer.java +++ b/src/jrummikub/server/DedicatedServer.java @@ -1,6 +1,5 @@ package jrummikub.server; -import java.io.IOException; import java.net.InetAddress; import org.apache.vysper.mina.TCPEndpoint; @@ -13,7 +12,9 @@ import org.apache.vysper.xmpp.modules.extension.xep0045_muc.storage.InMemoryRoom import org.apache.vysper.xmpp.modules.roster.persistence.MemoryRosterManager; import org.apache.vysper.xmpp.server.XMPPServer; -@SuppressWarnings("deprecation") +/** + * Implements a simple XMPP server with a global server password + */ public class DedicatedServer { String serverPassword; String hostName; @@ -44,6 +45,12 @@ public class DedicatedServer { return hostName; } + /** + * Start the server, this blocks + * + * @throws Exception + * when there is an error during startup + */ public void start() throws Exception { XMPPServer server = new XMPPServer(hostName); @@ -67,6 +74,9 @@ public class DedicatedServer { } + /** + * Allow authorization using a single password for all users + */ public class ServerPasswordAuthorization implements UserAuthorization { @Override public boolean verifyCredentials(Entity entity, String password, @@ -81,9 +91,16 @@ public class DedicatedServer { } } + /** + * Main for a simple command line dedicated server + * + * @param args + * first argument specifies the server password, it is "jrummikub" + * when none is specified + */ public static void main(String[] args) { - - DedicatedServer server = new DedicatedServer("password"); + DedicatedServer server = new DedicatedServer(args.length >= 1 ? args[0] + : "jrummikub"); System.out.println("Server hostname is " + server.getHostName()); try { server.start(); -- cgit v1.2.3