public Document getCapabilitiesDocument ( ) { Element rootElem = new Element ( "capabilities" ) ; Document doc = new Document ( rootElem ) ; if ( null != path ) { rootElem . setAttribute ( "location" , path ) ; Element elem = new Element ( "featureDataset" ) ; FeatureType ft = fdp . getFeatureType ( ) ; elem . setAttribute ( "type" , ft . toString ( ) . toLowerCase ( ) ) ; String url = path . replace ( "dataset.xml" , ft . toString ( ) . toLowerCase ( ) + ".xml" ) ; elem . setAttribute ( "url" , url ) ; rootElem . addContent ( elem ) ; } List < DsgFeatureCollection > list = fdp . getPointFeatureCollectionList ( ) ; DsgFeatureCollection fc = list . get ( 0 ) ; // LOOK maybe should pass in the dsg? rootElem . addContent ( writeTimeUnit ( fc . getTimeUnit ( ) ) ) ; rootElem . addContent ( new Element ( "AltitudeUnits" ) . addContent ( fc . getAltUnits ( ) ) ) ; // data variables List < ? extends VariableSimpleIF > vars = fdp . getDataVariables ( ) ; Collections . sort ( vars ) ; for ( VariableSimpleIF v : vars ) { rootElem . addContent ( writeVariable ( v ) ) ; } /* CollectionInfo info; try { info = new DsgCollectionHelper(fc).calcBounds(); } catch (IOException e) { throw new RuntimeException(e); } */ LatLonRect bb = fc . getBoundingBox ( ) ; if ( bb != null ) rootElem . addContent ( writeBoundingBox ( bb ) ) ; // add date range CalendarDateRange dateRange = fc . getCalendarDateRange ( ) ; if ( dateRange != null ) { Element drElem = new Element ( "TimeSpan" ) ; // from KML drElem . addContent ( new Element ( "begin" ) . addContent ( dateRange . getStart ( ) . toString ( ) ) ) ; drElem . addContent ( new Element ( "end" ) . addContent ( dateRange . getEnd ( ) . toString ( ) ) ) ; if ( dateRange . getResolution ( ) != null ) drElem . addContent ( new Element ( "resolution" ) . addContent ( dateRange . getResolution ( ) . toString ( ) ) ) ; rootElem . addContent ( drElem ) ; } /* add accept list Element elem = new Element("AcceptList"); //elem.addContent(new Element("accept").addContent("raw")); elem.addContent(new Element("accept").addContent("csv").setAttribute("displayName", "csv")); elem.addContent(new Element("accept").addContent("text/csv").setAttribute("displayName", "csv (file)")); elem.addContent(new Element("accept").addContent("xml").setAttribute("displayName", "xml")); elem.addContent(new Element("accept").addContent("text/xml").setAttribute("displayName", "xml (file)")); elem.addContent(new Element("accept").addContent("waterml2").setAttribute("displayName", "WaterML 2.0")); elem.addContent(new Element("accept").addContent("netcdf").setAttribute("displayName", "CF/NetCDF-3")); //elem.addContent(new Element("accept").addContent("ncstream")); rootElem.addContent(elem); */ return doc ; }
Create the capabilities XML document for this dataset