Package org.apache.oodt.cas.metadata

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


      // Add the product's metadata to the zip file.
      MetadataResource metadataResource = resource.getMetadataResource();
      Metadata metadata = metadataResource.getMetadata();

      ByteArrayOutputStream os = new ByteArrayOutputStream();
      SerializableMetadata serMetadata = new SerializableMetadata(metadata);
      serMetadata.writeMetadataToXmlStream(os);
      ByteArrayInputStream bis = new ByteArrayInputStream(os.toByteArray());

      parameters.setFileNameInZip(resource.getProductName() + ".met");
      parameters.setSourceExternalStream(true);
      zipFile.addStream(bis, parameters);
View Full Code Here


                    metConfFilePath));
        } else {
            String productID = null;
            if (metFilePath != null) {
                productID = ingester.ingest(new URL(fmUrlStr), new File(
                        filePath), new SerializableMetadata(
                        new FileInputStream(metFilePath)));
            } else {
                extractor = GenericMetadataObjectFactory
                        .getMetExtractorFromClassName(extractorClassName);
                productID = ingester.ingest(new URL(fmUrlStr), new File(
View Full Code Here

        return met;
    }

    private void writeMetFileToDir(Metadata met, String fullMetFilePath) {
        try {
            XMLUtils.writeXmlFile(new SerializableMetadata(met).toXML(), fullMetFilePath);
        } catch (Exception e) {
            LOG.log(Level.WARNING, "Met file not generated: reason: "
                    + e.getMessage(), e);
        }
    }
View Full Code Here

         // add Product References from the URI list
         addRefsFromUris(product, references);

         printer.println("ingestProduct: Result: "
               + client.ingestProduct(product,
                     new SerializableMetadata(getUri(metadataFile).toURL()
                           .openStream()), dataTransferer != null));
      } catch (Exception e) {
         throw new CmdLineActionException("Failed to ingest product '"
               + productName + "' : " + e.getMessage(), e);
      }
View Full Code Here

  public void indexMetFile(File file, boolean delete)
      throws InstantiationException, FileNotFoundException, IOException,
      SolrServerException {
    LOG.info("Attempting to index product from metadata file.");
    try {
      SerializableMetadata metadata = new SerializableMetadata("UTF-8", false);
      metadata.loadMetadataFromXmlStream(new FileInputStream(file));
      metadata.addMetadata("id", metadata.getMetadata("CAS."
          + CoreMetKeys.PRODUCT_ID));
      metadata.addMetadata(config.getProperty(ACCESS_KEY), config
          .getProperty(ACCESS_URL)
          + metadata.getMetadata("CAS." + CoreMetKeys.PRODUCT_ID));
      if (delete) {
        server
            .deleteById(metadata.getMetadata("CAS." + CoreMetKeys.PRODUCT_ID));
      }
      server.add(this.getSolrDocument(metadata));
      LOG.info("Indexed product: "
          + metadata.getMetadata("CAS." + CoreMetKeys.PRODUCT_ID));
    } catch (InstantiationException e) {
      LOG.severe("Could not instantiate metadata object: " + e.getMessage());
    } catch (FileNotFoundException e) {
      LOG.severe("Could not find metadata file: " + e.getMessage());
    } catch (IOException e) {
View Full Code Here

        if (metadataFilePath == null || configPropertiesPath == null) {
            System.err.println(usage);
            System.exit(1);
        }

        SerializableMetadata sm = new SerializableMetadata("UTF-8", false);
        sm.loadMetadataFromXmlStream(new File(metadataFilePath).toURL()
                .openStream());
        WorkflowTaskConfiguration config = new WorkflowTaskConfiguration();
        config.getProperties().load(
                new File(configPropertiesPath).toURL().openStream());
View Full Code Here

      // Add the dataset's metadata to the zip.
      MetadataResource metadataResource = resource.getMetadataResource();
      Metadata metadata = metadataResource.getMetadata();

      ByteArrayOutputStream os = new ByteArrayOutputStream();
      SerializableMetadata serMetadata = new SerializableMetadata(metadata);
      serMetadata.writeMetadataToXmlStream(os);
      ByteArrayInputStream bis = new ByteArrayInputStream(os.toByteArray());

      parameters.setFileNameInZip(resource.getName() + ".met");
      parameters.setSourceExternalStream(true);
      zipFile.addStream(bis, parameters);
View Full Code Here

   * @throws IOException
   *           If there is an IO problem opening the met file.
   */
  public Metadata readMetFile(String file) throws InstantiationException,
      FileNotFoundException, IOException {
    SerializableMetadata metadata = new SerializableMetadata("UTF-8", false);
    metadata.loadMetadataFromXmlStream(new FileInputStream(config
        .getMetAreaPath()
        + "/" + file));

    return metadata;
  }
View Full Code Here

   * @throws IOException
   *           If there is an IO exception writing the {@link File}.
   */
  public void writeMetFile(String id, Metadata metadata)
      throws FileNotFoundException, IOException {
    SerializableMetadata serMet = new SerializableMetadata(metadata, "UTF-8",
        false);
    serMet.writeMetadataToXmlStream(new FileOutputStream(new File(config
        .getMetAreaPath(), id + config.getMetExtension())));
  }
View Full Code Here

    if (file != null) {
      responseMap.put("file", file);
    }

    try {
      SerializableMetadata metadata = new SerializableMetadata("UTF-8", false);
      metadata
          .loadMetadataFromXmlStream(new FileInputStream(base + "/" + file));
      responseMap.put("metadata", metadata.getHashtable());
    } catch (InstantiationException e) {
      // no op
    } catch (FileNotFoundException e) {
      // no op
    } catch (IOException e) {
View Full Code Here

TOP

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

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.