1 21 22 package org.apache.derby.iapi.sql.dictionary; 23 24 import org.apache.derby.iapi.sql.depend.Provider; 25 26 import org.apache.derby.iapi.error.StandardException; 27 import org.apache.derby.iapi.services.sanity.SanityManager; 28 29 import org.apache.derby.catalog.AliasInfo; 30 31 import org.apache.derby.catalog.UUID; 32 33 import org.apache.derby.catalog.AliasInfo; 34 import org.apache.derby.catalog.DependableFinder; 35 import org.apache.derby.catalog.Dependable; 36 import org.apache.derby.catalog.UUID; 37 import org.apache.derby.iapi.services.io.StoredFormatIds; 38 39 54 55 public final class AliasDescriptor 56 extends TupleDescriptor 57 implements UniqueTupleDescriptor, Provider 58 { 59 private final UUID aliasID; 60 private final String aliasName; 61 private final UUID schemaID; 62 private final String javaClassName; 63 private final char aliasType; 64 private final char nameSpace; 65 private final boolean systemAlias; 66 private final AliasInfo aliasInfo; 67 private final String specificName; 68 69 82 83 public AliasDescriptor( DataDictionary dataDictionary, UUID aliasID, 84 String aliasName, UUID schemaID, String javaClassName, 85 char aliasType, char nameSpace, boolean systemAlias, 86 AliasInfo aliasInfo, String specificName) 87 { 88 super( dataDictionary ); 89 90 this.aliasID = aliasID; 91 this.aliasName = aliasName; 92 this.schemaID = schemaID; 93 this.javaClassName = javaClassName; 94 this.aliasType = aliasType; 95 this.nameSpace = nameSpace; 96 this.systemAlias = systemAlias; 97 this.aliasInfo = aliasInfo; 98 if (specificName == null) 99 specificName = dataDictionary.getSystemSQLName(); 100 this.specificName = specificName; 101 } 102 103 105 110 public UUID getUUID() 111 { 112 return aliasID; 113 } 114 115 120 public UUID getSchemaUUID() 121 { 122 return schemaID; 123 } 124 125 130 public String getJavaClassName() 131 { 132 return javaClassName; 133 } 134 135 136 141 public char getAliasType() 142 { 143 return aliasType; 144 } 145 146 151 public char getNameSpace() 152 { 153 return nameSpace; 154 } 155 156 161 public boolean getSystemAlias() 162 { 163 return systemAlias; 164 } 165 166 171 public AliasInfo getAliasInfo() 172 { 173 return aliasInfo; 174 } 175 176 177 189 194 195 public String toString() 196 { 197 if (SanityManager.DEBUG) 198 { 199 return "aliasID: " + aliasID + "\n" + 200 "aliasName: " + aliasName + "\n" + 201 "schemaID: " + schemaID + "\n" + 202 "javaClassName: " + javaClassName + "\n" + 203 "aliasType: " + aliasType + "\n" + 204 "nameSpace: " + nameSpace + "\n" + 205 "systemAlias: " + systemAlias + "\n" + 206 "aliasInfo: " + aliasInfo + "\n"; 207 } 208 else 209 { 210 return ""; 211 } 212 } 213 214 216 223 224 public boolean equals(Object otherObject) 225 { 226 if (!(otherObject instanceof AliasDescriptor)) 227 { return false; } 228 229 AliasDescriptor other = (AliasDescriptor) otherObject; 230 231 return aliasID.equals( other.getUUID() ); 232 } 233 234 239 public int hashCode() 240 { 241 return aliasID.hashCode(); 242 } 243 244 248 254 public DependableFinder getDependableFinder() 255 { 256 return getDependableFinder(StoredFormatIds.ALIAS_DESCRIPTOR_FINDER_V01_ID); 257 } 258 259 264 public String getObjectName() 265 { 266 return aliasName; 267 } 268 269 274 public UUID getObjectID() 275 { 276 return aliasID; 277 } 278 279 284 public String getClassType() 285 { 286 return Dependable.ALIAS; 287 } 288 289 290 public String getDescriptorType() 291 { 292 return getAliasType(aliasType); 293 } 294 295 public static final String getAliasType(char nameSpace) 296 { 297 switch (nameSpace) 298 { 299 case AliasInfo.ALIAS_TYPE_PROCEDURE_AS_CHAR: 300 return "PROCEDURE"; 301 case AliasInfo.ALIAS_TYPE_FUNCTION_AS_CHAR: 302 return "FUNCTION"; 303 case AliasInfo.ALIAS_TYPE_SYNONYM_AS_CHAR: 304 return "SYNONYM"; 305 } 306 return null; 307 } 308 309 310 public String getDescriptorName() 311 { 312 return aliasName; 313 } 314 315 316 319 public String getSpecificName() 320 { 321 return specificName; 322 } 323 324 328 public boolean isPersistent() 329 { 330 return !getSchemaUUID().toString().equals(SchemaDescriptor.SYSFUN_SCHEMA_UUID); 331 } 332 } 333 | Popular Tags |