|
|||||||||
| Home >> All >> er >> [ extensions overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
er.extensions
Class ERXConfigurationManager

java.lang.Objecter.extensions.ERXConfigurationManager
- public class ERXConfigurationManager
- extends java.lang.Object
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.
Propertiesfile under the Resources group of the application and framework project. It's a java.util.Properties file and Project Wonder's standard project templates include it. (The templates won't be available on some platforms at this moment.)WebObjects.propertiesunder 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 developent and deployment time.- Command line arguments
For example:-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 | |
private java.lang.String[] |
_commandLineArguments
|
protected java.lang.String |
_hostName
holds the host name |
private boolean |
_isInitialized
|
private boolean |
_isRapidTurnAroundInitialized
|
private NSMutableArray |
_monitoredProperties
|
private int |
_operatingSystem
|
static java.lang.String |
ConfigurationDidChangeNotification
Notification posted when the configuration is updated. |
(package private) static ERXConfigurationManager |
defaultManager
Configuration manager singleton |
protected java.lang.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
|
| Constructor Summary | |
private |
ERXConfigurationManager()
Private constructor to prevent instantiation from outside the class |
| Method Summary | |
private void |
_reinsertCommandLineArgumentsToSystemProperties(java.lang.String[] commandLineArguments)
|
private void |
_updateSystemPropertiesFromMonitoredProperties(java.io.File updatedFile,
NSArray monitoredProperties)
|
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.lang.String |
documentRoot()
|
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 is deployed as a servlet. |
void |
modelAddedHandler(NSNotification n)
|
int |
operatingSystem()
|
void |
resetConnectionDictionaryInModel(EOModel aModel)
|
void |
setCommandLineArguments(java.lang.String[] newCommandLineArguments)
Sets the command line arguments. |
private java.lang.String |
stringForKey(java.lang.String key)
|
void |
updateSystemProperties(NSNotification n)
Updates the configuration from the current configuration and posts ConfigurationDidChangeNotification 55 . |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
log
public static final ERXLogger log
- logging support
ConfigurationDidChangeNotification
public static final java.lang.String ConfigurationDidChangeNotification
- Notification posted when the configuration is updated.
The Java system properties is the part of the configuration.
- See Also:
- Constant Field Values
defaultManager
static ERXConfigurationManager defaultManager
- Configuration manager singleton
_commandLineArguments
private java.lang.String[] _commandLineArguments
_monitoredProperties
private NSMutableArray _monitoredProperties
_isInitialized
private boolean _isInitialized
_isRapidTurnAroundInitialized
private boolean _isRapidTurnAroundInitialized
WindowsOperatingSystem
public static final int WindowsOperatingSystem
- See Also:
- Constant Field Values
MacOSXOperatingSystem
public static final int MacOSXOperatingSystem
- See Also:
- Constant Field Values
SolarisOperatingSystem
public static final int SolarisOperatingSystem
- See Also:
- Constant Field Values
UnknownOperatingSystem
public static final int UnknownOperatingSystem
- See Also:
- Constant Field Values
_operatingSystem
private int _operatingSystem
documentRoot
protected java.lang.String documentRoot
- Path to the web server's document root.
This implementation tries first to resolve the
application.name()+ "DocumentRoot"property value, then theERXDocumentRoot> property before getting theDocumentRootkey in your WebServerConfig.plist in the JavaWebObjects bundle.
_hostName
protected java.lang.String _hostName
- holds the host name
| Constructor Detail |
ERXConfigurationManager
private ERXConfigurationManager()
- Private constructor to prevent instantiation from outside the class
| Method Detail |
defaultManager
public static ERXConfigurationManager defaultManager()
- Returns the single instance of this class
commandLineArguments
public java.lang.String[] commandLineArguments()
- Returns the command line arguments.
ERXApplication.main(java.lang.String[], java.lang.Class)55 sets this value.
setCommandLineArguments
public void setCommandLineArguments(java.lang.String[] newCommandLineArguments)
- Sets the command line arguments.
ERXApplication.main(java.lang.String[], java.lang.Class)55 will call this method when the application starts up.
initialize
public void initialize()
- Initializes the configuration manager.
The framework principal ERXExtensions calles
this method when the ERExtensions framework is loaded.
configureRapidTurnAround
public void configureRapidTurnAround()
- Sets up the system for rapid turnaround mode. It will watch the
changes on Properties files in application and framework bundles
and WebObjects.properties under the home directory.
Rapid turnaround mode will only be enabled if there are such
files available and system has WOCaching disabled.
updateSystemProperties
public void updateSystemProperties(NSNotification n)
- Updates the configuration from the current configuration and
posts
ConfigurationDidChangeNotification55 . It also callsERXLogger.configureLogging(java.util.Properties)55 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.
_updateSystemPropertiesFromMonitoredProperties
private void _updateSystemPropertiesFromMonitoredProperties(java.io.File updatedFile, NSArray monitoredProperties)
_reinsertCommandLineArgumentsToSystemProperties
private void _reinsertCommandLineArgumentsToSystemProperties(java.lang.String[] commandLineArguments)
stringForKey
private java.lang.String stringForKey(java.lang.String key)
modelAddedHandler
public void modelAddedHandler(NSNotification n)
resetConnectionDictionaryInModel
public void resetConnectionDictionaryInModel(EOModel aModel)
operatingSystem
public int operatingSystem()
documentRoot
public java.lang.String documentRoot()
hostName
public java.lang.String hostName()
- Gets the default host name for the current local host.
isDeployedAsServlet
public boolean isDeployedAsServlet()
- Checks if the application is deployed as a servlet.
The current implementation only checks if the application is linked against
JavaWOJSPServlet.framework.
|
|||||||||
| Home >> All >> er >> [ extensions overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
er.extensions.ERXConfigurationManager