org.apache.derby.iapi.sql.dictionary
Class StatementTablePermission

java.lang.Object
  extended by org.apache.derby.iapi.sql.dictionary.StatementPermission
      extended by org.apache.derby.iapi.sql.dictionary.StatementTablePermission
Direct Known Subclasses:
StatementColumnPermission

public class StatementTablePermission
extends StatementPermission

This class describes a table permission required by a statement.


Field Summary
(package private)  int privType
           
(package private)  UUID tableUUID
           
 
Constructor Summary
StatementTablePermission(UUID tableUUID, int privType)
          Constructor for StatementTablePermission.
 
Method Summary
 void check(LanguageConnectionContext lcc, java.lang.String authorizationId, boolean forGrant, Activation activation)
           
 boolean equals(java.lang.Object obj)
          Routine to check if another instance of access descriptor matches this.
 PermissionsDescriptor getPermissionDescriptor(java.lang.String authid, DataDictionary dd)
          Get the PermissionsDescriptor for the passed authorization id for this object.
 java.lang.String getPrivName()
          Return privilege needed for this access as string
 int getPrivType()
          Return privilege access requested for this access descriptor
protected  TableDescriptor getTableDescriptor(DataDictionary dd)
           
 UUID getTableUUID()
          Return table UUID for this access descriptor
 int hashCode()
          Return hash code for this instance
protected  boolean hasPermissionOnTable(LanguageConnectionContext lcc, Activation activation, java.lang.String authorizationId, boolean forGrant, ExecPreparedStatement ps)
          Check if current session has permission on the table (current user, PUBLIC or role) and, if applicable, register a dependency of ps on the current role.
protected  boolean oneAuthHasPermissionOnTable(DataDictionary dd, java.lang.String authorizationId, boolean forGrant)
           
 java.lang.String toString()
           
 
Methods inherited from class org.apache.derby.iapi.sql.dictionary.StatementPermission
genericCheck, getObjectType, getPrivilegedObject, isCorrectPermission
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

tableUUID

UUID tableUUID

privType

int privType
Constructor Detail

StatementTablePermission

public StatementTablePermission(UUID tableUUID,
                                int privType)
Constructor for StatementTablePermission. Creates an instance of table permission requested for the given access.

Parameters:
tableUUID - UUID of the table
privType - Access privilege requested
Method Detail

getPrivType

public int getPrivType()
Return privilege access requested for this access descriptor

Returns:
Privilege access

getTableUUID

public UUID getTableUUID()
Return table UUID for this access descriptor

Returns:
Table UUID

equals

public boolean equals(java.lang.Object obj)
Routine to check if another instance of access descriptor matches this. Used to ensure only one access descriptor for a table of given privilege is created. Otherwise, every column reference from a table may create a descriptor for that table.

Overrides:
equals in class java.lang.Object
Parameters:
obj - Another instance of StatementPermission
Returns:
true if match

hashCode

public int hashCode()
Return hash code for this instance

Overrides:
hashCode in class java.lang.Object
Returns:
Hashcode

check

public void check(LanguageConnectionContext lcc,
                  java.lang.String authorizationId,
                  boolean forGrant,
                  Activation activation)
           throws StandardException
Specified by:
check in class StatementPermission
Parameters:
lcc - LanguageConnectionContext
authorizationId - AuthorizationId
activation - activation for statement needing check
Throws:
StandardException - if the permission has not been granted
See Also:
StatementPermission.check(org.apache.derby.iapi.sql.conn.LanguageConnectionContext, java.lang.String, boolean, org.apache.derby.iapi.sql.Activation)

getTableDescriptor

protected TableDescriptor getTableDescriptor(DataDictionary dd)
                                      throws StandardException
Throws:
StandardException

hasPermissionOnTable

protected boolean hasPermissionOnTable(LanguageConnectionContext lcc,
                                       Activation activation,
                                       java.lang.String authorizationId,
                                       boolean forGrant,
                                       ExecPreparedStatement ps)
                                throws StandardException
Check if current session has permission on the table (current user, PUBLIC or role) and, if applicable, register a dependency of ps on the current role.

Parameters:
lcc - the current language connection context
activation - the activation of ps
authorizationId - the id of the current user
forGrant - true if FOR GRANT is required
ps - the prepared statement for which we are checking necessary privileges
Throws:
StandardException

oneAuthHasPermissionOnTable

protected boolean oneAuthHasPermissionOnTable(DataDictionary dd,
                                              java.lang.String authorizationId,
                                              boolean forGrant)
                                       throws StandardException
Throws:
StandardException

getPermissionDescriptor

public PermissionsDescriptor getPermissionDescriptor(java.lang.String authid,
                                                     DataDictionary dd)
                                              throws StandardException
Description copied from class: StatementPermission
Get the PermissionsDescriptor for the passed authorization id for this object. This method gets called during the execution phase of create view/constraint/trigger. The return value of this method is saved in dependency system to keep track of views/constraints/triggers dependencies on required permissions. This happens in execution phase after it has been established that passed authorization id has all the permissions it needs to create that view/constraint/trigger. Which means that we can only get to writing into dependency system once all the required privileges are confirmed.

Specified by:
getPermissionDescriptor in class StatementPermission
Parameters:
authid - AuthorizationId
dd - DataDictionary
Returns:
PermissionsDescriptor The PermissionsDescriptor for the passed authorization id on this object
Throws:
StandardException
See Also:
StatementPermission.getPermissionDescriptor(java.lang.String, org.apache.derby.iapi.sql.dictionary.DataDictionary)

getPrivName

public java.lang.String getPrivName()
Return privilege needed for this access as string

Returns:
privilege string

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Built on Thu 2012-03-29 21:53:33+0000, from revision ???

Apache Derby V10.6 Internals - Copyright © 2004,2007 The Apache Software Foundation. All Rights Reserved.