Example syntax for the <systemproperty>
element
The following example illustrates how to set the server environment using the
<systemproperty> element of the
<registry> element in
config.xml.
<registry roles="…" >
<systemproperty name="env" value="my.env" default="production"/>
</registry>
Notice that the defined <systemproperty> element:
- Redefines the name of the
envproperty to bemy.env. Thus, in places in which you formerly usedenv, you now usemy.env. For example,-Denvbecomes-Dmy.env. - Sets a default value (
production) for the system property.
To use this system property, you specify its value as a -D JVM
option at server startup. The option syntax varies by server type.
|
QuickStart (Jetty) |
|
|
Tomcat |
|
The value of my.env is immutable while the server is running.
PolicyCenter determines the value of the redefined
env system property in the following manner, using
-Dmy.env (on Jetty) as an example:
- If you specify the
-Dmy.env=testJVM option at the command prompt at server startup, PolicyCenter sets the value ofenvtotest. - If you do not specify a
-Dmy.envoption at server start, PolicyCenter setsenvto the value ofdefaultthat you specified in thesystemproperty, in this example,production. - If you do not set the value of
my.enveither through a defaultregistryproperty or with a JVM option, PolicyCenter sets the value of theenvproperty tonull.
<systemproperty> element. For example, suppose that
you set the following <registry> element in
config.xml: <systemproperty name="env" value="my.env" default="standalone" />
Then, at server startup, you specify a -Denv="test" JVM option.
PolicyCenter ignores any -Denv
option that you specify on the command prompt and sets the env
value to standalone.
