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

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


            } catch (MalformedURLException e) {
                LOG.log(Level.WARNING,
                        "DateTimeVersioner: MalformedURLException while generating "
                                + "initial data store ref for origRef: "
                                + origDirRef.getOrigReference());
                throw new VersioningException(e);
            } catch (URISyntaxException e) {
                LOG.log(Level.WARNING,
                        "DateTimeVersioner: Error creating File reference from original dir URI: "
                                + origDirRef.getOrigReference() + ": Message: "
                                + e.getMessage());
                throw new VersioningException(
                        "Unable to generate references from original dir reference for product: "
                                + product.getProductName() + ": Message: "
                                + e.getMessage());
            } catch (UnsupportedEncodingException e) {
                LOG.log(Level.WARNING,
                        "DateTimeVersioner: UnsupportedEncodingException while generating "
                                + "initial data store ref for origRef: "
                                + origDirRef.getOrigReference());
                throw new VersioningException(e);
            }

            // create the basic data store refs
            VersioningUtils.createBasicDataStoreRefsHierarchical(product
                    .getProductReferences());
View Full Code Here


                .equals(Product.STRUCTURE_HIERARCHICAL)) {

            if (product.getProductReferences() == null
                    || (product.getProductReferences() != null && product
                            .getProductReferences().size() == 0)) {
                throw new VersioningException(
                        "Hierarchical product and references not set!");
            }

            // get the first reference, it tells us what directory to move it
            // to
            // TODO: fix that hack :-)
            Reference r = (Reference) product.getProductReferences().get(0);

            String dataStoreRef = null;

            try {
                dataStoreRef = new File(new URI(productRepoPath)).toURL()
                        .toExternalForm()
                        + URLEncoder.encode(productName, "UTF-8") + "/";
                LOG.log(Level.INFO, "BasicVersioner: generated DataStore ref: "
                        + dataStoreRef + " from origRef: "
                        + r.getOrigReference());
                r.setDataStoreReference(dataStoreRef);
                VersioningUtils.createBasicDataStoreRefsHierarchical(product
                        .getProductReferences());
            } catch (URISyntaxException e) {
                LOG.log(Level.WARNING,
                        "BasicVersioner: URISyntaxException while generating initial "
                                + "data store ref for origRef: "
                                + r.getOrigReference());
                throw new VersioningException(e);
            } catch (MalformedURLException e) {
                LOG.log(Level.WARNING,
                        "BasicVersioner: MalformedURLException while generating initial "
                                + "data store ref for origRef: "
                                + r.getOrigReference());
                throw new VersioningException(e);
            } catch (UnsupportedEncodingException e) {
                LOG.log(Level.WARNING,
                        "BasicVersioner: UnsupportedEncodingException while generating "
                                + "initial data store ref for origRef: "
                                + r.getOrigReference());
                throw new VersioningException(e);
            }

        } else if (product.getProductStructure().equals(Product.STRUCTURE_FLAT)) {
            // just use the VersioningUtils
            VersioningUtils.createBasicDataStoreRefsFlat(productName,
                    productRepoPath, product.getProductReferences());
        } else {
            throw new VersioningException("Unsupported product structure: "
                    + product.getProductStructure());
        }

    }
View Full Code Here

            throws VersioningException {
        // we only handle single files, so throw exception if product is
        // heirarhical

        if (!product.getProductStructure().equals(Product.STRUCTURE_FLAT)) {
            throw new VersioningException(
                    "SingleFileVersioner: unable to version" + " Product: ["
                            + product.getProductName()
                            + "] with heirarchical structure");
        }

        // we need the Filename Metadata parameter for this to work
        String filename = metadata.getMetadata(FILENAME_FIELD);

        if (filename == null || (filename != null && filename.equals(""))) {
            throw new VersioningException(
                    "SingleFileVersioner: unable to version without "
                            + "Filename metadata field specified!");
        }

        // now we need the product type repo path
View Full Code Here

            throws VersioningException {

        // since we need the metadata, if the metadata is null, throw an
        // exception
        if (metadata == null) {
            throw new VersioningException(
                    "Unable to version product with no metadata!");
        }

        // we also only deal with Flat products, that is, Products with a single
        // reference
        if (flatProducts
                && !product.getProductStructure()
                        .equals(Product.STRUCTURE_FLAT)) {
            throw new VersioningException(
                    "Can only handle FLAT product structures");
        }

        // get the product type repo path
        String productTypeRepoPath = VersioningUtils
View Full Code Here

          LOG.log(Level.SEVERE,
              "ingestProduct: VersioningException when versioning Product: "
                  + p.getProductName() + " with Versioner "
                  + p.getProductType().getVersioner() + ": Message: "
                  + e.getMessage());
          throw new VersioningException(e);
        }

        // add the newly versioned references to the data store
        addProductReferences(p);
View Full Code Here

            LOG.log(Level.SEVERE,
                "ingestProduct: VersioningException when versioning Product: "
                        + product.getProductName() + " with Versioner "
                        + product.getProductType().getVersioner()
                        + ": Message: " + e.getMessage());
            throw new VersioningException(e);
        } catch (Exception e) {
            e.printStackTrace();
            LOG.log(Level.SEVERE, "Failed to ingest product [" + product
                    + "] : " + e.getMessage() + " -- rolling back ingest");
            try {
View Full Code Here

            LOG.log(Level.SEVERE,
                "ingestProduct: VersioningException when versioning Product: "
                        + product.getProductName() + " with Versioner "
                        + product.getProductType().getVersioner()
                        + ": Message: " + e.getMessage());
            throw new VersioningException(e);
        } catch (Exception e) {
            e.printStackTrace();
            LOG.log(Level.SEVERE, "Failed to ingest product [" + product
                    + "] : " + e.getMessage() + " -- rolling back ingest");
            try {
View Full Code Here

          LOG.log(Level.SEVERE,
              "ingestProduct: VersioningException when versioning Product: "
                  + p.getProductName() + " with Versioner "
                  + p.getProductType().getVersioner() + ": Message: "
                  + e.getMessage());
          throw new VersioningException(e);
        }

        // add the newly versioned references to the data store
        addProductReferences(p);
      }
View Full Code Here

  private String getFilePathSpec(ProductType productType) throws VersioningException {
    String fileSpec = properties.getProperty(BASE_PROPERTY + productType.getName().toLowerCase());
    if (Strings.isNullOrEmpty(fileSpec)) {
      fileSpec = properties.getProperty(BASE_PROPERTY + ALL);
      if (Strings.isNullOrEmpty(fileSpec)) {
        throw new VersioningException("Not defined for product type " + productType.getName());
      }
    }
    return fileSpec;
  }
View Full Code Here

                .equals(Product.STRUCTURE_HIERARCHICAL)) {

            if (product.getProductReferences() == null
                    || (product.getProductReferences() != null && product
                            .getProductReferences().size() == 0)) {
                throw new VersioningException(
                        "Hierarchical product and references not set!");
            }

            // get the first reference, it tells us what directory to move it
            // to
            // TODO: fix that hack :-)
            Reference r = (Reference) product.getProductReferences().get(0);

            String dataStoreRef = null;

            try {
                dataStoreRef = new File(new URI(productRepoPath)).toURL()
                        .toExternalForm();
                if(!dataStoreRef.endsWith("/")){
                  dataStoreRef+="/";
                }
               
                dataStoreRef+= URLEncoder.encode(productName, "UTF-8") + "/";
                LOG.log(Level.INFO, "BasicVersioner: generated DataStore ref: "
                        + dataStoreRef + " from origRef: "
                        + r.getOrigReference());
                r.setDataStoreReference(dataStoreRef);
                VersioningUtils.createBasicDataStoreRefsHierarchical(product
                        .getProductReferences());
            } catch (URISyntaxException e) {
                LOG.log(Level.WARNING,
                        "BasicVersioner: URISyntaxException while generating initial "
                                + "data store ref for origRef: "
                                + r.getOrigReference());
                throw new VersioningException(e);
            } catch (MalformedURLException e) {
                LOG.log(Level.WARNING,
                        "BasicVersioner: MalformedURLException while generating initial "
                                + "data store ref for origRef: "
                                + r.getOrigReference());
                throw new VersioningException(e);
            } catch (UnsupportedEncodingException e) {
                LOG.log(Level.WARNING,
                        "BasicVersioner: UnsupportedEncodingException while generating "
                                + "initial data store ref for origRef: "
                                + r.getOrigReference());
                throw new VersioningException(e);
            }

        } else if (product.getProductStructure().equals(Product.STRUCTURE_FLAT)) {
            // just use the VersioningUtils
            VersioningUtils.createBasicDataStoreRefsFlat(productName,
                    productRepoPath, product.getProductReferences());
        } else {
            throw new VersioningException("Unsupported product structure: "
                    + product.getProductStructure());
        }

    }
View Full Code Here

TOP

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

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.