Package org.apache.oodt.cas.metadata.exceptions

Examples of org.apache.oodt.cas.metadata.exceptions.MetExtractionException


        if (product.getProductType() == null
                || (product.getProductType() != null && (product
                        .getProductType().getName() == null || (product
                        .getProductType().getName() != null && product
                        .getProductType().getName().equals(""))))) {
            throw new MetExtractionException("Product Type undefined");
        }

        if (product.getProductReferences() == null
                || (product.getProductReferences() != null && product
                        .getProductReferences().size() == 0)) {
            throw new MetExtractionException("Product references undefined");
        }

        /*
         * if (met == null || (met != null && (met.getHashtable() == null ||
         * (met .getHashtable() != null && met.getHashtable().keySet() .size() ==
View Full Code Here


                prodFile = new File(getRootRefPath(product
                        .getProductReferences(), product.getProductType()
                        .getProductRepositoryPath()));
            } catch (Exception e) {
                e.printStackTrace();
                throw new MetExtractionException("URI exception parsing: ["
                        + product.getRootRef().getOrigReference() + "]");
            }
        } else {
            try {
                prodFile = new File(new URI(((Reference) product
                        .getProductReferences().get(0)).getOrigReference()));
            } catch (Exception e) {
                throw new MetExtractionException("URI exception parsing: ["
                        + ((Reference) product.getProductReferences().get(0))
                                .getOrigReference() + "]");

            }
        }
View Full Code Here

  private String getFullDateTime(Metadata metadata)
       throws MetExtractionException {
    if (!Strings.isNullOrEmpty(fullDateTimeKey)) {
      return metadata.getMetadata(fullDateTimeKey);
    } else {
      throw new MetExtractionException("Failed to find DateTimeKey " + fullDateTimeKey);
    }
  }
View Full Code Here

    if (!Strings.isNullOrEmpty(fieldKey)) {
      try {
        metadata.addMetadata(fieldKey, PathUtils.doDynamicReplacement(String.format(
            "[FORMAT(%s,%s,%s)]", fullDateTimeFormat, fullDateTime, fieldFormat)));
      } catch (Exception e) {
        throw new MetExtractionException(String.format(
            "Failed to create field for key %s from fullDateTime %s and fullDateTimeFormat %s",
            fieldKey, fullDateTime, fullDateTimeFormat), e);
      }
    }
  }
View Full Code Here

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

            return met;

        } catch (Exception e) {
            e.printStackTrace();
            LOG.severe(e.getMessage());
            throw new MetExtractionException(e.getMessage());
        }
    }
View Full Code Here

      statement = conn.createStatement();
      rs = statement.executeQuery(sqlQuery);

      return getMetadata(rs);
    } catch (SQLException e) {
      throw new MetExtractionException(
          String.format("Failed to get metadaata for key '%s'", key), e);
    } finally {
      try { conn.close(); } catch (Exception e) { /* ignore */ }
      try { statement.close(); } catch (Exception e) { /* ignore */ }
      try { rs.close(); } catch (Exception e) { /* ignore */ }
View Full Code Here

          Calendar cal = GregorianCalendar.getInstance();
          try {
            cal.setTime(((FilenameTokenConfig) this.config).getDateFormatter()
                .parse(keyVal));
          } catch (ParseException e) {
            throw new MetExtractionException(e.getMessage());
          }
          keyVal = DateUtils.toString(cal);
        }

        met.addMetadata(keyName, keyVal);
View Full Code Here

            this.metFileExt);
        String metFileFullPath = file.getAbsolutePath() + "." + extension;
      LOG.log(Level.INFO, "Reading metadata from " + metFileFullPath);
        // now read the met file and return it
        if (!new File(metFileFullPath).exists()) {
            throw new MetExtractionException("Met file: [" + metFileFullPath
                    + "] does not exist: failing!");
        }

        try {
            SerializableMetadata met = new SerializableMetadata("UTF-8", false);
            met.loadMetadataFromXmlStream(new FileInputStream(metFileFullPath));
            return met;
        } catch (Exception e) {
            e.printStackTrace();
            throw new MetExtractionException(e.getMessage());
        }
    }
View Full Code Here

                            + "]: Message: " + e.getMessage());
            return null;
        }

        if (status != 0) {
            throw new MetExtractionException(
                    "Exit status for met extraction not 0");
        } else if (!metFile.exists()) {
            throw new MetExtractionException(
                    "Met extractor failed to create metadata file");
        } else {
            LOG.log(Level.INFO, "Met extraction successful for product file: ["
                    + file.getAbsolutePath() + "]");
            try {
                SerializableMetadata sm = new SerializableMetadata("UTF-8",
                        false);
                sm.loadMetadataFromXmlStream(new FileInputStream(metFile));
                return sm;
            } catch (Exception e) {
                e.printStackTrace();
                throw new MetExtractionException(e.getMessage());
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.metadata.exceptions.MetExtractionException

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.