public class PolicyFileScanner extends Object
keystore "some_keystore_url", "keystore_type";
grant [SignedBy "signer_names"] [, CodeBase "URL"]
[, Principal [principal_class_name] "principal_name"]
[, Principal [principal_class_name] "principal_name"] ... {
permission permission_class_name [ "target_name" ] [, "action"]
[, SignedBy "signer_names"];
permission ...
};
For semantical details of this format, see org.apache.harmony.security.DefaultPolicy javadoc. | Modifier and Type | Class and Description |
|---|---|
static class |
PolicyFileScanner.InvalidFormatException
Specific exception class to signal policy file syntax error.
|
| Constructor and Description |
|---|
PolicyFileScanner() |
| Modifier and Type | Method and Description |
|---|---|
protected String |
composeStatus(StreamTokenizer st)
Formats a detailed description of tokenizer status: current token, current line number, etc.
|
protected StreamTokenizer |
configure(StreamTokenizer st)
Configures passed tokenizer accordingly to supported syntax.
|
protected void |
handleUnexpectedToken(StreamTokenizer st)
Throws InvalidFormatException with error status: which token is unexpected on which line.
|
protected void |
handleUnexpectedToken(StreamTokenizer st,
String message)
Throws InvalidFormatException with detailed diagnostics.
|
protected GrantEntry |
readGrantNode(StreamTokenizer st)
Tries to read grant clause.
|
protected KeystoreEntry |
readKeystoreNode(StreamTokenizer st)
Tries to read keystore clause fields.
|
protected Collection<PermissionEntry> |
readPermissionEntries(StreamTokenizer st)
Tries to read a list of permission entries.
|
protected PrincipalEntry |
readPrincipalNode(StreamTokenizer st)
Tries to read Principal Node fields.
|
void |
scanStream(Reader r,
Collection<GrantEntry> grantEntries,
List<KeystoreEntry> keystoreEntries)
Performs the main parsing loop.
|
protected StreamTokenizer configure(StreamTokenizer st)
public void scanStream(Reader r, Collection<GrantEntry> grantEntries, List<KeystoreEntry> keystoreEntries) throws IOException, PolicyFileScanner.InvalidFormatException
r - policy stream readergrantEntries - a collection to accumulate parsed GrantEntrieskeystoreEntries - a collection to accumulate parsed KeystoreEntriesIOException - if stream reading failedPolicyFileScanner.InvalidFormatException - if unexpected or unknown token encounteredprotected KeystoreEntry readKeystoreNode(StreamTokenizer st) throws IOException, PolicyFileScanner.InvalidFormatException
"some_keystore_url"[, "keystore_type"];
IOException - if stream reading failedPolicyFileScanner.InvalidFormatException - if unexpected or unknown token encounteredprotected GrantEntry readGrantNode(StreamTokenizer st) throws IOException, PolicyFileScanner.InvalidFormatException
[ [codebase "url"] | [signedby "name1,...,nameN"] |
principal ...] ]* { ... }
IOException - if stream reading failedPolicyFileScanner.InvalidFormatException - if unexpected or unknown token encounteredprotected PrincipalEntry readPrincipalNode(StreamTokenizer st) throws IOException, PolicyFileScanner.InvalidFormatException
[ principal_class_name ] "principal_name"
Both class and name may be wildcards, wildcard names should not surrounded by quotes.IOException - if stream reading failedPolicyFileScanner.InvalidFormatException - if unexpected or unknown token encounteredprotected Collection<PermissionEntry> readPermissionEntries(StreamTokenizer st) throws IOException, PolicyFileScanner.InvalidFormatException
permission permission_class_name
[ "target_name" ] [, "action_list"]
[, signedby "name1,name2,..."];
List is terminated by '}' (closing curly brace) symbol.IOException - if stream reading failedPolicyFileScanner.InvalidFormatException - if unexpected or unknown token encounteredprotected String composeStatus(StreamTokenizer st)
protected final void handleUnexpectedToken(StreamTokenizer st, String message) throws PolicyFileScanner.InvalidFormatException
st - a tokenizer holding the erroneous tokenmessage - a user-friendly comment, probably explaining expected syntax. Should not be null- use
the overloaded single-parameter method instead.PolicyFileScanner.InvalidFormatExceptionprotected final void handleUnexpectedToken(StreamTokenizer st) throws PolicyFileScanner.InvalidFormatException
st - a tokenizer holding the erroneous tokenPolicyFileScanner.InvalidFormatExceptionCopyright © 2016. All rights reserved.