Class DatabasePermission
- java.lang.Object
-
- java.security.Permission
-
- org.apache.derby.security.DatabasePermission
-
- All Implemented Interfaces:
- java.io.Serializable, java.security.Guard
public final class DatabasePermission extends java.security.PermissionThis 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:
- URL - a location description of or for a Derby database
- Actions - a list of granted administrative actions
- See Also:
DatabasePermission(String,String),SystemPermission,FilePermission, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.StringCREATEThe create database permission.static charURL_PATH_INCLUSIVE_CHARThe path type character matching any database anywhere.static java.lang.StringURL_PATH_INCLUSIVE_STRINGThe location text matching any database anywhere.static charURL_PATH_RECURSIVE_CHARThe wildcard character matching any database under a directory or its subdirectories.static java.lang.StringURL_PATH_RECURSIVE_STRINGstatic java.lang.StringURL_PATH_RECURSIVE_SUFFIXstatic charURL_PATH_RELATIVE_CHARThe relative path character.static java.lang.StringURL_PATH_RELATIVE_PREFIXstatic java.lang.StringURL_PATH_RELATIVE_STRINGstatic charURL_PATH_SEPARATOR_CHARThe URL file path separator character.static java.lang.StringURL_PATH_SEPARATOR_STRINGstatic charURL_PATH_WILDCARD_CHARThe wildcard character matching any database in a directory.static java.lang.StringURL_PATH_WILDCARD_STRINGstatic java.lang.StringURL_PATH_WILDCARD_SUFFIXstatic java.lang.StringURL_PROTOCOL_DIRECTORYThe URL protocol scheme specifying a directory location.
-
Constructor Summary
Constructors Constructor and Description DatabasePermission(java.lang.String url, java.lang.String actions)Creates a new DatabasePermission with the specified URL and actions.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description booleanequals(java.lang.Object obj)Checks two DatabasePermission objects for equality.java.lang.StringgetActions()Returns the "canonical string representation" of the actions.inthashCode()Returns the hash code value for this object.booleanimplies(java.security.Permission p)Checks if this DatabasePermission implies a specified permission.
-
-
-
Field Detail
-
URL_PROTOCOL_DIRECTORY
public static final java.lang.String URL_PROTOCOL_DIRECTORY
The URL protocol scheme specifying a directory location.- See Also:
- Constant Field Values
-
URL_PATH_INCLUSIVE_STRING
public static final java.lang.String URL_PATH_INCLUSIVE_STRING
The location text matching any database anywhere.- See Also:
- Constant Field Values
-
URL_PATH_INCLUSIVE_CHAR
public static final char URL_PATH_INCLUSIVE_CHAR
The path type character matching any database anywhere.- See Also:
- Constant Field Values
-
URL_PATH_SEPARATOR_CHAR
public static final char URL_PATH_SEPARATOR_CHAR
The URL file path separator character.- See Also:
- Constant Field Values
-
URL_PATH_RELATIVE_CHAR
public static final char URL_PATH_RELATIVE_CHAR
The relative path character.- See Also:
- Constant Field Values
-
URL_PATH_WILDCARD_CHAR
public static final char URL_PATH_WILDCARD_CHAR
The wildcard character matching any database in a directory.- See Also:
- Constant Field Values
-
URL_PATH_RECURSIVE_CHAR
public static final char URL_PATH_RECURSIVE_CHAR
The wildcard character matching any database under a directory or its subdirectories.- See Also:
- Constant Field Values
-
URL_PATH_SEPARATOR_STRING
public static final java.lang.String URL_PATH_SEPARATOR_STRING
-
URL_PATH_RELATIVE_STRING
public static final java.lang.String URL_PATH_RELATIVE_STRING
-
URL_PATH_RELATIVE_PREFIX
public static final java.lang.String URL_PATH_RELATIVE_PREFIX
-
URL_PATH_WILDCARD_STRING
public static final java.lang.String URL_PATH_WILDCARD_STRING
-
URL_PATH_WILDCARD_SUFFIX
public static final java.lang.String URL_PATH_WILDCARD_SUFFIX
-
URL_PATH_RECURSIVE_STRING
public static final java.lang.String URL_PATH_RECURSIVE_STRING
-
URL_PATH_RECURSIVE_SUFFIX
public static final java.lang.String URL_PATH_RECURSIVE_SUFFIX
-
CREATE
public static final java.lang.String CREATE
The create database permission.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DatabasePermission
public DatabasePermission(java.lang.String url, java.lang.String actions) throws java.io.IOExceptionCreates a new DatabasePermission with the specified URL and actions.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:location" - refers to a database called location,
- "directory:location/*" - matches any database in the directory location,
- "directory:location/-" - matches any database under location or its subdirectories.
- "directory:*" - matches any database in the user's current working directory.
- "directory:-" - matches any database under the user's current working directory or its subdirectories.
-
"directory:<<ALL FILES>>"matches any database anywhere.
- Parameters:
url- the database URLactions- the action string- Throws:
java.lang.NullPointerException- if an argument is nulljava.lang.IllegalArgumentException- if an argument is not legaljava.io.IOException- if the location URL cannot be canonicalized- See Also:
Permission.Permission(String),FilePermission.FilePermission(String,String)
-
-
Method Detail
-
implies
public boolean implies(java.security.Permission p)
Checks if this DatabasePermission implies a specified permission.This method returns true if:
- p is an instanceof DatabasePermission and
- p's directory pathname is implied by this object's pathname. For example, "/tmp/*" implies "/tmp/foo", since "/tmp/*" encompasses the "/tmp" directory and all files in that directory, including the one named "foo".
- Specified by:
impliesin classjava.security.Permission- Parameters:
p- the permission to check against- Returns:
- true if the specified permission is implied by this object, false if not
- See Also:
Permission.implies(Permission)
- p is an instanceof DatabasePermission and
-
equals
public boolean equals(java.lang.Object obj)
Checks two DatabasePermission objects for equality.Checks that obj is a DatabasePermission and has the same canonizalized URL and actions as this object.
- Specified by:
equalsin classjava.security.Permission- Parameters:
obj- the object we are testing for equality with this object- Returns:
- true if obj is a DatabasePermission, and has the same URL and actions as this DatabasePermission object, false if not
- See Also:
Permission.equals(Object)
-
hashCode
public int hashCode()
Returns the hash code value for this object.- Specified by:
hashCodein classjava.security.Permission- Returns:
- a hash code value for this object
- See Also:
Permission.hashCode()
-
getActions
public java.lang.String getActions()
Returns the "canonical string representation" of the actions.- Specified by:
getActionsin classjava.security.Permission- Returns:
- the canonical string representation of the actions
- See Also:
Permission.getActions()
-
-
DataMelt 3.0 © DataMelt by jWork.ORG