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.TableDescriptor; 27 28 import org.apache.derby.iapi.error.StandardException; 29 30 import org.apache.derby.iapi.services.sanity.SanityManager; 31 32 import org.apache.derby.catalog.UUID; 33 34 38 class OIDTDCacheable extends TDCacheable 39 { 40 private UUID identity; 41 42 OIDTDCacheable(DataDictionaryImpl dd) { 43 super(dd); 44 } 45 46 47 48 49 public void clearIdentity() 50 { 51 identity = null; 52 td = null; 53 } 54 55 56 public Object getIdentity() 57 { 58 return identity; 59 } 60 61 62 public Cacheable createIdentity(Object key, Object createParameter) 63 { 64 if (SanityManager.DEBUG) 65 { 66 if (!(key instanceof UUID)) 67 { 68 SanityManager.THROWASSERT("Key for an OIDTDCacheElement is a " + 69 key.getClass().getName() + 70 " instead of an UUID"); 71 } 72 if (!(createParameter instanceof TableDescriptor)) 73 { 74 SanityManager.THROWASSERT("Create parameter for an OIDTDCacheElement is a " + 75 createParameter.getClass().getName() + 76 "instead of a TableDescriptorImpl"); 77 } 78 } 79 80 identity = ((UUID) key).cloneMe(); 81 td = (TableDescriptor) createParameter; 82 83 if (td != null) 84 return this; 85 else 86 return null; 87 } 88 89 94 public Cacheable setIdentity(Object key) throws StandardException 95 { 96 if (SanityManager.DEBUG) 97 { 98 if (!(key instanceof UUID)) 99 { 100 SanityManager.THROWASSERT("Key for an OIDTDCacheElement is a " + 101 key.getClass().getName() + 102 " instead of an UUID"); 103 } 104 } 105 106 identity = ((UUID) key).cloneMe(); 107 td = dd.getUncachedTableDescriptor(identity); 108 109 if (td != null) 110 { 111 dd.addTableDescriptorToOtherCache(td, this); 113 return this; 114 } 115 else 116 return null; 117 } 118 119 122 150 } 151 | Popular Tags |