|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jscience.util.Settings
public final class Settings
Settings provides access to several properties and resources that are used throughout the classes of this Antelmann.com framework.
The default settings are loaded from a well known location
which denotes a file that is commonly distributed along with the
antelmann.jar file.
The default settings can be overwritten by simply altering the Properties
returned by getProperties(), where a subsequent call to that
method will reflect the changes (similar to System.getProperties().
setClassLoader(ClassLoader)
method to specify a ClassLoader appropriate for the given context, before
accessing any resources.
| Field Summary | |
|---|---|
static java.lang.String |
defaultPropertyFile
denotes the relative location of the file for the default Properties, so that it can be found through the ClassLoader |
| Method Summary | |
|---|---|
static void |
checkLicense(java.lang.Object licensee)
checks whether there is a valid license installed for accessing the given object - a convenience method normally used by an application to check whether access to an object is licensed. |
static java.lang.ClassLoader |
getClassLoader()
returns the ClassLoader currently used to locate resources |
LicenseHandler |
getLicenseHandler()
returns the LicenseHandler currently in place to react if a call to checkLicense(Object) fails initially. |
static java.util.Properties |
getOnlineProperties()
returns a fresh set of default Properties directly from the Antelmann.com website |
static java.util.Properties |
getProperties()
This method returns the current application properties; changes to the Properties will be reflected in subsequent calls to this method. |
static java.lang.String |
getProperty(java.lang.String key)
provides a shortcut for getProperties().getPropterty(key) |
static java.lang.String |
getProperty(java.lang.String key,
java.lang.String defaultValue)
This method will try to find the value for the given key and return it - or return the defaultValue if the property was not found or the default property file could not be opened |
static java.net.URL |
getResource(java.lang.String resource)
This method encapsulates calls to the embedded ClassLoader to ease dealing with problems when not finding the resource. |
static void |
init(java.util.Properties newProperties)
sets the properties to be used by Settings; this should not be used unless you need to overwrite the default properties |
static void |
installLicense(License l)
installs the given license to the LicenseManager - a convenience method. |
static void |
installLicenses(java.io.InputStream stream)
installs one or more License Objects from the given stream - a convenience method. |
static void |
load(java.io.File fileProperties)
first, this method tries to initialize with the default properties, but even if that fails, the properties are loaded from the given location. |
static void |
load(java.net.URL urlProperties)
first, this method tries to initialize with the default properties, but even if that fails, the properties are loaded from the given location. |
static void |
reset()
This method forces to reload the default settings from file. |
static void |
setClassLoader(java.lang.ClassLoader cl)
sets the ClassLoader to be used in getResource(String);
by default, the system class loader is used |
static void |
setContextClassLoader()
|
static void |
setLicenseHandler(LicenseHandler handler)
allows to react on failed license-checks by establishing a proper handler |
static java.lang.Object |
setProperty(java.lang.String key,
java.lang.String value)
sets a property within these settings |
static void |
setSystemClassLoader()
sets the class loader to be used to the system class loader (used by default) |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static java.lang.String defaultPropertyFile
ClassLoader
| Method Detail |
|---|
public static void setLicenseHandler(LicenseHandler handler)
getLicenseHandler(),
checkLicense(Object)public LicenseHandler getLicenseHandler()
checkLicense(Object),
setLicenseHandler(LicenseHandler)
public static void checkLicense(java.lang.Object licensee)
throws java.lang.SecurityException
licensee - any object for wich a license is to be checked
java.lang.SecurityException - if the license check failed;
the embedded exception will be
a LicensingExceptionsetLicenseHandler(LicenseHandler),
License,
LicenseManager,
LicensingException
public static void installLicenses(java.io.InputStream stream)
throws java.lang.SecurityException
java.lang.SecurityException - if one of the licenses within the stream
could not be verified. The embedded cause
will be a LicensingExceptionLicense,
LicenseManager,
LicensingException
public static void installLicense(License l)
throws java.lang.SecurityException
java.lang.SecurityException - if the licenses could not be verified.
The embedded cause will be a LicensingExceptionLicense,
LicenseManager,
LicensingExceptionpublic static void setClassLoader(java.lang.ClassLoader cl)
getResource(String);
by default, the system class loader is used
getResource(String)public static void init(java.util.Properties newProperties)
public static void setSystemClassLoader()
public static void setContextClassLoader()
public static java.lang.ClassLoader getClassLoader()
public static java.net.URL getResource(java.lang.String resource)
throws ResourceNotFoundException
ResourceNotFoundException - if the given resource could not be foundsetClassLoader(ClassLoader)
public static java.lang.String getProperty(java.lang.String key,
java.lang.String defaultValue)
public static java.lang.String getProperty(java.lang.String key)
throws ResourceNotFoundException
getProperties().getPropterty(key)
ResourceNotFoundException - if the property file could not be locatedgetProperties()
public static java.lang.Object setProperty(java.lang.String key,
java.lang.String value)
public static java.util.Properties getProperties()
throws ResourceNotFoundException
ResourceNotFoundException - if the property file could not be locatedreset()
public static void load(java.io.File fileProperties)
throws java.io.IOException
java.io.IOException
public static void load(java.net.URL urlProperties)
throws java.io.IOException
java.io.IOExceptionpublic static void reset()
getProperties() hereafter.
getProperties(),
defaultPropertyFilepublic static java.util.Properties getOnlineProperties()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||