The location of the Java security policy is set by the property
"java.security.policy". When using the Openwings CD/ICD
Editor (usually started via the "owediticd" script in
$OW_HOME/bin/), select the "Properties" button to edit
properties, then type a line like the one below. Note that the
JVM expects a single filename for this property, but the Openwings
Installer allows multiple values, separated by spaces.
java.security.policy=${openwings.property.java.security.policy}
${HelloWorldUser_im.property.net.openwings.install.policyDir}/HelloWorldUser_im.policy
The example above is taken from the HelloWorldUser component.
The first item in the "java.security.policy" property
is the Openwings security policy. The HelloWorldUser component
depends on the Openwings component: that is to say, the HelloWorldUser
component makes calls into Openwings libraries. The Openwings
security policy contains the information about what these Openwings
libraries (Jar files) are allowed to do. We don't know or need
to know the actual location of the Openwings security policy file,
we just include it by referencing the "java.security.policy"
property from the Openwings component. A good rule of thumb
is to reference the security policy of any component whose classpath
your component references in the "resolvableClasspath"
field.
The HelloWorldUser component has its own libraries, and the second
item in the "java.security.policy" property states the
location of a file that contains settings for these libraries.
This file is located in the policy directory of this component.
At install time, the Openwings installer will parse the "java.security.policy"
property, read in the Openwings security policy and the HelloWorldUser
security policy, and write out a combined security policy file
to a secure location. In the reference implementation, this will
be ${openwings.property.net.openwings.dataDir}/${myComponent}.policy.
Note that the combined security policy is not written under the
component's directory, since many components will have access
to their install directories and could edit their own security
policies at will!
Next: Create
your component's security policy