Changeset 5bbad0849d0e3e3c2e87ee597cde5fe000a6f031

Show
Ignore:
Timestamp:
01/12/12 19:42:13 (4 months ago)
Author:
Ted Faber <faber@…>
Children:
6bedbdba95fa86da37dcd0fca8e04160480215bf
Parents:
cfc4d68cb4e45963ff15d3552f527f4c420f6978
git-committer:
Ted Faber <faber@isi.edu> / 2012-01-12T19:42:13Z-0800
Message:

Accomodate new info format

Location:
axis
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • axis/Ftopo.java

    rb56eb7e r5bbad08  
    2020            java.rmi.RemoteException { 
    2121 
     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 
    2228        // Get the port and construct the (simple) request. 
    23         FeddPortType port = getPort("https://users.isi.deterlab.net:23235"); 
     29        FeddPortType port = getPort(urlString); 
    2430        InfoRequestType req = new InfoRequestType( 
    25                 new IDType(null, null, null, args[0], null)); 
     31                new IDType(null, null, null, exptName, null), true, true); 
    2632        InfoResponseType resp = null; 
    27         Map<String, List<EmbeddingMapType> > tbNodes =  
    28             new TreeMap<String, List<EmbeddingMapType>>(); 
    2933        VtopoType vt = null; 
    3034        TopologyType top = null; 
     
    4549        } 
    4650 
    47         // Put each embedding mapping (object containing embedding info) into a 
    48         // List keyed by testbed. 
    49         System.out.println("From embedding:"); 
    50         for (EmbeddingMapType m: resp.getEmbedding()) { 
    51             List<EmbeddingMapType> al = null; 
    5251 
    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 
    7653        top = resp.getExperimentdescription().getTopdldescription(); 
    7754        if ( top == null ) {  
     
    8562            if ( c != null) { 
    8663                System.out.println("\t" + c.getName()); 
     64                for (String name : c.getLocalname())  
     65                    System.out.println("\t\t" + name); 
    8766                for (AttributeType a: c.getAttribute())  
    8867                    System.out.println("\t\t" + a.getAttribute() + " " + 
  • axis/ParseTopdl.java

    r31aa1ee r5bbad08  
    2323     * parser at 3 places: when an XML element starts (&lt;element&gt;) when 
    2424     * one ends (&lt;element/&gt;) and whenever characters inside an element 
    25      * are encountered.  It mostly initializes fileds as elements are exited, 
     25     * are encountered.  It mostly initializes fields as elements are exited, 
    2626     * collecting other parsed fields into objects that are finally attached to 
    2727     * the topology itself. 
     
    4848        /** the most recent name element parsed */ 
    4949        protected String name; 
     50        // Many statuses as well 
     51        protected StatusType status; 
    5052 
    5153        // CPU parameters 
     
    6264        /** Current OS distro version */ 
    6365        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 
    6472 
    6573        // Software parameters 
     
    6876        /** Current software location */ 
    6977        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; 
    7087 
    7188        // Storage parameters 
     
    136153        /** Interfaces seen so far */ 
    137154        protected Vector<InterfaceType> interfaces; 
     155        /** Services seen so far */ 
     156        protected Vector<ServiceType> services; 
     157        /** Operations seen so far */ 
     158        protected Vector<String> operations; 
    138159 
    139160        /** 
     
    157178         */ 
    158179        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; 
    159192        /** 
    160193         * The current buffer of characters collected. 
     
    183216            other = null; 
    184217 
     218            localnames = new Vector<String>(); 
     219            collectLocalnames = false; 
     220 
    185221            type = null; 
    186222            name = null; 
     
    188224 
    189225            version = distribution = distributionversion = null; 
     226            description = null; 
    190227 
    191228            install = location = null; 
     
    212249 
    213250            aname = aval = null; 
     251            importers = new Vector<String>();; 
     252            serviceParams = new Vector<ServiceParamType>(); 
    214253 
    215254            elements = new Vector<ElementType>(); 
     
    220259            storage = new Vector<StorageType>(); 
    221260            interfaces = new Vector<InterfaceType>(); 
     261            services = new Vector<ServiceType>(); 
     262            serviceParams = new Vector<ServiceParamType>(); 
    222263            attrs = new Vector<AttributeType>(); 
     264            operations = new Vector<String>(); 
    223265 
    224266            attrElements = new TreeSet<String>(); 
     
    232274            nameElements = new TreeSet<String>(); 
    233275            for (String e : new String[] { 
    234                 "computer", "os", "interface", "substrates"  
     276                "computer", "os", "interface", "substrates", "service", 
     277                "param" 
    235278            }) nameElements.add(e); 
    236279            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); 
    237291            c = new char[0]; 
    238292        } 
     
    265319                nameStack.push(name); 
    266320                name = null; 
     321            } 
     322            if ( statusElements.contains(qn) ) { 
     323                statusStack.push(status); 
     324                status = null; 
     325            } 
     326            if ( localnameElements.contains(qn) ) { 
     327                collectLocalnames = true; 
    267328            } 
    268329            if (qn.equals("id")) inID = true; 
     
    321382                        interfaces.toArray( 
    322383                            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                        ); 
    324390                name = nameStack.pop(); 
    325391                cpus = new Vector<CpuType>(); 
     
    329395                interfaces = new Vector<InterfaceType>(); 
    330396                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; 
    331402            } 
    332403            else if (qn.equals("cpu")) { 
     
    414485                        interfaces.toArray( 
    415486                            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()])); 
    417492                uri = type = null; 
    418493                interfaces = new Vector<InterfaceType>(); 
    419494                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; 
    420500            } 
    421501            else if (qn.equals("uri")) {  
     
    450530            } 
    451531            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(); 
    453534            } 
    454535            else if (qn.equals("kerberosUsername")) {  
    455536                kerberosUsername = new String(c).trim(); 
     537            } 
     538            else if (qn.equals("description")) {  
     539                description = new String(c).trim(); 
    456540            } 
    457541            else if (qn.equals("other")) {  
     
    465549            else if (qn.equals("substrates")) { 
    466550                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                        )); 
    468557                name = nameStack.pop(); 
    469558                cap = null; 
    470559                lat = null; 
    471560                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; 
    472566            } 
    473567            else if (qn.equals("attribute")) { 
     
    480574            else if ( qn.equals("value")) { aval = new String(c).trim(); } 
    481575            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            } 
    482594 
    483595            // Always clear any accumulated characters