@VisibleForTesting static List<URI> getProductReferences( String productId, FileManagerClient fmClient) throws URISyntaxException, CatalogException { List<URI> files = Lists.newArrayList(); Product product = new Product(); product.setProductId(productId); List<Reference> refs = fmClient.getProductReferences(product); for (Reference ref : refs) { files.add(new URI(ref.getDataStoreReference())); } return files; }
@VisibleForTesting static Product createProduct(URI path) { Product product = new Product(); product.setProductStructure(Product.STRUCTURE_FLAT); //TODO: only support flat prods for now Reference reference = new Reference(); reference.setDataStoreReference(path.toString()); product.setProductReferences(Lists.newArrayList(reference)); return product; } }
public CompleteProduct() { product = new Product(); product.setProductType(new ProductType()); metadata = new Metadata(); }
public boolean removeFile(String filePath) throws DataTransferException, IOException { // TODO(bfoster): Clean this up so that it deletes by product not file. Product product = new Product(); Reference r = new Reference(); r.setDataStoreReference(filePath); product.setProductReferences(Lists.newArrayList(r)); dataTransfer.deleteProduct(product); return true; }
public boolean removeFile(String filePath) throws DataTransferException, IOException { // TODO(bfoster): Clean this up so that it deletes by product not file. Product product = new Product(); Reference r = new Reference(); r.setDataStoreReference(filePath); product.setProductReferences(Lists.newArrayList(r)); dataTransfer.deleteProduct(product); return true; }
public CompleteProduct() { product = new Product(); product.setProductType(new ProductType()); metadata = new Metadata(); }
public boolean removeFile(String filePath) throws DataTransferException, IOException { // TODO(bfoster): Clean this up so that it deletes by product not file. Product product = new Product(); Reference r = new Reference(); r.setDataStoreReference(filePath); product.setProductReferences(Lists.newArrayList(r)); dataTransfer.deleteProduct(product); return true; }
public static Product toScienceDataProduct(ResultSet rs) throws SQLException { Product product = new Product(); product.setProductId(rs.getString("granule_id")); product.setProductName(rs.getString("filename")); product.setProductStructure(Product.STRUCTURE_FLAT); product.setTransferStatus(Product.STATUS_RECEIVED); ProductType type = new ProductType(); type.setProductTypeId(rs.getString("dataset_id")); product.setProductType(type); return product; }
public static Product toScienceDataProduct(ResultSet rs) throws SQLException { Product product = new Product(); product.setProductId(rs.getString("granule_id")); product.setProductName(rs.getString("filename")); product.setProductStructure(Product.STRUCTURE_FLAT); product.setTransferStatus(Product.STATUS_RECEIVED); ProductType type = new ProductType(); type.setProductTypeId(rs.getString("dataset_id")); product.setProductType(type); return product; }
@SuppressWarnings("unchecked") public static Product getProductFromXmlRpc(Map<?, ?> productHash) { Product product = new Product(); product.setProductId((String) productHash.get("id")); product.setProductName((String) productHash.get("name")); if (productHash.get("type") != null) { product.setProductType(getProductTypeFromXmlRpc( (Map<String, Object>) productHash.get("type"))); } product.setProductStructure((String) productHash.get("structure")); product.setTransferStatus((String) productHash.get("transferStatus")); if (productHash.get("references") != null) { product.setProductReferences(getReferencesFromXmlRpc( (Vector<Map<String, Object>>) productHash .get("references"))); } if (productHash.get("rootReference") != null) { product.setRootRef(getReferenceFromXmlRpc( (Map<String, Object>) productHash.get("rootReference"))); } return product; }
@SuppressWarnings("unchecked") public static Product getProductFromXmlRpc(Map<?, ?> productHash) { Product product = new Product(); product.setProductId((String) productHash.get("id")); product.setProductName((String) productHash.get("name")); if (productHash.get("type") != null) { product.setProductType(getProductTypeFromXmlRpc( (Map<String, Object>) productHash.get("type"))); } product.setProductStructure((String) productHash.get("structure")); product.setTransferStatus((String) productHash.get("transferStatus")); if (productHash.get("references") != null) { product.setProductReferences(getReferencesFromXmlRpc( (Vector<Map<String, Object>>) productHash .get("references"))); } if (productHash.get("rootReference") != null) { product.setRootRef(getReferenceFromXmlRpc( (Map<String, Object>) productHash.get("rootReference"))); } return product; }
public static Product getProduct(ResultSet rs, boolean getType, boolean productIdString) throws SQLException { Product product = new Product(); if (productIdString) { product.setProductId(rs.getString("product_id")); } else { product.setProductId(String.valueOf(rs.getInt("product_id"))); } product.setProductName(rs.getString("product_name")); product.setProductStructure(rs.getString("product_structure")); product.setTransferStatus(rs.getString("product_transfer_status")); if (getType) { product.setProductType(getProductType(rs)); } else { // still grab the ID ProductType type = new ProductType(); type.setProductTypeId(rs.getString("product_type_id")); product.setProductType(type); } return product; }
public static Product getProduct(ResultSet rs, boolean getType, boolean productIdString) throws SQLException { Product product = new Product(); if (productIdString) { product.setProductId(rs.getString("product_id")); } else { product.setProductId(String.valueOf(rs.getInt("product_id"))); } product.setProductName(rs.getString("product_name")); product.setProductStructure(rs.getString("product_structure")); product.setTransferStatus(rs.getString("product_transfer_status")); if (getType) { product.setProductType(getProductType(rs)); } else { // still grab the ID ProductType type = new ProductType(); type.setProductTypeId(rs.getString("product_type_id")); product.setProductType(type); } return product; }
@Override public void execute(ActionMessagePrinter printer) throws CmdLineActionException { try { Validate.notNull(productId, "Must specify productid"); Validate.notNull(productTypeName, "Must specify productTypeName"); XmlRpcFileManagerClient client = getClient(); Product product = new Product(); // TODO(bfoster): Not sure why ProductType is needed here. ProductType pt = client.getProductTypeByName(productTypeName); if (pt == null) { throw new Exception("FileManager returned null ProductType"); } product.setProductType(pt); product.setProductId(productId); printer.println("Product: [id=" + productId + ", transferPct=" + client.getProductPctTransferred(product) + "]"); } catch (Exception e) { throw new CmdLineActionException("Failed to get percent transferred" + " for product id '" + productId + "' and ProductType name '" + productTypeName + "' : " + e.getMessage(), e); } }
@Override public void execute(ActionMessagePrinter printer) throws CmdLineActionException { try (FileManagerClient client = getClient()) { Validate.notNull(productId, "Must specify productid"); Validate.notNull(productTypeName, "Must specify productTypeName"); Product product = new Product(); // TODO(bfoster): Not sure why ProductType is needed here. ProductType pt = client.getProductTypeByName(productTypeName); if (pt == null) { throw new Exception("FileManager returned null ProductType"); } product.setProductType(pt); product.setProductId(productId); printer.println("Product: [id=" + productId + ", transferPct=" + client.getProductPctTransferred(product) + "]"); } catch (Exception e) { throw new CmdLineActionException("Failed to get percent transferred" + " for product id '" + productId + "' and ProductType name '" + productTypeName + "' : " + e.getMessage(), e); } }
Product product = new Product(); product.setProductName(productName); product.setProductStructure(productStructure);
public static Product getDefaultFlatProduct(String name, String defaultProductTypeId) { Product defaultProduct = new Product(); defaultProduct.setProductName(name); defaultProduct.setProductReferences(new Vector<Reference>()); defaultProduct.setProductStructure(Product.STRUCTURE_FLAT); ProductType pType = new ProductType(); pType.setProductTypeId(defaultProductTypeId); defaultProduct.setProductType(pType); defaultProduct.setTransferStatus(Product.STATUS_TRANSFER); return defaultProduct; }
public static Product getDefaultFlatProduct(String name, String defaultProductTypeId) { Product defaultProduct = new Product(); defaultProduct.setProductName(name); defaultProduct.setProductReferences(new Vector<Reference>()); defaultProduct.setProductStructure(Product.STRUCTURE_FLAT); ProductType pType = new ProductType(); pType.setProductTypeId(defaultProductTypeId); defaultProduct.setProductType(pType); defaultProduct.setTransferStatus(Product.STATUS_TRANSFER); return defaultProduct; }
Product product = new Product(); product.setProductName(productName); product.setProductStructure(productStructure);
public static Product getProduct(AvroProduct avroPoduct){ Product product = new Product(); product.setProductName(avroPoduct.getProductName()); if (avroPoduct.getProductType() != null) product.setProductType(getProductType(avroPoduct.getProductType())); product.setProductStructure(avroPoduct.getProductStructure()); product.setTransferStatus(avroPoduct.getTransferStatus()); //references if (avroPoduct.getReferences() != null) product.setProductReferences(getReferences(avroPoduct.getReferences())); product.setProductId(avroPoduct.getProductId()); if (avroPoduct.getRootRef() != null) product.setRootRef(getReference(avroPoduct.getRootRef())); return product; }