Changeset b9c0090 for axis/Create.java


Ignore:
Timestamp:
Apr 8, 2011 2:32:11 PM (13 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master
Children:
a218fe2
Parents:
e2d324a
Message:

Parses topdl to the point where it will successfully create.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • axis/Create.java

    re2d324a rb9c0090  
    55import edu.isi.www.fedd_types.*;
    66import edu.isi.www.fedd_wsdl.*;
     7
     8// Topdl classes
     9import edu.isi.www.topdl.*;
    710
    811// The fault thrown by failed commands
     
    4144
    4245    /**
     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    /**
    4362     * Create an ABAC credential indicating the the given destination acts for
    4463     * 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.
    4566     * @param id the Identity delegating authority
    4667     * @param dest the destination
     
    7091        // Parse out the args
    7192        String exptName = "test";
    72         String tclFile = "./deter-only.tcl";
     93        String topoFileName = "./deter-only.tcl";
    7394        String certFile = "./emulab.pem";
    7495        String urlString = "https://users.isi.deterlab.net:23235";
    7596
    7697        if (args.length > 0) exptName = args[0];
    77         if (args.length > 1) tclFile = args[1];
     98        if (args.length > 1) topoFileName = args[1];
    7899        if (args.length > 2) certFile = args[2];
    79100        if (args.length > 3) urlString = args[3];
     
    83104         */
    84105        FeddPortType port = getPort(urlString);
     106        File topoFile = new File(topoFileName);
    85107        Identity AbacID = null;
    86108        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 {
    89123            AbacID = new Identity(new File(certFile));
    90124        }
     
    96130        }
    97131        catch (IOException e) {
    98             System.err.println("Cannot load file " + e);
     132            System.err.println("Cannot load ABAC id from " +
     133                    certFile + ": " + e);
    99134            System.exit(20);
    100135        }
     
    122157
    123158        CreateRequestType createReq = new CreateRequestType(null,
    124                 new ExperimentDescriptionType(nsContents, null),
     159                new ExperimentDescriptionType(nsContents, topo),
    125160                null,
    126161                new IDType(null, null, null, newLabels.getLocalname(), null),
Note: See TracChangeset for help on using the changeset viewer.