public synchronized void loadProducts(ProgressMonitor pm) { products = productLocationType.findProducts(path, pm); }
@Override public int hashCode() { int result = productLocationType.hashCode(); result = 31 * result + path.hashCode(); return result; } }
private static void addProductToResult(Map<String, Product> result, File file) { try { final Product product = readSingleProduct(file); putIfNotNull(result, product); } catch (IOException e) { // ok; add nothing to result map. } }
private void initProductLocations() { MetadataElement tsElem = tsProduct.getMetadataRoot().getElement(TIME_SERIES_ROOT_NAME); MetadataElement productListElem = tsElem.getElement(PRODUCT_LOCATIONS); MetadataElement[] productElems = productListElem.getElements(); productLocationList = new ArrayList<ProductLocation>(productElems.length); final File fileLocation = tsProduct.getProduct().getFileLocation(); for (MetadataElement productElem : productElems) { String path = productElem.getAttributeString(PL_PATH); File productFile; if (fileLocation != null) { final URI resolvedUri = fileLocation.toURI().resolve(path); productFile = new File(resolvedUri); } else { productFile = new File(path); } String type = productElem.getAttributeString(PL_TYPE); productLocationList.add(new ProductLocation(ProductLocationType.valueOf(type), productFile.getAbsolutePath())); } }
private void addProductLocationMetadata(ProductLocation productLocation) { MetadataElement productLocationsElement = tsProduct.getMetadataRoot(). getElement(TIME_SERIES_ROOT_NAME). getElement(PRODUCT_LOCATIONS); // @todo - nur produkt pfade, keine Verzeichnisse ProductData productPath = ProductData.createInstance(productLocation.getPath()); ProductData productType = ProductData.createInstance(productLocation.getProductLocationType().toString()); int length = productLocationsElement.getElements().length + TimeSeriesChangeEvent.BAND_TO_BE_REMOVED; MetadataElement elem = new MetadataElement( String.format("%s.%s", PRODUCT_LOCATIONS, Integer.toString(length))); elem.addAttribute(new MetadataAttribute(PL_PATH, productPath, true)); elem.addAttribute(new MetadataAttribute(PL_TYPE, productType, true)); productLocationsElement.addElement(elem); }