Class SystemPropertiesManager
java.lang.Object
com.google.appengine.tools.development.SystemPropertiesManager
Manager for a web applications System Properties.
In production each Server Instance has its own independent System Properties. In the Java Development Server the System Properties are shared.
We modify the system properties when the dev appserver is launched using key/value pairs defined in appengine-web.xml. This can make it very easy to leak state across tests that launch instances of the dev appserver, so we keep track of the original values all system properties at start-up. We then restore the values when we shutdown the server.
-
Method Summary
Modifier and TypeMethodDescriptionvoidClears system properties we set insetSystemProperties(com.google.apphosting.utils.config.AppEngineWebXml, java.io.File).voidsetAppengineSystemProperties(String release, String applicationId, String majorVersionId) SetsSystemPropertyvalues for the current application.voidsetSystemProperties(com.google.apphosting.utils.config.AppEngineWebXml appEngineWebXml, File appengineWebXmlFile)
-
Method Details
-
setAppengineSystemProperties
public void setAppengineSystemProperties(String release, String applicationId, String majorVersionId) SetsSystemPropertyvalues for the current application.In a single server application (loaded from a single WAR):
-
appId should be set to
-
majorVersionId should be set to the
AppEngineWebXml.getMajorVersionId().
AppEngineWebXml.getAppId().In a multi server application (loaded from an EAR):
-
appId should be set to
AppEngineApplicationXml.getApplicationId().
-
majorVersionId should be set to the
AppEngineWebXml.getMajorVersionId()for the first web application in the EAR directory according toEarHelper.readEarInfo(String, File). This setting is for compatibility purposes. The value may not match the configuration for all servers in cases different servers have different major versions.
- Parameters:
release- the SDK release (SdkInfo.getLocalVersion().getRelease()).applicationId- the application id.majorVersionId- the application version.
-
majorVersionId should be set to the
-
setSystemProperties
public void setSystemProperties(com.google.apphosting.utils.config.AppEngineWebXml appEngineWebXml, File appengineWebXmlFile) throws com.google.apphosting.utils.config.AppEngineConfigException - Throws:
com.google.apphosting.utils.config.AppEngineConfigException
-
restoreSystemProperties
public void restoreSystemProperties()Clears system properties we set insetSystemProperties(com.google.apphosting.utils.config.AppEngineWebXml, java.io.File). Also, restores system properties to their values at the time thisSystemPropertiesManagerwas constructed. Additional system properties added after thisSystemPropertiesManagerwas constructed are not cleared for historical reasons.Note that restoring system properties that have been set by non-user code we did not write could theoretically affect behavior.
-