|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.dspace.core.ConfigurationManager
public class ConfigurationManager
Class for reading the DSpace system configuration. The main configuration is read in as properties from a standard properties file. Email templates and configuration files for other tools are also be accessed via this class.
The main configuration is by default read from the resource
/dspace.cfg.
To specify a different configuration, the system property
dspace.configuration should be set to the filename
of the configuration file.
Other configuration files are read from the config directory
of the DSpace installation directory (specified as the property
dspace.dir in the main configuration file.)
| Constructor Summary | |
|---|---|
ConfigurationManager()
|
|
| Method Summary | |
|---|---|
static boolean |
getBooleanProperty(String property)
Get a configuration property as a boolean. |
static boolean |
getBooleanProperty(String property,
boolean defaultValue)
Get a configuration property as a boolean, with default. |
protected static File |
getConfigurationFile()
Deprecated. Please remove all direct usage of the configuration file. |
static String |
getDefaultSubmissionLicense()
Get the site-wide default license that submitters need to grant |
static Email |
getEmail(String emailFile)
Get the template for an email message. |
static int |
getIntProperty(String property)
Get a configuration property as an integer |
static int |
getIntProperty(String property,
int defaultValue)
Get a configuration property as an integer, with default |
static String |
getLicenseText(String licenseFile)
Get the License |
static long |
getLongProperty(String property)
Get a configuration property as a long |
static long |
getLongProperty(String property,
int defaultValue)
Get a configuration property as an long, with default |
static String |
getNewsFilePath()
Get the path for the news files. |
static Properties |
getProperties()
|
static String |
getProperty(String property)
Get a configuration property |
static boolean |
isConfigured()
Identify if DSpace is properly configured |
static void |
loadConfig(String configFile)
Load the DSpace configuration properties. |
static void |
main(String[] argv)
Command-line interface for running configuration tasks. |
static Enumeration |
propertyNames()
Returns an enumeration of all the keys in the DSpace configuration |
static String |
readNewsFile(String newsFile)
Reads news from a text file. |
static void |
writeLicenseFile(String licenseFile,
String newLicense)
Writes license to a text file. |
static String |
writeNewsFile(String newsFile,
String news)
Writes news to a text file. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ConfigurationManager()
| Method Detail |
|---|
public static boolean isConfigured()
public static Properties getProperties()
public static String getProperty(String property)
property - the name of the property
null if the property
does not exist.public static int getIntProperty(String property)
property - the name of the property
0 is returned if the
property does not exist. To differentiate between this case and
when the property actually is zero, use getProperty.
public static int getIntProperty(String property,
int defaultValue)
property - the name of the propertydefaultValue - value to return if property is not found or is not an Integer.
default is returned if
the property does not exist or is not an Integer. To differentiate between this case
and when the property actually is false, use
getProperty.public static long getLongProperty(String property)
property - the name of the property
0 is returned if the
property does not exist. To differentiate between this case and
when the property actually is zero, use getProperty.
public static long getLongProperty(String property,
int defaultValue)
property - the name of the propertydefaultValue - value to return if property is not found or is not a Long.
default is returned if
the property does not exist or is not an Integer. To differentiate between this case
and when the property actually is false, use
getProperty.public static String getLicenseText(String licenseFile)
license - file name
public static boolean getBooleanProperty(String property)
TRUE or YES (case
insensitive.)
property - the name of the property
false is returned if
the property does not exist. To differentiate between this case
and when the property actually is false, use
getProperty.
public static boolean getBooleanProperty(String property,
boolean defaultValue)
TRUE or YES (case
insensitive.)
property - the name of the propertydefaultValue - value to return if property is not found.
default is returned if
the property does not exist. To differentiate between this case
and when the property actually is false, use
getProperty.public static Enumeration propertyNames()
public static Email getEmail(String emailFile)
throws IOException
java.text.MessageFormat.
emailFile - full name for the email template, for example "/dspace/config/emails/register".
IOException - if the template couldn't be found, or there was some other
error reading the templatepublic static String getDefaultSubmissionLicense()
public static String getNewsFilePath()
public static String readNewsFile(String newsFile)
position - a constant indicating which file (top or side) should be read
in.
public static String writeNewsFile(String newsFile,
String news)
position - a constant indicating which file (top or side) should be
written to.news - the text to be written to the file.
public static void writeLicenseFile(String licenseFile,
String newLicense)
news - the text to be written to the file.protected static File getConfigurationFile()
public static void loadConfig(String configFile)
configFile - The dspace.cfg configuration file to use, or
null to try default locationspublic static void main(String[] argv)
-property name prints the value of the property
name from dspace.cfg to the standard
output. If the property does not exist, nothing is written.
argv - command-line arguments
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||