© 2008 The MITRE Corporation. All rights reserved. Developing an Open Source AIXM5 Java Library (AIXM-J) Steven Chase Lead Software Engineer MITRE/CAASD March 19, 2008
© 2008 The MITRE Corporation. All rights reserved. 2 Overview Background –Tools –Data sources Open source project –Goals –Technology –Challenges –Status –Using the library Demo
© 2008 The MITRE Corporation. All rights reserved. 3 MITRE/CAASD Background The MITRE Corporation –Private, independent, not-for-profit organization –Chartered to work in the public interest CAASD –Federally Funded Research & Development Center (FFRDC) operated by MITRE –Provides systems research and development for the Federal Aviation Administration (FAA) and international civil aviation authorities
© 2008 The MITRE Corporation. All rights reserved. 4 CAASD Developed Tools Procedure design, flyability, simulation, visualization ILS approach/airport safety analysis, CRM Safety Assessment Toolset TARGETS
© 2008 The MITRE Corporation. All rights reserved. 5 Data Sources National Flight Data Center (NFDC/NASR) AVN Information Services (AVNIS) Jeppesen National Aeronautical Charting Office (NACO) Digital Aeronautical Flight Information File (DAFIF) Digital Obstacle File (DOF) Elevation Data (DEM, DTED, etc)
© 2008 The MITRE Corporation. All rights reserved. 6 Goals Develop AIXM5 Java library that is: –Independent –Easy to use –Well documented –Extensible –AIXM5 compliant Enable applications to read/write AIXM5 data Handle large data sets
© 2008 The MITRE Corporation. All rights reserved. 7 Technology Sun JDK (5 or greater) –Enum, generics, enhanced for loop, etc. Dom4j –Library for using XML, XPath (jaxen) and XSLT –Full support for DOM, SAX and JAXP –Easy, fast, open source Why not use JAXB or XMLBeans? –In early versions, not all AIXM5 schema elements and attributes were supported –Auto-generated code may be hard to work with –Other attempts have been made
© 2008 The MITRE Corporation. All rights reserved. 8 Challenges Understanding the model Model is still changing Sample XML is limited Implementing GML
© 2008 The MITRE Corporation. All rights reserved. 9 Status Features –AirportHeliport –Runway –Navaid –Designated Point –Vertical Structure –STAR/SID –Basic Message –GML Point and ValidTime TEST OBSTACLE POLE COMPLETED STEEL RED BLACK YES NO EGM Sample XML – Vertical Structure
© 2008 The MITRE Corporation. All rights reserved. 10 Status (ctd) Includes sample programs that read/write AIXM5 –XML has not been validated Uses GNU General Public License (GPL) Hosted on Sourceforge –
© 2008 The MITRE Corporation. All rights reserved. 11 Using the Library Add aixm-j, dom4j, jaxen jar files to classpath Your Application Aviation Objects Convert to AIXM-J Objects AIXM-J Library Objects AIXM5 XML dom4j Generating AIXM5 XML
Demo Document Number Here © 2008 The MITRE Corporation. All rights reserved. 12
© 2008 The MITRE Corporation. All rights reserved. 13
© 2008 The MITRE Corporation. All rights reserved. 14 Sample Code/Notes © 2008 The MITRE Corporation. All rights reserved. 14
© 2008 The MITRE Corporation. All rights reserved. 15 Sample Conversion Method // Takes an Airport object and returns an AixmFeature object public static AixmFeature createAixmAirport(Airport airport) { // create an AixmFeature object AixmFeature ah = new AixmFeature(AixmFeatureType.AirportHeliport); // create an AixmAirportHeliportTimeSlice AixmAirportHeliportTimeSlice timeSlice = new AixmAirportHeliportTimeSlice(); // set gmlId timeSlice.setGmlId(String.valueOf(airport.getUniqueKey())); // set designator timeSlice.setDesignator(airport.getAirportId()); // set elevation AixmVerticalDistanceValue fieldElevation = new AixmVerticalDistanceValue(airport.getElevation(), AixmUomDistanceVerticalType.FT); timeSlice.setFieldElevation(fieldElevation); // set rest of fields here… // add the timeSlice to AirportHeliport ah.addTimeSlice(timeSlice); // return the AixmFeature object return ah; }
© 2008 The MITRE Corporation. All rights reserved. 16 Generating AIXM5 XML // Convert airport to AixmFeature object AixmFeature aixmAirport = AixmAirportUtil.createAixmAirport(airport); // Create dom4j Document Document document = DocumentHelper.createDocument(); // Create the root Element QName qname = QName.get(“AirportHeliport”, AixmConstants.AIXM_NAMESPACE); Element rootElement = DocumentHelper.createElement(qname); // Set the root Element, XPath won’t work until you do this document.setRootElement(element); // Call AIXM-J method to add dom4j Elements to represent the airport aixmAirport.addElements(rootElement, document); // Pretty print the document OutputFormat formatter = OutputFormat.createPrettyPrint(); try { XMLWriter writer = new XMLWriter(System.out, formatter); writer.write(document); writer.flush(); } catch (Exception ex) { ex.printStackTrace(); }
© 2008 The MITRE Corporation. All rights reserved. 17 Generated XML KIAD WASHINGTON DULLES INTL K6KIAD AD NO WASHINGTON …
© 2008 The MITRE Corporation. All rights reserved. 18 Parsing an AIXM5 ILS File // Open the file, create a BufferedReader and SAXReader FileInputStream is = new FileInputStream(new File("ILS.aixm.xml")); BufferedReader br = new BufferedReader(new InputStreamReader(is)); SAXReader saxReader = new SAXReader(); // Add handler for each Navaid tag saxReader.addHandler("/ils-subscriber-file/Navaid", new ElementHandler() { public void onEnd(ElementPath path) { Element navaidElement = path.getCurrent(); // Convert the dom4j Element to an AixmFeature object AixmFeature navaid = new AixmFeature(AixmFeatureType.Navaid).parseElements(navaidElement); // Do something with the data here, in this example we just print the object System.out.println("navaid : " + navaid); // Free up memory navaidElement.detach(); } public void onStart(ElementPath path) {/* do nothing */} } ); // Read the XML file saxReader.read(br);
© 2008 The MITRE Corporation. All rights reserved. 19 Notes AIXM – Aeronautical Information Exchange Model (AIXM) is designed to enable the management and distribution of Aeronautical Information Services (AIS) data in digital format XMLBeans – XMLBeans is a technology for accessing XML by binding it to Java types JDK – Java Development Kit, includes Java compiler, runtime environment, etc. JAXB – The Java Architecture for XML Binding SAX – Simple API for XML (SAX) is a serial access parser API for XML; event driven; user defines callback methods that are called during parsing DOM – Document Object Model (DOM) is a standard object model for representing XML formats; tree based model JAXP – Java API for XML Processing XPath – Xml Path (XPath) is a language for selecting nodes from an XML document Jaxen – Java XPath Engine (Jaxen) is an open source XPath library for Java Dom4j – dom4j is an easy to use, open source library for working with XML, XPath and XSLT XSLT – Extensible Stylesheet Language Transformations (XSLT) is a language for transforming XML documents into other XML documents
© 2008 The MITRE Corporation. All rights reserved. 20 Notes (ctd) CAASD – Center for Advanced Aviation System Development, operated by MITRE TARGETS – Terminal Area Route Generation, Evaluation and Traffic Simulation ILS – Instrument Landing System CRM – Collision Risk Model DEM – Digital Elevation Model DTED – Digital Terrain Elevation Data NASR – National Airspace System Resources