Package org.apache.oodt.cas.metadata

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


    }

    public void writeToPropEqValFile(String filePath,
            String[] metadataToWriteOut) throws IOException {
        try {
            SerializableMetadata sMetadata = new SerializableMetadata("UTF-8",
                    false);
            for (String metadataKey : metadataToWriteOut)
                if (this.metadata.getMetadata(metadataKey) != null
                        && !this.metadata.getMetadata(metadataKey).equals(""))
                    sMetadata.addMetadata(metadataKey, this.metadata
                            .getMetadata(metadataKey));
            sMetadata.writeMetadataToXmlStream(new FileOutputStream(filePath));
        } catch (Exception e) {
            throw new IOException("Failed to write metadata file for "
                    + this.pFile + " : " + e.getMessage());
        }
    }
View Full Code Here


    try {
      URL ingestUrl = this.getClass().getResource("/ingest");
      URL refUrl = this.getClass().getResource("/ingest/test.txt");
      URL metUrl = this.getClass().getResource("/ingest/test.txt.met");

      prodMet = new SerializableMetadata(new FileInputStream(
        new File(metUrl.getFile())));

      // now add the right file location
      prodMet.addMetadata(CoreMetKeys.FILE_LOCATION, new File(
        ingestUrl.getFile()).getCanonicalPath());
View Full Code Here

        URL refUrl = this.getClass().getResource("/ingest/test-file-3.txt");
        URL metUrl = this.getClass().getResource("/ingest/test-file-3.txt.met");

        Metadata prodMet = null;
        StdIngester ingester = new StdIngester(transferServiceFacClass);
        prodMet = new SerializableMetadata(new FileInputStream(
            metUrl.getFile()));
        // now add the right file location
        prodMet.addMetadata(CoreMetKeys.FILE_LOCATION, new File(
            ingestUrl.getFile()).getCanonicalPath());
        String productId = ingester.ingest(
View Full Code Here

        try {
            URL ingestUrl = this.getClass().getResource("/ingest");
            URL refUrl = this.getClass().getResource("/ingest/test.txt");
            URL metUrl = this.getClass().getResource("/ingest/test.txt.met");

            prodMet = new SerializableMetadata(new FileInputStream(
                new File(metUrl.getFile())));

            // now add the right file location
            prodMet.addMetadata(CoreMetKeys.FILE_LOCATION, new File(
                ingestUrl.getFile()).getCanonicalPath());
View Full Code Here

        try {
            URL ingestUrl = this.getClass().getResource("/ingest");
            URL refUrl = this.getClass().getResource("/ingest/test.txt");
            URL metUrl = this.getClass().getResource("/ingest/test.txt.met");

            prodMet = new SerializableMetadata(new FileInputStream(
                new File(metUrl.getFile())));

            // now add the right file location
            prodMet.addMetadata(CoreMetKeys.FILE_LOCATION, new File(
                ingestUrl.getFile()).getCanonicalPath());
View Full Code Here

        try {
            URL ingestUrl = this.getClass().getResource("/ingest");
            URL refUrl = this.getClass().getResource("/ingest/test.txt");
            URL metUrl = this.getClass().getResource("/ingest/test.txt.met");

            prodMet = new SerializableMetadata(new FileInputStream(
                new File(metUrl.getFile())));

            // now add the right file location
            prodMet.addMetadata(CoreMetKeys.FILE_LOCATION, new File(
                ingestUrl.getFile()).getCanonicalPath());
View Full Code Here

   }

   protected void dumpMetadataIfRequested() throws Exception {
      if (Boolean.parseBoolean(pgeMetadata
            .getMetadata(DUMP_METADATA))) {
         new SerializableMetadata(pgeMetadata.asMetadata())
               .writeMetadataToXmlStream(new FileOutputStream(
                     getDumpMetadataPath()));
      }
   }
View Full Code Here

        this.pgeMetadata, args);
  }

  protected void writeFromMetadata(Metadata metadata, String toMetFilePath)
      throws FileNotFoundException, IOException {
    new SerializableMetadata(metadata, "UTF-8", false)
        .writeMetadataToXmlStream(new FileOutputStream(toMetFilePath));
  }
View Full Code Here

            throw new Exception("FileManager returned null metadata");
         }
         if (outputDir != null) {
            if (outputDir.exists()) {
               XMLUtils.writeXmlFile(
                     new SerializableMetadata(metadata).toXML(), new File(
                           outputDir.getAbsoluteFile(),
                           generateFilename(metadata)).getAbsolutePath());
            } else {
               throw new Exception("Output dir '" + outputDir
                     + "' does not exist");
            }
         } else {
            OutputStream os = new OutputStream() {
               private StringBuffer sb = new StringBuffer("");

               @Override
               public void write(int character) throws IOException {
                  sb.append((char) character);
               }

               @Override
               public void close() throws IOException {
                  super.close();
                  printer.println(sb.toString());
               }
            };
            XMLUtils.writeXmlToStream(
                  new SerializableMetadata(metadata).toXML(),
                  os);
            os.close();
         }
      } catch (Exception e) {
         throw new CmdLineActionException(
View Full Code Here

  private static void addMetFileToProductZip(Metadata productMet,
      String metFileBaseName, ZipOutputStream out) throws Exception {

    // get the product metadata, and add its met file to the stream
    ByteArrayOutputStream metOut = new ByteArrayOutputStream();
    SerializableMetadata serialMet = new SerializableMetadata(productMet);
    serialMet.writeMetadataToXmlStream(metOut);
    ByteArrayInputStream metIn = new ByteArrayInputStream(metOut.toByteArray());
    String metFileName = metFileBaseName + ".met";
    addZipEntryFromStream(metIn, out, metFileName);
  }
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.