- Timestamp:
- Jan 12, 2012 7:42:13 PM (13 years ago)
- Branches:
- compt_changes, info-ops, master
- Children:
- 6bedbdba
- Parents:
- cfc4d68
- Location:
- axis
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
axis/Ftopo.java
rcfc4d68 r5bbad08 20 20 java.rmi.RemoteException { 21 21 22 String exptName = "test"; 23 String urlString = "https://users.isi.deterlab.net:23235"; 24 25 if (args.length > 0) exptName = args[0]; 26 if (args.length > 1) urlString = args[1]; 27 22 28 // Get the port and construct the (simple) request. 23 FeddPortType port = getPort( "https://users.isi.deterlab.net:23235");29 FeddPortType port = getPort(urlString); 24 30 InfoRequestType req = new InfoRequestType( 25 new IDType(null, null, null, args[0], null));31 new IDType(null, null, null, exptName, null), true, true); 26 32 InfoResponseType resp = null; 27 Map<String, List<EmbeddingMapType> > tbNodes =28 new TreeMap<String, List<EmbeddingMapType>>();29 33 VtopoType vt = null; 30 34 TopologyType top = null; … … 45 49 } 46 50 47 // Put each embedding mapping (object containing embedding info) into a48 // List keyed by testbed.49 System.out.println("From embedding:");50 for (EmbeddingMapType m: resp.getEmbedding()) {51 List<EmbeddingMapType> al = null;52 51 53 if (tbNodes.containsKey(m.getTestbed())) { 54 al = tbNodes.get(m.getTestbed()); 55 } 56 else { 57 al = new ArrayList<EmbeddingMapType>(); 58 tbNodes.put(m.getTestbed(), al); 59 } 60 al.add(m); 61 } 62 63 for (String tb: tbNodes.keySet()) { 64 System.out.println("Testbed: " + tb); 65 for ( EmbeddingMapType m : tbNodes.get(tb)) { 66 System.out.print("\t" + m.getToponame() + " "); 67 for ( String pn : m.getPhysname()) 68 System.out.print(pn + " " ); 69 System.out.println(); 70 } 71 System.out.println(); 72 } 73 System.out.println(); 74 75 // There's a topdl description in there, too 52 // Walk the topdl description 76 53 top = resp.getExperimentdescription().getTopdldescription(); 77 54 if ( top == null ) { … … 85 62 if ( c != null) { 86 63 System.out.println("\t" + c.getName()); 64 for (String name : c.getLocalname()) 65 System.out.println("\t\t" + name); 87 66 for (AttributeType a: c.getAttribute()) 88 67 System.out.println("\t\t" + a.getAttribute() + " " + -
axis/ParseTopdl.java
rcfc4d68 r5bbad08 23 23 * parser at 3 places: when an XML element starts (<element>) when 24 24 * one ends (<element/>) and whenever characters inside an element 25 * are encountered. It mostly initializes fi leds as elements are exited,25 * are encountered. It mostly initializes fields as elements are exited, 26 26 * collecting other parsed fields into objects that are finally attached to 27 27 * the topology itself. … … 48 48 /** the most recent name element parsed */ 49 49 protected String name; 50 // Many statuses as well 51 protected StatusType status; 50 52 51 53 // CPU parameters … … 62 64 /** Current OS distro version */ 63 65 protected String distributionversion; 66 /** Local names of this node */ 67 protected Vector<String> localnames; 68 69 /** True if in a Computer testbed or substrate that has local names */ 70 protected boolean collectLocalnames; 71 64 72 65 73 // Software parameters … … 68 76 /** Current software location */ 69 77 protected String location; 78 79 // Service Parameters 80 protected Vector<String> importers; 81 protected Vector<ServiceParamType> serviceParams; 82 protected String description; 83 84 //ServiceParam parameters 85 protected String serviceParamName; 86 protected ServiceParamTypeType serviceParamType; 70 87 71 88 // Storage parameters … … 136 153 /** Interfaces seen so far */ 137 154 protected Vector<InterfaceType> interfaces; 155 /** Services seen so far */ 156 protected Vector<ServiceType> services; 157 /** Operations seen so far */ 158 protected Vector<String> operations; 138 159 139 160 /** … … 157 178 */ 158 179 protected Stack<String> nameStack; 180 /** 181 * Analogous to attrStack for status 182 */ 183 protected Stack<StatusType> statusStack; 184 /** 185 * Analogous to attrElements for names. 186 */ 187 protected Set<String> statusElements; 188 /** 189 * These elements collect localnames 190 */ 191 protected Set<String> localnameElements; 159 192 /** 160 193 * The current buffer of characters collected. … … 183 216 other = null; 184 217 218 localnames = new Vector<String>(); 219 collectLocalnames = false; 220 185 221 type = null; 186 222 name = null; … … 188 224 189 225 version = distribution = distributionversion = null; 226 description = null; 190 227 191 228 install = location = null; … … 212 249 213 250 aname = aval = null; 251 importers = new Vector<String>();; 252 serviceParams = new Vector<ServiceParamType>(); 214 253 215 254 elements = new Vector<ElementType>(); … … 220 259 storage = new Vector<StorageType>(); 221 260 interfaces = new Vector<InterfaceType>(); 261 services = new Vector<ServiceType>(); 262 serviceParams = new Vector<ServiceParamType>(); 222 263 attrs = new Vector<AttributeType>(); 264 operations = new Vector<String>(); 223 265 224 266 attrElements = new TreeSet<String>(); … … 232 274 nameElements = new TreeSet<String>(); 233 275 for (String e : new String[] { 234 "computer", "os", "interface", "substrates" 276 "computer", "os", "interface", "substrates", "service", 277 "param" 235 278 }) nameElements.add(e); 236 279 nameStack = new Stack<String>(); 280 281 statusElements = new TreeSet<String>(); 282 for (String e : new String[] { 283 "computer", "testbed", "substrates", "service", 284 }) statusElements.add(e); 285 statusStack = new Stack<StatusType>(); 286 287 localnameElements = new TreeSet<String>(); 288 for (String e : new String[] { 289 "computer", "testbed", "substrates", 290 }) localnameElements.add(e); 237 291 c = new char[0]; 238 292 } … … 265 319 nameStack.push(name); 266 320 name = null; 321 } 322 if ( statusElements.contains(qn) ) { 323 statusStack.push(status); 324 status = null; 325 } 326 if ( localnameElements.contains(qn) ) { 327 collectLocalnames = true; 267 328 } 268 329 if (qn.equals("id")) inID = true; … … 321 382 interfaces.toArray( 322 383 new InterfaceType[interfaces.size()]), 323 attrs.toArray(new AttributeType[attrs.size()])); 384 attrs.toArray(new AttributeType[attrs.size()]), 385 localnames.toArray(new String[localnames.size()]), 386 status, 387 services.toArray(new ServiceType[services.size()]), 388 operations.toArray(new String[operations.size()]) 389 ); 324 390 name = nameStack.pop(); 325 391 cpus = new Vector<CpuType>(); … … 329 395 interfaces = new Vector<InterfaceType>(); 330 396 attrs = attrStack.pop(); 397 localnames = new Vector<String>(); 398 status = statusStack.pop(); 399 services = new Vector<ServiceType>(); 400 operations = new Vector<String>(); 401 collectLocalnames = false; 331 402 } 332 403 else if (qn.equals("cpu")) { … … 414 485 interfaces.toArray( 415 486 new InterfaceType[interfaces.size()]), 416 attrs.toArray(new AttributeType[attrs.size()])); 487 attrs.toArray(new AttributeType[attrs.size()]), 488 localnames.toArray(new String[localnames.size()]), 489 status, 490 services.toArray(new ServiceType[services.size()]), 491 operations.toArray(new String[operations.size()])); 417 492 uri = type = null; 418 493 interfaces = new Vector<InterfaceType>(); 419 494 attrs = attrStack.pop(); 495 localnames = new Vector<String>(); 496 status = statusStack.pop(); 497 services = new Vector<ServiceType>(); 498 operations = new Vector<String>(); 499 collectLocalnames = false; 420 500 } 421 501 else if (qn.equals("uri")) { … … 450 530 } 451 531 else if (qn.equals("localname")) { 452 localname = new String(c).trim(); 532 if (collectLocalnames) localnames.add(new String(c).trim()); 533 else localname = new String(c).trim(); 453 534 } 454 535 else if (qn.equals("kerberosUsername")) { 455 536 kerberosUsername = new String(c).trim(); 537 } 538 else if (qn.equals("description")) { 539 description = new String(c).trim(); 456 540 } 457 541 else if (qn.equals("other")) { … … 465 549 else if (qn.equals("substrates")) { 466 550 subs.add(new SubstrateType(name, cap, lat, 467 attrs.toArray(new AttributeType[attrs.size()]))); 551 attrs.toArray(new AttributeType[attrs.size()]), 552 localnames.toArray(new String[localnames.size()]), 553 status, 554 services.toArray(new ServiceType[services.size()]), 555 operations.toArray(new String[operations.size()]) 556 )); 468 557 name = nameStack.pop(); 469 558 cap = null; 470 559 lat = null; 471 560 attrs = attrStack.pop(); 561 localnames = new Vector<String>(); 562 status = statusStack.pop(); 563 services = new Vector<ServiceType>(); 564 operations = new Vector<String>(); 565 collectLocalnames = false; 472 566 } 473 567 else if (qn.equals("attribute")) { … … 480 574 else if ( qn.equals("value")) { aval = new String(c).trim(); } 481 575 else if ( qn.equals("name")) { name = new String(c).trim(); } 576 else if ( qn.equals("param") ) { 577 serviceParams.add(new ServiceParamType(name, 578 ServiceParamTypeType.fromString(type))); 579 name = nameStack.pop(); 580 type = null; 581 } 582 else if (qn.equals("service")) { 583 services.add(new ServiceType( 584 name, importers.toArray(new String[importers.size()]), 585 serviceParams.toArray( 586 new ServiceParamType[serviceParams.size()]), 587 description, status)); 588 name = nameStack.pop(); 589 importers = new Vector<String>(); 590 serviceParams = new Vector<ServiceParamType>(); 591 description = null; 592 status = statusStack.pop(); 593 } 482 594 483 595 // Always clear any accumulated characters
Note: See TracChangeset
for help on using the changeset viewer.