Package org.apache.oodt.product

Examples of org.apache.oodt.product.ProductException


        // we'll only accept queries for ProductId=some_id
        String kwdQuery = query.getKwdQueryString();
        String[] kwdQueryToks = kwdQuery.split("=");
        if (kwdQueryToks == null
                || (kwdQueryToks != null && kwdQueryToks.length != 2)) {
            throw new ProductException(
                    "Malformed query: CASProductHandler only accepts queries of the "
                            + "form " + PRODUCT_ID
                            + " = <some product id>: your query was: "
                            + kwdQuery);
        }

        String prodId = kwdQueryToks[1];
        Product product = null;
        try {
            product = this.fm.getProductById(prodId);
            product.setProductReferences(this.fm.getProductReferences(product));
        } catch (CatalogException e) {
            throw new ProductException(
                    "Exception querying file manager for product: [" + prodId
                            + "]: Message: " + e.getMessage());
        }

        try {
            addResultsFromProductId(query, product);
        } catch (URISyntaxException e) {
            throw new ProductException(
                    "URI Syntax Exception deciphering product: ["
                            + product.getProductName() + "]: Message: "
                            + e.getMessage());
        }
        return query;
View Full Code Here


            buf = new byte[length];
            int numRead;
            long numSkipped;
            numSkipped = in.skip(offset);
            if (numSkipped != offset) {
                throw new ProductException("Was not able to skip: [" + offset
                        + "] bytes into product: num actually skipped: ["
                        + numSkipped + "]");
            }

            numRead = in.read(buf, 0, length);

            if (numRead != length) {
                throw new ProductException("Was not able to read: [" + length
                        + "] bytes from product: num actually read: ["
                        + numRead + "]");
            }
        } catch (IOException e) {
            e.printStackTrace();
            throw new ProductException(
                    "IO exception retrieving chunk of product: [" + id
                            + "]: Message: " + e.getMessage());
        } finally {
            if (in != null) {
                try {
View Full Code Here

        try {
            translateToDomain(selectSet, true);
            translateToDomain(whereSet, false);
        } catch (Exception e) {
            e.printStackTrace();
            throw new ProductException(e.getMessage());
        }
        queryAndPackageResults(query);
        return query;
    }
View Full Code Here

      xmlQuery.getResults().add(
          new LargeResult(/* id */rtAndPath,/* mimeType */ mimeType, /* profileID */null,
              /* resourceID */new File(realPath).getName(), Collections.EMPTY_LIST,
              handler.sizeOf(realPath)));
    } else {
      throw new ProductException("return type: [" + cmd + "] is unsupported!");
    }

    return xmlQuery;

  }
View Full Code Here

  }

  private void validate(String ofsn, String cmd) throws ProductException {
    if (ofsn == null || cmd == null || (ofsn != null && ofsn.equals(""))
        || (cmd != null && cmd.equals(""))) {
      throw new ProductException("must specify OFSN and RT parameters!");
    } else if (!OFSNUtils.validateOFSN(ofsn)) {
      throw new ProductException("OFSN is invalid");
    }
  }
View Full Code Here

  }

  private void validateHandlerConfig(OFSNHandlerConfig cfg, String cmd)
      throws ProductException {
    if (cfg == null) {
      throw new ProductException("Unrecognized command: [" + cmd + "]!");
    }
  }
View Full Code Here

  }

  private boolean isListingCmd(String cmd) throws ProductException {
    OFSNHandlerConfig cfg = this.conf.getHandlerConfig(cmd);
    if (cfg == null) {
      throw new ProductException("Unrecognized command: [" + cmd + "]!");
    }

    if (cfg.getType().equals(LISTING_CMD)) {
      return true;
    } else
View Full Code Here

        try {
            translateToDomain(selectSet, true);
            translateToDomain(whereSet, false);
        } catch (Exception e) {
            LOG.severe(e.getMessage());
            throw new ProductException(e.getMessage());
        }

        queryAndPackageResults(query);

        return query;
View Full Code Here

      is.skip(offset);
      is.read(retBytes, 0, length);
      return retBytes;
    } catch (IOException e) {
      e.printStackTrace();
      throw new ProductException("Error reading bytes from file: [" + filepath
          + "] MD5: Message: " + e.getMessage());
    }
  }
View Full Code Here

   * org.apache.oodt.product.handlers.ofsn.OFSNListHandler#getListing(java
   * .lang.String)
   */
  public File[] getListing(String ofsn) throws ProductException {
    if (!new File(ofsn).exists()) {
      throw new ProductException("file: [" + ofsn + "] does not exist!");
    }
    return new File[] { new File(ofsn) };
  }
View Full Code Here

TOP

Related Classes of org.apache.oodt.product.ProductException

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.