Fix for OODT-968 Add metadata
Project: http://git-wip-us.apache.org/repos/asf/oodt/repo Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/a88b22ae Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/a88b22ae Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/a88b22ae Branch: refs/heads/master Commit: a88b22aed938084e54a3609d55df7210c943c513 Parents: 82b5225 Author: Tom Barber <tom.bar...@jpl.nasa.gov> Authored: Wed Jan 3 15:25:01 2018 +0000 Committer: Tom Barber <tom.bar...@jpl.nasa.gov> Committed: Wed Jan 3 15:25:01 2018 +0000 ---------------------------------------------------------------------- CHANGES.txt | 1 + .../oodt/cas/filemgr/catalog/LuceneCatalog.java | 24 ++++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/oodt/blob/a88b22ae/CHANGES.txt ---------------------------------------------------------------------- diff --git a/CHANGES.txt b/CHANGES.txt index 4e50f80..9627d2f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -8,6 +8,7 @@ Release 1.3 - In Progress * OODT-957 Add CVE reporting plugin to maven build chain * OODT-958 Update commons-collections * OODT-959 Update tika to 1.16 +* OODT-968 Add metadata removes product Release 1.2 - 08/14/2017 http://git-wip-us.apache.org/repos/asf/oodt/blob/a88b22ae/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java ---------------------------------------------------------------------- diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java index 59ded25..e87a436 100644 --- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java +++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java @@ -150,26 +150,26 @@ public class LuceneCatalog implements Catalog { */ public synchronized void addMetadata(Metadata m, Product product) throws CatalogException { + CompleteProduct p if(product.getProductId()!=null && CATALOG_CACHE.containsKey(product.getProductId())) { - CompleteProduct p = CATALOG_CACHE.get(product.getProductId()); - - p.setMetadata(m); - if (hasMetadataAndRefs(p)) { - LOG.log(Level.FINE, - "metadata and references present for product: [" - + product.getProductId() + "]"); - addCompleteProductToIndex(p); - // now remove its entry from the cache - CATALOG_CACHE.remove(product.getProductId()); - } + p = CATALOG_CACHE.get(product.getProductId()); } else{ // move product from index to cache // it will be moved back after metadata is added - getCompleteProductById(product.getProductId(), true, true); + p = getCompleteProductById(product.getProductId(), true, true); LOG.log(Level.FINE, "Product not found in local cache, retrieved from index"); removeProduct(product); + } + p.setMetadata(m); + if (hasMetadataAndRefs(p)) { + LOG.log(Level.FINE, + "metadata and references present for product: [" + + product.getProductId() + "]"); + addCompleteProductToIndex(p); + // now remove its entry from the cache + CATALOG_CACHE.remove(product.getProductId()); } }