本文整理汇总了Java中org.apache.oodt.cas.filemgr.structs.Product.getDefaultFlatProduct方法的典型用法代码示例。如果您正苦于以下问题:Java Product.getDefaultFlatProduct方法的具体用法?Java Product.getDefaultFlatProduct怎么用?Java Product.getDefaultFlatProduct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.oodt.cas.filemgr.structs.Product
的用法示例。
在下文中一共展示了Product.getDefaultFlatProduct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testTransfer
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
public void testTransfer() {
Product testProduct = Product.getDefaultFlatProduct("test",
"urn:oodt:GenericFile");
testProduct.getProductReferences().add(
new Reference("file:" + productOrigLoc, "file:"
+ productExpectedLoc, 0L));
try {
transfer.transferProduct(testProduct);
} catch (Exception e) {
fail(e.getMessage());
}
// assert that it didn't transfer the file anywhere
assertFalse(new File(productExpectedLoc).exists());
}
示例2: testVersionHierarchical
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
public void testVersionHierarchical() {
String expected = "file:/archive/testdir/";
Product p = Product
.getDefaultFlatProduct("testdir", "urn:oodt:GenericFile");
p.setProductStructure(Product.STRUCTURE_HIERARCHICAL);
p.getProductType().setProductRepositoryPath("file:///archive");
p.getProductReferences().add(
new Reference("file:///tmp/somedir/", null, 4L));
p.getProductReferences().add(
new Reference("file:///tmp/somedir/file.txt", null, 4096L));
BasicVersioner versioner = new BasicVersioner();
try {
versioner.createDataStoreReferences(p, new Metadata());
} catch (Exception e) {
fail(e.getMessage());
}
assertNotNull(p.getProductReferences());
assertEquals(2, p.getProductReferences().size());
assertEquals(expected, p.getProductReferences().get(0)
.getDataStoreReference());
}
示例3: testVersionerHierarchical
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
/**
* @since OODT-108
*/
public void testVersionerHierarchical() {
Product p = Product.getDefaultFlatProduct("test", "urn:oodt:GenericFile");
p.setProductStructure(Product.STRUCTURE_HIERARCHICAL);
Reference r = new Reference("file:///tmp", null, 0L);
Reference r2 = new Reference("file:///tmp/file1.txt", null, 4096L);
Reference r3 = new Reference("file:///tmp/file2.txt", null, 4096L);
p.getProductReferences().add(r);
p.getProductReferences().add(r2);
p.getProductReferences().add(r3);
InPlaceVersioner versioner = new InPlaceVersioner();
Metadata met = new Metadata();
try {
versioner.createDataStoreReferences(p, met);
} catch (Exception e) {
fail(e.getMessage());
}
for (Reference ref : p.getProductReferences()) {
assertEquals(ref.getDataStoreReference(), ref.getOrigReference());
}
}
示例4: 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());
}
示例5: testVersion
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
public void testVersion() {
Metadata met = new Metadata();
met.addMetadata("Filename", "somefile.txt");
met.addMetadata("AcquisitionDate", "130622");
Product prod = Product.getDefaultFlatProduct("foo", "urn:sometype:foo");
prod.getProductType().setProductRepositoryPath("file:///data/archive");
prod.getProductType().getTypeMetadata()
.addMetadata("filePathSpec", "/[AcquisitionDate]/[Filename]");
prod.getProductReferences().add(
new Reference("file:///data/staging/somefile.txt", null, 4L));
ProductTypeMetVersioner versioner = new ProductTypeMetVersioner();
try {
versioner.createDataStoreReferences(prod, met);
} catch (Exception e) {
fail(e.getMessage());
}
assertNotNull(prod);
assertNotNull(prod.getProductReferences());
assertEquals(1, prod.getProductReferences().size());
assertEquals(expected, prod.getProductReferences().get(0)
.getDataStoreReference());
}
示例6: testVersionerWithNoStartDateTimeAndNoAcqDate
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
public void testVersionerWithNoStartDateTimeAndNoAcqDate() {
AcquisitionDateVersioner versioner = new AcquisitionDateVersioner();
Product p = Product.getDefaultFlatProduct("test", "urn:oodt:GenericFile");
p.getProductType().setProductRepositoryPath("file:///home/files");
Reference r = new Reference("file:///tmp/dir1/file1.txt", null, 4L);
p.getProductReferences().add(r);
Metadata met = new Metadata();
met.addMetadata(CoreMetKeys.FILENAME, "file1.txt");
SimpleDateFormat acqDateFormatter = new SimpleDateFormat(
AcquisitionDateVersioner.ACQ_DATE_FORMAT);
acqDateFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));
String expectedDateTimeStr = acqDateFormatter.format(new Date());
String expectedPath = "file:/home/files/" + expectedDateTimeStr
+ "/file1.txt";
try {
versioner.createDataStoreReferences(p, met);
} catch (Exception e) {
LOG.log(Level.SEVERE, e.getMessage());
fail(e.getMessage());
}
assertNotNull(p.getProductReferences());
assertEquals(1, p.getProductReferences().size());
assertEquals(expectedPath, p.getProductReferences().get(0)
.getDataStoreReference());
}
示例7: testVersionerWithNoStartDateTimeAndAcqDate
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
public void testVersionerWithNoStartDateTimeAndAcqDate() {
AcquisitionDateVersioner versioner = new AcquisitionDateVersioner();
Product p = Product.getDefaultFlatProduct("test", "urn:oodt:GenericFile");
p.getProductType().setProductRepositoryPath("file:///home/files");
Reference r = new Reference("file:///tmp/dir1/file1.txt", null, 4L);
p.getProductReferences().add(r);
Metadata met = new Metadata();
met.addMetadata(CoreMetKeys.FILENAME, "file1.txt");
met.addMetadata("AcquisitionDate", "090910");
String expectedPath = "file:/home/files/"
+ met.getMetadata("AcquisitionDate") + "/file1.txt";
try {
versioner.createDataStoreReferences(p, met);
} catch (Exception e) {
LOG.log(Level.SEVERE, e.getMessage());
fail(e.getMessage());
}
assertNotNull(p.getProductReferences());
assertEquals(1, p.getProductReferences().size());
assertEquals(expectedPath, p.getProductReferences().get(0)
.getDataStoreReference());
}
示例8: testVersionerWithStartDateTime
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
public void testVersionerWithStartDateTime() {
AcquisitionDateVersioner versioner = new AcquisitionDateVersioner();
Product p = Product.getDefaultFlatProduct("test", "urn:oodt:GenericFile");
p.getProductType().setProductRepositoryPath("file:///home/files");
Reference r = new Reference("file:///tmp/dir1/file1.txt", null, 4L);
p.getProductReferences().add(r);
Metadata met = new Metadata();
met.addMetadata(CoreMetKeys.FILENAME, "file1.txt");
met.addMetadata("StartDateTime", "2006-09-10T00:00:01.000Z");
String expectedPath = "file:/home/files/060910/file1.txt";
try {
versioner.createDataStoreReferences(p, met);
} catch (Exception e) {
LOG.log(Level.SEVERE, e.getMessage());
fail(e.getMessage());
}
assertNotNull(p.getProductReferences());
assertEquals(1, p.getProductReferences().size());
assertEquals(expectedPath, p.getProductReferences().get(0)
.getDataStoreReference());
}
示例9: testExtract
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
/**
* @since OODT-58
*/
public void testExtract() {
MimeTypeExtractor extractor = new MimeTypeExtractor();
Product p = Product.getDefaultFlatProduct("test", "urn:oodt:GenericFile");
Reference r = new Reference("file:///tmp/test.he5",
"file:///archive/test.he5/test.he5", 0L);
p.getProductReferences().add(r);
Metadata met = new Metadata();
try {
met = extractor.doExtract(p, met);
} catch (MetExtractionException e) {
fail(e.getMessage());
}
assertNotNull(met);
assertNotNull(met.getAllMetadata(MIME_TYPE));
assertEquals(3, met.getAllMetadata(MIME_TYPE).size());
System.out.println(met.getAllMetadata(MIME_TYPE));
assertEquals("application/x-hdf", met.getAllMetadata(MIME_TYPE).get(0));
assertEquals("application", met.getAllMetadata(MIME_TYPE).get(1));
assertEquals("x-hdf", met.getAllMetadata(MIME_TYPE).get(2));
}
示例10: getLatestProduct
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
public Product getLatestProduct(Query query, ProductType type) {
if (!isConnected())
return Product.getDefaultFlatProduct("", "");
List products;
try {
products = fmgrClient.query(query, type);
if (products != null && products.size() > 0) {
Product p = (Product) products.get(0);
p.setProductReferences(safeGetProductReferences(p));
return p;
}
} catch (Exception e) {
LOG.log(Level.SEVERE, "Unable to obtain products: query: [" + query
+ "]: Message: " + e.getMessage(), e);
}
return null;
}
示例11: safeGetProductById
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
public Product safeGetProductById(String id) {
if (!isConnected())
return Product.getDefaultFlatProduct("", "");
try {
return fm.getProductById(id);
} catch (Exception e) {
LOG.log(Level.WARNING, "Unable to get product by id: [" + id
+ "]: Message: " + e.getMessage());
return null;
}
}
示例12: createDummyProduct
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
private Product createDummyProduct() {
Product testProduct = Product.getDefaultFlatProduct("test",
"urn:oodt:GenericFile");
testProduct.getProductReferences().add(
new Reference(origFile.toURI().toString(), new File(repoDir,
"test.txt").toURI().toString(), origFile.length()));
return testProduct;
}
示例13: getTestProduct
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
private static Product getTestProduct() {
Product testProduct = Product.getDefaultFlatProduct("test",
"urn:oodt:GenericFile");
testProduct.getProductType().setName("GenericFile");
// set references
Reference ref = new Reference("file:///foo.txt", "file:///bar.txt", 100);
Vector references = new Vector();
references.add(ref);
testProduct.setProductReferences(references);
return testProduct;
}
示例14: testVersionerFlat
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
/**
* @since OODT-108
*/
public void testVersionerFlat() {
Product p = Product.getDefaultFlatProduct("test", "urn:oodt:GenericFile");
Reference r = new Reference("file:///tmp/test.txt", null, 0L);
p.getProductReferences().add(r);
InPlaceVersioner versioner = new InPlaceVersioner();
Metadata met = new Metadata();
try {
versioner.createDataStoreReferences(p, met);
} catch (Exception e) {
fail(e.getMessage());
}
assertTrue(r.getDataStoreReference().equals(r.getOrigReference()));
}
示例15: getTestProduct
import org.apache.oodt.cas.filemgr.structs.Product; //导入方法依赖的package包/类
private Product getTestProduct() throws MalformedURLException {
Product testProduct = Product.getDefaultFlatProduct("test",
"urn:oodt:GenericFile");
List<Reference> refs = new LinkedList<Reference>();
URL refUrl = this.getClass().getResource("/ingest/test.txt");
Reference ref = new Reference();
ref.setOrigReference(new File(refUrl.getFile()).toURL().toExternalForm());
ref.setFileSize(123);
refs.add(ref);
testProduct.setProductReferences(refs);
return testProduct;
}