1 21 22 package org.apache.derby.impl.sql.depend; 23 24 import org.apache.derby.iapi.services.io.StoredFormatIds; 25 26 import org.apache.derby.iapi.sql.depend.ProviderInfo; 27 28 import org.apache.derby.iapi.services.sanity.SanityManager; 29 30 import org.apache.derby.catalog.DependableFinder; 31 import org.apache.derby.catalog.UUID; 32 import org.apache.derby.iapi.services.io.FormatableHashtable; 33 34 import java.io.ObjectOutput ; 35 import java.io.ObjectInput ; 36 import java.io.IOException ; 37 38 41 42 public class BasicProviderInfo implements ProviderInfo 43 { 44 57 58 public UUID uuid; 59 public DependableFinder dFinder; 60 public String providerName; 61 62 64 68 public BasicProviderInfo() {} 69 70 77 public BasicProviderInfo( 78 UUID uuid, 79 DependableFinder dFinder, 80 String providerName) 81 { 82 this.uuid = uuid; 83 this.dFinder = dFinder; 84 this.providerName = providerName; 85 } 86 87 89 90 public DependableFinder getDependableFinder() 91 { 92 return dFinder; 93 } 94 95 96 public UUID getObjectId() 97 { 98 return uuid; 99 } 100 101 102 public String getProviderName() 103 { 104 return providerName; 105 } 106 107 109 117 public void readExternal( ObjectInput in ) 118 throws IOException , ClassNotFoundException 119 { 120 121 FormatableHashtable fh = (FormatableHashtable)in.readObject(); 122 uuid = (UUID)fh.get("uuid"); 123 dFinder = (DependableFinder)fh.get("dFinder"); 124 providerName = (String ) fh.get("providerName"); 125 } 126 127 134 public void writeExternal( ObjectOutput out ) 135 throws IOException 136 { 137 FormatableHashtable fh = new FormatableHashtable(); 138 fh.put("uuid", uuid); 139 fh.put("dFinder", dFinder); 140 fh.put("providerName", providerName); 141 out.writeObject(fh); 142 } 143 144 149 public int getTypeFormatId() { return StoredFormatIds.PROVIDER_INFO_V02_ID; } 150 151 154 public String toString() 155 { 156 if (SanityManager.DEBUG) 157 { 158 String traceUUID; 159 String traceDFinder; 160 String traceProviderName; 161 162 if (uuid == null) 163 { 164 traceUUID = "uuid: null "; 165 } 166 else 167 { 168 traceUUID = "uuid: "+uuid+" "; 169 } 170 171 if (dFinder == null) 172 { 173 traceDFinder = "dFinder: null "; 174 } 175 else 176 { 177 traceDFinder = "dFinder: "+dFinder+" "; 178 } 179 180 if (providerName == null) 181 { 182 traceProviderName = "providerName: null "; 183 } 184 else 185 { 186 traceProviderName = "providerName: "+providerName+" "; 187 } 188 189 return "ProviderInfo: ("+traceUUID+traceDFinder+traceProviderName+")"; 190 } 191 else 192 { 193 return ""; 194 } 195 } 196 } 197 | Popular Tags |