1 16 package org.apache.axis.wsdl.symbolTable; 17 18 import org.apache.axis.utils.Messages; 19 import org.w3c.dom.Node ; 20 21 import javax.xml.namespace.QName ; 22 import java.io.IOException ; 23 import java.io.Serializable ; 24 import java.util.HashSet ; 25 import java.util.Vector ; 26 27 73 public abstract class TypeEntry extends SymTabEntry implements Serializable { 74 75 76 protected Node node; 78 79 protected TypeEntry refType; 81 82 protected String dims = ""; 84 86 protected boolean underlTypeNillable = false; 89 protected QName componentType = null; 91 94 protected QName itemQName = null; 95 96 97 protected boolean undefined; 99 104 105 protected boolean isBaseType; 107 109 110 protected boolean isSimpleType = 111 false; 113 114 protected boolean onlyLiteralReference = false; 116 117 protected HashSet types = null; 118 119 120 protected Vector containedElements; 121 122 123 protected Vector containedAttributes; 124 125 128 137 protected TypeEntry(QName pqName, TypeEntry refType, Node pNode, 138 String dims) { 139 140 super(pqName); 141 142 node = pNode; 143 this.undefined = refType.undefined; 144 this.refType = refType; 145 146 if (dims == null) { 147 dims = ""; 148 } 149 150 this.dims = dims; 151 152 if (refType.undefined) { 153 154 TypeEntry uType = refType; 156 157 while (!(uType instanceof Undefined)) { 158 uType = uType.refType; 159 } 160 161 ((Undefined) uType).register(this); 162 } else { 163 isBaseType = (refType.isBaseType && refType.dims.equals("") 164 && dims.equals("")); 165 } 166 } 167 168 174 protected TypeEntry(QName pqName, Node pNode) { 175 176 super(pqName); 177 178 node = pNode; 179 refType = null; 180 undefined = false; 181 dims = ""; 182 isBaseType = false; 183 } 184 185 190 protected TypeEntry(QName pqName) { 191 192 super(pqName); 193 194 node = null; 195 undefined = false; 196 dims = ""; 197 isBaseType = true; 198 } 199 200 205 public Node getNode() { 206 return node; 207 } 208 209 216 public String getBaseType() { 217 218 if (isBaseType) { 219 return name; 220 } else { 221 return null; 222 } 223 } 224 225 230 public boolean isBaseType() { 231 return isBaseType; 232 } 233 234 239 public void setBaseType(boolean baseType) { 240 isBaseType = baseType; 241 } 242 243 248 public boolean isSimpleType() { 249 return isSimpleType; 250 } 251 252 257 public void setSimpleType(boolean simpleType) { 258 isSimpleType = simpleType; 259 } 260 261 272 public boolean isOnlyLiteralReferenced() { 273 return onlyLiteralReference; 274 } 276 281 public void setOnlyLiteralReference(boolean set) { 282 onlyLiteralReference = set; 283 } 285 290 protected TypeEntry getUndefinedTypeRef() { 291 292 if (this instanceof Undefined) { 293 return this; 294 } 295 296 if (undefined && (refType != null)) { 297 if (refType.undefined) { 298 TypeEntry uType = refType; 299 300 while (!(uType instanceof Undefined)) { 301 uType = uType.refType; 302 } 303 304 return uType; 305 } 306 } 307 308 return null; 309 } 310 311 319 protected boolean updateUndefined(TypeEntry oldRef, TypeEntry newRef) 320 throws IOException { 321 322 boolean changedState = false; 323 324 if (refType == oldRef) { 326 refType = newRef; 327 changedState = true; 328 329 TypeEntry te = refType; 331 332 while ((te != null) && (te != this)) { 333 te = te.refType; 334 } 335 336 if (te == this) { 337 338 undefined = false; 340 isBaseType = false; 341 node = null; 342 343 throw new IOException ( 344 Messages.getMessage( 345 "undefinedloop00", getQName().toString())); 346 } 347 } 348 349 if ((refType != null) && undefined && (refType.undefined == false)) { 351 undefined = false; 352 changedState = true; 353 isBaseType = (refType.isBaseType && refType.dims.equals("") 354 && dims.equals("")); 355 } 356 357 return changedState; 358 } 359 360 365 public TypeEntry getRefType() { 366 return refType; 367 } 369 374 public void setRefType(TypeEntry refType) { 375 this.refType = refType; 376 } 377 378 383 public String getDimensions() { 384 return dims; 385 } 387 391 public boolean getUnderlTypeNillable() { 392 if (!underlTypeNillable 396 && !getDimensions().equals("") 397 && refType != null) { 398 underlTypeNillable = refType.getUnderlTypeNillable(); 399 } 400 return underlTypeNillable; 401 } 402 403 406 public void setUnderlTypeNillable(boolean underlTypeNillable) { 407 this.underlTypeNillable = underlTypeNillable; 408 } 409 410 414 public QName getComponentType() 415 { 416 return componentType; 417 } 418 419 422 public void setComponentType(QName componentType) 423 { 424 this.componentType = componentType; 425 } 426 427 public QName getItemQName() { 428 return itemQName; 429 } 430 431 public void setItemQName(QName itemQName) { 432 this.itemQName = itemQName; 433 } 434 435 440 public String toString() { 441 return toString(""); 442 } 443 444 450 protected String toString(String indent) { 451 452 String refString = indent + "RefType: null \n"; 453 454 if (refType != null) { 455 refString = indent + "RefType:\n" + refType.toString(indent + " ") 456 + "\n"; 457 } 458 459 return super.toString(indent) 460 + indent + "Class: " + this.getClass().getName() + "\n" 461 + indent + "Base?: " + isBaseType + "\n" 462 + indent + "Undefined?: " + undefined + "\n" 463 + indent + "isSimpleType? " + isSimpleType + "\n" 464 + indent + "Node: " + getNode() + "\n" 465 + indent + "Dims: " + dims + "\n" 466 + indent + "isOnlyLiteralReferenced: " + onlyLiteralReference + "\n" 467 + refString; 468 } 469 470 481 public HashSet getNestedTypes(SymbolTable symbolTable, 482 boolean derivedFlag) { 483 if( types == null) { 484 types = Utils.getNestedTypes(this, symbolTable, derivedFlag); 485 } 486 return types; 487 } 489 492 public Vector getContainedAttributes() { 493 return containedAttributes; 494 } 495 498 public void setContainedAttributes(Vector containedAttributes) { 499 this.containedAttributes = containedAttributes; 500 } 501 504 public Vector getContainedElements() { 505 return containedElements; 506 } 507 510 public void setContainedElements(Vector containedElements) { 511 this.containedElements = containedElements; 512 } 513 } 514 | Popular Tags |