本文整理汇总了Java中org.apache.oodt.cas.filemgr.structs.Product类的典型用法代码示例。如果您正苦于以下问题:Java Product类的具体用法?Java Product怎么用?Java Product使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Product类属于org.apache.oodt.cas.filemgr.structs包,在下文中一共展示了Product类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testClientTransFalseAndFlatProduct
import org.apache.oodt.cas.filemgr.structs.Product; //导入依赖的package包/类
public void testClientTransFalseAndFlatProduct() throws CmdLineActionException, IOException {
ActionMessagePrinter printer = new ActionMessagePrinter();
MockIngestProductCliAction cliAction = new MockIngestProductCliAction();
cliAction.setProductName(PRODUCT_NAME);
cliAction.setProductStructure(Product.STRUCTURE_FLAT);
cliAction.setProductTypeName(PRODUCT_TYPE_NAME);
cliAction.setMetadataFile(metadataFile.getAbsolutePath());
cliAction.setReferences(Lists.newArrayList(flatRefFile.getAbsolutePath()));
cliAction.execute(printer);
assertEquals(2, printer.getPrintedMessages().size());
assertEquals("ingestProduct: Result: " + PRODUCT_ID, printer.getPrintedMessages().get(0));
assertEquals("\n", printer.getPrintedMessages().get(1));
assertEquals(PRODUCT_NAME, clientSetProduct.getProductName());
assertEquals(Product.STRUCTURE_FLAT, clientSetProduct.getProductStructure());
assertEquals(PRODUCT_TYPE_NAME, clientSetProduct.getProductType().getName());
assertEquals(1, clientSetProduct.getProductReferences().size());
assertEquals("file:" + flatRefFile.getAbsolutePath(), clientSetProduct.getProductReferences().get(0).getOrigReference());
assertNull(clientSetDataTransferer);
assertEquals(2, clientSetMetadata.getAllKeys().size());
assertEquals(FILENAME_MET_VAL, clientSetMetadata.getMetadata(FILENAME_MET_KEY));
assertEquals(NOMINAL_DATE_MET_VAL, clientSetMetadata.getMetadata(NOMINAL_DATE_MET_KEY));
}
示例2: getClient
import org.apache.oodt.cas.filemgr.structs.Product; //导入依赖的package包/类
@Override
public FileManagerClient getClient() throws MalformedURLException,
ConnectionException {
return new DummyFileManagerClient(new URL("http://localhost:9000"),
false) {
@Override
public List<FileTransferStatus> getCurrentFileTransfers() {
status = new FileTransferStatus();
status.setFileRef(new Reference(ORIG_REF, DS_REF, FILE_SIZE));
status.setBytesTransferred(BYTE_TRANS);
Product parentProduct = new Product();
parentProduct.setProductName(PRODUCT_NAME);
status.setParentProduct(parentProduct);
return Lists.newArrayList(status);
}
};
}
示例3: getProductByName
import org.apache.oodt.cas.filemgr.structs.Product; //导入依赖的package包/类
@Override
public Product getProductByName(String productName) {
lastMethodCallDetails = new MethodCallDetails("getProductByName",
Lists.newArrayList((Object) productName));
Product p = new Product();
p.setProductId("TestProductId");
p.setProductName(productName);
p.setProductReferences(Lists.newArrayList(
new Reference("file:/orig/file", "file:/ds/file", 3)));
p.setProductStructure(Product.STRUCTURE_FLAT);
p.setTransferStatus(Product.STATUS_RECEIVED);
ProductType pt = new ProductType();
pt.setName("TestProductType");
p.setProductType(pt);
return p;
}
示例4: deleteProduct
import org.apache.oodt.cas.filemgr.structs.Product; //导入依赖的package包/类
@Override
public void deleteProduct(Product product) throws DataTransferException, IOException {
for (Reference ref : product.getProductReferences()) {
String u;
try {
u = URI.create(ref.getDataStoreReference()).toURL().getPath();
}
catch (IllegalArgumentException e) {
u = URI.create("file://"+ref.getDataStoreReference()).toURL().getPath();
}
File dataFile = new File(u);
if (!dataFile.delete()) {
throw new IOException(String.format("Failed to delete file %s - delete returned false",
dataFile));
}
}
}
示例5: quietNotifyProductTransferComplete
import org.apache.oodt.cas.filemgr.structs.Product; //导入依赖的package包/类
private void quietNotifyProductTransferComplete(Product p) {
if (client == null) {
LOG.log(Level.WARNING,
"File Manager service not defined: this transfer will not be tracked");
return;
}
try {
client.removeProductTransferStatus(p);
} catch (DataTransferException e) {
LOG.log(Level.SEVERE, e.getMessage());
LOG.log(Level.WARNING,
"Error notifying file manager of product transfer completion for product: ["
+ p.getProductId() + "]: Message: " + e.getMessage());
}
}
示例6: getClient
import org.apache.oodt.cas.filemgr.structs.Product; //导入依赖的package包/类
public FileManagerClient getClient() throws MalformedURLException,
ConnectionException {
return new DummyFileManagerClient(new URL("http://localhost:9000"),
false) {
public Product getProductById(String productId) {
Product p = new Product();
p.setProductId(productId);
p.setProductName(PRODUCT_NAME);
ProductType pt = new ProductType();
pt.setName(PRODUCT_TYPE_NAME);
p.setProductType(pt);
p.setProductStructure(PRODUCT_STRUCTURE);
p.setTransferStatus(PRODUCT_STATUS);
p.setRootRef(new Reference("file:/dummy/path", ROOT_REF, 2));
p.setProductReferences(Lists.newArrayList(new Reference(
ORIG_REF_1, DS_REF_1, FILE_SIZE_REF_1), new Reference(
ORIG_REF_2, DS_REF_2, FILE_SIZE_REF_2)));
return p;
}
};
}
示例7: getCatalogMetadata
import org.apache.oodt.cas.filemgr.structs.Product; //导入依赖的package包/类
@GET
@Path(CATALOG)
@Produces("text/plain")
public String getCatalogMetadata(@QueryParam("id") String id,
@DefaultValue(FORMAT_HTML) @QueryParam("format") String format,
@Context HttpServletRequest req, @Context HttpServletResponse res) {
// Call file manager to get metadata
Product prod;
Metadata metadata;
String productId = id.substring(id.lastIndexOf("/") + 1);
try {
prod = CurationService.config.getFileManagerClient().getProductById(
productId);
metadata = this.getCatalogMetadata(prod);
} catch (Exception e) {
return "<div class=\"error\">" + e.getMessage() + "</div>";
}
if (FORMAT_HTML.equals(format)) {
return this.getMetadataAsHTML(metadata);
}
return this.getMetadataAsJSON(metadata).toString();
}
示例8: getClient
import org.apache.oodt.cas.filemgr.structs.Product; //导入依赖的package包/类
@Override
public FileManagerClient getClient() throws MalformedURLException,
ConnectionException {
return new DummyFileManagerClient(new URL("http://localhost:9000"),
false) {
@Override
public Product getProductById(String productId) {
Product p = new Product();
p.setProductId(productId);
p.setProductName(PRODUCT_NAME);
return p;
}
@Override
public List<Reference> getProductReferences(Product product) {
return null;
}
};
}
示例9: getProductFromXmlRpc
import org.apache.oodt.cas.filemgr.structs.Product; //导入依赖的package包/类
@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;
}
示例10: getFilePath
import org.apache.oodt.cas.filemgr.structs.Product; //导入依赖的package包/类
public String getFilePath(Product prod) {
if (!isConnected())
return "N/A";
if (prod.getProductReferences() == null) {
prod.setProductReferences(safeGetProductReferences(prod));
}
if (prod.getProductReferences() == null
|| (prod.getProductReferences() != null
&& prod.getProductReferences().size() == 0)) {
return "N/A";
}
// get the first ref
Reference r = (Reference) prod.getProductReferences().get(0);
return safeGetFileFromUri(r.getDataStoreReference()).getAbsolutePath();
}
示例11: setCatalogMetadata
import org.apache.oodt.cas.filemgr.structs.Product; //导入依赖的package包/类
@POST
@Path(CATALOG)
@Consumes("application/x-www-form-urlencoded")
@Produces("text/plain")
public String setCatalogMetadata(MultivaluedMap<String, String> formParams,
@FormParam("id") String id) {
Product prod;
Metadata metadata = this.getMetadataFromMap(formParams);
String productId = id.substring(id.lastIndexOf("/") + 1);
try {
prod = CurationService.config.getFileManagerClient().getProductById(
productId);
this.updateCatalogMetadata(prod, metadata);
} catch (Exception e) {
LOG.log(Level.SEVERE, e.getMessage());
return "<div class=\"error\">" + e.getMessage() + "</div>";
}
return this.getMetadataAsHTML(metadata);
}
示例12: doExtract
import org.apache.oodt.cas.filemgr.structs.Product; //导入依赖的package包/类
public Metadata doExtract(Product product, Metadata met)
throws MetExtractionException {
Metadata extractMet = new Metadata();
merge(met, extractMet);
Pattern pattern = Pattern.compile(this.filenamePattern);
Matcher matcher = pattern.matcher(getProductFile(product).getName());
if (matcher.matches()) {
for (int i = 0; i < this.metadataKeys.size(); i++) {
String key = this.metadataKeys.get(i);
String value = matcher.group(i + 1);
extractMet.addMetadata(key, value);
}
} else {
throw new MetExtractionException("Filename does not conform to the pattern "
+ this.filenamePattern);
}
return extractMet;
}
示例13: execute
import org.apache.oodt.cas.filemgr.structs.Product; //导入依赖的package包/类
@Override
public void execute(ActionMessagePrinter printer)
throws CmdLineActionException {
try {
Validate.notNull(productId, "Must specify productid");
Validate.notNull(productTypeName, "Must specify productTypeName");
FileManagerClient 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);
}
}
示例14: doExtract
import org.apache.oodt.cas.filemgr.structs.Product; //导入依赖的package包/类
public Metadata doExtract(Product product, Metadata met)
throws MetExtractionException {
Metadata extractMet = new Metadata();
merge(met, extractMet);
if (product.getProductStructure().equals(Product.STRUCTURE_FLAT)) {
Reference prodRef = (Reference) product.getProductReferences().get(
0);
extractMet.addMetadata(MIME_TYPE, prodRef.getMimeType().getName());
extractMet.addMetadata(MIME_TYPE, prodRef.getMimeType()
.getType().getType());
extractMet.addMetadata(MIME_TYPE, prodRef.getMimeType()
.getType().getSubtype());
}
return extractMet;
}
示例15: sync
import org.apache.oodt.cas.filemgr.structs.Product; //导入依赖的package包/类
public void sync(String uniqueElementName,
List<String> uniqueElementProductTypeNames) throws CacheException {
try {
this.uniqueElementName = uniqueElementName;
this.uniqueElementProductTypeNames = uniqueElementProductTypeNames;
List<Product> products = new Vector<Product>();
for (String productType : this.uniqueElementProductTypeNames) {
products.addAll(getProductsOverDateRange(
this.rangeQueryElementName, productType, this.startOfQuery,
this.endOfQuery));
}
clear();
for (Product product : products) {
String value = getValueForMetadata(product, uniqueElementName);
this.uniqueElements.add(value);
}
} catch (Exception e) {
throw new CacheException("Failed to sync with database : "
+ e.getMessage(), e);
}
}