|
Project Wonder 2.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object er.extensions.ERXConfigurationManager
Configuration Manager
handles rapid turnaround for
system configuration as well as swizzling of the EOModel connection
dictionaries.
Placing configuration parameters
You can provide the system configuration by the following ways:
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. -WOCachingEnabled false -com.webobjects.pid $$
Don't forget to put a dash "-" before the key.Loading order of the configuration parameters
When the application launches, configuration parameters will be loaded by the following order. ERXConfigurationManager trys to reload them by the exactly same order when one of those configuration files changes.
1. Properties in frameworks that the application links to
2. Properties in the application
3. WebObjects.properties under the home directory
4. Command line arguments
If there is a conflicting parameter between the files and arguments, the latter one overrides the earlier one.
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.
Changing the connection dictionary
To do this for Oracle you can either specify on a per model basis or on a global basis.
Global: dbConnectServerGLOBAL = myDatabaseServer dbConnectUserGLOBAL = me dbConnectPasswordGLOBAL = secret Per Model for say model ER: ER.DBServer = myDatabaseServer ER.DBUser = me ER.DBPassword = secret Openbase: same, with DBDatabase and DBHostname JDBC: same with urlGlobal, or db.url
Prototypes can be swapped globally or per model either by hydrating an archived prototype entity for a file or from another entity.
Field Summary | |
protected String |
_hostName
holds the host name |
static String |
ConfigurationDidChangeNotification
Notification posted when the configuration is updated. |
protected String |
documentRoot
Path to the web server's document root. |
static ERXLogger |
log
logging support |
static int |
MacOSXOperatingSystem
|
static int |
SolarisOperatingSystem
|
static int |
UnknownOperatingSystem
|
static int |
WindowsOperatingSystem
|
Method Summary | |
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 |
String |
documentRoot()
|
String |
hostName()
Gets the default host name for the current local host. |
void |
initialize()
Initializes the configuration manager. |
boolean |
isDeployedAsServlet()
Checks if the application is deployed as a servlet. |
void |
loadOptionalConfigurationFiles()
This will overlay the current system config files. |
void |
modelAddedHandler(NSNotification n)
Called when a model is loaded. |
int |
operatingSystem()
|
void |
resetConnectionDictionaryInModel(EOModel aModel)
Resets the connection dictionary to the specified values that are in the defaults. |
void |
setCommandLineArguments(String[] newCommandLineArguments)
Sets the command line arguments. |
void |
updateSystemProperties(NSNotification n)
Updates the configuration from the current configuration and posts ConfigurationDidChangeNotification . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final ERXLogger log
public static final String ConfigurationDidChangeNotification
public static final int WindowsOperatingSystem
public static final int MacOSXOperatingSystem
public static final int SolarisOperatingSystem
public static final int UnknownOperatingSystem
protected String documentRoot
application.name()+ "DocumentRoot"
property value,
then the ERXDocumentRoot> property before
getting the DocumentRoot
key in your WebServerConfig.plist in the
JavaWebObjects bundle.
protected String _hostName
Method Detail |
public static ERXConfigurationManager defaultManager()
public String[] commandLineArguments()
ERXApplication.main(java.lang.String[], java.lang.Class)
sets this value.
setCommandLineArguments(java.lang.String[])
public void setCommandLineArguments(String[] newCommandLineArguments)
ERXApplication.main(java.lang.String[], java.lang.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 loadOptionalConfigurationFiles()
public void updateSystemProperties(NSNotification n)
ConfigurationDidChangeNotification
. It also
calls ERXLogger.configureLogging(java.util.Properties)
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 eventpublic void modelAddedHandler(NSNotification n)
n
- notification posted when a model is loaded. The object is
the model.public void resetConnectionDictionaryInModel(EOModel aModel)
aModel
- to be resetpublic int operatingSystem()
public String documentRoot()
public String hostName()
public boolean isDeployedAsServlet()
The current implementation only checks if the application
is linked against JavaWOJSPServlet.framework
.
|
Last updated: Do, Dez 9, 2004 12:46 PM CET | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |