The
JDOPermission
class is used to grant the JDO implementation permission to perform
privileged operations if you have a Java security manager in your Java
runtime environment. JDOPermission extends
java.security.BasicPermission. The following
permissions are defined:
- setStateManager
-
This permission allows a StateManager instance to
manage an instance of PersistenceCapable, allowing
it to access and modify any of the fields in the class that are
defined as persistent or transactional. (Chapter 12
covers transactional fields.)
- getMetadata
-
This permission allows a StateManager instance to
access the metadata of any registered persistent class.
- closePersistenceManagerFactory
-
This permission must be granted to close a
PersistenceManagerFactory.
Use of the JDOPermission class allows the security
manager to restrict potentially malicious classes from accessing
information contained in instances of persistent classes.
Assume that you have placed the jar files for the JDO implementation
you are using in the /home/jdoImpl directory.
The following sample policy-file entry grants any jars or class files
in that directory permission to get metadata and manage the state of
persistent instances:
grant codeBase "file:/home/jdoImpl/" {
permission javax.jdo.spi.JDOPermission "getMetadata";
permission javax.jdo.spi.JDOPermission "setStateManager";
};