@Override public void addFiles(File... files) { final int startIndex = productLocationList.size(); for (File file : files) { productLocationList.add(new ProductLocation(ProductLocationType.FILE, file.getAbsolutePath())); } final int stopIndex = productLocationList.size() - 1; fireIntervalAdded(this, startIndex, stopIndex); }
@Override public void addDirectory(File directory, boolean recursive) { final ProductLocationType locationType = recursive ? ProductLocationType.DIRECTORY_REC : ProductLocationType.DIRECTORY; productLocationList.add(new ProductLocation(locationType, directory.getPath())); final int index = productLocationList.size() - 1; fireIntervalAdded(this, index, index); }
@Override public void addDirectory(File directory, boolean recursive) { timeSeries.addProductLocation( new ProductLocation(recursive ? ProductLocationType.DIRECTORY_REC : ProductLocationType.DIRECTORY, directory.getAbsolutePath())); final int index = timeSeries.getProductLocations().size() - 1; fireIntervalAdded(this, index, index); }
@Override public void addFiles(File... files) { final int startIndex = timeSeries.getProductLocations().size(); for (File file : files) { timeSeries.addProductLocation(new ProductLocation(ProductLocationType.FILE, file.getAbsolutePath())); } final int stopIndex = timeSeries.getProductLocations().size() - 1; fireIntervalAdded(this, startIndex, stopIndex); }
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())); } }