public DAPVariable[] extractVariables(OpendapLeaf leaf) { DDS dds = getDDS(leaf.getDdsUri()); return extractVariables(dds); }
private void setMetadataText(int componentIndex, OpendapLeaf leaf) { String text = null; try { if (leaf.isDapAccess()) { if (metaInfoArea.getSelectedIndex() == DDS_AREA_INDEX) { text = OpendapUtils.getResponse(leaf.getDdsUri()); } else if (metaInfoArea.getSelectedIndex() == DAS_AREA_INDEX) { text = OpendapUtils.getResponse(leaf.getDasUri()); } } else if (leaf.isFileAccess()) { if (metaInfoArea.getSelectedIndex() == DDS_AREA_INDEX) { text = "No DDS information for file '" + leaf.getName() + "'."; } else if (metaInfoArea.getSelectedIndex() == DAS_AREA_INDEX) { text = "No DAS information for file '" + leaf.getName() + "'."; } } } catch (IOException e) { BeamLogManager.getSystemLogger().warning("Unable to retrieve meta information for file '" + leaf.getName() + "'."); } setResponseText(componentIndex, text); }
@Test public void testGetDdsURI() { assertEquals("http://domain/dap_node.dds", opendapLeaf.getDdsUri()); }
@Test public void testThatTwoDapDatasetsHaveBeenAdded() throws URISyntaxException, IOException { //preparation final URI catalogBaseUri = new URI("http://every.where/child/catalog.xml"); InputStream catalogIS = null; try { catalogIS = getThreddsCatalogInputStreamWithTwoChildDapDatasets(); //execution catalogTree.insertCatalogElements(catalogIS, catalogBaseUri, parentNode, false); //verification assertEquals(2, parentNode.getChildCount()); assertEquals(true, CatalogTreeUtils.isDapNode(parentNode.getChildAt(0))); assertEquals(true, CatalogTreeUtils.isDapNode(parentNode.getChildAt(1))); DefaultMutableTreeNode firstChild = (DefaultMutableTreeNode) parentNode.getChildAt(0); OpendapLeaf firstLeaf = (OpendapLeaf) firstChild.getUserObject(); assertEquals("http://every.where/opendap/hyrax/data/child/ProductName.N1.nc.dds", firstLeaf.getDdsUri()); DefaultMutableTreeNode secondChild = (DefaultMutableTreeNode) parentNode.getChildAt(1); OpendapLeaf secondLeaf = (OpendapLeaf) secondChild.getUserObject(); assertEquals("http://every.where/opendap/hyrax/data/child/OtherProductName.N1.nc.dds", secondLeaf.getDdsUri()); } finally { if (catalogIS != null) { catalogIS.close(); } } }