1 55 package org.jboss.axis.wsdl.symbolTable; 56 57 import org.jboss.axis.utils.Messages; 58 import org.w3c.dom.Node ; 59 60 import javax.xml.namespace.QName ; 61 import java.io.IOException ; 62 63 109 public abstract class TypeEntry extends SymTabEntry 110 { 111 protected Node node; 113 protected TypeEntry refType; 115 116 protected String dims = ""; 119 protected boolean undefined; protected boolean isBaseType; protected boolean isSimpleType = false; protected boolean onlyLiteralReference = false; 131 135 protected TypeEntry(QName pqName, TypeEntry refType, Node pNode, String dims) 136 { 137 super(pqName); 138 node = pNode; 139 this.undefined = refType.undefined; 140 this.refType = refType; 141 if (dims == null) 142 dims = ""; 143 this.dims = dims; 144 145 if (refType.undefined) 146 { 147 TypeEntry uType = refType; 149 while (!(uType instanceof Undefined)) 150 { 151 uType = uType.refType; 152 } 153 ((Undefined)uType).register(this); 154 } 155 else 156 { 157 isBaseType = (refType.isBaseType && refType.dims.equals("") && dims.equals("")); 158 } 159 160 162 } 163 164 167 protected TypeEntry(QName pqName, Node pNode) 168 { 169 super(pqName); 170 node = pNode; 171 refType = null; 172 undefined = false; 173 dims = ""; 174 isBaseType = false; 175 } 177 178 181 protected TypeEntry(QName pqName) 182 { 183 super(pqName); 184 node = null; 185 undefined = false; 186 dims = ""; 187 isBaseType = true; 188 } 190 191 194 public Node getNode() 195 { 196 return node; 197 } 198 199 204 public String getBaseType() 205 { 206 if (isBaseType) 207 { 208 return name; 209 } 210 else 211 { 212 return null; 213 } 214 } 215 216 public boolean isBaseType() 217 { 218 return isBaseType; 219 } 220 221 public boolean isSimpleType() 222 { 223 return isSimpleType; 224 } 225 226 public void setSimpleType(boolean simpleType) 227 { 228 isSimpleType = simpleType; 229 } 230 231 240 public boolean isOnlyLiteralReferenced() 241 { 242 return onlyLiteralReference; 243 } 245 248 public void setOnlyLiteralReference(boolean set) 249 { 250 onlyLiteralReference = set; 251 } 253 256 protected TypeEntry getUndefinedTypeRef() 257 { 258 if (this instanceof Undefined) 259 return this; 260 if (undefined && refType != null) 261 { 262 if (refType.undefined) 263 { 264 TypeEntry uType = refType; 265 while (!(uType instanceof Undefined)) 266 { 267 uType = uType.refType; 268 } 269 return uType; 270 } 271 } 272 return null; 273 } 274 275 282 protected boolean updateUndefined(TypeEntry oldRef, TypeEntry newRef) throws IOException 283 { 284 boolean changedState = false; 285 if (refType == oldRef) 287 { 288 refType = newRef; 289 changedState = true; 290 TypeEntry te = refType; 292 while (te != null && te != this) 293 { 294 te = te.refType; 295 } 296 if (te == this) 297 { 298 undefined = false; 300 isBaseType = false; 301 node = null; 302 throw new IOException (Messages.getMessage("undefinedloop00", getQName().toString())); 303 } 304 } 305 306 if (refType != null && undefined && refType.undefined == false) 308 { 309 undefined = false; 310 changedState = true; 311 isBaseType = (refType.isBaseType && refType.dims.equals("") && dims.equals("")); 312 } 313 return changedState; 314 } 315 316 317 320 public TypeEntry getRefType() 321 { 322 return refType; 323 } 325 public void setRefType(TypeEntry refType) 326 { 327 this.refType = refType; 328 } 329 330 333 public String getDimensions() 334 { 335 return dims; 336 } 338 341 public String toString() 342 { 343 return toString(""); 344 } 345 346 349 protected String toString(String indent) 350 { 351 String refString = indent + "RefType: null \n"; 352 if (refType != null) 353 refString = indent + "RefType:\n" + refType.toString(indent + " ") + "\n"; 354 return super.toString(indent) + 355 indent + "Class: " + this.getClass().getName() + "\n" + 356 indent + "Base?: " + isBaseType + "\n" + 357 indent + "Undefined?: " + undefined + "\n" + 358 indent + "isSimpleType? " + isSimpleType + "\n" + 359 indent + "Node: " + getNode() + "\n" + 360 indent + "Dims: " + dims + "\n" + 361 refString; 362 } 363 } 364 365 ; 366 | Popular Tags |