1 2 package SOFA.SOFAnode.Made.CDL; 3 import java.rmi.RemoteException ; 4 5 import SOFA.SOFAnode.Made.TIR.AbsoluteName; 6 import SOFA.SOFAnode.Made.TIR.ArrayDef; 7 import SOFA.SOFAnode.Made.TIR.CDLType; 8 import SOFA.SOFAnode.Made.TIR.Contained; 9 import SOFA.SOFAnode.Made.TIR.Container; 10 import SOFA.SOFAnode.Made.TIR.DefinitionKind; 11 import SOFA.SOFAnode.Made.TIR.Identification; 12 import SOFA.SOFAnode.Made.TIR.InterfaceDef; 13 import SOFA.SOFAnode.Made.TIR.ProtocolBinOperationDef; 14 import SOFA.SOFAnode.Made.TIR.ProtocolMetaOperandDef; 15 import SOFA.SOFAnode.Made.TIR.ProtocolOperDef; 16 import SOFA.SOFAnode.Made.TIR.ProtocolOperKind; 17 import SOFA.SOFAnode.Made.TIR.ProtocolOperandDef; 18 import SOFA.SOFAnode.Made.TIR.ProtocolUnOperationDef; 19 import SOFA.SOFAnode.Made.TIR.TIRExceptLock; 20 import SOFA.SOFAnode.Made.TIR.TypedefDef; 21 22 class CompProvide extends CompContainedIm { 23 CompReffer type; 24 EnumList operations; 25 String typeCode; 26 27 public CompProvide(ID id, CompContainer in, CompRepository inRep, CompReffer t, EnumList op, String tC) { 28 super(ObjectsKind.o_Provides, id, in, inRep); 29 id.version = ((CompContained) in).getIdent().version; 30 type = t; 31 operations = op; 32 typeCode = tC; 33 } 35 36 public boolean containsArray() { 37 if (typeCode.indexOf('a')!=-1) 38 return true; 39 return false; 40 } 41 42 public static CompReffer canBeProvReq(FullID idp, EnumList propNames, CompRepository inRep, EnumList operNm, StringBuffer typeCode) throws CDLExceptLock, CDLExceptRemote { 43 EnumList operNames = null; 44 CompReffer what = null; 45 if ((what = inRep.searchReffer(idp, 1))==null) { return null; 48 } 49 if (System.getProperty("cdl.disableBindTests","no").compareTo("yes")==0) { 50 return what; 51 } 52 boolean ok = false; 56 int kind = what.what; 57 CompReffer r = what; 58 while (!ok) { 59 if (kind != ObjectsKind.o_Interface) { 61 if (kind == ObjectsKind.o_Typedef || kind == ObjectsKind.o_Array) { 62 int i,j; 63 FullID id = r.ref; 64 if (r.isNew) { CompContainer con = inRep; 66 id.sn.names.toFirst(); 67 for(i=0;i<id.sn.names.size();i++) { 68 CompContained[] a = con.lookup((String ) id.sn.names.aktual()); 69 if (a==null || a.length==0) { 70 inRep.searchError = "this can't be provision"; 71 return null; 72 } 73 if (a.length==1) { 74 if (a[0].isContainer()) con = (CompContainer) a[0]; 75 else { 76 inRep.searchError = "this can't be provision"; 77 return null; 78 } 79 } else { 80 inRep.searchError = "this can't be provision"; 81 return null; 82 } 83 id.sn.names.toNext(); 84 } 85 CompContained sec = con.lookup(id.name, id.version); 86 if (sec!=null) { 87 CompType sectype = ((CompTypedef) sec).type; 88 if (sectype.objectKind() != ObjectsKind.o_Interface) { 89 if (sectype.objectKind()==ObjectsKind.o_none) { r = (CompReffer) sectype; 91 kind = r.what; 92 } else { 93 if (sectype.objectKind()==ObjectsKind.o_Array) { 94 while (sectype.objectKind()==ObjectsKind.o_Array) { 95 typeCode.append('a'); 96 EnumList exprProp = ((CompArray) sectype).length.nameProp(inRep); 98 if (!CompExprOper.testPropInExpr(propNames,exprProp)) { 99 inRep.searchError = "unknown property"; 100 return null; 101 } 102 sectype = ((CompArray) sectype).type; 103 } 104 if (sectype.objectKind() != ObjectsKind.o_none) { 105 if (sectype.objectKind() == ObjectsKind.o_Interface) { 106 typeCode.append('i'); 107 operNames = ((CompInterface) sectype).operationNames(); 108 ok = true; 109 } else { 110 inRep.searchError = "this can't be provision"; 111 return null; 112 } 113 } else { 114 r = (CompReffer) sectype; 115 kind = r.what; 116 } 117 } else { 118 inRep.searchError = "this can't be provision"; 119 return null; 120 } 121 } 122 } else { 123 typeCode.append('i'); 124 operNames = ((CompInterface) sectype).operationNames(); 125 ok = true; 126 } 127 } else { 128 inRep.searchError = "this can't be provision"; 129 return null; 130 } 131 } else { try { 133 Container con = inRep.cdlRepository; 134 id.sn.names.toFirst(); 135 for(i=0;i<id.sn.names.size();i++) { 136 Contained[] a = con.lookup_name((String ) id.sn.names.aktual()); 137 if (a==null || a.length==0) { 138 inRep.searchError = "this can't be provision"; 139 return null; 140 } 141 if (a.length==1) { 142 if (a[0] instanceof Container) con = (Container) a[0]; 143 else { 144 inRep.searchError = "this can't be provision"; 145 return null; 146 } 147 } else { 148 boolean found = false; 149 for(j=0;j<a.length;j++) { 150 if (a[j].get_identification().version().compareTo(id.version)==0) { 151 if ( !(a[j] instanceof Container)) { 152 inRep.searchError = "this can't be provision"; 153 return null; 154 } 155 found = true; 156 con = (Container) a[j]; 157 break; 158 } 159 } 160 if (!found) { 161 inRep.searchError = "this can't be provision"; 162 return null; 163 } 164 } 165 id.sn.names.toNext(); 166 } 167 Contained sec = con.lookup(id.name, id.version); 168 if (sec!=null) { 169 CDLType sectype = ((TypedefDef) sec).original_type(); 170 if (sectype.get_def_kind().value() != DefinitionKind.dk_Interface) { 171 if (sectype.get_def_kind().value() == DefinitionKind.dk_Typedef) { 172 CompReffer ret = new CompReffer(); 173 ret.what = sectype.get_def_kind().value(); 174 ret.ref = new FullID(true); 175 Identification idl; 176 ret.ref.name = new String ((idl = ((TypedefDef)sectype).get_identification()).name()); 177 ret.ref.version = new String (idl.version()); 178 ret.ref.isin = IDKind.version; 179 ret.isNew = false; 180 AbsoluteName abs = idl.absolute_name(); 181 for(j=0;j<abs.size();j++) { 182 ret.ref.sn.addScope(new String (abs.elementAt(j))); 183 } 184 r = ret; 185 kind = r.what; 186 } else { 187 if (sectype.get_def_kind().value()==DefinitionKind.dk_Array) { 188 while (sectype.get_def_kind().value()==DefinitionKind.dk_Array) { 189 typeCode.append('a'); 190 EnumList exprProp = CompExprOper.scanNormalExpr(((ArrayDef) sectype).length()); 192 if (!CompExprOper.testPropInExpr(propNames,exprProp)) { 193 inRep.searchError = "unknown property"; 194 return null; 195 } 196 sectype = ((ArrayDef) sectype).element_type(); 197 } 198 if (sectype.get_def_kind().value()!=DefinitionKind.dk_Typedef) { 199 if (sectype.get_def_kind().value()==DefinitionKind.dk_Interface) { 200 typeCode.append('i'); 201 operNames = normIfaceOperations((InterfaceDef) sectype, inRep); 202 ok = true; 203 } else { 204 inRep.searchError = "this can't be provision"; 205 return null; 206 } 207 } else { 208 CompReffer ret = new CompReffer(); 209 ret.what = sectype.get_def_kind().value(); 210 ret.ref = new FullID(true); 211 Identification idl; 212 ret.ref.name = new String ((idl = ((TypedefDef)sectype).get_identification()).name()); 213 ret.ref.version = new String (idl.version()); 214 ret.ref.isin = IDKind.version; 215 ret.isNew = false; 216 AbsoluteName abs = idl.absolute_name(); 217 for(j=0;j<abs.size();j++) { 218 ret.ref.sn.addScope(new String (abs.elementAt(j))); 219 } 220 r = ret; 221 kind = r.what; 222 } 223 } else { 224 inRep.searchError = "this can't be provision"; 225 return null; 226 } 227 } 228 } else { 229 typeCode.append('i'); 230 operNames = normIfaceOperations((InterfaceDef) sectype, inRep); 231 ok = true; 232 } 233 } else { 234 inRep.searchError = "this can't be provision"; 235 return null; 236 } 237 } catch (TIRExceptLock e) { 238 throw new CDLExceptLock("Repository is locked."); 239 } catch (RemoteException e) { 240 throw new CDLExceptRemote("Remote exception occured: "+e.getMessage()); 241 } 242 } 243 } else { 244 inRep.searchError = "this can't be provision"; 245 return null; 246 } 247 } else { 248 typeCode.append('i'); 249 operNames = ifaceOperations(r, inRep); 250 ok = true; 251 } 252 } 253 operNames.toFirst(); 255 for(int i=0;i<operNames.size();i++) { 256 operNm.addName((String ) operNames.aktual()); 257 operNames.toNext(); 258 } 259 return what; 260 } 261 262 public static EnumList ifaceOperations(CompReffer ref, CompRepository inRep) throws CDLExceptLock, CDLExceptRemote { 263 int i; 264 if (ref.isNew) { 265 CompContainer con = inRep; 266 ref.ref.sn.names.toFirst(); 267 for(i=0;i<ref.ref.sn.names.size();i++) { 268 CompContained[] a = con.lookup((String ) ref.ref.sn.names.aktual()); 269 if (a==null || a.length==0) { 270 return null; 271 } 272 if (a.length==1) { 273 if (a[0].isContainer()) con = (CompContainer) a[0]; 274 else { 275 return null; 276 } 277 } else { 278 return null; 279 } 280 ref.ref.sn.names.toNext(); 281 } 282 CompContained sec = con.lookup(ref.ref.name, ref.ref.version); 283 if (sec==null) 284 return null; 285 return ((CompInterface) sec).operationNames(); 286 } else { 287 try { 288 Container con = inRep.cdlRepository; 289 ref.ref.sn.names.toFirst(); 290 for(i=0;i<ref.ref.sn.names.size();i++) { 291 Contained[] a = con.lookup_name((String ) ref.ref.sn.names.aktual()); 292 if (a==null || a.length==0) { 293 return null; 294 } 295 if (a.length==1) { 296 if (a[0] instanceof Container) con = (Container) a[0]; 297 else { 298 return null; 299 } 300 } else { 301 boolean found = false; 302 for(int j=0;j<a.length;j++) { 303 if (a[j].get_identification().version().compareTo(ref.ref.version)==0) { 304 if ( !(a[j] instanceof Container)) { 305 return null; 306 } 307 found = true; 308 con = (Container) a[j]; 309 break; 310 } 311 } 312 if (!found) { 313 return null; 314 } 315 } 316 ref.ref.sn.names.toNext(); 317 } 318 Contained sec = con.lookup(ref.ref.name, ref.ref.version); 319 if (sec==null) 320 return null; 321 return normIfaceOperations((InterfaceDef) sec, inRep); 322 } catch (TIRExceptLock e) { 323 throw new CDLExceptLock("Repository is locked."); 324 } catch (RemoteException e) { 325 throw new CDLExceptRemote("Remote exception occured: "+e.getMessage()); 326 } 327 } 328 } 329 330 private static EnumList normIfaceOperations(InterfaceDef sec, CompRepository inRep) throws TIRExceptLock, RemoteException { 331 EnumList ret = new EnumList(); 332 DefinitionKind dkoper = inRep.workRepository.get_spec_def_kind(DefinitionKind.dk_Operation); 333 Contained[] obj = sec.contents(dkoper); 334 for (int j=0;j<obj.length;j++) { ret.addName(obj[j].get_identification().name()); 336 } 337 baseIfacesOperations((InterfaceDef) sec, ret, dkoper); 338 return ret; 339 } 340 341 private static void baseIfacesOperations(InterfaceDef iface, EnumList names, DefinitionKind dkoper) throws TIRExceptLock, RemoteException { 342 InterfaceDef[] bbase = ((InterfaceDef) iface).base_interfaces(); 343 for (int i=0;i<bbase.length;i++) { 344 Contained[] obj = ((InterfaceDef) bbase[i]).contents(dkoper); 345 for (int j=0;j<obj.length;j++) { 346 names.addName(obj[j].get_identification().name()); 347 } 348 baseIfacesOperations(bbase[i], names, dkoper); 349 } 350 } 351 352 public boolean isOperation(String name) { 353 return operations.isIn(name); 354 } 355 356 public void checkConsist(EnumList props, CompRepository rep) throws CDLExceptCheck, CDLExceptLock, CDLExceptRemote { 357 type.checkConsist(props, rep); 358 } 359 360 363 public String ifaceProtocol() throws CDLExceptLock, CDLExceptRemote { 364 if (typeCode.indexOf('a')==-1) 365 return CompProvide.realIfaceProtocol(type, "?", id.name, rep); 366 else { 367 CompReffer r = CompProvide.getProvReqIface(type.ref, rep); 368 if (r!=null) 369 return CompProvide.realIfaceProtocol(r, "?", id.name, rep); 370 else 371 return null; 372 } 373 } 374 375 public static String realIfaceProtocol(CompReffer iface, String mode, String name, CompRepository inRep) throws CDLExceptLock, CDLExceptRemote { 376 int i,j; 377 if (iface.isNew) { 378 CompContainer con = inRep; 379 iface.ref.sn.names.toFirst(); 380 for(i=0;i<iface.ref.sn.names.size();i++) { 381 CompContained[] a = con.lookup((String ) iface.ref.sn.names.aktual()); 382 if (a==null || a.length==0) { 383 System.err.println("Error in searching interface "+iface.ref); 384 return null; 385 } 386 if (a.length==1) { 387 if (a[0].isContainer()) con = (CompContainer) a[0]; 388 else { 389 System.err.println("Error in searching interface "+iface.ref); 390 return null; 391 } 392 } else { 393 System.err.println("Error in searching interface "+iface.ref); 394 return null; 395 } 396 iface.ref.sn.names.toNext(); 397 } 398 CompContained sec = con.lookup(iface.ref.name, iface.ref.version); 399 if (sec!=null) { 400 if (sec.objectKind()==ObjectsKind.o_Interface) { 401 if (((CompInterface) sec).protocol != null) 402 return compProtToText(((CompInterface) sec).protocol, mode, name); 403 else { 404 if (((CompInterface)sec).contents().length==0) 405 return ""; 406 return null; 407 } 408 } else 409 return null; 410 } else { 411 return null; 412 } 413 } else { try { 415 FullID id = iface.ref; 416 Container con = inRep.cdlRepository; 417 id.sn.names.toFirst(); 418 for(i=0;i<id.sn.names.size();i++) { 419 Contained[] a = con.lookup_name((String ) id.sn.names.aktual()); 420 if (a==null || a.length==0) { 421 System.err.println("Error in searching interface "+iface.ref); 422 return null; 423 } 424 if (a.length==1) { 425 if (a[0] instanceof Container) con = (Container) a[0]; 426 else { 427 System.err.println("Error in searching interface "+iface.ref); 428 return null; 429 } 430 } else { 431 boolean found = false; 432 for(j=0;j<a.length;j++) { 433 if (a[j].get_identification().version().compareTo(id.version)==0) { 434 if ( !(a[j] instanceof Container)) { 435 System.err.println("Error in searching interface "+iface.ref); 436 return null; 437 } 438 found = true; 439 con = (Container) a[j]; 440 break; 441 } 442 } 443 if (!found) { 444 System.err.println("Error in searching interface "+iface.ref); 445 return null; 446 } 447 } 448 id.sn.names.toNext(); 449 } 450 Contained sec = con.lookup(id.name, id.version); 451 if (sec!=null) { 452 if (sec.get_def_kind().value()==DefinitionKind.dk_Interface) { 453 if (((InterfaceDef) sec).protocol() != null) 454 return normProtToText(((InterfaceDef) sec).protocol().protocol(), mode, name); 455 else 456 return null; 457 } else 458 return null; 459 } else { 460 return null; 461 } 462 } catch (TIRExceptLock e) { 463 throw new CDLExceptLock("Repository is locked."); 464 } catch (RemoteException e) { 465 throw new CDLExceptRemote("Remote exception occured: "+e.getMessage()); 466 } 467 468 } 469 } 470 471 public static String compProtToText(CompProtOper p, String mode, String name) { 472 StringBuffer sb = new StringBuffer (); 473 switch (p.type) { 474 case CompProtKind.p_operand: 475 sb.append(mode); 476 sb.append(name); 477 sb.append("."); 478 sb.append(((CompProtOperand) p).operand); 479 break; 480 case CompProtKind.p_nulloperand: 481 sb.append("NULL"); 482 break; 483 case CompProtKind.p_metaoperand: 484 sb.append("["); 485 sb.append(((CompProtMetaOperand) p).name); 486 sb.append("]"); 487 break; 488 case CompProtKind.p_repetition: 489 sb.append("("); 490 sb.append(compProtToText(((CompProtUnOper) p).operand, mode, name)); 491 sb.append(")*"); 492 break; 493 case CompProtKind.p_andparallel: 494 sb.append("("); 495 sb.append(compProtToText(((CompProtBinOper) p).operand1, mode, name)); 496 sb.append(")|("); 497 sb.append(compProtToText(((CompProtBinOper) p).operand2, mode, name)); 498 sb.append(")"); 499 break; 500 case CompProtKind.p_orparallel: 501 sb.append("("); 502 sb.append(compProtToText(((CompProtBinOper) p).operand1, mode, name)); 503 sb.append(")||("); 504 sb.append(compProtToText(((CompProtBinOper) p).operand2, mode, name)); 505 sb.append(")"); 506 break; 507 case CompProtKind.p_alternative: 508 sb.append("("); 509 sb.append(compProtToText(((CompProtBinOper) p).operand1, mode, name)); 510 sb.append(")+("); 511 sb.append(compProtToText(((CompProtBinOper) p).operand2, mode, name)); 512 sb.append(")"); 513 break; 514 case CompProtKind.p_sequence: 515 sb.append("("); 516 sb.append(compProtToText(((CompProtBinOper) p).operand1, mode, name)); 517 sb.append(");("); 518 sb.append(compProtToText(((CompProtBinOper) p).operand2, mode, name)); 519 sb.append(")"); 520 break; 521 case CompProtKind.p_restriction: 522 sb.append("("); 523 sb.append(compProtToText(((CompProtBinOper) p).operand1, mode, name)); 524 sb.append(")/("); 525 sb.append(compProtToText(((CompProtBinOper) p).operand2, mode, name)); 526 sb.append(")"); 527 break; 528 default: break; 529 } 530 return sb.toString(); 531 } 532 533 public static String normProtToText(ProtocolOperDef p, String mode, String name) throws RemoteException { 534 StringBuffer sb = new StringBuffer (); 535 switch (p.get_po_kind().value()) { 536 case ProtocolOperKind.pok_operand: 537 sb.append(mode); 538 sb.append(name); 539 sb.append("."); 540 sb.append(((ProtocolOperandDef) p).operand()[0]); 541 break; 542 case ProtocolOperKind.pok_nulloperand: 543 sb.append("NULL"); 544 break; 545 case ProtocolOperKind.pok_metaoperand: 546 sb.append("["); 547 sb.append(((ProtocolMetaOperandDef) p).name()); 548 sb.append("]"); 549 break; 550 case ProtocolOperKind.pok_repetition: 551 sb.append("("); 552 sb.append(normProtToText(((ProtocolUnOperationDef) p).operand(), mode, name)); 553 sb.append(")*"); 554 break; 555 case ProtocolOperKind.pok_andparallel: 556 sb.append("("); 557 sb.append(normProtToText(((ProtocolBinOperationDef) p).operand1(), mode, name)); 558 sb.append(")|("); 559 sb.append(normProtToText(((ProtocolBinOperationDef) p).operand2(), mode, name)); 560 sb.append(")"); 561 break; 562 case ProtocolOperKind.pok_orparallel: 563 sb.append("("); 564 sb.append(normProtToText(((ProtocolBinOperationDef) p).operand1(), mode, name)); 565 sb.append(")||("); 566 sb.append(normProtToText(((ProtocolBinOperationDef) p).operand2(), mode, name)); 567 sb.append(")"); 568 break; 569 case ProtocolOperKind.pok_alternative: 570 sb.append("("); 571 sb.append(normProtToText(((ProtocolBinOperationDef) p).operand1(), mode, name)); 572 sb.append(")+("); 573 sb.append(normProtToText(((ProtocolBinOperationDef) p).operand2(), mode, name)); 574 sb.append(")"); 575 break; 576 case ProtocolOperKind.pok_sequence: 577 sb.append("("); 578 sb.append(normProtToText(((ProtocolBinOperationDef) p).operand1(), mode, name)); 579 sb.append(");("); 580 sb.append(normProtToText(((ProtocolBinOperationDef) p).operand2(), mode, name)); 581 sb.append(")"); 582 break; 583 case ProtocolOperKind.pok_restriction: 584 sb.append("("); 585 sb.append(normProtToText(((ProtocolBinOperationDef) p).operand1(), mode, name)); 586 sb.append(")/("); 587 sb.append(normProtToText(((ProtocolBinOperationDef) p).operand2(), mode, name)); 588 sb.append(")"); 589 break; 590 default: break; 591 } 592 return sb.toString(); 593 } 594 595 596 public static CompReffer getProvReqIface(FullID idp, CompRepository inRep) throws CDLExceptLock, CDLExceptRemote { 597 CompReffer what = null; 598 if ((what = inRep.searchReffer(idp))==null) { 599 return null; 600 } 601 boolean ok = false; 603 int kind = what.what; 604 CompReffer r = what; 605 while (!ok) { 606 if (kind != ObjectsKind.o_Interface) { 608 if (kind == ObjectsKind.o_Typedef || kind == ObjectsKind.o_Array) { 609 int i,j; 610 FullID id = r.ref; 611 if (r.isNew) { CompContainer con = inRep; 613 id.sn.names.toFirst(); 614 for(i=0;i<id.sn.names.size();i++) { 615 CompContained[] a = con.lookup((String ) id.sn.names.aktual()); 616 if (a==null || a.length==0) { 617 return null; 618 } 619 if (a.length==1) { 620 if (a[0].isContainer()) con = (CompContainer) a[0]; 621 else { 622 return null; 623 } 624 } else { 625 return null; 626 } 627 id.sn.names.toNext(); 628 } 629 CompContained sec = con.lookup(id.name, id.version); 630 if (sec!=null) { 631 CompType sectype = ((CompTypedef) sec).type; 632 if (sectype.objectKind() != ObjectsKind.o_Interface) { 633 if (sectype.objectKind()==ObjectsKind.o_none) { r = (CompReffer) sectype; 635 kind = r.what; 636 } else { 637 if (sectype.objectKind()==ObjectsKind.o_Array) { 638 while (sectype.objectKind()==ObjectsKind.o_Array) { 639 sectype = ((CompArray) sectype).type; 640 } 641 if (sectype.objectKind() != ObjectsKind.o_none) { 642 if (sectype.objectKind() == ObjectsKind.o_Interface) { 643 r = (CompReffer) sectype; 645 ok = true; 646 } else { 647 return null; 648 } 649 } else { 650 r = (CompReffer) sectype; 651 kind = r.what; 652 } 653 } else { 654 return null; 655 } 656 } 657 } else { 658 r = (CompReffer) sectype; 660 ok = true; 661 } 662 } else { 663 return null; 664 } 665 } else { try { 667 Container con = inRep.cdlRepository; 668 id.sn.names.toFirst(); 669 for(i=0;i<id.sn.names.size();i++) { 670 Contained[] a = con.lookup_name((String ) id.sn.names.aktual()); 671 if (a==null || a.length==0) { 672 return null; 673 } 674 if (a.length==1) { 675 if (a[0] instanceof Container) con = (Container) a[0]; 676 else { 677 return null; 678 } 679 } else { 680 boolean found = false; 681 for(j=0;j<a.length;j++) { 682 if (a[j].get_identification().version().compareTo(id.version)==0) { 683 if ( !(a[j] instanceof Container)) { 684 return null; 685 } 686 found = true; 687 con = (Container) a[j]; 688 break; 689 } 690 } 691 if (!found) { 692 return null; 693 } 694 } 695 id.sn.names.toNext(); 696 } 697 Contained sec = con.lookup(id.name, id.version); 698 if (sec!=null) { 699 CDLType sectype = ((TypedefDef) sec).original_type(); 700 if (sectype.get_def_kind().value() != DefinitionKind.dk_Interface) { 701 if (sectype.get_def_kind().value() == DefinitionKind.dk_Typedef) { 702 CompReffer ret = new CompReffer(); 703 ret.what = sectype.get_def_kind().value(); 704 ret.ref = new FullID(true); 705 Identification idl; 706 ret.ref.name = new String ((idl = ((TypedefDef)sectype).get_identification()).name()); 707 ret.ref.version = new String (idl.version()); 708 ret.ref.isin = IDKind.version; 709 ret.isNew = false; 710 AbsoluteName abs = idl.absolute_name(); 711 for(j=0;j<abs.size();j++) { 712 ret.ref.sn.addScope(new String (abs.elementAt(j))); 713 } 714 r = ret; 715 kind = r.what; 716 } else { 717 if (sectype.get_def_kind().value()==DefinitionKind.dk_Array) { 718 while (sectype.get_def_kind().value()==DefinitionKind.dk_Array) { 719 sectype = ((ArrayDef) sectype).element_type(); 720 } 721 if (sectype.get_def_kind().value()!=DefinitionKind.dk_Typedef) { 722 if (sectype.get_def_kind().value()==DefinitionKind.dk_Interface) { 723 CompReffer ret = new CompReffer(); 724 ret.what = sectype.get_def_kind().value(); 725 ret.ref = new FullID(true); 726 Identification idl; 727 ret.ref.name = new String ((idl = ((TypedefDef)sectype).get_identification()).name()); 728 ret.ref.version = new String (idl.version()); 729 ret.ref.isin = IDKind.version; 730 ret.isNew = false; 731 AbsoluteName abs = idl.absolute_name(); 732 for(j=0;j<abs.size();j++) { 733 ret.ref.sn.addScope(new String (abs.elementAt(j))); 734 } 735 r = ret; 736 ok = true; 737 } else { 738 return null; 739 } 740 } else { 741 CompReffer ret = new CompReffer(); 742 ret.what = sectype.get_def_kind().value(); 743 ret.ref = new FullID(true); 744 Identification idl; 745 ret.ref.name = new String ((idl = ((TypedefDef)sectype).get_identification()).name()); 746 ret.ref.version = new String (idl.version()); 747 ret.ref.isin = IDKind.version; 748 ret.isNew = false; 749 AbsoluteName abs = idl.absolute_name(); 750 for(j=0;j<abs.size();j++) { 751 ret.ref.sn.addScope(new String (abs.elementAt(j))); 752 } 753 r = ret; 754 kind = r.what; 755 } 756 } else { 757 return null; 758 } 759 } 760 } else { 761 CompReffer ret = new CompReffer(); 762 ret.what = sectype.get_def_kind().value(); 763 ret.ref = new FullID(true); 764 Identification idl; 765 ret.ref.name = new String ((idl = ((TypedefDef)sectype).get_identification()).name()); 766 ret.ref.version = new String (idl.version()); 767 ret.ref.isin = IDKind.version; 768 ret.isNew = false; 769 AbsoluteName abs = idl.absolute_name(); 770 for(j=0;j<abs.size();j++) { 771 ret.ref.sn.addScope(new String (abs.elementAt(j))); 772 } 773 r = ret; 774 ok = true; 775 } 776 } else { 777 return null; 778 } 779 } catch (TIRExceptLock e) { 780 throw new CDLExceptLock("Repository is locked."); 781 } catch (RemoteException e) { 782 throw new CDLExceptRemote("Remote exception occured: "+e.getMessage()); 783 } 784 } 785 } else { 786 return null; 787 } 788 } else { 789 ok = true; 790 } 791 } 792 return r; 793 } 794 795 } 796 | Popular Tags |