Add options to default.properties to use hostname or version as resource

https://igniterealtime.org/issues/browse/SPARK-1622
This commit is contained in:
wroot
2015-06-27 18:19:25 +03:00
parent dcc1586c67
commit e24aa12f97
4 changed files with 19 additions and 2 deletions

View File

@ -1056,12 +1056,20 @@ public class LoginDialog {
} }
String resource = localPref.getResource(); String resource = localPref.getResource();
if (localPref.isUseHostnameAsResource()) { if (Default.getBoolean("HOSTNAME_AS_RESOURCE")) {
try { try {
resource = InetAddress.getLocalHost().getHostName(); resource = InetAddress.getLocalHost().getHostName();
} catch(UnknownHostException e) { } catch(UnknownHostException e) {
Log.error("unable to retrieve hostname",e); Log.error("unable to retrieve hostname",e);
} }
} else if (localPref.isUseHostnameAsResource()) {
try {
resource = InetAddress.getLocalHost().getHostName();
} catch(UnknownHostException e) {
Log.error("unable to retrieve hostname",e);
}
} else if (Default.getBoolean("VERSION_AS_RESOURCE")) {
resource = Default.getString(Default.APPLICATION_NAME) + " " + JiveInfo.getVersion() + "." + Default.getString(Default.BUILD_NUMBER);
} else if (localPref.isUseVersionAsResource()) { } else if (localPref.isUseVersionAsResource()) {
resource = Default.getString(Default.APPLICATION_NAME) + " " + JiveInfo.getVersion() + "." + Default.getString(Default.BUILD_NUMBER); resource = Default.getString(Default.APPLICATION_NAME) + " " + JiveInfo.getVersion() + "." + Default.getString(Default.BUILD_NUMBER);
} }

View File

@ -281,6 +281,7 @@ public class LoginSettingDialog implements PropertyChangeListener {
add(connectionPanel, new GridBagConstraints(0, 1, 3, 1, 1.0, 1.0, add(connectionPanel, new GridBagConstraints(0, 1, 3, 1, 1.0, 1.0,
GridBagConstraints.WEST, GridBagConstraints.BOTH, GridBagConstraints.WEST, GridBagConstraints.BOTH,
new Insets(5, 5, 5, 5), 0, 0)); new Insets(5, 5, 5, 5), 0, 0));
if (Default.getBoolean(Default.HOSTNAME_AS_RESOURCE) == Default.getBoolean(Default.VERSION_AS_RESOURCE)) {
add(resourceLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, add(resourceLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.NONE, GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(5, 5, 5, 5), 0, 0)); new Insets(5, 5, 5, 5), 0, 0));
@ -293,6 +294,7 @@ public class LoginSettingDialog implements PropertyChangeListener {
add(useVersionAsResourceBox, new GridBagConstraints(0, 4, 2, 1, 0.0, 1.0, add(useVersionAsResourceBox, new GridBagConstraints(0, 4, 2, 1, 0.0, 1.0,
GridBagConstraints.WEST, GridBagConstraints.NONE, GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(5, 5, 5, 5), 0, 0)); new Insets(5, 5, 5, 5), 0, 0));
}
add(timeOutLabel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, add(timeOutLabel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0,
GridBagConstraints.WEST, GridBagConstraints.NONE, GridBagConstraints.WEST, GridBagConstraints.NONE,
new Insets(5, 5, 5, 5), 0, 0)); new Insets(5, 5, 5, 5), 0, 0));

View File

@ -99,6 +99,8 @@ public class Default {
public static final String USER_DIRECTORY_WINDOWS = "USER_DIRECTORY_WINDOWS"; public static final String USER_DIRECTORY_WINDOWS = "USER_DIRECTORY_WINDOWS";
public static final String USER_DIRECTORY_LINUX = "USER_DIRECTORY_LINUX"; public static final String USER_DIRECTORY_LINUX = "USER_DIRECTORY_LINUX";
public static final String USER_DIRECTORY_MAC = "USER_DIRECTORY_MAC"; public static final String USER_DIRECTORY_MAC = "USER_DIRECTORY_MAC";
public static final String HOSTNAME_AS_RESOURCE = "HOSTNAME_AS_RESOURCE";
public static final String VERSION_AS_RESOURCE = "VERSION_AS_RESOURCE";
static ClassLoader cl = SparkRes.class.getClassLoader(); static ClassLoader cl = SparkRes.class.getClassLoader();

View File

@ -8,7 +8,7 @@ APPLICATION_NAME = Spark
SHORT_NAME = Spark SHORT_NAME = Spark
############# Auto Set During Build ############# ############# Auto Set During Build #############
APPLICATION_VERSION = 2.7.0 APPLICATION_VERSION = 2.7.1
# Passed into ant via cmd line argument: # Passed into ant via cmd line argument:
# -Dbuild.number=<build number> # -Dbuild.number=<build number>
# If not passed in, this field is ignored. # If not passed in, this field is ignored.
@ -41,6 +41,11 @@ ACCOUNT_DISABLED =
# Users wont be able to access the advanced configuration # Users wont be able to access the advanced configuration
ADVANCED_DISABLED = ADVANCED_DISABLED =
# Force using hostname or version as a resource (both are "false" by default; only one can be
# "true" at a time; if both are "true", then hostname will be used as a resource)
HOSTNAME_AS_RESOURCE = false
VERSION_AS_RESOURCE = false
#If Advanded preferences is enabled you are able to remove tabs, except the "General" tab #If Advanded preferences is enabled you are able to remove tabs, except the "General" tab
#Removes SSO Tab #Removes SSO Tab
SSO_DISABLED = false SSO_DISABLED = false