Package edu.wisc.game.util
Class MainConfig
java.lang.Object
edu.wisc.game.util.MainConfig
A MainConfig is a structure storing the content of a configuration file.
(It can also be modified with the doPut() method, though).
Typically, an application uses only one such file -- the master
config file of the Game Server running on this host.
It can be used by the site administrator to override some
defaults. The master config file is located outside of the WAR file, so that
adjustments can be made without rebuilding the WAR file.
In particular, the main config file (usually located in /opt/w2020/w2020.conf) may override the user name and password for accessing the MySQL database password specified in META-INF/persistence.xml (packaged into the WAR file). Thus changing the database password, or asking the server to work with a different database, can be accommodated without having to rebuild the WAR file.
The MainConfig object is used in sql.Main
In some applications there are multiple instances of MainConfig. E.g. MergeDatasets uses the config file for the merge data set as the main config file, and additionally has an instance of MainConfig describing the data set being merged into the merge data set.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionLooks up the path in this config file, adjusts it if necessary (when on a DoIT shared hosting host), and converts it to a File objectdoGetGuiClientUrl
(boolean dev) doGetString
(String name, String defVal) void
Modifies a table, overriding the value read from the config filestatic File
Looks up the path in the main config file of the app, adjusts it if necessary (when on a DoIT shared hosting host), and converts it to a File objectstatic String
getGuiClientUrl
(boolean dev) The URL string for the Rule Game GUI Client.static MainConfig
Gets the default instance.static String
static void
If any setPath() is used, put() can only be done after setPath()static void
Sets the location of this app's main config file, and causes the app to read it in, if it has not been read yet.toString()
-
Constructor Details
-
MainConfig
- Parameters:
_path
- The location of the master config file (or an alternative config file) from which this structure will be initialized
-
-
Method Details
-
getMainConfig
Gets the default instance. -
setPath
Sets the location of this app's main config file, and causes the app to read it in, if it has not been read yet. This method is used by analysis tools who work with different databases than the default one. It is also used by the Captive Server, with null argument, to disable the attempts to look for the master config file (which CGS users likely won't have).- Parameters:
_path
- The location of the main config file to be used in this application, or null to indicate that we don't use a config file in this app.
-
getString
-
doGetString
-
getFile
Looks up the path in the main config file of the app, adjusts it if necessary (when on a DoIT shared hosting host), and converts it to a File object -
doGetFile
Looks up the path in this config file, adjusts it if necessary (when on a DoIT shared hosting host), and converts it to a File object -
getGuiClientUrl
The URL string for the Rule Game GUI Client.- Parameters:
dev
- True for the dev version, false for prod- Returns:
- The URL string, or the default (a URL on same server and port)
-
doGetGuiClientUrl
-
toString
-
doPut
Modifies a table, overriding the value read from the config file -
put
If any setPath() is used, put() can only be done after setPath()
-