1 21 22 package org.apache.derby.impl.sql.catalog; 23 24 import org.apache.derby.iapi.services.cache.Cacheable; 25 26 import org.apache.derby.iapi.sql.dictionary.SchemaDescriptor; 27 import org.apache.derby.iapi.sql.dictionary.TableDescriptor; 28 29 import org.apache.derby.iapi.error.StandardException; 30 31 import org.apache.derby.iapi.services.sanity.SanityManager; 32 33 39 class NameTDCacheable extends TDCacheable 40 { 41 private TableKey identity; 42 43 NameTDCacheable(DataDictionaryImpl dd) { 44 super(dd); 45 } 46 47 48 49 50 51 public void clearIdentity() 52 { 53 identity = null; 54 td = null; 55 } 56 57 58 public Object getIdentity() 59 { 60 return identity; 61 } 62 63 64 public Cacheable createIdentity(Object key, Object createParameter) 65 { 66 if (SanityManager.DEBUG) 67 { 68 if (!(key instanceof TableKey)) 69 { 70 SanityManager.THROWASSERT("Key for a NameTDCacheElement is a " + 71 key.getClass().getName() + 72 " instead of a TableKey"); 73 } 74 75 if (!(createParameter instanceof TableDescriptor)) 76 { 77 SanityManager.THROWASSERT("Create parameter for a NameTDCacheElement is a " + 78 createParameter.getClass().getName() + 79 "instead of a TableDescriptorImpl"); 80 } 81 } 82 83 identity = (TableKey)key; 84 td = (TableDescriptor) createParameter; 85 86 if (td != null) 87 return this; 88 else 89 return null; 90 } 91 92 97 public Cacheable setIdentity(Object key) throws StandardException 98 { 99 if (SanityManager.DEBUG) 100 { 101 if (!(key instanceof TableKey)) 102 { 103 SanityManager.THROWASSERT("Key for a NameTDCacheElement is a " + 104 key.getClass().getName() + 105 " instead of a TableKey"); 106 } 107 } 108 109 ; 110 td = dd.getUncachedTableDescriptor(identity = (TableKey)key); 111 112 if (td != null) 113 { 114 dd.addTableDescriptorToOtherCache(td, this); 118 return this; 119 } 120 else 121 return null; 122 } 123 124 127 129 156 } 157 | Popular Tags |