public class PolicyParser extends Object
The Java runtime creates one global Policy object, which is used to represent the static policy configuration file. It is consulted by a ProtectionDomain when the protection domain initializes its set of permissions.
The Policy init method parses the policy
configuration file, and then
populates the Policy object. The Policy object is agnostic in that
it is not involved in making policy decisions. It is merely the
Java runtime representation of the persistent policy configuration
file.
When a protection domain needs to initialize its set of permissions, it executes code such as the following to ask the global Policy object to populate a Permissions object with the appropriate permissions:
policy = Policy.getPolicy(); Permissions perms = policy.getPermissions(protectiondomain)
The protection domain contains CodeSource object, which encapsulates its codebase (URL) and public key attributes. It also contains the principals associated with the domain. The Policy object evaluates the global policy in light of who the principal is and what the code source is and returns an appropriate Permissions object.
| Modifier and Type | Class and Description |
|---|---|
static class |
PolicyParser.GrantEntry
Each grant entry in the policy configuration file is
represented by a
GrantEntry object.
|
static class |
PolicyParser.ParsingException |
static class |
PolicyParser.PermissionEntry
Each permission entry in the policy configuration file is
represented by a
PermissionEntry object.
|
static class |
PolicyParser.PrincipalEntry
Principal info (class and name) in a grant entry
|
| Modifier and Type | Field and Description |
|---|---|
static String |
REPLACE_NAME |
| Constructor and Description |
|---|
PolicyParser()
Creates a PolicyParser object.
|
PolicyParser(boolean expandProp) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(PolicyParser.GrantEntry ge) |
String |
getKeyStoreProvider() |
String |
getKeyStoreType() |
String |
getKeyStoreUrl()
Returns the (possibly expanded) keystore location, or null if the
expansion fails.
|
String |
getStorePassURL() |
Enumeration |
grantElements()
Enumerate all the entries in the global policy object.
|
static void |
main(String[] arg) |
void |
read(Reader policy)
Reads a policy configuration into the Policy object using a
Reader object.
|
boolean |
remove(PolicyParser.GrantEntry ge) |
void |
replace(PolicyParser.GrantEntry origGe,
PolicyParser.GrantEntry newGe) |
void |
setKeyStoreProvider(String provider) |
void |
setKeyStoreType(String type) |
void |
setKeyStoreUrl(String url) |
void |
setStorePassURL(String storePassURL) |
void |
write(Writer policy)
write out the policy
|
public static final String REPLACE_NAME
public PolicyParser()
public PolicyParser(boolean expandProp)
public void read(Reader policy) throws PolicyParser.ParsingException, IOException
policy - the policy Reader object.PolicyParser.ParsingException - if the policy configuration contains
a syntax error.IOException - if an error occurs while reading the policy
configuration.public void add(PolicyParser.GrantEntry ge)
public void replace(PolicyParser.GrantEntry origGe, PolicyParser.GrantEntry newGe)
public boolean remove(PolicyParser.GrantEntry ge)
public String getKeyStoreUrl()
public void setKeyStoreUrl(String url)
public String getKeyStoreType()
public void setKeyStoreType(String type)
public String getKeyStoreProvider()
public void setKeyStoreProvider(String provider)
public String getStorePassURL()
public void setStorePassURL(String storePassURL)
public Enumeration grantElements()
public void write(Writer policy)
Copyright © 2017. All rights reserved.