Package org.apache.oodt.cas.filemgr.metadata.extractors.examples

Examples of org.apache.oodt.cas.filemgr.metadata.extractors.examples.FilenameRegexMetExtractor


   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"));
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.filemgr.metadata.extractors.examples.FilenameRegexMetExtractor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.