db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r659805 - in /db/derby/code/trunk/java/engine/org/apache/derby: catalog/ iapi/services/io/ iapi/sql/depend/ iapi/sql/dictionary/ impl/sql/catalog/ impl/sql/depend/
Date Sat, 24 May 2008 12:32:43 GMT
Author: dag
Date: Sat May 24 05:32:42 2008
New Revision: 659805

URL: http://svn.apache.org/viewvc?rev=659805&view=rev
Log:
DERBY-3666 Make role descriptor a dependency Provider

Patch derby-3666-2, which implements functionality.

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/catalog/Dependable.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/RegisteredFormatIds.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/depend/DependencyManager.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/RoleDescriptor.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/CoreDDFinderClassInfo.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DDdependableFinder.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/depend/BasicDependencyManager.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/catalog/Dependable.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/catalog/Dependable.java?rev=659805&r1=659804&r2=659805&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/catalog/Dependable.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/catalog/Dependable.java Sat May 24 05:32:42
2008
@@ -61,6 +61,7 @@
 	public static final String TABLE_PERMISSION             = "TablePrivilege";
 	public static final String COLUMNS_PERMISSION           = "ColumnsPrivilege";
 	public static final String ROUTINE_PERMISSION           = "RoutinePrivilege";
+	public static final String ROLE_GRANT                   = "RoleGrant";
 
 
 	/**

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/RegisteredFormatIds.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/RegisteredFormatIds.java?rev=659805&r1=659804&r2=659805&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/RegisteredFormatIds.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/RegisteredFormatIds.java
Sat May 24 05:32:42 2008
@@ -532,5 +532,6 @@
         /* 468 */   "org.apache.derby.iapi.types.DTSClassInfo",
         /* 469 */   "org.apache.derby.catalog.types.RowMultiSetImpl",
         /* 470 */   "org.apache.derby.impl.store.access.btree.index.B2I",
+        /* 471 */   "org.apache.derby.impl.sql.catalog.CoreDDFinderClassInfo",
 };
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java?rev=659805&r1=659804&r2=659805&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/services/io/StoredFormatIds.java
Sat May 24 05:32:42 2008
@@ -336,6 +336,12 @@
      */
     static public final int COLUMNS_PERMISSION_FINDER_V01_ID =
             (MIN_ID_2 + 463);
+
+    /**
+    class org.apache.derby.impl.sql.catalog.CoreDDFinderClassInfo
+     */
+    static public final int ROLE_GRANT_FINDER_V01_ID =
+            (MIN_ID_2 + 471);
     
     /**
     class org.apache.derby.impl.sql.catalog.DataDictionaryDescriptorFinder
@@ -1895,7 +1901,7 @@
      * Make sure this is updated when a new module is added
      */
     public static final int MAX_ID_2 =
-            (MIN_ID_2 + 470);
+            (MIN_ID_2 + 471);
 
     // DO NOT USE 4 BYTE IDS ANYMORE
     static public final int MAX_ID_4 =

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/depend/DependencyManager.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/depend/DependencyManager.java?rev=659805&r1=659804&r2=659805&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/depend/DependencyManager.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/depend/DependencyManager.java
Sat May 24 05:32:42 2008
@@ -326,6 +326,10 @@
 	public static final int REVOKE_PRIVILEGE_RESTRICT = 45;
 	public static final int DROP_COLUMN_RESTRICT = 46;
 
+	// Revoke action when a granted role is revoked. A revoke
+	// statement causes the dependents to drop.
+	public static final int REVOKE_ROLE = 47;
+
     /**
      * Extensions to this interface may use action codes > MAX_ACTION_CODE without fear
of
      * clashing with action codes in this base interface.

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/RoleDescriptor.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/RoleDescriptor.java?rev=659805&r1=659804&r2=659805&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/RoleDescriptor.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/RoleDescriptor.java
Sat May 24 05:32:42 2008
@@ -36,6 +36,7 @@
  * This class is used by rows in the SYS.SYSROLES system table.
  */
 public class RoleDescriptor extends TupleDescriptor
+                                    implements Provider
 {
     private final UUID uuid;
     private final String roleName;
@@ -138,4 +139,64 @@
 
         dd.dropRoleDescriptor(roleName, grantee, grantor, tc);
     }
+
+    //////////////////////////////////////////////
+    //
+    // PROVIDER INTERFACE
+    //
+    //////////////////////////////////////////////
+
+    /**
+     * Get the provider's UUID
+     *
+     * @return The provider's UUID
+     */
+    public UUID getObjectID()
+    {
+        return uuid;
+    }
+
+    /**
+     * Is this provider persistent?  A stored dependency will be required
+     * if both the dependent and provider are persistent.
+     *
+     * @return boolean              Whether or not this provider is persistent.
+     */
+    public boolean isPersistent()
+    {
+        return true;
+    }
+
+    /**
+     * Return the name of this Provider.  (Useful for errors.)
+     *
+     * @return String   The name of this provider.
+     */
+    public String getObjectName()
+    {
+        return ((isDef ? "CREATE ROLE: " : "GRANT ROLE: ") + roleName +
+                " GRANT TO: " + grantee +
+                " GRANTED BY: " + grantor +
+                (withAdminOption? " WITH ADMIN OPTION" : ""));
+    }
+
+    /**
+     * Get the provider's type.
+     *
+     * @return char         The provider's type.
+     */
+    public String getClassType()
+    {
+        return Dependable.ROLE_GRANT;
+    }
+
+    /**
+     *  @return the stored form of this provider
+     *
+     *  @see Dependable#getDependableFinder
+     */
+    public DependableFinder getDependableFinder()
+    {
+        return new DDdependableFinder(StoredFormatIds.ROLE_GRANT_FINDER_V01_ID);
+    }
 }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/CoreDDFinderClassInfo.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/CoreDDFinderClassInfo.java?rev=659805&r1=659804&r2=659805&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/CoreDDFinderClassInfo.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/CoreDDFinderClassInfo.java
Sat May 24 05:32:42 2008
@@ -52,6 +52,7 @@
 			case StoredFormatIds.TABLE_PERMISSION_FINDER_V01_ID:
 			case StoredFormatIds.ROUTINE_PERMISSION_FINDER_V01_ID:
 			case StoredFormatIds.COLUMNS_PERMISSION_FINDER_V01_ID:
+		    case StoredFormatIds.ROLE_GRANT_FINDER_V01_ID:
 				return new DDdependableFinder(fmtId);
 			case StoredFormatIds.COLUMN_DESCRIPTOR_FINDER_V01_ID:
 				return new DDColumnDependableFinder(fmtId);

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DDdependableFinder.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DDdependableFinder.java?rev=659805&r1=659804&r2=659805&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DDdependableFinder.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/catalog/DDdependableFinder.java
Sat May 24 05:32:42 2008
@@ -175,6 +175,9 @@
 			case StoredFormatIds.ROUTINE_PERMISSION_FINDER_V01_ID:
 				return Dependable.ROUTINE_PERMISSION;
 
+			case StoredFormatIds.ROLE_GRANT_FINDER_V01_ID:
+				return Dependable.ROLE_GRANT;
+
 			default:
 				if (SanityManager.DEBUG)
 				{
@@ -255,6 +258,9 @@
 			case StoredFormatIds.ROUTINE_PERMISSION_FINDER_V01_ID:
                 return dd.getRoutinePermissions(dependableObjectID);
 
+		    case StoredFormatIds.ROLE_GRANT_FINDER_V01_ID:
+				return dd.getRoleDescriptor(dependableObjectID);
+
 			default:
 				if (SanityManager.DEBUG)
 				{

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/depend/BasicDependencyManager.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/depend/BasicDependencyManager.java?rev=659805&r1=659804&r2=659805&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/depend/BasicDependencyManager.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/depend/BasicDependencyManager.java
Sat May 24 05:32:42 2008
@@ -877,7 +877,10 @@
 
 		    case REVOKE_PRIVILEGE_RESTRICT:
 			    return "REVOKE PRIVILEGE RESTRICT";
-			    			   
+
+		    case REVOKE_ROLE:
+				return "REVOKE ROLE";
+
 			default:
 				if (SanityManager.DEBUG)
 				{



Mime
View raw message