class DefaultPolicyScanner 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 the
default policy description.
DefaultPolicyParser| Modifier and Type | Class and Description |
|---|---|
(package private) static class |
DefaultPolicyScanner.GrantEntry
Compound token representing grant clause.
|
static class |
DefaultPolicyScanner.InvalidFormatException
Specific exception class to signal policy file syntax error.
|
(package private) static class |
DefaultPolicyScanner.KeystoreEntry
Compound token representing keystore clause.
|
(package private) static class |
DefaultPolicyScanner.PermissionEntry
Compound token representing permission entry of a grant
clause.
|
(package private) static class |
DefaultPolicyScanner.PrincipalEntry
Compound token representing principal entry of a grant
clause.
|
| Constructor and Description |
|---|
DefaultPolicyScanner() |
| Modifier and Type | Method and Description |
|---|---|
(package private) String |
composeStatus(StreamTokenizer st)
Formats a detailed description of tokenizer status: current token,
current line number, etc.
|
(package private) StreamTokenizer |
configure(StreamTokenizer st)
Configures passed tokenizer accordingly to supported syntax.
|
(package private) void |
handleUnexpectedToken(StreamTokenizer st)
Throws InvalidFormatException with error status: which token is
unexpected on which line.
|
(package private) void |
handleUnexpectedToken(StreamTokenizer st,
String message)
Throws InvalidFormatException with detailed diagnostics.
|
(package private) DefaultPolicyScanner.GrantEntry |
readGrantEntry(StreamTokenizer st)
Tries to read grant clause.
|
(package private) DefaultPolicyScanner.KeystoreEntry |
readKeystoreEntry(StreamTokenizer st)
Tries to read keystore clause fields.
|
(package private) Collection<DefaultPolicyScanner.PermissionEntry> |
readPermissionEntries(StreamTokenizer st)
Tries to read a list of permission entries.
|
(package private) DefaultPolicyScanner.PrincipalEntry |
readPrincipalEntry(StreamTokenizer st)
Tries to read Principal entry fields.
|
(package private) void |
scanStream(Reader r,
Collection<DefaultPolicyScanner.GrantEntry> grantEntries,
List<DefaultPolicyScanner.KeystoreEntry> keystoreEntries)
Performs the main parsing loop.
|
StreamTokenizer configure(StreamTokenizer st)
void scanStream(Reader r, Collection<DefaultPolicyScanner.GrantEntry> grantEntries, List<DefaultPolicyScanner.KeystoreEntry> keystoreEntries) throws IOException, DefaultPolicyScanner.InvalidFormatException
r - policy stream readergrantEntries - a collection to accumulate parsed GrantEntrieskeystoreEntries - a collection to accumulate parsed KeystoreEntriesIOException - if stream reading failedDefaultPolicyScanner.InvalidFormatException - if unexpected or unknown token encounteredDefaultPolicyScanner.KeystoreEntry readKeystoreEntry(StreamTokenizer st) throws IOException, DefaultPolicyScanner.InvalidFormatException
"some_keystore_url"[, "keystore_type"];
IOException - if stream reading failedDefaultPolicyScanner.InvalidFormatException - if unexpected or unknown token encounteredDefaultPolicyScanner.GrantEntry readGrantEntry(StreamTokenizer st) throws IOException, DefaultPolicyScanner.InvalidFormatException
[ [codebase "url"] | [signedby "name1,...,nameN"] |
principal ...] ]* { ... }
IOException - if stream reading failedDefaultPolicyScanner.InvalidFormatException - if unexpected or unknown token encounteredDefaultPolicyScanner.PrincipalEntry readPrincipalEntry(StreamTokenizer st) throws IOException, DefaultPolicyScanner.InvalidFormatException
[ principal_class_name ] "principal_name"
Both class and name may be wildcards, wildcard names should not
surrounded by quotes.IOException - if stream reading failedDefaultPolicyScanner.InvalidFormatException - if unexpected or unknown token encounteredCollection<DefaultPolicyScanner.PermissionEntry> readPermissionEntries(StreamTokenizer st) throws IOException, DefaultPolicyScanner.InvalidFormatException
permission permission_class_name
[ "target_name" ] [, "action_list"]
[, signedby "name1,name2,..."];
List is terminated by '}' (closing curly brace) symbol.IOException - if stream reading failedDefaultPolicyScanner.InvalidFormatException - if unexpected or unknown token encounteredString composeStatus(StreamTokenizer st)
final void handleUnexpectedToken(StreamTokenizer st, String message) throws DefaultPolicyScanner.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.DefaultPolicyScanner.InvalidFormatExceptionfinal void handleUnexpectedToken(StreamTokenizer st) throws DefaultPolicyScanner.InvalidFormatException
st - a tokenizer holding the erroneous tokenDefaultPolicyScanner.InvalidFormatExceptionCopyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.