Package edu.wisc.game.util
Class MainConfig
java.lang.Object
edu.wisc.game.util.MainConfig
public class MainConfig extends Object
Accessing the main configuration file of the Game Server, which
can be used by the site administrator to override some
defaults. It 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
-
Constructor Summary
Constructors Constructor Description MainConfig(String _path) -
Method Summary
Modifier and Type Method Description static StringadjustPath(String path)Tries to figure if we're running on a DoIT shared hosting host, and the path such as /opt/w2020/something has to be understood with respect to the root of the chrooted directory (such as "/var/www/vhosts/wwwtest.rulegame.wisc.edu"), rather than with respect to the root of the file system.FiledoGetFile(String name, String defVal)StringdoGetGuiClientUrl(boolean dev)StringdoGetString(String name, String defVal)static FilegetFile(String name, String defVal)Looks up the path, adjusts it if necessary (when on a DoIT shared hosting host), and converts it to a File objectstatic StringgetGuiClientUrl(boolean dev)The URL string for the Rule Game GUI Client.static MainConfiggetMainConfig()Gets the default instance.static StringgetString(String name, String defVal)static voidsetPath(String _path)This method is used by analysis tools who work with different databases than the default one.StringtoString()
-
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
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). -
adjustPath
Tries to figure if we're running on a DoIT shared hosting host, and the path such as /opt/w2020/something has to be understood with respect to the root of the chrooted directory (such as "/var/www/vhosts/wwwtest.rulegame.wisc.edu"), rather than with respect to the root of the file system.- Parameters:
path- Something like "/opt/foo"- Returns:
- Either the original path, or something like "/var/www/vhosts/wwwtest.rulegame.wisc.edu/opt/foo"
-
getString
-
doGetString
-
getFile
Looks up the path, adjusts it if necessary (when on a DoIT shared hosting host), and converts it to a File object -
doGetFile
-
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
-