|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.starhope.appius.util.AppiusConfig
public final class AppiusConfig
This static class is the singleton responsible for configuration, factories, etc.
Field Summary | |
---|---|
private static Properties |
config
The internal configuration database is really a Java Properties object. |
private static ConcurrentSkipListSet<GetsConfigReload> |
configLoaders
Set of things that want to know if the configuration changes |
private static boolean |
dbcpActive
If true, use database connection pooling |
private static Map<String,Connection> |
dbh
This is the data source for SQL queries. |
private static Map<String,DataSource> |
ds
JDBC data source |
private static ConcurrentHashMap<FilterType,AbstractCensor> |
filters
The library of instantiated filters for various purposes |
private static Map<String,org.apache.commons.dbcp.PoolableConnectionFactory> |
poolableConnectionFactory
This is the container for the poolable connection factory, which is never directly read again, but is used to contain the DBCP pool. |
static Random |
rnd
A running random number holder |
private static boolean |
tomcatDBCP
Flag: whether to use Tomcat's DBCP |
Constructor Summary | |
---|---|
AppiusConfig()
|
Method Summary | ||
---|---|---|
static boolean |
alwaysRealtime()
|
|
static boolean |
confDontKickStaff()
This is a negative assertion ... |
|
static void |
configChanged()
Announce to all interested parties that the configuration has been changed in some way |
|
static boolean |
disableCache()
|
|
static int |
getAdminPort()
Get the port number on which to listen for administrative commands |
|
static int |
getBackdoorBufferSize()
|
|
static com.whirlycott.cache.Cache<String,?> |
getCache(String cacheID)
|
|
static String |
getChatFilterName()
Deprecated. |
|
static String |
getConfig(String key)
This fetches up a configuration property in general. |
|
static boolean |
getConfigBool(String string)
|
|
static boolean |
getConfigBoolOrFalse(String string)
The same as getConfigBool(String) but returns a “false”
if the key is not found |
|
static boolean |
getConfigBoolOrTrue(String string)
The same as getConfigBool(String) but returns a “true”
if the key is not found |
|
static String |
getConfigOrDefault(String key,
String defaultValue)
|
|
static String |
getConfigOrNull(String string)
This calls @see(#getConfig), but doesn't throw any exceptions, it just returns a null if the string isn't found in the configuration. |
|
private static Connection |
getConnectionToArbitraryDatabase(String host,
String schema,
String user,
String password)
Obtain a connection to an arbitrary schema on the database server |
|
static Connection |
getDatabaseConnection()
|
|
static String |
getDBCPInfo()
get status information from DBCP pools |
|
private static byte |
getDBCPWhenExhaustedAction()
Get the byte values used for DBCP enumeration of whenExhaustedAction from the string forms used in the configuration. |
|
static String |
getDNS_JNDI()
This returns the DNS URL to be used in JNDI queries for DNS lookups. |
|
static AbstractCensor |
getFilter(FilterType filter_type)
Obtain a filter (censor) object suitable for filtering a certain type of data, e.g. |
|
static int |
getFutureDatagramsMax()
Get the number of deferred (future) datagrams permitted to be enqueued for a single user, before the user's connection is decided to be “too laggy” and dropped. |
|
static long |
getIdleKickTime()
|
|
static long |
getIdleWarnTime()
|
|
static int |
getInt(String string)
|
|
static int |
getIntOrDefault(String string,
int defaultValue)
Get an integer value from the configuration; or, return a given default value if the value is not set, or can't be parsed as an integer. |
|
static int |
getIntOrZero(String string)
|
|
static AbstractItem |
getItemCreationTemplate(int itemID)
|
|
static Connection |
getJournalDatabaseConnection()
get a connection to the journal database |
|
static List<String> |
getList(String configKey)
Get a list of strings from a single configuration key, separated by whitespace |
|
static Logger |
getLogger()
|
|
static String |
getLoginFilterName()
|
|
static javax.mail.Address |
getMailSender()
Get a Java mail Address object for sending automated eMails. |
|
static int |
getMaxInputSize()
Get the maximum allowed input size for one client |
|
static long |
getMetronomeTime()
Get the granularity of the global metronome. |
|
static long |
getNudgeTime()
|
|
static boolean |
getRandomBool()
|
|
static int |
getRandomInt(int from,
int to)
|
|
static
|
getRecordLoaderForClass(Class<T> klass)
get the record loader type for handling records of a given class |
|
static RecordSetLoader<? extends DataRecordSet<?>> |
getRecordSetLoaderForClass(Class<? extends DataRecordSet<?>> klass)
WRITEME: Document this method brpocock@star-hope.org |
|
static String |
getServerName()
Deprecated. |
|
static String |
getSFSName()
Deprecated. |
|
static int |
getSFSPort()
Deprecated. |
|
static String |
getSMTPHost()
|
|
static Connection |
getStoreDatabaseConnection()
|
|
static String |
getTLD()
Get the top-level domain name of the game server(s). |
|
static Class<? extends User> |
getUserClass()
WRITEME: document this method (brpocock@star-hope.org, Dec 30, 2009) |
|
static Connection |
getZonesDatabaseConnection()
Get a connection to the database containing the Zones table |
|
static void |
init()
Initialize the configuration system from the Properties system and any other relevant sources. |
|
private static void |
initDBCP(String host,
String user,
String password,
String schema)
WRITEME: document this method (brpocock@star-hope.org, Dec 16, 2009) |
|
static boolean |
isBackdoorOpen()
Determine whether the administrative backdoor should be open |
|
static boolean |
isDebug()
Return true if the system is set to debugging mode |
|
static void |
loadConfig()
Load (or reload) the configuration from the configuration properties file (/etc/appius/config.properties), and notify other classes that can adjust their configuration of that fact. |
|
static boolean |
mailBugs()
|
|
static GameWorldMessage |
newGameWorldMessage()
|
|
static void |
setConfig(String key,
String value)
|
|
static void |
setMailBugs(boolean b)
Determine whether to mail out bug reports, or not. |
|
static void |
wantConfigReload(GetsConfigReload thing)
Add something to the list of things that want configuration reload notifications |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final Properties config
private static ConcurrentSkipListSet<GetsConfigReload> configLoaders
private static boolean dbcpActive
private static final Map<String,Connection> dbh
private static final Map<String,DataSource> ds
private static ConcurrentHashMap<FilterType,AbstractCensor> filters
private static final Map<String,org.apache.commons.dbcp.PoolableConnectionFactory> poolableConnectionFactory
public static final Random rnd
private static boolean tomcatDBCP
Constructor Detail |
---|
public AppiusConfig()
Method Detail |
---|
public static boolean alwaysRealtime()
public static boolean confDontKickStaff()
public static void configChanged()
public static boolean disableCache()
public static int getAdminPort()
public static int getBackdoorBufferSize()
public static com.whirlycott.cache.Cache<String,?> getCache(String cacheID)
cacheID
- the name of the cache
@Deprecated public static String getChatFilterName()
public static String getConfig(String key) throws NotFoundException
key
- The identifier of the configuration value to be
queried
NotFoundException
- If the configuration string is not
foundpublic static boolean getConfigBool(String string) throws NotFoundException
string
- the configuration identifier string
NotFoundException
- if the value can't be found or isn't a
boolean (literal "true" or "false" only)public static boolean getConfigBoolOrFalse(String string)
getConfigBool(String)
but returns a “false”
if the key is not found
string
- the config identifier string
public static boolean getConfigBoolOrTrue(String string)
getConfigBool(String)
but returns a “true”
if the key is not found
string
- the config identifier string
public static String getConfigOrDefault(String key, String defaultValue)
key
- configuration keydefaultValue
- default value
public static String getConfigOrNull(String string)
string
- The identifier of the configuration being queries
private static Connection getConnectionToArbitraryDatabase(String host, String schema, String user, String password)
host
- Database server hostnameschema
- Database schema nameuser
- database user account namepassword
- database user account password
public static Connection getDatabaseConnection() throws SQLException
SQLException
- (bubbled up from underlying layers)public static String getDBCPInfo() throws NotFoundException, SQLException
NotFoundException
- If one of the schema keys can't be
found
SQLException
- if the driver can't be accessedprivate static byte getDBCPWhenExhaustedAction()
public static String getDNS_JNDI()
public static AbstractCensor getFilter(FilterType filter_type)
filter_type
- the type of filter to obtain
public static int getFutureDatagramsMax()
public static long getIdleKickTime()
public static long getIdleWarnTime()
public static int getInt(String string) throws NumberFormatException, NotFoundException
string
- the configuration key
NotFoundException
- if the key isn't found in the
configuration
NumberFormatException
- if the key can't be parsed as an
integerpublic static int getIntOrDefault(String string, int defaultValue)
string
- The configuration keydefaultValue
- The default value to be returned if the value
isn't available
public static int getIntOrZero(String string)
string
- the configuration key
public static AbstractItem getItemCreationTemplate(int itemID)
itemID
- The item whose template is being requested
AbstractItem
for that itempublic static Connection getJournalDatabaseConnection() throws SQLException
SQLException
- if the connection can't be made for some
reasonpublic static List<String> getList(String configKey)
configKey
- the configuration key containing the list
public static Logger getLogger()
public static String getLoginFilterName()
public static javax.mail.Address getMailSender()
public static int getMaxInputSize()
public static long getMetronomeTime()
public static long getNudgeTime()
public static boolean getRandomBool()
public static int getRandomInt(int from, int to)
from
- lower limitto
- upper limit
public static <T extends DataRecord> RecordLoader<T> getRecordLoaderForClass(Class<T> klass)
T
- the type for which a RecordLoader is being soughtklass
- the class of the DataRecord type
public static RecordSetLoader<? extends DataRecordSet<?>> getRecordSetLoaderForClass(Class<? extends DataRecordSet<?>> klass)
klass
- WRITEME
@Deprecated public static String getServerName()
@Deprecated public static String getSFSName()
getServerName()
@Deprecated public static int getSFSPort()
public static String getSMTPHost()
public static Connection getStoreDatabaseConnection() throws SQLException
SQLException
- (bubbled up from underlying layers)public static String getTLD()
public static Class<? extends User> getUserClass()
public static Connection getZonesDatabaseConnection() throws SQLException
SQLException
- if the connection can't be obtainedpublic static void init()
private static void initDBCP(String host, String user, String password, String schema)
host
- WRITEMEuser
- WRITEMEpassword
- WRITEMEschema
- WRITEMEpublic static boolean isBackdoorOpen()
public static boolean isDebug()
public static void loadConfig()
public static boolean mailBugs()
public static GameWorldMessage newGameWorldMessage()
public static void setConfig(String key, String value)
key
- The configuration value to be setvalue
- The new valuepublic static void setMailBugs(boolean b)
b
- Whether to mail bug reportspublic static void wantConfigReload(GetsConfigReload thing)
thing
- The object wanting configuration change
notifications
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |