Package com.mckoi.database
Class Privileges
- java.lang.Object
-
- com.mckoi.database.Privileges
-
public class Privileges extends java.lang.ObjectA set of privileges to grant a user for an object.- Author:
- Tobias Downer
-
-
Field Summary
Fields Modifier and Type Field Description static intALLThe priv to allow full access to the database object.static intALTERThe priv to alter objects (only applicable for SCHEMA grant objects).static intCOMPACTThe priv to compact a database object.static intCREATEThe priv to create objects (only applicable for SCHEMA grant objects).static intDELETEThe priv to DELETE from a database object.static intDROPThe priv to drop objects (only applicable for SCHEMA grant objects).static PrivilegesEMPTY_PRIVSNo privileges.static intINSERTThe priv to INSERT to a database object.static intLISTThe priv to view objects in a schema (only applicable for SCHEMA grant objects).static PrivilegesPROCEDURE_ALL_PRIVSAll access (execute/update/delete/etc) privs for a procedure object.static PrivilegesPROCEDURE_EXECUTE_PRIVSExecute access privs for a procedure object.static intREFERENCESThe priv to REFERENCE a database object.static PrivilegesSCHEMA_ALL_PRIVSAll access privs for a schema object.static PrivilegesSCHEMA_READ_PRIVSRead access privs for a schema object.static intSELECTThe priv to SELECT from a database object.static PrivilegesTABLE_ALL_PRIVSEnable all privs for the object.static PrivilegesTABLE_READ_PRIVSRead privs for the object.static intUPDATEThe priv to UPDATE a database object.static intUSAGEThe priv to see statistics on a database object.
-
Constructor Summary
Constructors Constructor Description Privileges()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Privilegesadd(int priv)Adds a privilege and returns a new Privileges object with the new priv set.booleanequals(java.lang.Object ob)booleanisEmpty()Returns true if this Privileges object contains no priv entries.Privilegesmerge(Privileges in_privs)Merges privs from the given privilege object with this set of privs.static intparseString(java.lang.String priv)Given a string, returns the priv bit for it.booleanpermits(int priv)Returns true if this privileges permits the given priv.Privilegesremove(int priv)Removes a privilege with a column list parameter.Privilegesremove(Privileges privs)Removes the given privileges from this privileges object and returns the new privileges object.java.lang.StringtoEncodedString()Converts this privilege to an encoded string.inttoInt()Returns this Privileges object as an encoded int bit array.java.lang.StringtoString()
-
-
-
Field Detail
-
ALL
public static final int ALL
The priv to allow full access to the database object. If this is used, it should be the only privilege added.- See Also:
- Constant Field Values
-
SELECT
public static final int SELECT
The priv to SELECT from a database object.- See Also:
- Constant Field Values
-
DELETE
public static final int DELETE
The priv to DELETE from a database object.- See Also:
- Constant Field Values
-
UPDATE
public static final int UPDATE
The priv to UPDATE a database object.- See Also:
- Constant Field Values
-
INSERT
public static final int INSERT
The priv to INSERT to a database object.- See Also:
- Constant Field Values
-
REFERENCES
public static final int REFERENCES
The priv to REFERENCE a database object.- See Also:
- Constant Field Values
-
USAGE
public static final int USAGE
The priv to see statistics on a database object.- See Also:
- Constant Field Values
-
COMPACT
public static final int COMPACT
The priv to compact a database object.- See Also:
- Constant Field Values
-
CREATE
public static final int CREATE
The priv to create objects (only applicable for SCHEMA grant objects).- See Also:
- Constant Field Values
-
ALTER
public static final int ALTER
The priv to alter objects (only applicable for SCHEMA grant objects).- See Also:
- Constant Field Values
-
DROP
public static final int DROP
The priv to drop objects (only applicable for SCHEMA grant objects).- See Also:
- Constant Field Values
-
LIST
public static final int LIST
The priv to view objects in a schema (only applicable for SCHEMA grant objects).- See Also:
- Constant Field Values
-
EMPTY_PRIVS
public static final Privileges EMPTY_PRIVS
No privileges.
-
TABLE_ALL_PRIVS
public static final Privileges TABLE_ALL_PRIVS
Enable all privs for the object.
-
TABLE_READ_PRIVS
public static final Privileges TABLE_READ_PRIVS
Read privs for the object.
-
SCHEMA_ALL_PRIVS
public static final Privileges SCHEMA_ALL_PRIVS
All access privs for a schema object.
-
SCHEMA_READ_PRIVS
public static final Privileges SCHEMA_READ_PRIVS
Read access privs for a schema object.
-
PROCEDURE_ALL_PRIVS
public static final Privileges PROCEDURE_ALL_PRIVS
All access (execute/update/delete/etc) privs for a procedure object.
-
PROCEDURE_EXECUTE_PRIVS
public static final Privileges PROCEDURE_EXECUTE_PRIVS
Execute access privs for a procedure object.
-
-
Method Detail
-
add
public Privileges add(int priv)
Adds a privilege and returns a new Privileges object with the new priv set.
-
remove
public Privileges remove(int priv)
Removes a privilege with a column list parameter.
-
remove
public Privileges remove(Privileges privs)
Removes the given privileges from this privileges object and returns the new privileges object.
-
permits
public boolean permits(int priv)
Returns true if this privileges permits the given priv.
-
merge
public Privileges merge(Privileges in_privs)
Merges privs from the given privilege object with this set of privs. This performs an OR on all the attributes in the set. If the entry does not exist in this set then it is added.
-
isEmpty
public boolean isEmpty()
Returns true if this Privileges object contains no priv entries.
-
parseString
public static int parseString(java.lang.String priv)
Given a string, returns the priv bit for it.
-
toInt
public int toInt()
Returns this Privileges object as an encoded int bit array.
-
toEncodedString
public java.lang.String toEncodedString()
Converts this privilege to an encoded string.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object ob)
- Overrides:
equalsin classjava.lang.Object
-
-