@Override public boolean accept(OpendapLeaf leaf) { String text = expressionTextField.getText(); if (StringUtils.isNullOrEmpty(text)) { return true; } text = text.replace("*", ".*").toLowerCase(); Pattern pattern = Pattern.compile(text); final Matcher matcher = pattern.matcher(leaf.getName().toLowerCase()); return matcher.matches(); }
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); }
private boolean fitsToUserSpecifiedTimeRange(OpendapLeaf leaf) { try { final ProductData.UTC[] timeStamps = timeStampExtractor.extractTimeStamps(leaf.getName());
@Test public void testGetLeaves() throws Exception { Assume.assumeTrue(!GraphicsEnvironment.isHeadless()); final CatalogTree catalogTree = new CatalogTree(null, new DefaultAppContext(""), null); List<InvDataset> datasets = new ArrayList<InvDataset>(); InvCatalog catalog = new InvCatalogImpl("catalogName", "1.0", new URI("http://x.y")); final InvDataset rootDataset = createDataset(catalog, "first", "OPENDAP"); rootDataset.getDatasets().add(createDataset(catalog, "second", "OPENDAP")); rootDataset.getDatasets().add(createDataset(catalog, "third", "OPENDAP")); datasets.add(rootDataset); catalogTree.setNewRootDatasets(datasets); OpendapLeaf[] leaves = catalogTree.getLeaves(); Arrays.sort(leaves, new Comparator<OpendapLeaf>() { @Override public int compare(OpendapLeaf o1, OpendapLeaf o2) { return o1.getName().compareTo(o2.getName()); } }); assertEquals(2, leaves.length); assertEquals("second", leaves[0].getName()); assertEquals("third", leaves[1].getName()); }