1 21 22 package org.apache.derby.iapi.sql.dictionary; 23 24 import org.apache.derby.iapi.sql.depend.Provider; 25 import org.apache.derby.catalog.DependableFinder; 26 import org.apache.derby.iapi.services.io.StoredFormatIds; 27 import org.apache.derby.iapi.reference.Property; 28 import org.apache.derby.catalog.UUID; 29 import org.apache.derby.catalog.Dependable; 30 31 37 38 public final class SchemaDescriptor extends TupleDescriptor 39 implements UniqueTupleDescriptor, Provider 40 { 41 42 59 67 public static final String STD_SYSTEM_SCHEMA_NAME = "SYS"; 68 69 public static final String IBM_SYSTEM_SCHEMA_NAME = "SYSIBM"; 70 71 78 public static final String IBM_SYSTEM_CAT_SCHEMA_NAME = "SYSCAT"; 79 public static final String IBM_SYSTEM_FUN_SCHEMA_NAME = "SYSFUN"; 80 public static final String IBM_SYSTEM_PROC_SCHEMA_NAME = "SYSPROC"; 81 public static final String IBM_SYSTEM_STAT_SCHEMA_NAME = "SYSSTAT"; 82 public static final String IBM_SYSTEM_NULLID_SCHEMA_NAME = "NULLID"; 83 84 87 public static final String STD_SQLJ_SCHEMA_NAME = "SQLJ"; 88 89 93 public static final String STD_SYSTEM_DIAG_SCHEMA_NAME = "SYSCS_DIAG"; 94 95 99 public static final String STD_SYSTEM_UTIL_SCHEMA_NAME = "SYSCS_UTIL"; 100 101 109 public static final String STD_DEFAULT_SCHEMA_NAME = Property.DEFAULT_USER_NAME; 110 111 112 115 public static final String SYSCAT_SCHEMA_UUID = 116 "c013800d-00fb-2641-07ec-000000134f30"; 117 public static final String SYSFUN_SCHEMA_UUID = 118 "c013800d-00fb-2642-07ec-000000134f30"; 119 public static final String SYSPROC_SCHEMA_UUID = 120 "c013800d-00fb-2643-07ec-000000134f30"; 121 public static final String SYSSTAT_SCHEMA_UUID = 122 "c013800d-00fb-2644-07ec-000000134f30"; 123 public static final String SYSCS_DIAG_SCHEMA_UUID = 124 "c013800d-00fb-2646-07ec-000000134f30"; 125 public static final String SYSCS_UTIL_SCHEMA_UUID = 126 "c013800d-00fb-2649-07ec-000000134f30"; 127 public static final String NULLID_SCHEMA_UUID = 128 "c013800d-00fb-2647-07ec-000000134f30"; 129 public static final String SQLJ_SCHEMA_UUID = 130 "c013800d-00fb-2648-07ec-000000134f30"; 131 public static final String SYSTEM_SCHEMA_UUID = 132 "8000000d-00d0-fd77-3ed8-000a0a0b1900"; 133 public static final String SYSIBM_SCHEMA_UUID = 134 "c013800d-00f8-5b53-28a9-00000019ed88"; 135 public static final String DEFAULT_SCHEMA_UUID = 136 "80000000-00d2-b38f-4cda-000a0a412c00"; 137 138 139 140 public static final String STD_DECLARED_GLOBAL_TEMPORARY_TABLES_SCHEMA_NAME = "SESSION"; 141 public static final String DEFAULT_USER_NAME = Property.DEFAULT_USER_NAME; 142 public static final String SA_USER_NAME = "DBA"; 143 144 145 153 154 private final String name; 156 private UUID oid; 157 private final String aid; 158 159 private final boolean isSystem; 160 private final boolean isSYSIBM; 161 162 172 public SchemaDescriptor( 173 DataDictionary dataDictionary, 174 String name, 175 String aid, 176 UUID oid, 177 boolean isSystem) 178 { 179 super (dataDictionary); 180 181 this.name = name; 182 this.aid = aid; 183 this.oid = oid; 184 this.isSystem = isSystem; 185 isSYSIBM = isSystem && IBM_SYSTEM_SCHEMA_NAME.equals(name); 186 } 187 188 193 public String getSchemaName() 194 { 195 return name; 196 } 197 198 204 public String getAuthorizationId() 205 { 206 return aid; 207 } 208 209 214 public UUID getUUID() 215 { 216 return oid; 217 } 218 219 225 public void setUUID(UUID oid) 226 { 227 this.oid = oid; 228 } 229 230 234 239 public DependableFinder getDependableFinder() 240 { 241 return getDependableFinder(StoredFormatIds.SCHEMA_DESCRIPTOR_FINDER_V01_ID); 243 } 244 245 250 public String getObjectName() 251 { 252 return name; 253 } 254 255 260 public UUID getObjectID() 261 { 262 return oid; 263 } 264 265 270 public String getClassType() 271 { 272 return Dependable.SCHEMA; 273 } 274 275 279 284 public String toString() 285 { 286 return name; 287 } 288 289 291 298 299 public boolean equals(Object otherObject) 300 { 301 if (!(otherObject instanceof SchemaDescriptor)) 302 return false; 303 304 SchemaDescriptor other = (SchemaDescriptor) otherObject; 305 306 if ((oid != null) && (other.oid != null)) 307 return oid.equals( other.oid); 308 309 return name.equals(other.name); 310 } 311 312 320 public boolean isSystemSchema() 321 { 322 return(isSystem); 323 } 324 325 330 public boolean isSchemaWithGrantableRoutines() 331 { 332 if (!isSystem) 333 return true; 334 335 if (name.equals(STD_SQLJ_SCHEMA_NAME) || name.equals(STD_SYSTEM_UTIL_SCHEMA_NAME)) 336 return true; 337 338 return false; 339 } 340 341 public boolean isSYSIBM() 342 { 343 return isSYSIBM; 344 } 345 346 351 public int hashCode() 352 { 353 return oid.hashCode(); 354 } 355 356 357 public String getDescriptorName() 358 { 359 return name; 360 } 361 362 363 public String getDescriptorType() 364 { 365 return "Schema"; 366 } 367 } 368 | Popular Tags |