本文整理汇总了Java中org.apache.oodt.cas.filemgr.structs.Product.setProductStructure方法的典型用法代码示例。如果您正苦于以下问题:Java Product.setProductStructure方法的具体用法?Java Product.setProductStructure怎么用?Java Product.setProductStructure使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.oodt.cas.filemgr.structs.Product
的用法示例。
在下文中一共展示了Product.setProductStructure方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: getProduct
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
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;
}
示例4: getProductById
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
@Override
public Product getProductById(String productId) {
lastMethodCallDetails = new MethodCallDetails("getProductById",
Lists.newArrayList((Object) productId));
Product p = new Product();
p.setProductId(productId);
p.setProductName("TestProductName");
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;
}
示例5: 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 getProductByName(String name) {
Product p = new Product();
p.setProductId(PRODUCT_ID);
p.setProductName(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;
}
};
}
示例6: testVersioner
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
public void testVersioner() {
DirectoryProductVersioner versioner = new DirectoryProductVersioner();
Product p = Product.getDefaultFlatProduct("test", "urn:oodt:GenericFile");
p.setProductStructure(Product.STRUCTURE_HIERARCHICAL);
p.getProductType().setProductRepositoryPath("file:///home/files");
Reference r = new Reference("file:///tmp/dir1", null, 4L);
Reference r2 = new Reference("file:///tmp/dir1/file1.txt", null, 20L);
p.getProductReferences().add(r);
p.getProductReferences().add(r2);
Metadata met = new Metadata();
met.addMetadata(CoreMetKeys.FILENAME, "dir1");
try {
versioner.createDataStoreReferences(p, met);
} catch (Exception e) {
LOG.log(Level.SEVERE, e.getMessage());
fail(e.getMessage());
}
assertNotNull(p.getProductReferences());
assertEquals(2, p.getProductReferences().size());
assertEquals("file:/home/files/dir1/", p.getProductReferences().get(0)
.getDataStoreReference());
assertEquals("file:/home/files/dir1/file1.txt", p.getProductReferences()
.get(1).getDataStoreReference());
}
示例7: test
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
@Test
public void test() throws MetExtractionException {
TikaAutoDetectExtractor tikaExtractor = new TikaAutoDetectExtractor();
Metadata emptyMetadata = new Metadata();
Reference ref = new Reference();
URL file = this.getClass().getResource("/test.txt");
ref.setOrigReference(file.toString());
ref.setDataStoreReference(file.toString());
Product product = new Product();
product.getProductReferences().add(ref);
product.setProductStructure(Product.STRUCTURE_FLAT);
Metadata outputMetadata = tikaExtractor.doExtract(product, emptyMetadata);
assertNotNull(outputMetadata);
assertTrue(outputMetadata.getAllKeys().size() > 0);
assertTrue(outputMetadata.containsKey("X-Parsed-By"));
assertFalse(outputMetadata.getMetadata("X-Parsed-By").equals("org.apache.tika.parser.EmptyParser"));
}
示例8: getPrevPage
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
@Override
public ProductPage getPrevPage(ProductType pt, ProductPage currentPage) {
ProductPage pp = new ProductPage();
pp.setPageNum(currentPage.getPageNum() - 1);
pp.setTotalPages(currentPage.getTotalPages());
pp.setPageSize(currentPage.getPageSize());
Product p4 = new Product();
p4.setProductId(PRODUCT_ID_4);
p4.setProductName(PRODUCT_NAME_4);
p4.setProductType(pt);
p4.setProductStructure(PRODUCT_STRUCTURE);
p4.setTransferStatus(PRODUCT_STATUS);
pp.setPageProducts(Lists.newArrayList(p4));
return pp;
}
示例9: toScienceDataProduct
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
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;
}
示例10: getFirstPage
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
@Override
public ProductPage getFirstPage(ProductType pt) {
ProductPage pp = new ProductPage();
pp.setPageNum(PAGE_NUM);
pp.setTotalPages(TOTAL_PAGES);
pp.setPageSize(PAGE_SIZE);
Product p1 = new Product();
p1.setProductId(PRODUCT_ID_1);
p1.setProductName(PRODUCT_NAME_1);
p1.setProductType(pt);
p1.setProductStructure(PRODUCT_STRUCTURE);
p1.setTransferStatus(PRODUCT_STATUS);
Product p2 = new Product();
p2.setProductId(PRODUCT_ID_2);
p2.setProductName(PRODUCT_NAME_2);
p2.setProductType(pt);
p2.setProductStructure(PRODUCT_STRUCTURE);
p2.setTransferStatus(PRODUCT_STATUS);
Product p3 = new Product();
p3.setProductId(PRODUCT_ID_3);
p3.setProductName(PRODUCT_NAME_3);
p3.setProductType(pt);
p3.setProductStructure(PRODUCT_STRUCTURE);
p3.setTransferStatus(PRODUCT_STATUS);
pp.setPageProducts(Lists.newArrayList(p1, p2, p3));
return pp;
}
示例11: createProduct
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
@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;
}
示例12: testExtract
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
public void testExtract() {
Properties config = new Properties();
config.setProperty("filenamePattern", "(\\w*)_(\\d*)\\.txt");
config.setProperty("metadataKeys", "Name,ID");
FilenameRegexMetExtractor extractor = new FilenameRegexMetExtractor();
extractor.configure(config);
Reference ref = new Reference();
ref.setOrigReference("file:/foo/bar/foobar_001.txt");
ref.setDataStoreReference("file:/foo/bar/final/foobar_001.txt");
Product product = new Product();
product.getProductReferences().add(ref);
product.setProductStructure(Product.STRUCTURE_FLAT);
Metadata met = new Metadata();
try {
met = extractor.doExtract(product, met);
} catch (MetExtractionException e) {
fail(e.getMessage());
}
assertTrue(met.containsKey("Name"));
assertTrue(met.containsKey("ID"));
assertEquals("foobar", met.getMetadata("Name"));
assertEquals("001", met.getMetadata("ID"));
}
示例13: testExtractBasicFileAttributes
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
public void testExtractBasicFileAttributes() {
// Define Reference & Product
URL refUrl = this.getClass().getResource("/ingest/test.txt");
Reference ref = new Reference();
ref.setOrigReference(refUrl.toString());
ref.setDataStoreReference(refUrl.toString());
Product product = new Product();
product.getProductReferences().add(ref);
product.setProductStructure(Product.STRUCTURE_FLAT);
// Define configuration to extract basic file attributes
Properties config = new Properties();
config.setProperty("attributes", "*");
// Configure Extractor
fileAttributesExtractor.configure(config);
// Extract file attributes metadata
Metadata metadata = new Metadata();
try {
metadata = fileAttributesExtractor.doExtract(product, metadata);
} catch (MetExtractionException e) {
fail(e.getMessage());
}
// Test
assertNotNull(metadata);
assertTrue(metadata.containsKey(IS_SYMBOLIC_LINK));
assertTrue(metadata.containsKey(CREATION_TIME));
assertTrue(metadata.containsKey(LAST_MODIFIED_TIME));
assertTrue(metadata.containsKey(IS_OTHER));
assertTrue(metadata.containsKey(IS_DIRECTORY));
assertTrue(metadata.containsKey(FILE_KEY));
assertTrue(metadata.containsKey(LAST_ACCESS_TIME));
assertTrue(metadata.containsKey(IS_REGULAR_FILE));
assertTrue(metadata.containsKey(SIZE));
}
示例14: testExtractPosixFileAttributes
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
public void testExtractPosixFileAttributes() {
// Define Reference & Product
URL refUrl = this.getClass().getResource("/ingest/test.txt");
Reference ref = new Reference();
ref.setOrigReference(refUrl.toString());
ref.setDataStoreReference(refUrl.toString());
Product product = new Product();
product.getProductReferences().add(ref);
product.setProductStructure(Product.STRUCTURE_FLAT);
// Define configuration to extract basic file attributes
Properties config = new Properties();
config.setProperty("attributes", "posix:*");
// Configure Extractor
fileAttributesExtractor.configure(config);
// Extract file attributes metadata
Metadata metadata = new Metadata();
try {
metadata = fileAttributesExtractor.doExtract(product, metadata);
} catch (MetExtractionException e) {
fail(e.getMessage());
}
// Test
assertNotNull(metadata);
assertTrue(metadata.containsKey(OWNER));
assertTrue(metadata.containsKey(PERMISSIONS));
assertTrue(metadata.containsKey(GROUP));
}
示例15: ingest
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
public String ingest(URL fmUrl, File prodFile, Metadata met)
throws IngestException {
checkOrSetFileManager(fmUrl);
String productType = met.getMetadata(PRODUCT_TYPE);
String fileLocation = met.getMetadata(FILE_LOCATION);
String fileName = met.getMetadata(FILENAME);
if (!check(productType, PRODUCT_TYPE)
|| !check(fileLocation, FILE_LOCATION)
|| !check(fileName, FILENAME)) {
throw new IngestException("Must specify: " + PRODUCT_TYPE + " and "
+ FILENAME + " and " + FILE_LOCATION
+ " within metadata file. Cannot ingest product: ["
+ prodFile.getAbsolutePath() + "]");
}
// allow user to override default product name (Filename)
String productName = met.getMetadata(PRODUCT_NAME) != null ? met
.getMetadata(PRODUCT_NAME) : fileName;
// check to see if product structure was specified
String productStructure = met.getMetadata(PRODUCT_STRUCTURE);
if (productStructure == null) {
// try and guess the structure
if (prodFile.isDirectory()) {
productStructure = Product.STRUCTURE_HIERARCHICAL;
} else {
productStructure = Product.STRUCTURE_FLAT;
}
}
// create the product
Product product = new Product();
product.setProductName(productName);
product.setProductStructure(productStructure);
product.setProductType(getProductType(productType));
List<String> references = new Vector<String>();
if (!fileLocation.endsWith("/")) {
fileLocation += "/";
}
String fullFilePath = fileLocation + fileName;
references.add(new File(fullFilePath).toURI().toString());
if (productStructure.equals(Product.STRUCTURE_HIERARCHICAL)) {
references.addAll(VersioningUtils.getURIsFromDir(new File(
fullFilePath)));
}
// build refs and attach to product
VersioningUtils.addRefsFromUris(product, references);
LOG.log(Level.INFO, "StdIngester: ingesting product: " + PRODUCT_NAME
+ ": [" + productName + "]: " + PRODUCT_TYPE + ": ["
+ productType + "]: " + FILE_LOCATION + ": [" + fileLocation
+ "]");
String productID;
try {
productID = fmClient.ingestProduct(product, met, true);
} catch (Exception e) {
LOG.log(Level.SEVERE, e.getMessage());
LOG.log(Level.WARNING, "exception ingesting product: ["
+ productName + "]: Message: " + e.getMessage());
throw new IngestException("exception ingesting product: ["
+ productName + "]: Message: " + e.getMessage());
}
return productID;
}