public class ERXConfigurationManager
extends java.lang.Object
Note: This is the standard way for WebObjects 5.x applications.
Properties file under the Resources group of the
application and framework project.
It's a Properties file and Project Wonder's
standard project templates include it. (The templates won't
be available on some platforms at this moment.)WebObjects.properties under the user home directory;
same format to Properties.
Note that the user home directory depends on the user who launch the application. They may change between the development and deployment time.
For example: -WOCachingEnabled false -com.webobjects.pid $$
Don't forget to put a dash "-" before the key.
Note that the order between frameworks does not seems to be specified. You should not put conflicting parameters between framework Properties files. On the other hand, the application Properties should be always loaded after all framework Properties are loaded. You can safely override parameters on the frameworks from the applications Properties.
Global:
dbConnectServerGLOBAL = myDatabaseServer
dbConnectUserGLOBAL = me
dbConnectPasswordGLOBAL = secret
dbConnectPluginGLOBAL = Oracle
Per Model for say model ER:
ER.DBServer = myDatabaseServer
ER.DBUser = me
ER.DBPassword = secret
ER.DBPlugin = Oracle
Openbase: same, with DBDatabase and DBHostname
JDBC: same with dbConnectURLGLOBAL, or ER.DBURL
Prototypes can be swapped globally or per model either by hydrating an archived prototype entity for a file or from another entity.
| Properties | |
er.extensions.ERXConfigurationManager.PropertiesTouchFile | if this property is set to a file name, the application will register for notifications of changes to that file and when that file is touched, the application will re-load properties. |
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
_hostName
holds the host name
|
static java.lang.String |
ConfigurationDidChangeNotification
Notification posted when the configuration is updated.
|
protected java.lang.String |
documentRoot |
static org.apache.log4j.Logger |
log
logging support
|
static int |
MacOSXOperatingSystem |
static int |
SolarisOperatingSystem |
static int |
UnknownOperatingSystem |
static int |
WindowsOperatingSystem |
| Modifier and Type | Method and Description |
|---|---|
java.util.Properties |
applyConfiguration(java.util.Properties systemProperties)
This will overlay the current system config files.
|
java.util.Properties |
commandLineArgumentProperties()
Returns the command line arguments as Properties.
|
java.lang.String[] |
commandLineArguments()
Returns the command line arguments.
|
void |
configureRapidTurnAround()
Sets up the system for rapid turnaround mode.
|
static ERXConfigurationManager |
defaultManager()
Returns the single instance of this class
|
java.util.Properties |
defaultProperties()
Returns the command line arguments as Properties.
|
java.lang.String |
documentRoot()
Path to the web server's document root.
|
java.lang.String |
hostName()
Gets the default host name for the current local host.
|
void |
initialize()
Initializes the configuration manager.
|
boolean |
isDeployedAsServlet()
Checks if the application
|
void |
loadConfiguration()
This will overlay the current system config files.
|
int |
operatingSystem() |
void |
setCommandLineArguments(java.lang.String[] newCommandLineArguments)
Sets the command line arguments.
|
void |
updateAllSystemProperties(NSNotification notification) |
void |
updateSystemProperties(NSNotification n)
Updates the configuration from the current configuration and
posts
ConfigurationDidChangeNotification. |
public static final org.apache.log4j.Logger log
public static final java.lang.String ConfigurationDidChangeNotification
public static final int WindowsOperatingSystem
public static final int MacOSXOperatingSystem
public static final int SolarisOperatingSystem
public static final int UnknownOperatingSystem
protected java.lang.String documentRoot
protected java.lang.String _hostName
public static ERXConfigurationManager defaultManager()
public java.lang.String[] commandLineArguments()
ERXApplication.main(String[], Class) sets this value.setCommandLineArguments(java.lang.String[])public java.util.Properties commandLineArgumentProperties()
ERXApplication.main(String[], Class) sets this value.setCommandLineArguments(String[])public java.util.Properties defaultProperties()
ERXApplication.main(String[], Class) sets this value.setCommandLineArguments(String[])public void setCommandLineArguments(java.lang.String[] newCommandLineArguments)
ERXApplication.main(String[], Class) will call this method
when the application starts up.commandLineArguments()public void initialize()
ERXExtensions calls
this method when the ERExtensions framework is loaded.public void configureRapidTurnAround()
public void loadConfiguration()
public java.util.Properties applyConfiguration(java.util.Properties systemProperties)
public void updateSystemProperties(NSNotification n)
ConfigurationDidChangeNotification. It also
calls ERXLogger.configureLoggingWithSystemProperties() to reconfigure
the logging system.
The configuration files: Properties and WebObjects.properties files are reloaded to the Java system properties by the same order to the when the system starts up. Then the command line arguments will be applied to the properties again so that the configuration will be consistent during the application lifespan.
This method is called when rapid turnaround is enabled and one of the configuration files changes.
n - NSNotification object for the event (null means load all files)public void updateAllSystemProperties(NSNotification notification)
public int operatingSystem()
public java.lang.String documentRoot()
application.name()+ "DocumentRoot" property value,
then the ERXDocumentRoot property before
getting the DocumentRoot key in your WebServerConfig.plist in the
JavaWebObjects bundle.public java.lang.String hostName()
public boolean isDeployedAsServlet()
The current implementation only checks if the application
is linked against JavaWOJSPServlet.framework.
Copyright © 2002 – 2022 Project Wonder.