perfsonar-dev - Re: cannot add child org.ggf.ns.nmwg.topology.l3.v3_0.Link to Data?
Subject: perfsonar development work
List archive
- From: ulisses <>
- To: Jason Zurawski <>
- Cc:
- Subject: Re: cannot add child org.ggf.ns.nmwg.topology.l3.v3_0.Link to Data?
- Date: Tue, 25 Jul 2006 17:22:28 +0200
Hi Jason!
I attach the code in this e-mail
the main functions in performAction are:
fillNodesNetworks // describes links and it's childs and fail to convert XML
to DOM
fillNodes // describes Nodes and it's childs and its XML is converted
properly to DOM
Thanks so much
ulisses
On 2006-07-25 09:19:06, Jason Zurawski wrote:
> Ulisses;
>
> >it worked as you said, but the xml cannot be converted to DOM, the
> >minimum version I found of an xml result that cannot converted [1] is
> >inserting only one Link:
> >
> ><nmwg:message id="localhost.localdomain.1dd5faf9:10ca4666fcf:-7fea"
> > type="TOPSDownloadDBResponse"
> > xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/">
> > <nmwg:metadata id="TOPSDownloadDBResponseMetadata"/>
> > <nmwg:data id="TOPSDownloadDBResponse"
> > metadataIdRef="TOPSDownloadDBResponseMetadata">
> > <nmwg:metadata id="TOPSDownloadDBResponseMetadata"/>
> > <nmwgtopo3:link
> > id="localhost.localdomain.1dd5faf9:10ca4666fcf:-7feb"
> > xmlns:nmwgtopo3="http://ggf.org/ns/nmwg/topology/l3/3.0/">
> > <nmwgtopo3:interface
> > id="localhost.localdomain.1dd5faf9:10ca4666fcf:-7fec">
> >
> > <nmwgtopo3:ifDescription>GE-0/0/0.20</nmwgtopo3:ifDescription>
> > <nmwgtopo3:type>other</nmwgtopo3:type>
> > <nmwgtopo3:capacity>0</nmwgtopo3:capacity>
> > <nmwgtopo3:netmask>62.40.98.40/29</nmwgtopo3:netmask>
> > <nmwgtopo3:ipAddress value="62.40.98.41"/>
> > </nmwgtopo3:interface>
> > <nmwgtopo3:name>be1.be.geant.net_62.40.98.40/29 -
> > _</nmwgtopo3:name>
> > </nmwgtopo3:link>
> > </nmwg:data>
> ></nmwg:message>
> >
> >I don't think the problem is the header/metadata because if I insert only
> >Nodes:
> >
> ><nmwg:message id="localhost.localdomain.-34e31349:10ca46f251b:-7ee2"
> > type="TOPSDownloadDBResponse"
> > xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/">
> > <nmwg:metadata id="TOPSDownloadDBResponseMetadata"/>
> > <nmwg:data id="TOPSDownloadDBResponse"
> > metadataIdRef="TOPSDownloadDBResponseMetadata">
> > <nmwg:metadata id="TOPSDownloadDBResponseMetadata"/>
> > <nmwgtopo3:node
> > id="localhost.localdomain.-34e31349:10ca46f251b:-7f8f"
> > xmlns:nmwgtopo3="http://ggf.org/ns/nmwg/topology/base/3.0/">
> > <nmwgtopo3:hostName>bodo-gw.uninett.no</nmwgtopo3:hostName>
> > <nmwgtopo3:name>bodo-gw.uninett.no</nmwgtopo3:name>
> > </nmwgtopo3:node>
> > <nmwgtopo3:node
> > id="localhost.localdomain.-34e31349:10ca46f251b:-7fe5"
> > xmlns:nmwgtopo3="http://ggf.org/ns/nmwg/topology/base/3.0/">
> > <nmwgtopo3:hostName>de2.de.geant.net</nmwgtopo3:hostName>
> > <nmwgtopo3:name>de2.de.geant.net</nmwgtopo3:name>
> > </nmwgtopo3:node>
> > </nmwg:data>
> ></nmwg:message>
> >
> >it is converted correctly
> >
> >any comment will be greatly appreciated
> >
> >Thanks
> >
> > Ulisses
> >
> >
> >[1]
> >
> ><?xml version="1.0" encoding="UTF-8"?>
> ><nmwg:message xmlns:nmwg="http://ggf.org/ns/nmwg/base/2.0/"
> >id="resultCodeMessage">
> > <nmwg:metadata id="resultCodeMetadata">
> > <nmwg:eventType>error.common.parse_error</nmwg:eventType>
> > </nmwg:metadata>
> > <nmwg:data id="resultDescriptionData_for_resultCodeMetadata"
> > metadataIdRef="resultCodeMetadata">
> > <nmwg:datum value="Cannot convert Message to DOM" />
> > </nmwg:data>
> ></nmwg:message>
> >
>
> I would need to see the code, perhaps there is a collision on the child
> hash.
>
> -jason
>
>
package org.perfsonar.service.topologyService; import org.ggf.ns.nmwg.base.v2_0.*; import org.ggf.ns.nmwg.topology.base.v3_0.*; import org.ggf.ns.nmwg.topology.l3.v3_0.*; import org.perfsonar.commons.util.XMLUtils; import org.perfsonar.service.commons.exceptions.DataFormatException; import org.perfsonar.service.commons.exceptions.RequestException; import org.perfsonar.service.commons.exceptions.SystemException; import org.perfsonar.service.commons.storage.StorageManager; import java.util.Vector; import java.util.Hashtable; import java.sql.*; // for jdbc // import org.postgresql.Driver; // Class.forName("org.postgresql.Driver"); /** * Topology Service Action * * @author Ulisses, using Maciej Glowiak's code as skeleton * */ public class TopsDownloadDBAction extends TopsAction { // -------------------------------------------------------------- Constants // ----------------------------------------------------- instance variables private Connection conn = null; // The object to connect to the SQL database // ----------------------------------------------------------- Constructor public TopsDownloadDBAction(Connection jdbc) throws SystemException { super(jdbc); // TODO: is this right?, if I don't put this here it doesn't compile/works conn= jdbc; } // --------------------------------------------------------- Public methods public Message performAction(Message request) throws SystemException, RequestException, DataFormatException { Hashtable nodes_interfaces; String m; logger.debug("TopServiceEngine: performing TopsDownloadDBAction..."); Message response = new Message(); response.setType("TOPSDownloadDBResponse"); Metadata responseMetadata = new Metadata(); responseMetadata.setId("TOPSDownloadDBResponseMetadata"); response.addChild(responseMetadata); Data responseData = new Data(); responseData.setId("TOPSDownloadDBResponse"); responseData.setMetadata(responseMetadata); // Maciej says .addChild(responseMetadata); is equivalent responseData.setMetadataIdRef("TOPSDownloadDBResponseMetadata"); // fill the responseData, first networks, nodes afterwards // nodes_interfaces= fillNodesNetworks(responseData); // fillNodes(responseData, nodes_interfaces); fillNodes(responseData); // response.addChild(responseData); // this is equivalent: response.setData(responseData); logger.info("TopServiceEngine: before returning response"); m= "TopServiceEngine:finally response is:\n" + XMLUtils.serializeXML(response); logger.debug(m); return response; } // private & protected methods protected Long getSpeedOfInterface(Long speed, Long if_highspeed, Long if_speed) { // The reason of encapsulating this in a method is to allow consistency checks // with the values filled Long retval; // speed > if_high_speed > if_speed, where '>' means higher preference if (speed > 0) { retval= speed; } else if (if_highspeed > 0) { retval= if_highspeed; } else { retval= if_speed; } return retval; } protected String convertIfTypeToDescription(int ifType) { String conv[] = { "unused", "other", // (1), -- none of the following "regular1822", // (2), "hdh1822", // (3), "ddnX25", // (4), "rfc877x25", // (5), "ethernetCsmacd", // (6), "iso88023Csmacd", // (7), -- Deprecated via RFC-draft-ietf-hubmib-etherif-mib-v3 ethernetCsmacd (6) should be used instead "iso88024TokenBus", // (8), "iso88025TokenRing", // (9), "iso88026Man", // (10), "starLan", // (11), -- Deprecated via RFC-draft-ietf-hubmib-etherif-mib-v3 ethernetCsmacd (6) should be used instead "proteon10Mbit", // (12), "proteon80Mbit", // (13), "hyperchannel", // (14), "fddi", // (15), "lapb", // (16), "sdlc", // (17), "ds1", // (18), -- DS1-MIB "e1", // (19), -- Obsolete see DS1-MIB "basicISDN", // (20), "primaryISDN", // (21), "propPointToPointSerial", // (22), -- proprietary serial "ppp", // (23), "softwareLoopback", // (24), "eon", // (25), -- CLNP over IP "ethernet3Mbit", // (26), "nsip", // (27), -- XNS over IP "slip", // (28), -- generic SLIP "ultra", // (29), -- ULTRA technologies "ds3", // (30), -- DS3-MIB "sip", // (31), -- SMDS, coffee "frameRelay", // (32), -- DTE only. "rs232", // (33), "para", // (34), -- parallel-port "arcnet", // (35), -- arcnet "arcnetPlus", // (36), -- arcnet plus "atm", // (37), -- ATM cells "miox25", // (38), "sonet", // (39), -- SONET or SDH "x25ple", // (40), "iso88022llc", // (41), "localTalk", // (42), "smdsDxi", // (43), "frameRelayService", // (44), -- FRNETSERV-MIB "v35", // (45), "hssi", // (46), "hippi", // (47), "modem", // (48), -- Generic modem "aal5", // (49), -- AAL5 over ATM "sonetPath", // (50), "sonetVT", // (51), "smdsIcip", // (52), -- SMDS InterCarrier Interface "propVirtual", // (53), -- proprietary virtual/internal "propMultiplexor", // (54),-- proprietary multiplexing "ieee80212", // (55), -- 100BaseVG "fibreChannel", // (56), -- Fibre Channel "hippiInterface", // (57), -- HIPPI interfaces "frameRelayInterconnect", // (58), -- Obsolete use either "frameRelay", // (32) or "frameRelayService", // (44). "aflane8023", // (59), -- ATM Emulated LAN for 802.3 "aflane8025", // (60), -- ATM Emulated LAN for 802.5 "cctEmul", // (61), -- ATM Emulated circuit "fastEther", // (62), -- Obsoleted via RFC-draft-ietf-hubmib-etherif-mib-v3 ethernetCsmacd (6) should be used instead "isdn", // (63), -- ISDN and X.25 "v11", // (64), -- CCITT V.11/X.21 "v36", // (65), -- CCITT V.36 "g703at64k", // (66), -- CCITT G703 at 64Kbps "g703at2mb", // (67), -- Obsolete see DS1-MIB "qllc", // (68), -- SNA QLLC "fastEtherFX", // (69), -- Obsoleted via RFC-draft-ietf-hubmib-etherif-mib-v3 ethernetCsmacd (6) should be used instead "channel", // (70), -- channel "ieee80211", // (71), -- radio spread spectrum "ibm370parChan", // (72), -- IBM System 360/370 OEMI Channel "escon", // (73), -- IBM Enterprise Systems Connection "dlsw", // (74), -- Data Link Switching "isdns", // (75), -- ISDN S/T interface "isdnu", // (76), -- ISDN U interface "lapd", // (77), -- Link Access Protocol D "ipSwitch", // (78), -- IP Switching Objects "rsrb", // (79), -- Remote Source Route Bridging "atmLogical", // (80), -- ATM Logical Port "ds0", // (81), -- Digital Signal Level 0 "ds0Bundle", // (82), -- group of ds0s on the same ds1 "bsc", // (83), -- Bisynchronous Protocol "async", // (84), -- Asynchronous Protocol "cnr", // (85), -- Combat Net Radio "iso88025Dtr", // (86), -- ISO 802.5r DTR "eplrs", // (87), -- Ext Pos Loc Report Sys "arap", // (88), -- Appletalk Remote Access Protocol "propCnls", // (89), -- Proprietary Connectionless Protocol "hostPad", // (90), -- CCITT-ITU X.29 PAD Protocol "termPad", // (91), -- CCITT-ITU X.3 PAD Facility "frameRelayMPI", // (92), -- Multiproto Interconnect over FR "x213", // (93), -- CCITT-ITU X213 "adsl", // (94), -- Asymmetric Digital Subscriber Loop "radsl", // (95), -- Rate-Adapt. Digital Subscriber Loop "sdsl", // (96), -- Symmetric Digital Subscriber Loop "vdsl", // (97), -- Very H-Speed Digital Subscrib. Loop "iso88025CRFPInt", // (98), -- ISO 802.5 CRFP "myrinet", // (99), -- Myricom Myrinet "voiceEM", // (100), -- voice recEive and transMit "voiceFXO", // (101), -- voice Foreign Exchange Office "voiceFXS", // (102), -- voice Foreign Exchange Station "voiceEncap", // (103), -- voice encapsulation "voiceOverIp", // (104), -- voice over IP encapsulation "atmDxi", // (105), -- ATM DXI "atmFuni", // (106), -- ATM FUNI "atmIma", // (107), -- ATM IMA "pppMultilinkBundle", // (108), -- PPP Multilink Bundle "ipOverCdlc", // (109), -- IBM ipOverCdlc "ipOverClaw", // (110), -- IBM Common Link Access to Workstn "stackToStack", // (111), -- IBM stackToStack "virtualIpAddress", // (112), -- IBM VIPA "mpc", // (113), -- IBM multi-protocol channel support "ipOverAtm", // (114), -- IBM ipOverAtm "iso88025Fiber", // (115), -- ISO 802.5j Fiber Token Ring "tdlc", // (116), -- IBM twinaxial data link control "gigabitEthernet", // (117), -- Obsoleted via RFC-draft-ietf-hubmib-etherif-mib-v3 ethernetCsmacd (6) should be used instead "hdlc", // (118), -- HDLC "lapf", // (119), -- LAP F "v37", // (120), -- V.37 "x25mlp", // (121), -- Multi-Link Protocol "x25huntGroup", // (122), -- X25 Hunt Group "trasnpHdlc", // (123), -- Transp HDLC "interleave", // (124), -- Interleave channel "fast", // (125), -- Fast channel "ip", // (126), -- IP (for APPN HPR in IP networks) "docsCableMaclayer", // (127), -- CATV Mac Layer "docsCableDownstream", // (128), -- CATV Downstream interface "docsCableUpstream", // (129), -- CATV Upstream interface "a12MppSwitch", // (130), -- Avalon Parallel Processor "tunnel", // (131), -- Encapsulation interface "coffee", // (132), -- coffee pot "ces", // (133), -- Circuit Emulation Service "atmSubInterface", // (134), -- ATM Sub Interface "l2vlan", // (135), -- Layer 2 Virtual LAN using 802.1Q "l3ipvlan", // (136), -- Layer 3 Virtual LAN using IP "l3ipxvlan", // (137), -- Layer 3 Virtual LAN using IPX "digitalPowerline", // (138), -- IP over Power Lines "mediaMailOverIp", // (139), -- Multimedia Mail over IP "dtm", // (140), -- Dynamic syncronous Transfer Mode "dcn", // (141), -- Data Communications Network "ipForward", // (142), -- IP Forwarding Interface "msdsl", // (143), -- Multi-rate Symmetric DSL "ieee1394", // (144), -- IEEE1394 High Performance Serial Bus "if", // -gsn (145), -- HIPPI-6400 "dvbRccMacLayer", // (146), -- DVB-RCC MAC Layer "dvbRccDownstream", // (147), -- DVB-RCC Downstream Channel "dvbRccUpstream", // (148), -- DVB-RCC Upstream Channel "atmVirtual", // (149), -- ATM Virtual Interface "mplsTunnel", // (150), -- MPLS Tunnel Virtual Interface "srp", // (151), -- Spatial Reuse Protocol "voiceOverAtm", // (152), -- Voice Over ATM "voiceOverFrameRelay", // (153), -- Voice Over Frame Relay "idsl", // (154), -- Digital Subscriber Loop over ISDN "compositeLink", // (155), -- Avici Composite Link Interface "ss7SigLink", // (156), -- SS7 Signaling Link "propWirelessP2P", // (157), -- Prop. P2P wireless interface "frForward", // (158), -- Frame Forward Interface "rfc1483", // (159), -- Multiprotocol over ATM AAL5 "usb", // (160), -- USB Interface "ieee8023adLag", // (161), -- IEEE 802.3ad Link Aggregate "bgppolicyaccounting", // (162), -- BGP Policy Accounting "frf16MfrBundle", // (163), -- FRF .16 Multilink Frame Relay "h323Gatekeeper", // (164), -- H323 Gatekeeper "h323Proxy", // (165), -- H323 Voice and Video Proxy "mpls", // (166), -- MPLS "mfSigLink", // (167), -- Multi-frequency signaling link "hdsl2", // (168), -- High Bit-Rate DSL - 2nd generation "shdsl", // (169), -- Multirate HDSL2 "ds1FDL", // (170), -- Facility Data Link 4Kbps on a DS1 "pos", // (171), -- Packet over SONET/SDH Interface "dvbAsiIn", // (172), -- DVB-ASI Input "dvbAsiOut", // (173), -- DVB-ASI Output "plc", // (174), -- Power Line Communtications "nfas", // (175), -- Non Facility Associated Signaling "tr008", // (176), -- TR008 "gr303RDT", // (177), -- Remote Digital Terminal "gr303IDT", // (178), -- Integrated Digital Terminal "isup", // (179), -- ISUP "propDocsWirelessMaclayer", // (180), -- prop/Maclayer "propDocsWirelessDownstream", // (181), -- prop/Downstream "propDocsWirelessUpstream", // (182), -- prop/Upstream "hiperlan2", // (183), -- HIPERLAN Type 2 Radio Interface "propBWAp2Mp", // (184), -- PropBroadbandWirelessAccesspt2multipt "sonetOverheadChannel", // (185), -- SONET Overhead Channel "digitalWrapperOverheadChannel", // (186), -- Digital Wrapper "aal2", // (187), -- ATM adaptation layer 2 "radioMAC", // (188), -- MAC layer over radio links "atmRadio", // (189), -- ATM over radio links "imt", // (190), -- Inter Machine Trunks "mvl", // (191), -- Multiple Virtual Lines DSL "reachDSL", // (192), -- Long Reach DSL "frDlciEndPt", // (193), -- Frame Relay DLCI End Point "atmVciEndPt", // (194), -- ATM VCI End Point "opticalChannel", // (195), -- Optical Channel "opticalTransport", // (196), -- Optical Transport "propAtm", // (197), -- Proprietary ATM "voiceOverCable", // (198), -- Voice Over Cable Interface "infiniband", // (199), -- Infiniband "teLink", // (200), -- TE Link "q2931", // (201), -- Q.2931 "virtualTg", // (202), -- Virtual Trunk Group "sipTg", // (203), -- SIP Trunk Group "sipSig", // (204), -- SIP Signaling "docsCableUpstreamChannel", // (205), -- CATV Upstream Channel "econet", // (206), -- Acorn Econet "pon155", // (207), -- FSAN 155Mb Symetrical PON interface "pon622", // (208), -- FSAN622Mb Symetrical PON interface "bridge", // (209), -- Transparent bridge interface "linegroup", // (210), -- Interface common to multiple lines "voiceEMFGD", // (211), -- voice E&M Feature Group D "voiceFGDEANA", // (212), -- voice FGD Exchange Access North American "voiceDID", // (213), -- voice Direct Inward Dialing "mpegTransport", // (214), -- MPEG transport interface "sixToFour", // (215), -- 6to4 interface "gtp", // (216), -- GTP (GPRS Tunneling Protocol) "pdnEtherLoop1", // (217), -- Paradyne EtherLoop 1 "pdnEtherLoop2", // (218), -- Paradyne EtherLoop 2 "opticalChannelGroup", // (219), -- Optical Channel Group "homepna", // (220), -- HomePNA ITU-T G.989 "gfp", // (221), -- Generic Framing Procedure (GFP) "ciscoISLvlan", // (222), -- Layer 2 Virtual LAN using Cisco ISL "actelisMetaLOOP", // (223), -- Acteleis proprietary MetaLOOP High Speed Link "fcipLink" // (224) -- FCIP Link }; if ((ifType == 0) || (ifType > conv.length)) { return conv[1]; // return "other", interface type not supported } return conv[ifType]; } protected Vector fillNetworkInterfaces(org.ggf.ns.nmwg.topology.l3.v3_0.Link link, int network_oid) throws SystemException { String select_network_interfaces= "SELECT speed, if_highspeed, if_speed, " + "if_type, if_index, if_description, " + "default_ip_interface_address, default_ip_network_subnet_prefix, object_id " + "FROM network_interface " + "WHERE object_id IN " + "(SELECT network_interface_object_id " + "FROM network_to_interface " + "WHERE network_object_id = " + network_oid + " )"; Statement st; ResultSet rs; Long speed; Vector<String> interfaces = new Vector<String>(); String interface_ref; int i= 0; try { st= conn.createStatement(); rs= st.executeQuery(select_network_interfaces); while(rs.next()) { interface_ref = "private_index: " + i; org.ggf.ns.nmwg.topology.l3.v3_0.Interface iface= new org.ggf.ns.nmwg.topology.l3.v3_0.Interface(); org.ggf.ns.nmwg.topology.l3.v3_0.Type type= new org.ggf.ns.nmwg.topology.l3.v3_0.Type(); type.setType(convertIfTypeToDescription(rs.getInt(4))); iface.setTypeElement(type); if (rs.getString(5) != null) { org.ggf.ns.nmwg.topology.l3.v3_0.IfIndex ifindex= new org.ggf.ns.nmwg.topology.l3.v3_0.IfIndex(); ifindex.setIfIndex(rs.getString(5)); iface.setIfIndexElement(ifindex); interface_ref+= "snmp_ifindex: " + rs.getString(5); } else { interface_ref+= ", snmp_ifindex: unknown"; } if (rs.getString(6) != null) { org.ggf.ns.nmwg.topology.l3.v3_0.IfDescription ifdescription= new org.ggf.ns.nmwg.topology.l3.v3_0.IfDescription(); ifdescription.setIfDescription(rs.getString(6)); iface.setIfDescriptionElement(ifdescription); } speed= getSpeedOfInterface(rs.getLong(1), rs.getLong(2), rs.getLong(3)); org.ggf.ns.nmwg.topology.l3.v3_0.Capacity capacity= new org.ggf.ns.nmwg.topology.l3.v3_0.Capacity(); capacity.setCapacity(speed.toString()); iface.setCapacityElement(capacity); if (rs.getString(7) != null) { IpAddress ipaddress= new IpAddress(); ipaddress.setIpAddress(rs.getString(7)); iface.setIpAddressElement(ipaddress); } if (rs.getString(8) != null) { Netmask netmask= new Netmask(); netmask.setNetmask(rs.getString(8)); iface.setNetmaskElement(netmask); } link.addChild(iface); interfaces.addElement(interface_ref); i++; } // end of while() } catch (SQLException e) { throw new SystemException("TopServiceEngine: fillNetworkInterfaces: error while fetching from the database:" + e.getMessage()); } return interfaces; } protected Vector fillNetwork(Data responseData, int network_oid) throws SystemException { String select_network= "SELECT network_type, network_name " + "FROM network " + "WHERE object_id = " + network_oid; Statement st; ResultSet rs; Vector interfaces= new Vector(); try { st= conn.createStatement(); rs= st.executeQuery(select_network); while (rs.next()) { org.ggf.ns.nmwg.topology.l3.v3_0.Link link= new org.ggf.ns.nmwg.topology.l3.v3_0.Link(); if (rs.getString(1) != null) { org.ggf.ns.nmwg.topology.l3.v3_0.Type type= new org.ggf.ns.nmwg.topology.l3.v3_0.Type(); type.setType(rs.getString(1)); link.setTypeElement(type); } if (rs.getString(2) != null) { org.ggf.ns.nmwg.topology.l3.v3_0.Name name= new org.ggf.ns.nmwg.topology.l3.v3_0.Name(); name.setName(rs.getString(2)); link.setNameElement(name); } interfaces= fillNetworkInterfaces(link, network_oid); logger.debug("ulisses: adding link " +rs.getString(1) +", " +rs.getString(2)+", " +network_oid); responseData.setChild(link); // TODO: remove: String mm= "now: link is:\n" + XMLUtils.serializeXML(link); // TODO: remove: logger.debug(mm); } rs.close(); st.close(); } catch (SQLException e) { throw new SystemException("TopServiceEngine: fillNetwork: error while fetching from the database:" + e.getMessage()); } return interfaces; } protected Hashtable fillNodesNetworks(Data responseData) throws SystemException { try { int i= 2; Statement st = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); ResultSet rs; String select_network_oid= "SELECT network_object_id FROM network_to_interface " + "WHERE network_interface_object_id IN " + "( SELECT object_id FROM network_interface WHERE object_id IN " + "( SELECT object_id FROM network_interface_key WHERE object_id_of_network_node IN " + "( SELECT object_id from network_node )))"; int network_oid; int rowcount; rs= st.executeQuery(select_network_oid); rs.last(); rowcount = rs.getRow(); // Get the row position which is also the number of rows in the ResultSet. rs.beforeFirst(); // Reposition at the beginning of the ResultSet to take up rs.next() call. Hashtable<Integer,Vector> nodes_interfaces= new Hashtable<Integer,Vector>(rowcount); while ((--i != 0) && (rs.next())) { // iterate results Vector interfaces; network_oid= rs.getInt(1); interfaces= fillNetwork(responseData, network_oid); nodes_interfaces.put(network_oid, interfaces); } rs.close(); st.close(); String m= "now: response is:\n" + XMLUtils.serializeXML(responseData); logger.debug(m); return nodes_interfaces; } catch (SQLException e) { throw new SystemException("TopServiceEngine: fillNodesNetworks: error while fetching from the database:" + e.getMessage()); } } // protected void fillNodes(Data responseData, Hashtable nodes_interfaces) throws SystemException { protected void fillNodes(Data responseData) throws SystemException { String m; Statement st; ResultSet rs; int i= 20; try { String query= "SELECT ip_management_address, " + "network_node_type_id, location_id, " + "dns_name1, dns_name2, usage_type, name, " + "object_id " + "FROM network_node"; st= conn.createStatement(); rs= st.executeQuery(query); while (rs.next()) { // iterate results Node node= new Node(); if (rs.getString(4) != null) { // HostName is optional HostName hostname= new HostName(); hostname.setHostName(rs.getString(4)); node.setHostNameElement(hostname); } if (rs.getString(6) != null) { // Type is optional org.ggf.ns.nmwg.topology.base.v3_0.Type type= new org.ggf.ns.nmwg.topology.base.v3_0.Type(); type.setType(rs.getString(6)); node.setTypeElement(type); } if (rs.getString(7) != null) { // Name is optional org.ggf.ns.nmwg.topology.base.v3_0.Name name= new org.ggf.ns.nmwg.topology.base.v3_0.Name(); name.setName(rs.getString(7)); node.setNameElement(name); } responseData.addChild(node); } rs.close(); st.close(); } catch (SQLException e) { throw new SystemException("TopServiceEngine: fillNodes: error while fetching from the database:" + e.getMessage()); } return; } }
- Re: cannot add child org.ggf.ns.nmwg.topology.l3.v3_0.Link to Data?, Jason Zurawski, 07/25/2006
- Re: cannot add child org.ggf.ns.nmwg.topology.l3.v3_0.Link to Data?, ulisses, 07/25/2006
- Re: [pS-dev] Re: cannot add child org.ggf.ns.nmwg.topology.l3.v3_0.Link to Data?, Jason Zurawski, 07/25/2006
- Re: cannot add child org.ggf.ns.nmwg.topology.l3.v3_0.Link to Data?, ulisses, 07/25/2006
Archive powered by MHonArc 2.6.16.