|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.security.Policy sysModel.PolicyFile
public final class PolicyFile
An implementation of a Policy
object whose permissions are specified by a policy
file.
The approximate syntax of policy files is:
policyFile ::= keystoreOrGrantEntries ; keystoreOrGrantEntries ::= keystoreOrGrantEntry | keystoreOrGrantEntries keystoreOrGrantEntry | EMPTY ; keystoreOrGrantEntry ::= keystoreEntry | grantEntry ; keystoreEntry ::= "keystore" keystoreUrl ';' | "keystore" keystoreUrl ',' keystoreAlgorithm ';' ; keystoreUrl ::= URL ; keystoreAlgorithm ::= STRING ; grantEntry ::= "grant" domainParameters '{' permissions '}' ';' domainParameters ::= domainParameter | domainParameter ',' domainParameters ; domainParameter ::= "signedBy" signerNames | "codeBase" codeBaseUrl | "principal" principalClassName principalName | "principal" principalName ; signerNames ::= quotedString ; codeBaseUrl ::= URL ; principalClassName ::= STRING ; principalName ::= quotedString ; quotedString ::= quoteChar STRING quoteChar ; quoteChar ::= '"' | '\''; permissions ::= permission | permissions permission ; permission ::= "permission" permissionClassName permissionTarget permissionAction | "permission" permissionClassName permissionTarget | "permission" permissionClassName;
Comments are either form of Java comments. Keystore entries only affect subsequent grant entries, so if a grant
entry preceeds a keystore entry, that grant entry is not affected by that keystore entry. Certian instances of
${property-name}
will be replaced with System.getProperty("property-name")
in quoted
strings.
This class will load the following files when created or refreshed, in order:
${java.home}/lib/security/java.policy
."policy.file.n"
, for increasing n starting from 1. The sequence stops at the
first undefined property, so you must set "policy.file.1"
if you also set "policy.file.2"
,
and so on."java.security.policy"
.
Policy
Field Summary | |
---|---|
private java.util.Map<java.security.CodeSource,java.security.Permissions> |
cs2pc
|
private static boolean |
DEBUG
|
private static java.lang.String |
DEFAULT_POLICY
|
private static int |
STATE_BEGIN
|
private static int |
STATE_GRANT
|
private static int |
STATE_PERMS
|
Constructor Summary | |
---|---|
PolicyFile()
|
Method Summary | |
---|---|
private static void |
debug(java.lang.String msg)
|
private static void |
debug(java.lang.Throwable t)
|
private static void |
error(java.net.URL base,
java.io.StreamTokenizer in,
java.lang.String msg)
I miss macros. |
private static java.lang.String |
expand(java.lang.String s)
Expand all instances of "${property-name}" into System.getProperty("property-name") . |
java.security.PermissionCollection |
getPermissions(java.security.CodeSource codeSource)
|
private void |
parse(java.net.URL url)
Parse a policy file, incorporating the permission definitions described therein. |
void |
refresh()
|
java.lang.String |
toString()
|
Methods inherited from class java.security.Policy |
---|
getPermissions, getPolicy, implies, setPolicy |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final boolean DEBUG
private static final java.lang.String DEFAULT_POLICY
private final java.util.Map<java.security.CodeSource,java.security.Permissions> cs2pc
private static final int STATE_BEGIN
private static final int STATE_GRANT
private static final int STATE_PERMS
Constructor Detail |
---|
public PolicyFile()
Method Detail |
---|
private static void debug(java.lang.String msg)
private static void debug(java.lang.Throwable t)
public java.security.PermissionCollection getPermissions(java.security.CodeSource codeSource)
getPermissions
in class java.security.Policy
public void refresh()
refresh
in class java.security.Policy
public java.lang.String toString()
toString
in class java.lang.Object
private void parse(java.net.URL url) throws java.io.IOException
url
- The URL of the policy file to read.
java.io.IOException
- if an I/O error occurs, or if the policy file cannot be parsed.private static java.lang.String expand(java.lang.String s)
"${property-name}"
into System.getProperty("property-name")
.
private static void error(java.net.URL base, java.io.StreamTokenizer in, java.lang.String msg) throws java.io.IOException
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |