当前位置: 首页>>代码示例>>Java>>正文


Java Product类代码示例

本文整理汇总了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));
}
 
开发者ID:apache,项目名称:oodt,代码行数:23,代码来源:TestIngestProductCliAction.java

示例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);
      }
   };
}
 
开发者ID:apache,项目名称:oodt,代码行数:18,代码来源:TestGetCurrentTransfersCliAction.java

示例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;
}
 
开发者ID:apache,项目名称:oodt,代码行数:17,代码来源:MockXmlRpcFileManagerClient.java

示例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));
    }
  }
}
 
开发者ID:apache,项目名称:oodt,代码行数:18,代码来源:LocalDataTransferer.java

示例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());
   }
}
 
开发者ID:apache,项目名称:oodt,代码行数:17,代码来源:LocalDataTransferer.java

示例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;
      }
   };
}
 
开发者ID:apache,项目名称:oodt,代码行数:22,代码来源:TestGetProductByIdCliAction.java

示例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();
}
 
开发者ID:apache,项目名称:oodt,代码行数:26,代码来源:MetadataResource.java

示例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;
      }
   };
}
 
开发者ID:apache,项目名称:oodt,代码行数:19,代码来源:TestDeleteProductByIdCliAction.java

示例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;
}
 
开发者ID:apache,项目名称:oodt,代码行数:23,代码来源:XmlRpcStructFactory.java

示例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();
}
 
开发者ID:apache,项目名称:oodt,代码行数:18,代码来源:FileManagerUtils.java

示例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);
}
 
开发者ID:apache,项目名称:oodt,代码行数:24,代码来源:MetadataResource.java

示例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;
}
 
开发者ID:apache,项目名称:oodt,代码行数:20,代码来源:FilenameRegexMetExtractor.java

示例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);
   }
}
 
开发者ID:apache,项目名称:oodt,代码行数:27,代码来源:GetProductPercentTransferredCliAction.java

示例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;
}
 
开发者ID:apache,项目名称:oodt,代码行数:19,代码来源:MimeTypeExtractor.java

示例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);
    }
}
 
开发者ID:apache,项目名称:oodt,代码行数:22,代码来源:LocalCache.java


注:本文中的org.apache.oodt.cas.filemgr.structs.Product类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。