1 21 22 package org.apache.derby.impl.sql.compile; 23 24 import org.apache.derby.iapi.sql.execute.ConstantAction; 25 import org.apache.derby.impl.sql.execute.PrivilegeInfo; 26 import org.apache.derby.iapi.services.sanity.SanityManager; 27 import org.apache.derby.iapi.error.StandardException; 28 29 import java.util.HashMap ; 30 import java.util.Iterator ; 31 import java.util.List ; 32 33 36 public class GrantNode extends DDLStatementNode 37 { 38 private PrivilegeNode privileges; 39 private List grantees; 40 41 47 48 public String toString() 49 { 50 if (SanityManager.DEBUG) 51 { 52 StringBuffer sb = new StringBuffer (); 53 for( Iterator it = grantees.iterator(); it.hasNext();) 54 { 55 if( sb.length() > 0) 56 sb.append( ","); 57 sb.append( it.next().toString()); 58 } 59 return super.toString() + 60 privileges.toString() + 61 "TO: \n" + sb.toString() + "\n"; 62 } 63 else 64 { 65 return ""; 66 } 67 } 69 public String statementToString() 70 { 71 return "GRANT"; 72 } 73 74 75 81 public void init( Object privileges, 82 Object grantees) 83 { 84 this.privileges = (PrivilegeNode) privileges; 85 this.grantees = (List ) grantees; 86 } 87 88 95 public QueryTreeNode bind() throws StandardException 96 { 97 privileges = (PrivilegeNode) privileges.bind( new HashMap (), grantees, true); 98 return this; 99 } 101 102 107 public ConstantAction makeConstantAction() throws StandardException 108 { 109 return getGenericConstantActionFactory().getGrantConstantAction( privileges.makePrivilegeInfo(), 110 grantees); 111 } 112 } 113 | Popular Tags |