Changeset b9c0090 for axis/Create.java
- Timestamp:
- Apr 8, 2011 2:32:11 PM (13 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master
- Children:
- a218fe2
- Parents:
- e2d324a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
axis/Create.java
re2d324a rb9c0090 5 5 import edu.isi.www.fedd_types.*; 6 6 import edu.isi.www.fedd_wsdl.*; 7 8 // Topdl classes 9 import edu.isi.www.topdl.*; 7 10 8 11 // The fault thrown by failed commands … … 41 44 42 45 /** 46 * Reads a topology file as topdl. If this fails, just return null as 47 * later code will read the file as tcl. 48 * @param f The file to read 49 * @return the TopologyType encoded, or null of unparsable/unreadable 50 * @throws IOException if the file cannot be read 51 */ 52 static public TopologyType readTopdl(File f) throws IOException { 53 try { 54 ParseTopdl p = new ParseTopdl(new FileInputStream(f), "experiment"); 55 return p.getTopology(); 56 } 57 catch (IOException e) { throw e; } 58 catch (Exception e) { return null; } 59 } 60 61 /** 43 62 * Create an ABAC credential indicating the the given destination acts for 44 63 * the given Identity, and attach a certificate to it. 64 * For some reason, the parse doesn't fail silently - something in the 65 * bowels of the XML parser prints an error. Sigh. 45 66 * @param id the Identity delegating authority 46 67 * @param dest the destination … … 70 91 // Parse out the args 71 92 String exptName = "test"; 72 String t clFile = "./deter-only.tcl";93 String topoFileName = "./deter-only.tcl"; 73 94 String certFile = "./emulab.pem"; 74 95 String urlString = "https://users.isi.deterlab.net:23235"; 75 96 76 97 if (args.length > 0) exptName = args[0]; 77 if (args.length > 1) t clFile = args[1];98 if (args.length > 1) topoFileName = args[1]; 78 99 if (args.length > 2) certFile = args[2]; 79 100 if (args.length > 3) urlString = args[3]; … … 83 104 */ 84 105 FeddPortType port = getPort(urlString); 106 File topoFile = new File(topoFileName); 85 107 Identity AbacID = null; 86 108 byte[] nsContents = null; 87 try { 88 nsContents = readNsFile(new File(tclFile)); 109 TopologyType topo = null; 110 111 try { 112 113 if ( (topo = readTopdl(topoFile)) == null) 114 nsContents = readNsFile(topoFile); 115 116 } 117 catch (IOException e) { 118 System.err.println("Cannot load topology file " + e); 119 System.exit(20); 120 } 121 122 try { 89 123 AbacID = new Identity(new File(certFile)); 90 124 } … … 96 130 } 97 131 catch (IOException e) { 98 System.err.println("Cannot load file " + e); 132 System.err.println("Cannot load ABAC id from " + 133 certFile + ": " + e); 99 134 System.exit(20); 100 135 } … … 122 157 123 158 CreateRequestType createReq = new CreateRequestType(null, 124 new ExperimentDescriptionType(nsContents, null),159 new ExperimentDescriptionType(nsContents, topo), 125 160 null, 126 161 new IDType(null, null, null, newLabels.getLocalname(), null),
Note: See TracChangeset
for help on using the changeset viewer.