Package org.apache.oodt.cas.filemgr.structs.exceptions

Examples of org.apache.oodt.cas.filemgr.structs.exceptions.DataTransferException


      DeleteObjectRequest request = new DeleteObjectRequest(bucketName, stripProtocol(
          ref.getDataStoreReference(), true));
      try {
        s3Client.deleteObject(request);
      } catch (AmazonClientException e) {
        throw new DataTransferException(String.format(
            "Failed to delete product reference %s from S3", ref.getDataStoreReference()), e);
      }
    }
  }
View Full Code Here


                  Level.WARNING,
                  "URI Syntax Exception when moving dir "
                        + ((Reference) product.getProductReferences().get(0))
                              .getOrigReference() + ": Message: "
                        + e.getMessage());
            throw new DataTransferException(e);
         }
      } else if (product.getProductStructure().equals(Product.STRUCTURE_FLAT)) {
         try {
            moveFilesToProductRepo(product);
         } catch (URISyntaxException e) {
            LOG.log(
                  Level.WARNING,
                  "URI Syntax Exception when moving files: Message: "
                        + e.getMessage());
            throw new DataTransferException(e);
         }
      } else {
         throw new DataTransferException(
               "Cannot transfer product on unknown ProductStructure: "
                     + product.getProductStructure());
      }
   }
View Full Code Here

                  Level.WARNING,
                  "URI Syntax Exception when moving dir "
                        + ((Reference) product.getProductReferences().get(0))
                              .getDataStoreReference() + ": Message: "
                        + e.getMessage());
            throw new DataTransferException(e);
         }
      } else if (product.getProductStructure().equals(Product.STRUCTURE_FLAT)) {
         try {
            copyFilesToDir(product, directory);
         } catch (URISyntaxException e) {
            LOG.log(
                  Level.WARNING,
                  "URI Syntax Exception when moving files: Message: "
                        + e.getMessage());
            throw new DataTransferException(e);
         }
      } else {
         throw new DataTransferException(
               "Cannot transfer product on unknown ProductStructure: "
                     + product.getProductStructure());
      }
   }
View Full Code Here

        if (p.getProductStructure().equals(Product.STRUCTURE_FLAT)) {
            // we just need to get its first reference
            if (p.getProductReferences() == null
                    || (p.getProductReferences() != null && p
                            .getProductReferences().size() != 1)) {
                throw new DataTransferException(
                        "Flat products must have a single reference: cannot move");
            }

            // okay, it's fine to move it
            // first, we need to update the data store ref
            Reference r = (Reference) p.getProductReferences().get(0);
            if (r.getDataStoreReference().equals(
                    new File(newPath).toURI().toString())) {
                throw new DataTransferException("cannot move product: ["
                        + p.getProductName() + "] to same location: ["
                        + r.getDataStoreReference() + "]");
            }

            // create a copy of the current data store path: we'll need it to
            // do the data transfer
            Reference copyRef = new Reference(r);

            // update the copyRef to have the data store ref as the orig ref
            // the the newLoc as the new ref
            copyRef.setOrigReference(r.getDataStoreReference());
            copyRef.setDataStoreReference(new File(newPath).toURI().toString());

            p.getProductReferences().clear();
            p.getProductReferences().add(copyRef);

            // now transfer it
            try {
                this.dataTransfer.transferProduct(p);
            } catch (IOException e) {
                throw new DataTransferException(e.getMessage());
            }

            // now delete the original copy
            try {
                if (!new File(new URI(copyRef.getOrigReference())).delete()) {
                    LOG.log(Level.WARNING, "Deletion of original file: ["
                            + r.getDataStoreReference()
                            + "] on product move returned false");
                }
            } catch (URISyntaxException e) {
                throw new DataTransferException(
                        "URI Syntax exception trying to remove original product ref: Message: "
                                + e.getMessage());
            }

            // now save the updated reference
            try {
                this.catalog.modifyProduct(p);
                return true;
            } catch (CatalogException e) {
                throw new DataTransferException(e.getMessage());
            }
        } else
            throw new UnsupportedOperationException(
                    "Moving of heirarhical products not supported yet");
    }
View Full Code Here

          }
        } catch (Exception e) {
          LOG.log(Level.SEVERE,
              "ingestProduct: DataTransferException when transfering Product: "
                  + p.getProductName() + ": Message: " + e.getMessage());
          throw new DataTransferException(e);
        }
      }

      // that's it!
      return p.getProductId();
View Full Code Here

         }
      } catch (Exception e) {
         LOG.log(Level.SEVERE, "Failed to read '" + numBytes
               + "' bytes from file '" + filePath + "' at index '" + offset
               + "' : " + e.getMessage(), e);
         throw new DataTransferException("Failed to read '" + numBytes
               + "' bytes from file '" + filePath + "' at index '" + offset
               + "' : " + e.getMessage(), e);
      } finally {
         try { is.close(); } catch (Exception e) {}
      }
View Full Code Here

     */
    public void transferProduct(Product product) throws DataTransferException,
            IOException {

        if (fileManagerUrl == null) {
            throw new DataTransferException(
                    "No file manager url specified for remote data transfer: cannot transfer product: ["
                            + product.getProductName() + "]!");
        }

        quietNotifyTransferProduct(product);
View Full Code Here

            } catch (URISyntaxException e) {
                LOG.log(Level.WARNING, "URI Syntax Exception when moving dir "
                        + ((Reference) product.getProductReferences().get(0))
                                .getOrigReference() + ": Message: "
                        + e.getMessage());
                throw new DataTransferException(e);
            }
        } else if (product.getProductStructure().equals(Product.STRUCTURE_FLAT)) {
            try {
                moveFilesToProductRepo(product);
            } catch (URISyntaxException e) {
                LOG.log(Level.WARNING,
                        "URI Syntax Exception when moving files: Message: "
                                + e.getMessage());
                throw new DataTransferException(e);
            }
        } else {
            throw new DataTransferException(
                    "Cannot transfer product on unknown ProductStructure: "
                            + product.getProductStructure());
        }
    }
View Full Code Here

                  Level.WARNING,
                  "URI Syntax Exception when moving dir "
                        + ((Reference) product.getProductReferences().get(0))
                              .getOrigReference() + ": Message: "
                        + e.getMessage());
            throw new DataTransferException(e);
         }
      } else if (product.getProductStructure().equals(Product.STRUCTURE_FLAT)) {
         try {
            moveFilesToProductRepo(product);
         } catch (URISyntaxException e) {
            LOG.log(
                  Level.WARNING,
                  "URI Syntax Exception when moving files: Message: "
                        + e.getMessage());
            throw new DataTransferException(e);
         }
      } else {
         throw new DataTransferException(
               "Cannot transfer product on unknown ProductStructure: "
                     + product.getProductStructure());
      }
   }
View Full Code Here

                  Level.WARNING,
                  "URI Syntax Exception when moving dir "
                        + ((Reference) product.getProductReferences().get(0))
                              .getDataStoreReference() + ": Message: "
                        + e.getMessage());
            throw new DataTransferException(e);
         }
      } else if (product.getProductStructure().equals(Product.STRUCTURE_FLAT)) {
         try {
            copyFilesToDir(product, directory);
         } catch (URISyntaxException e) {
            LOG.log(
                  Level.WARNING,
                  "URI Syntax Exception when moving files: Message: "
                        + e.getMessage());
            throw new DataTransferException(e);
         }
      } else {
         throw new DataTransferException(
               "Cannot transfer product on unknown ProductStructure: "
                     + product.getProductStructure());
      }
   }
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.filemgr.structs.exceptions.DataTransferException

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.