db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r423949 - in /db/derby/code/trunk/java/engine/org/apache/derby: iapi/sql/dictionary/ impl/sql/catalog/ impl/sql/execute/
Date Thu, 20 Jul 2006 14:59:32 GMT
Author: djd
Date: Thu Jul 20 07:59:31 2006
New Revision: 423949

URL: http://svn.apache.org/viewvc?rev=423949&view=rev
Log:
DERBY-1330 (partial) Currently, in case of revoke privilege, DataDictionary.addRemovePermissionsDescriptor
expects
it's callers to set the permission descriptor's uuid so that DependencyManager can be invoked
by
addRemovePermissionsDescriptor to send REVOKE_PRIVILEGE action to permission descriptor's
dependents
(sending of REVOKE_PRIVILEGE work has not been finished yet.
This patch is in preparation of that work). In order to set the uuid, the callers have to
goto system
tables to find the uuid and then set the permission descriptor's uuid.

It will be less error prone if DataDictionary.addRemovePermissionsDescriptor did the setting
of uuid of
permission descriptor, rather than having every caller set the uuid correctly.
DataDictionary.addRemovePermissionsDescriptor method has to goto the permission system tables
anyways
and has the uuid information handy and hence it will be more efficient for it to set the uuid
of the
permission descriptor. This is inline with the patch that was commited some time back so that
resetting
of the uuid happened in addRemovePermissionsDescriptor method rather than expecting the callers
to do that.

In order to do this, I have added an abstract method to PermissionsCatalogRowFactory called
setUUIDOfThePassedDescriptor.
 This method will set the uuid of the passed permission descriptor to same value as the row
corresponding to the
permission system table which is also passed as a parameter. This method will be called by
DataDictionary.addRemovePermissionsDescriptor. 

Patch submitted by Mamta Satoor.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/PermissionsCatalogRowFactory.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSCOLPERMSRowFactory.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSROUTINEPERMSRowFactory.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSTABLEPERMSRowFactory.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TablePrivilegeInfo.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/PermissionsCatalogRowFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/PermissionsCatalogRowFactory.java?rev=423949&r1=423948&r2=423949&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/PermissionsCatalogRowFactory.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/PermissionsCatalogRowFactory.java
Thu Jul 20 07:59:31 2006
@@ -114,4 +114,16 @@
      */
     abstract public int removePermissions( ExecRow row, PermissionsDescriptor perm, boolean[]
colsChanged)
         throws StandardException;
+
+    /**
+     * Set the uuid of the passed permission descriptor to the uuid of the row
+     * from the system table. DataDictionary will make this call before calling 
+     * the dependency manager to send invalidation messages to the objects 
+     * dependent on the permission descriptor's uuid.
+     * 
+     * @param row The row from the system table for the passed permission descriptor
+     * @param perm Permission descriptor
+     * @throws StandardException
+     */
+    abstract public void setUUIDOfThePassedDescriptor(ExecRow row, PermissionsDescriptor
perm) throws StandardException;
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java?rev=423949&r1=423948&r2=423949&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DataDictionaryImpl.java
Thu Jul 20 07:59:31 2006
@@ -9989,6 +9989,15 @@
         }
         else
         {
+        	if (!add)
+        	{
+        		//set the uuid of the passed permission descriptor to 
+        		//corresponding rows's uuid in permissions system table. The
+        		//permission descriptor's uuid is required to have the 
+        		//dependency manager send the revoke privilege action to
+        		//all the dependent objects on that permission descriptor.
+        		rf.setUUIDOfThePassedDescriptor(existingRow, perm);
+        	}
             // add/remove these permissions to/from the existing permissions
             boolean[] colsChanged = new boolean[ existingRow.nColumns()];
             boolean[] indicesToUpdate = new boolean[ rf.getNumIndexes()];

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSCOLPERMSRowFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSCOLPERMSRowFactory.java?rev=423949&r1=423948&r2=423949&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSCOLPERMSRowFactory.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSCOLPERMSRowFactory.java
Thu Jul 20 07:59:31 2006
@@ -380,4 +380,14 @@
         }
         return 0; // no change
     } // end of removePermissions
+    
+	/** 
+	 * @see PermissionsCatalogRowFactory#setUUIDOfThePassedDescriptor
+	 */
+    public void setUUIDOfThePassedDescriptor(ExecRow row, PermissionsDescriptor perm)
+    throws StandardException
+    {
+        DataValueDescriptor existingPermDVD = row.getColumn(COLPERMSID_COL_NUM);
+        perm.setUUID(getUUIDFactory().recreateUUID(existingPermDVD.getString()));
+    }
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSROUTINEPERMSRowFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSROUTINEPERMSRowFactory.java?rev=423949&r1=423948&r2=423949&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSROUTINEPERMSRowFactory.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSROUTINEPERMSRowFactory.java
Thu Jul 20 07:59:31 2006
@@ -309,4 +309,14 @@
     {
         return -1; // There is only one kind of routine privilege so delete the whole row.
     } // end of removePermissions
+    
+	/** 
+	 * @see PermissionsCatalogRowFactory#setUUIDOfThePassedDescriptor
+	 */
+    public void setUUIDOfThePassedDescriptor(ExecRow row, PermissionsDescriptor perm)
+    throws StandardException
+    {
+        DataValueDescriptor existingPermDVD = row.getColumn(ROUTINEPERMSID_COL_NUM);
+        perm.setUUID(getUUIDFactory().recreateUUID(existingPermDVD.getString()));
+    }
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSTABLEPERMSRowFactory.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSTABLEPERMSRowFactory.java?rev=423949&r1=423948&r2=423949&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSTABLEPERMSRowFactory.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/SYSTABLEPERMSRowFactory.java
Thu Jul 20 07:59:31 2006
@@ -457,4 +457,14 @@
         }
         return false;
     } // end of removeOnePermission
+    
+	/** 
+	 * @see PermissionsCatalogRowFactory#setUUIDOfThePassedDescriptor
+	 */
+    public void setUUIDOfThePassedDescriptor(ExecRow row, PermissionsDescriptor perm)
+    throws StandardException
+    {
+        DataValueDescriptor existingPermDVD = row.getColumn(TABLEPERMSID_COL_NUM);
+        perm.setUUID(getUUIDFactory().recreateUUID(existingPermDVD.getString()));
+    }
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TablePrivilegeInfo.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TablePrivilegeInfo.java?rev=423949&r1=423948&r2=423949&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TablePrivilegeInfo.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/execute/TablePrivilegeInfo.java
Thu Jul 20 07:59:31 2006
@@ -128,27 +128,11 @@
 		{
 			String grantee = (String) itr.next();
 			if( tablePermsDesc != null)
-			{
-				if (!grant)
-				{
-					TablePermsDescriptor tempTablePermsDesc = 
-						dd.getTablePermissions(td.getUUID(), grantee);
-					tablePermsDesc.setUUID(tempTablePermsDesc.getUUID());
-				} 
 				dd.addRemovePermissionsDescriptor( grant, tablePermsDesc, grantee, tc);
-			}
 			for( int i = 0; i < columnBitSets.length; i++)
 			{
 				if( colPermsDescs[i] != null)
-				{
-					if (!grant)
-					{
-						ColPermsDescriptor tempColPermsDescriptor = 
-							dd.getColumnPermissions(td.getUUID(), colPermsDescs[i].getType() ,grant, grantee);
-						colPermsDescs[i].setUUID(tempColPermsDescriptor.getUUID());
-					} 
 					dd.addRemovePermissionsDescriptor( grant, colPermsDescs[i], grantee, tc);					
-				}
 			}
 		}
 	} // end of executeConstantAction



Mime
View raw message