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.catalog.UUID; 27 import org.apache.derby.iapi.reference.SQLState; 28 import org.apache.derby.iapi.services.sanity.SanityManager; 29 import org.apache.derby.iapi.sql.StatementType; 30 import org.apache.derby.catalog.DependableFinder; 31 import org.apache.derby.catalog.Dependable; 32 import org.apache.derby.iapi.services.io.StoredFormatIds; 33 34 import org.apache.derby.iapi.services.uuid.UUIDFactory; 35 import org.apache.derby.iapi.services.monitor.Monitor; 36 37 50 51 public final class ConglomerateDescriptor extends TupleDescriptor 52 implements UniqueTupleDescriptor, Provider 53 { 54 private long conglomerateNumber; 56 private String name; 57 private String [] columnNames; 58 private final boolean indexable; 59 private final boolean forConstraint; 60 private final IndexRowGenerator indexRowGenerator; 61 private final UUID uuid; 62 private final UUID tableID; 63 private final UUID schemaID; 64 65 82 ConglomerateDescriptor(DataDictionary dataDictionary, 83 long conglomerateNumber, 84 String name, 85 boolean indexable, 86 IndexRowGenerator indexRowGenerator, 87 boolean forConstraint, 88 UUID uuid, 89 UUID tableID, 90 UUID schemaID) 91 { 92 super( dataDictionary ); 93 94 this.conglomerateNumber = conglomerateNumber; 95 this.name = name; 96 this.indexable = indexable; 97 this.indexRowGenerator = indexRowGenerator; 98 this.forConstraint = forConstraint; 99 if (uuid == null) 100 { 101 UUIDFactory uuidFactory = Monitor.getMonitor().getUUIDFactory(); 102 uuid = uuidFactory.createUUID(); 103 } 104 this.uuid = uuid; 105 this.tableID = tableID; 106 this.schemaID = schemaID; 107 } 108 109 114 public long getConglomerateNumber() 115 { 116 return conglomerateNumber; 117 } 118 119 125 public void setConglomerateNumber(long conglomerateNumber) 126 { 127 this.conglomerateNumber = conglomerateNumber; 128 } 129 130 135 public UUID getUUID() 136 { 137 return uuid; 138 } 139 140 145 public UUID getTableID() 146 { 147 return tableID; 148 } 149 150 155 public UUID getSchemaID() 156 { 157 return schemaID; 158 } 159 160 165 public boolean isIndex() 166 { 167 return indexable; 168 } 169 170 175 public boolean isConstraint() 176 { 177 return forConstraint; 178 } 179 180 186 public String getConglomerateName() 187 { 188 return name; 189 } 190 191 196 public void setConglomerateName(String newName) 197 { 198 name = newName; 199 } 200 201 207 public IndexRowGenerator getIndexDescriptor() 208 { 209 return indexRowGenerator; 210 } 211 212 218 public void setColumnNames(String [] columnNames) 219 { 220 this.columnNames = columnNames; 221 } 222 223 229 public String [] getColumnNames() 230 { 231 return columnNames; 232 } 233 234 238 241 public DependableFinder getDependableFinder() 242 { 243 return getDependableFinder(StoredFormatIds.CONGLOMERATE_DESCRIPTOR_FINDER_V01_ID); 244 } 245 246 251 public String getObjectName() 252 { 253 if (SanityManager.DEBUG) 254 { 255 SanityManager.ASSERT(name != null, 256 "ConglomerateDescriptor only expected to be provider for indexes"); 257 } 258 return name; 259 } 260 261 266 public UUID getObjectID() 267 { 268 return uuid; 269 } 270 271 276 public String getClassType() 277 { 278 if (indexable) 279 { 280 return Dependable.INDEX; 281 } 282 else 283 { 284 return Dependable.HEAP; 285 } 286 } 287 288 293 294 public String toString() 295 { 296 if (SanityManager.DEBUG) 297 { 298 String keyString = ""; 299 300 if (indexable && columnNames != null ) 301 { 302 int[] keyColumns = indexRowGenerator.baseColumnPositions(); 303 304 keyString = ", key columns = {" + columnNames[keyColumns[0] - 1]; 305 for (int index = 1; index < keyColumns.length; index++) 306 { 307 keyString = keyString + ", " + columnNames[keyColumns[index] - 1]; 308 } 309 keyString = keyString + "}"; 310 } 311 312 return "ConglomerateDescriptor: conglomerateNumber = " + conglomerateNumber + 313 " name = " + name + 314 " uuid = " + uuid + 315 " indexable = " + indexable + keyString; 316 } 317 else 318 { 319 return ""; 320 } 321 } 322 323 324 public String getDescriptorType() 325 { 326 if (indexable) 327 return "Index"; 328 else 329 return "Table"; 330 } 331 332 333 public String getDescriptorName() { return name; } 334 335 } 336 | Popular Tags |