Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / derby-10.3.2.1 / java / engine / org / apache / derby / impl / sql / compile / RevokeNode.java
diff --git a/JMCR-Stable/real-world application/derby-10.3.2.1/java/engine/org/apache/derby/impl/sql/compile/RevokeNode.java b/JMCR-Stable/real-world application/derby-10.3.2.1/java/engine/org/apache/derby/impl/sql/compile/RevokeNode.java
new file mode 100644 (file)
index 0000000..5cee63e
--- /dev/null
@@ -0,0 +1,110 @@
+/*\r
+\r
+   Derby - Class org.apache.derby.impl.sql.compile.RevokeNode\r
+\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to you under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+      http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+\r
+ */\r
+\r
+package        org.apache.derby.impl.sql.compile;\r
+\r
+import org.apache.derby.iapi.sql.execute.ConstantAction;\r
+import org.apache.derby.impl.sql.execute.PrivilegeInfo;\r
+import org.apache.derby.iapi.services.sanity.SanityManager;\r
+import org.apache.derby.iapi.error.StandardException;\r
+\r
+import java.util.HashMap;\r
+import java.util.Iterator;\r
+import java.util.List;\r
+\r
+/**\r
+ * This class represents a REVOKE statement.\r
+ */\r
+public class RevokeNode extends DDLStatementNode\r
+{\r
+    private PrivilegeNode privileges;\r
+    private List grantees;\r
+\r
+       /**\r
+        * Convert this object to a String.  See comments in QueryTreeNode.java\r
+        * for how this should be done for tree printing.\r
+        *\r
+        * @return      This object as a String\r
+        */\r
+\r
+       public String toString()\r
+       {\r
+               if (SanityManager.DEBUG)\r
+               {\r
+            StringBuffer sb = new StringBuffer();\r
+            for( Iterator it = grantees.iterator(); it.hasNext();)\r
+            {\r
+                if( sb.length() > 0)\r
+                    sb.append( ",");\r
+                sb.append( it.next().toString());\r
+            }\r
+                       return super.toString() +\r
+                   privileges.toString() +\r
+                   "TO: \n" + sb.toString() + "\n";\r
+               }\r
+               else\r
+               {\r
+                       return "";\r
+               }\r
+    } // end of toString\r
+\r
+       public String statementToString()\r
+       {\r
+        return "REVOKE";\r
+    }\r
+\r
+    \r
+    /**\r
+     * Initialize a RevokeNode.\r
+     *\r
+     * @param privileges PrivilegesNode\r
+     * @param grantees List\r
+     */\r
+    public void init( Object privileges,\r
+                      Object grantees)\r
+    {\r
+        this.privileges = (PrivilegeNode) privileges;\r
+        this.grantees = (List) grantees;\r
+    }\r
+\r
+    /**\r
+     * Bind this RevokeNode. Resolve all table, column, and routine references.\r
+     *\r
+     *\r
+     * @exception StandardException    Standard error policy.\r
+     */\r
+       public void bindStatement() throws StandardException\r
+       {\r
+        privileges = (PrivilegeNode) privileges.bind( new HashMap(), grantees, false);\r
+    } // end of bind\r
+\r
+\r
+       /**\r
+        * Create the Constant information that will drive the guts of Execution.\r
+        *\r
+        * @exception StandardException Standard error policy.\r
+        */\r
+       public ConstantAction makeConstantAction() throws StandardException\r
+       {\r
+        return getGenericConstantActionFactory().getRevokeConstantAction( privileges.makePrivilegeInfo(),\r
+                                                                          grantees);\r
+    }\r
+}\r