|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.security.Permission
org.apache.derby.security.DatabasePermission
public final class DatabasePermission
This class represents access to database-scoped privileges. An example of database-scoped privileges is the permission to create a database under a specified directory path.
A DatabasePermission is defined by two string attributes, similar to a java.io.FilePermission:
DatabasePermission(String,String)
,
SystemPermission
,
FilePermission
,
Serialized FormField Summary | |
---|---|
static java.lang.String |
CREATE
The create database permission. |
protected static java.util.Set |
LEGAL_ACTIONS
The legal database permission action names. |
private java.lang.String |
parentPath
The parent directory of this permission's canonical directory path, or null if this permission's path does not have a parent directory. |
private java.lang.String |
path
This permission's canonical directory path. |
private char |
pathType
Indicates whether the path denotes an inclusive, recursive, wildcard, or single location. |
private java.lang.String |
url
The original location URL passed to constructor. |
static char |
URL_PATH_INCLUSIVE_CHAR
The path type character matching any database anywhere. |
static java.lang.String |
URL_PATH_INCLUSIVE_STRING
The location text matching any database anywhere. |
static char |
URL_PATH_RECURSIVE_CHAR
The wildcard character matching any database under a directory or its subdirectories. |
static java.lang.String |
URL_PATH_RECURSIVE_STRING
|
static java.lang.String |
URL_PATH_RECURSIVE_SUFFIX
|
static char |
URL_PATH_RELATIVE_CHAR
The relative path character. |
static java.lang.String |
URL_PATH_RELATIVE_PREFIX
|
static java.lang.String |
URL_PATH_RELATIVE_STRING
|
static char |
URL_PATH_SEPARATOR_CHAR
The URL file path separator character. |
static java.lang.String |
URL_PATH_SEPARATOR_STRING
|
static char |
URL_PATH_WILDCARD_CHAR
The wildcard character matching any database in a directory. |
static java.lang.String |
URL_PATH_WILDCARD_STRING
|
static java.lang.String |
URL_PATH_WILDCARD_SUFFIX
|
static java.lang.String |
URL_PROTOCOL_DIRECTORY
The URL protocol scheme specifying a directory location. |
Constructor Summary | |
---|---|
DatabasePermission(java.lang.String url,
java.lang.String actions)
Creates a new DatabasePermission with the specified URL and actions. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object obj)
Checks two DatabasePermission objects for equality. |
java.lang.String |
getActions()
Returns the "canonical string representation" of the actions. |
int |
hashCode()
Returns the hash code value for this object. |
boolean |
implies(java.security.Permission p)
Checks if this DatabasePermission implies a specified permission. |
protected void |
initActions(java.lang.String actions)
Parses the list of database actions. |
protected void |
initLocation(java.lang.String url)
Parses the database location URL. |
private void |
readObject(java.io.ObjectInputStream s)
Called upon Deserialization for restoring the state of this DatabasePermission from a stream. |
private void |
writeObject(java.io.ObjectOutputStream s)
Called upon Serialization for saving the state of this DatabasePermission to a stream. |
Methods inherited from class java.security.Permission |
---|
checkGuard, getName, newPermissionCollection, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String URL_PROTOCOL_DIRECTORY
public static final java.lang.String URL_PATH_INCLUSIVE_STRING
public static final char URL_PATH_INCLUSIVE_CHAR
public static final char URL_PATH_SEPARATOR_CHAR
public static final char URL_PATH_RELATIVE_CHAR
public static final char URL_PATH_WILDCARD_CHAR
public static final char URL_PATH_RECURSIVE_CHAR
public static final java.lang.String URL_PATH_SEPARATOR_STRING
public static final java.lang.String URL_PATH_RELATIVE_STRING
public static final java.lang.String URL_PATH_RELATIVE_PREFIX
public static final java.lang.String URL_PATH_WILDCARD_STRING
public static final java.lang.String URL_PATH_WILDCARD_SUFFIX
public static final java.lang.String URL_PATH_RECURSIVE_STRING
public static final java.lang.String URL_PATH_RECURSIVE_SUFFIX
public static final java.lang.String CREATE
protected static final java.util.Set LEGAL_ACTIONS
private final java.lang.String url
private transient java.lang.String path
"<<ALL FILES>>"
for the "anywhere" permission.
The canonical path is used when testing permissions with implies(),
where real directory locations, not just notational differences,
ought to be compared. Analog to java.io.FilePermission, the
canonical path is also used by equals() and hashCode() to support
hashing and mapping of permissions by their real directory locations.
Because canonical file paths are platform dependent, this field
must not be serialized (hence transient) but be recomputed from
the original URL upon deserialization.
private transient java.lang.String parentPath
private char pathType
Constructor Detail |
---|
public DatabasePermission(java.lang.String url, java.lang.String actions) throws java.io.IOException
actions contains a comma-separated list of the desired actions
granted on a database. Currently, the only supported action is
create
.
URL denotes a database location URL, which, at this time, must
start with directory:
followed by a directory pathname.
Note that in a URL, the separator character is always "/" rather than
the file separator of the operating-system. The directory path may
be absolute or relative, in which case it is prefixed with the current
user directory. In addition, similar to java.io.FilePermission, the
directory pathname may end with a wildcard character to allow for
arbitrarily named databases under a path:
"directory:<<ALL FILES>>"
matches any database anywhere.
url
- the database URLactions
- the action string
java.lang.NullPointerException
- if an argument is null
java.lang.IllegalArgumentException
- if an argument is not legal
java.io.IOException
- if the location URL cannot be canonicalizedPermission.Permission(String)
,
FilePermission.FilePermission(String,String)
Method Detail |
---|
protected void initActions(java.lang.String actions)
actions
- the comma-separated action list
java.lang.NullPointerException
- if actions is null
java.lang.IllegalArgumentException
- if not a list of legal actionsprotected void initLocation(java.lang.String url) throws java.io.IOException
url
- the database URL
java.lang.NullPointerException
- if the URL is null
java.lang.IllegalArgumentException
- if the URL is not well-formed
java.io.IOException
- if the location URL cannot be canonicalizedpublic boolean implies(java.security.Permission p)
This method returns true if:
implies
in class java.security.Permission
p
- the permission to check against
Permission.implies(Permission)
public boolean equals(java.lang.Object obj)
Checks that obj is a DatabasePermission and has the same canonizalized URL and actions as this object.
equals
in class java.security.Permission
obj
- the object we are testing for equality with this object
Permission.equals(Object)
public int hashCode()
hashCode
in class java.security.Permission
Permission.hashCode()
public java.lang.String getActions()
getActions
in class java.security.Permission
Permission.getActions()
private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException
java.io.IOException
private void readObject(java.io.ObjectInputStream s) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
|
Built on Thu 2010-12-23 20:49:13+0000, from revision ??? | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |