Package org.apache.oodt.cas.metadata

Examples of org.apache.oodt.cas.metadata.Metadata


  }

  public boolean filter(ProductType type) {
    if(this.constraints == null) return true;
    if (type.getTypeMetadata() != null) {
      Metadata typeMet = type.getTypeMetadata();
      for (Object constraintObj : this.constraints.keySet()) {
        String constraintName = (String) constraintObj;
        String constraintValue = this.constraints.getProperty(constraintName);
        if (!typeMet.containsKey(constraintName)) {
          return false;
        }

        if (!typeMet.getMetadata(constraintName).equals(constraintValue)) {
          return false;
        }

      }
View Full Code Here


    }

    String requestUrl = req.getRequestURL().toString();
    String base = requestUrl.substring(0, requestUrl.lastIndexOf('/'));

    Metadata channelMet = new Metadata();
    channelMet.addMetadata("ProductType", productTypeName);
    channelMet.addMetadata("ProductTypeId", productTypeId);
    channelMet.addMetadata("TopN", String.valueOf(topN));
    channelMet.addMetadata("BaseUrl", base);

    List products = null;

    try {
      if (productTypeName.equals("ALL")) {
        products = fm.getTopNProducts(top);
      } else {

        try {
          type = fm.getProductTypeById(productTypeId);
        } catch (RepositoryManagerException e) {
          LOG.log(Level.SEVERE,
              "Unable to obtain product type from product type id: ["
                  + productTypeId + "]: Message: " + e.getMessage());
          return;
        }

        products = fm.getTopNProducts(top, type);
      }

    } catch (CatalogException e) {
      e.printStackTrace();
      LOG
          .log(Level.WARNING,
              "Exception getting products from Catalog: Message: "
                  + e.getMessage());
      return;
    }

    if (products != null && products.size() > 0) {
      String channelDesc = null;

      if (!productTypeName.equals("ALL")) {
        channelDesc = type.getDescription();
      } else {
        channelDesc = "ALL";
      }

      try {

        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setNamespaceAware(true);
        Document doc = factory.newDocumentBuilder().newDocument();

        Element rss = XMLUtils.addNode(doc, doc, "rss");
        XMLUtils.addAttribute(doc, rss, "version", "2.0");
        XMLUtils
            .addAttribute(doc, rss, "xmlns:cas", (String) NS_MAP.get("cas"));
        Element channel = XMLUtils.addNode(doc, rss, "channel");

        XMLUtils.addNode(doc, channel, "title", productTypeName);
        XMLUtils.addNode(doc, channel, "link", RSSUtils.getChannelLink(
            this.conf.getChannelLink(), channelMet));
        XMLUtils.addNode(doc, channel, "description", channelDesc);

        String buildPubDate = dateFormatter.format(new Date());

        XMLUtils.addNode(doc, channel, "language", "en-us");
        XMLUtils.addNode(doc, channel, "copyright", COPYRIGHT_BOILER_PLATE);
        XMLUtils.addNode(doc, channel, "pubDate", buildPubDate);
        XMLUtils.addNode(doc, channel, "category", productTypeName);
        XMLUtils.addNode(doc, channel, "generator", "CAS File Manager");
        XMLUtils.addNode(doc, channel, "lastBuildDate", buildPubDate);

        for (Iterator i = products.iterator(); i.hasNext();) {
          Product p = (Product) i.next();

          String productTypeIdStr = p.getProductType().getProductTypeId();
          ProductType productType = null;

          try {
            productType = fm.getProductTypeById(productTypeIdStr);
          } catch (RepositoryManagerException e) {
            e.printStackTrace();
            LOG.log(Level.SEVERE,
                "Unable to obtain product type from product type id: ["
                    + ((Product) products.get(0)).getProductType()
                        .getProductTypeId() + "]: Message: " + e.getMessage());
            return;
          }

          p.setProductType(productType);
          p.setProductReferences(safeGetProductReferences(p));

          Element item = XMLUtils.addNode(doc, channel, "item");

          XMLUtils.addNode(doc, item, "title", p.getProductName());
          XMLUtils.addNode(doc, item, "description", p.getProductType()
              .getName());
          XMLUtils.addNode(doc, item, "link", base + "/data?productID="
              + p.getProductId());

          Metadata m = this.safeGetMetadata(p);
          String productReceivedTime = m.getMetadata("CAS.ProductReceivedTime");
          Date receivedTime = null;

          try {
            receivedTime = DateConvert.isoParse(productReceivedTime);
          } catch (ParseException ignore) {
          }

          if (receivedTime != null) {
            XMLUtils.addNode(doc, item, "pubDate", dateFormatter
                .format(receivedTime));
          }

          // add met field for FileSize for use in RSS envelope
          if (p.getProductReferences() != null
              && p.getProductReferences().size() == 1) {
            m.addMetadata("FileSize", String.valueOf(p.getProductReferences()
                .get(0).getFileSize()));
          }

          // add additional elements from the RSSConfig
          for (RSSTag tag : this.conf.getTags()) {
View Full Code Here

          Product product = (Product) i.next();
          if (alreadyZipped(product, productHash)) {
            continue;
          }

          Metadata metadata = null;
          product.setProductReferences(client.getProductReferences(product));
          metadata = client.getMetadata(product);
          DataUtils.createProductZipFile(product, metadata, productDirPath);
          productHash.put(product.getProductName(), ALREADY_ZIPPED);
        }
View Full Code Here

     *      java.io.File, org.apache.oodt.cas.metadata.MetExtractor,
     *      java.io.File)
     */
    public String ingest(URL fmUrl, File prodFile, MetExtractor extractor,
            File metConfFile) throws IngestException {
        Metadata met = null;
        try {
            met = extractor.extractMetadata(prodFile, metConfFile);
        } catch (MetExtractionException e) {
            e.printStackTrace();
            throw new IngestException("Met extraction exception on product: ["
View Full Code Here

        } catch (Exception e) {
            throw new RuntimeException("Unable to retrieve product:["
                    + productId + "] by id");
        }

        Metadata met = null;

        try {
            met = this.fmClient.getMetadata(product);
        } catch (Exception e) {
            throw new RuntimeException("Unable to get metadata for product: ["
View Full Code Here

     * @param outDirPath
     *            The path on the local filesystem to write the {@link Metadata}
     *            file to.
     */
    public void dumpMetadata(String productId, String outDirPath) {
        Metadata met = getMetadata(productId);
        String fullMetFilePath = outDirPath;
        fullMetFilePath = (fullMetFilePath.endsWith("/")) ? fullMetFilePath
                : fullMetFilePath + "/";
        String filename = met.getMetadata(FILENAME) != null ? met
                .getMetadata(FILENAME) : met.getMetadata(PRODUCT_NAME);
        fullMetFilePath += filename + ".met";
        writeMetFileToDir(met, fullMetFilePath);
    }
View Full Code Here

                    && page.getPageProducts().size() > 0) {
                for (Iterator j = page.getPageProducts().iterator(); j
                        .hasNext();) {
                    Product p = (Product) j.next();
                    p.setProductReferences(fmgrClient.getProductReferences(p));
                    Metadata met = fmgrClient.getMetadata(p);
                    Reference r = ((Reference) p.getProductReferences().get(0));
                    String newLocPath = PathUtils.replaceEnvVariables(
                            this.pathSpec, met);

                    LOG.log(Level.INFO, "Moving product: ["
View Full Code Here

    /**
     * Default Constructor.
     *
     */
    public WorkflowInstance() {
        sharedContext = new Metadata();
    }
View Full Code Here

  /**
   * Default Constructor.
   */
  public TaskJobInput() {
    taskConfig = new WorkflowTaskConfiguration();
    dynMetadata = new Metadata();
  }
View Full Code Here

    }

    if (dynMetadataFile != null) {
      InputStream in = null;
      try {
        this.dynMetadata = new Metadata();
        Properties fileProps = new Properties();
        in = new BufferedInputStream(new FileInputStream(new File(dynMetadataFile)));
        fileProps.load(in);
        for (Object key: fileProps.keySet()){
          String keyStr = (String)key;
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.metadata.Metadata

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.