[Mulgara-svn] r1114 - trunk/src/jar/server/java/org/mulgara/server
pag at mulgara.org
pag at mulgara.org
Mon Jul 28 23:04:07 UTC 2008
Author: pag
Date: 2008-07-28 16:04:07 -0700 (Mon, 28 Jul 2008)
New Revision: 1114
Modified:
trunk/src/jar/server/java/org/mulgara/server/ServerInfo.java
Log:
Provided default port values here, rather than EmbeddedMulgaraServer. Also, hostnames is pre-initialized, so it can accept a single hostname before the rest of them are provided. The setHostnameAliases method used to use the uninitialized state to check that aliases weren't added twice, but this was simply an assertion that the code was built as expected. Also added a toStaticString() method to get the full state in a string, useful for debugging.
Modified: trunk/src/jar/server/java/org/mulgara/server/ServerInfo.java
===================================================================
--- trunk/src/jar/server/java/org/mulgara/server/ServerInfo.java 2008-07-28 22:59:46 UTC (rev 1113)
+++ trunk/src/jar/server/java/org/mulgara/server/ServerInfo.java 2008-07-28 23:04:07 UTC (rev 1114)
@@ -29,6 +29,7 @@
// Java packages
import java.net.URI;
+import java.util.HashSet;
import java.util.Set;
// log4j packages
@@ -69,13 +70,13 @@
private static String boundHostname = null;
/** The port used for RMI. */
- private static int rmiPort = 0;
+ private static int rmiPort = 1099;
/** The port used for HTTP. */
- private static int httpPort = 0;
+ private static int httpPort = 8080;
/** The set of hostname aliases. */
- private static Set<String> hostnames = null;
+ private static Set<String> hostnames = new HashSet<String>();
/**
@@ -165,10 +166,7 @@
* @throws IllegalStateException If the host names have already been set
*/
public static void setHostnameAliases(Set<String> hostnames) {
- if (ServerInfo.hostnames != null) {
- throw new IllegalStateException("Host names have already been set");
- }
- ServerInfo.hostnames = hostnames;
+ ServerInfo.hostnames.addAll(hostnames);
}
@@ -227,4 +225,17 @@
ServerInfo.httpPort = httpPort;
}
+ public static String toStaticString() {
+ StringBuilder s = new StringBuilder();
+ s.append("Server URI = ").append(serverURI).append("\n");
+ s.append("Local session factory = ");
+ if (localSessionFactory == null) s.append("null\n");
+ else s.append(localSessionFactory.getClass().getSimpleName()).append("\n");
+ s.append("Bound host name = ").append(boundHostname).append("\n");
+ s.append("RMI Port = ").append(rmiPort).append("\n");
+ s.append("HTTP Port = ").append(httpPort).append("\n");
+ s.append("Host names = ").append(hostnames).append("\n");
+ return s.toString();
+ }
+
}
More information about the Mulgara-svn
mailing list