Commit 7358c3de authored by Matt Tucker's avatar Matt Tucker Committed by matt

Minor fixes.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@401 b35dd754-fafc-0310-a699-88a17e54d16e
parent 9220f3f9
...@@ -25,11 +25,10 @@ import org.dom4j.Document; ...@@ -25,11 +25,10 @@ import org.dom4j.Document;
import javax.naming.InitialContext; import javax.naming.InitialContext;
/** /**
* This class controls Jive properties. Jive properties are only meant to be set and retrieved * Controls Jive properties. Jive properties are only meant to be set and retrieved
* by core Jive classes.<p> * by core Jive classes.
* <p/> * <p/>
* All properties are stored in the file <tt>jive_config.xml</tt> which is located in the * The location of the messengerHome directory should be specified one of
* <tt>messengerHome/conf</tt> directory. The location of that directory should be specified one of
* three ways: * three ways:
* <ol> * <ol>
* <li>Set a Java system property named <tt>messengerHome</tt> with the full path to your * <li>Set a Java system property named <tt>messengerHome</tt> with the full path to your
...@@ -338,7 +337,7 @@ public class JiveGlobals { ...@@ -338,7 +337,7 @@ public class JiveGlobals {
loadSetupProperties(); loadSetupProperties();
} }
// jiveHome not loaded? // messengerHome not loaded?
if (xmlProperties == null) { if (xmlProperties == null) {
return null; return null;
} }
...@@ -489,6 +488,7 @@ public class JiveGlobals { ...@@ -489,6 +488,7 @@ public class JiveGlobals {
} }
xmlProperties.deleteProperty(name); xmlProperties.deleteProperty(name);
} }
/** /**
* Returns a Jive property. * Returns a Jive property.
* *
...@@ -497,9 +497,11 @@ public class JiveGlobals { ...@@ -497,9 +497,11 @@ public class JiveGlobals {
*/ */
public static String getProperty(String name) { public static String getProperty(String name) {
if (properties == null) { if (properties == null) {
if (isSetupMode()) {
return null;
}
properties = JiveProperties.getInstance(); properties = JiveProperties.getInstance();
} }
return (String)properties.get(name); return (String)properties.get(name);
} }
...@@ -513,11 +515,12 @@ public class JiveGlobals { ...@@ -513,11 +515,12 @@ public class JiveGlobals {
*/ */
public static String getProperty(String name, String defaultValue) { public static String getProperty(String name, String defaultValue) {
if (properties == null) { if (properties == null) {
if (isSetupMode()) {
return defaultValue;
}
properties = JiveProperties.getInstance(); properties = JiveProperties.getInstance();
} }
String value = (String)properties.get(name); String value = (String)properties.get(name);
if (value != null) { if (value != null) {
return value; return value;
} }
...@@ -588,11 +591,14 @@ public class JiveGlobals { ...@@ -588,11 +591,14 @@ public class JiveGlobals {
* *
* @return a List of all immediate children property names (Strings). * @return a List of all immediate children property names (Strings).
*/ */
public static List getPropertyNames(String parent) { public static List<String> getPropertyNames(String parent) {
if (properties == null) { if (properties == null) {
if (isSetupMode()) {
return new ArrayList<String>();
}
properties = JiveProperties.getInstance(); properties = JiveProperties.getInstance();
} }
return new ArrayList(properties.getChildrenNames(parent)); return new ArrayList<String>(properties.getChildrenNames(parent));
} }
/** /**
...@@ -607,6 +613,9 @@ public class JiveGlobals { ...@@ -607,6 +613,9 @@ public class JiveGlobals {
*/ */
public static List<String> getProperties(String parent) { public static List<String> getProperties(String parent) {
if (properties == null) { if (properties == null) {
if (isSetupMode()) {
return new ArrayList<String>();
}
properties = JiveProperties.getInstance(); properties = JiveProperties.getInstance();
} }
...@@ -628,11 +637,14 @@ public class JiveGlobals { ...@@ -628,11 +637,14 @@ public class JiveGlobals {
* *
* @return a List of all property names (Strings). * @return a List of all property names (Strings).
*/ */
public static List getPropertyNames() { public static List<String> getPropertyNames() {
if (properties == null) { if (properties == null) {
if (isSetupMode()) {
return new ArrayList<String>();
}
properties = JiveProperties.getInstance(); properties = JiveProperties.getInstance();
} }
return new ArrayList(properties.getPropertyNames()); return new ArrayList<String>(properties.getPropertyNames());
} }
/** /**
...@@ -644,6 +656,9 @@ public class JiveGlobals { ...@@ -644,6 +656,9 @@ public class JiveGlobals {
*/ */
public static void setProperty(String name, String value) { public static void setProperty(String name, String value) {
if (properties == null) { if (properties == null) {
if (isSetupMode()) {
return;
}
properties = JiveProperties.getInstance(); properties = JiveProperties.getInstance();
} }
properties.put(name, value); properties.put(name, value);
...@@ -657,6 +672,9 @@ public class JiveGlobals { ...@@ -657,6 +672,9 @@ public class JiveGlobals {
*/ */
public static void setProperties(Map propertyMap) { public static void setProperties(Map propertyMap) {
if (properties == null) { if (properties == null) {
if (isSetupMode()) {
return;
}
properties = JiveProperties.getInstance(); properties = JiveProperties.getInstance();
} }
...@@ -671,6 +689,9 @@ public class JiveGlobals { ...@@ -671,6 +689,9 @@ public class JiveGlobals {
*/ */
public static void deleteProperty(String name) { public static void deleteProperty(String name) {
if (properties == null) { if (properties == null) {
if (isSetupMode()) {
return;
}
properties = JiveProperties.getInstance();; properties = JiveProperties.getInstance();;
} }
properties.remove(name); properties.remove(name);
...@@ -686,6 +707,15 @@ public class JiveGlobals { ...@@ -686,6 +707,15 @@ public class JiveGlobals {
JIVE_CONFIG_FILENAME = configName; JIVE_CONFIG_FILENAME = configName;
} }
/**
* Returns true if in setup mode.
*
* @return true if in setup mode.
*/
private static boolean isSetupMode() {
return !(Boolean.valueOf(JiveGlobals.getXMLProperty("setup")).booleanValue());
}
/** /**
* Loads properties if necessary. Property loading must be done lazily so * Loads properties if necessary. Property loading must be done lazily so
* that we give outside classes a chance to set <tt>messengerHome</tt>. * that we give outside classes a chance to set <tt>messengerHome</tt>.
......
...@@ -42,7 +42,7 @@ public class XMPPBootContainer extends BootstrapContainer { ...@@ -42,7 +42,7 @@ public class XMPPBootContainer extends BootstrapContainer {
AuditManagerImpl.class.getName(), AuditManagerImpl.class.getName(),
UserManagerImpl.class.getName(), UserManagerImpl.class.getName(),
RosterManagerImpl.class.getName(), RosterManagerImpl.class.getName(),
DbPrivateStore.class.getName()}; PrivateStorage.class.getName()};
} }
protected String[] getCoreModuleNames() { protected String[] getCoreModuleNames() {
......
...@@ -39,8 +39,6 @@ public class BasicServer extends BasicModule implements XMPPServer, BasicServerM ...@@ -39,8 +39,6 @@ public class BasicServer extends BasicModule implements XMPPServer, BasicServerM
private ConnectionManager connectionManager; private ConnectionManager connectionManager;
private boolean initialized = false; private boolean initialized = false;
private boolean setupMode = !(Boolean.valueOf(JiveGlobals.getXMLProperty("setup")).booleanValue());
/** /**
* Create a default loopback test server. * Create a default loopback test server.
*/ */
...@@ -92,9 +90,7 @@ public class BasicServer extends BasicModule implements XMPPServer, BasicServerM ...@@ -92,9 +90,7 @@ public class BasicServer extends BasicModule implements XMPPServer, BasicServerM
super.initialize(container); super.initialize(container);
try { try {
lookup = container.getServiceLookup(); lookup = container.getServiceLookup();
if (!setupMode) { name = JiveGlobals.getProperty("xmpp.domain");
name = JiveGlobals.getProperty("xmpp.domain");
}
if (name == null) { if (name == null) {
name = "127.0.0.1"; name = "127.0.0.1";
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment