Package org.apache.oodt.cas.product.jaxrs.exceptions

Examples of org.apache.oodt.cas.product.jaxrs.exceptions.InternalServerErrorException


    }
    catch (ParserConfigurationException e)
    {
      String message = "Unable to create RSS XML document for RSS response.";
      LOGGER.log(Level.WARNING, message, e);
      throw new InternalServerErrorException(message);
    }
    catch (ParseException e)
    {
      String message = "Unable to create RSS XML document for RSS response.";
      LOGGER.log(Level.WARNING, message, e);
      throw new InternalServerErrorException(message);
    }
  }
View Full Code Here


    if (!workingDir.exists() && !workingDir.mkdirs())
    {
      String message = "Unable to create the working directory ("
        + workingDir.getAbsolutePath() + ") to build the zip file.";
      LOGGER.log(Level.FINE, message);
      throw new InternalServerErrorException(message);
    }

    try
    {
      // Retrieve the reference file.
      Reference reference = resource.getReference();
      File refFile = new File(new URI(reference.getDataStoreReference()));
      if (!refFile.exists())
      {
        throw new BadRequestException("Unable to locate the source file for the"
          + " reference.");
      }

      // Try to remove previously created zip files that have the same name.
      String workingDirPath = workingDir.getCanonicalPath();
      workingDirPath += workingDirPath.endsWith("/") ? "" : "/";
      File file = new File(workingDirPath + refFile.getName() + ".zip");
      if (file.exists() && !file.delete())
      {
        String message = "Unable to delete an existing zip file ("
          + file.getAbsolutePath()
          + ") before creating a new zip file with the same name.";
        LOGGER.log(Level.FINE, message);
        throw new InternalServerErrorException(message);
      }

      // Add the reference file to the zip file.
      ZipFile zipFile = new ZipFile(file);
      ZipParameters parameters = new ZipParameters();
      parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
      parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);
      zipFile.addFile(refFile, parameters);

      httpHeaders.add("Content-Type", "application/zip");
      httpHeaders.add("Content-Disposition",
        "attachment; filename=\"" + file.getName() + "\"");
      FileInputStream fis = new FileInputStream(file);
      IOUtils.copy(fis, entityStream);
      fis.close();
    }
    catch (URISyntaxException e)
    {
      String message =
        "Problem with the data store URI for the reference source file(s).";
      LOGGER.log(Level.FINE, message, e);
      throw new NotFoundException(message + " " + e.getMessage());
    }
    catch (ZipException e)
    {
      String message =
        "Unable to create a zip archive of the reference source file(s).";
      LOGGER.log(Level.FINE, message, e);
      throw new InternalServerErrorException(message + " " + e.getMessage());
    }
  }
View Full Code Here

    }
    catch (ParserConfigurationException e)
    {
      String message = "Unable to create RSS XML document for RSS response.";
      LOGGER.log(Level.WARNING, message, e);
      throw new InternalServerErrorException(message);
    }
    catch (ParseException e)
    {
      String message = "Unable to create RSS XML document for RSS response.";
      LOGGER.log(Level.WARNING, message, e);
      throw new InternalServerErrorException(message);
    }
  }
View Full Code Here

    }
    catch (ZipException e)
    {
      String message = "Unable to create a zip archive of the product.";
      LOGGER.log(Level.FINE, message, e);
      throw new InternalServerErrorException(message + " " + e.getMessage());
    }
    catch (IOException e)
    {
      String message = "Encountered I/O problems while trying to create a zip "
        + "archive of the product.";
      LOGGER.log(Level.FINE, message, e);
      throw new InternalServerErrorException(message + " " + e.getMessage());
    }
  }
View Full Code Here

    }
    catch (ParserConfigurationException e)
    {
      String message = "Unable to create RSS XML document for RSS response.";
      LOGGER.log(Level.WARNING, message, e);
      throw new InternalServerErrorException(message);
    }
  }
View Full Code Here

    }
    catch (ParserConfigurationException e)
    {
      String message = "Unable to build org.w3c.dom.Document for output.";
      LOGGER.log(Level.WARNING, message, e);
      throw new InternalServerErrorException(message);
    }
  }
View Full Code Here

    catch (ZipException e)
    {
      String message = "Unable to create a zip archive of the dataset.";
      LOGGER.log(Level.FINE, message, e);
      throw new InternalServerErrorException(message + " " + e.getMessage());
    }
    catch (IOException e)
    {
      String message = "Encountered I/O problems while trying to create a zip "
        + "archive of the dataset.";
      LOGGER.log(Level.FINE, message, e);
      throw new InternalServerErrorException(message + " " + e.getMessage());
    }
  }
View Full Code Here

    }
    catch (ParserConfigurationException e)
    {
      String message = "Unable to create RSS XML document for RSS response.";
      LOGGER.log(Level.WARNING, message, e);
      throw new InternalServerErrorException(message);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.product.jaxrs.exceptions.InternalServerErrorException

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.