*/
public void updateCatalogMetadata(Product product, Metadata newMetadata)
throws CatalogException, FileNotFoundException, IOException {
System.getProperties().load(
new FileInputStream(CurationService.config.getFileMgrProps()));
Catalog catalog = GenericFileManagerObjectFactory
.getCatalogServiceFromFactory("org.apache.oodt.cas.curation.util.CuratorLuceneCatalogFactory");
Metadata oldMetadata = catalog.getMetadata(product);
List<Reference> references = catalog.getProductReferences(product);
Product newProduct = new Product(product.getProductName(), product
.getProductType(), product.getProductStructure(), product
.getTransferStatus(), product.getProductReferences());
// Constructor is bugged and doesn't set transfer status
newProduct.setTransferStatus(product.getTransferStatus());
catalog.removeMetadata(oldMetadata, product);
catalog.removeProduct(product);
newProduct.setProductId(product.getProductId());
catalog.addProduct(newProduct);
newProduct.setProductReferences(references);
catalog.addProductReferences(newProduct);
catalog.addMetadata(newMetadata, newProduct);
}