Package eu.planets_project.ifr.core.storage.api.query

Examples of eu.planets_project.ifr.core.storage.api.query.QueryValidationException


     * @see eu.planets_project.ifr.core.storage.api.DigitalObjectManager#list(java.net.URI, eu.planets_project.ifr.core.storage.api.query.Query)
     */
    public List<URI> list(URI pdURI, Query q) throws QueryValidationException {
      if (q == null) {
        // list() without query not supported - empty result list
        throw new QueryValidationException("null query not allowed");
      }
     
      if (pdURI == null) {
        // Hierarchy is flat (no sub-directories) - only allow 'null' as pdURI!
           if (q instanceof QueryString) {
             return new YahooResultList((QueryString) q);
           } else {
             throw new QueryValidationException("Unsupported query type");
           }
      } else {
        return new YahooResultList(null);
      }
  }
View Full Code Here


    /**
     * {@inheritDoc}
     * @see eu.planets_project.ifr.core.storage.api.DigitalObjectManager#list(java.net.URI, eu.planets_project.ifr.core.storage.api.query.Query)
     */
    public List<URI> list(URI pdURI, Query q) throws QueryValidationException {
        throw new QueryValidationException("This implementation does not support queries.");
    }
View Full Code Here

   * {@inheritDoc}
   * @see eu.planets_project.ifr.core.storage.api.DigitalObjectManager#list(java.net.URI, eu.planets_project.ifr.core.storage.api.query.Query)
   */
  public List<URI> list(URI pdURI, Query q) throws QueryValidationException {
      if (q == null)
        throw new QueryValidationException("null query not allowed");
     
      if (!(q instanceof QueryString))
        throw new QueryValidationException("Unsupported query type");
   
      if (pdURI == null) {
        // SRU hierarchy is flat (no sub-directories) - only allow 'null' as pdURI!
        ArrayList<URI> resultList = new ArrayList<URI>();
       
        try {
        String url = baseURL + "&query=" + URLEncoder.encode(((QueryString) q).getQuery(), "UTF-8") +
                "&maximumRecords=" + "10" /* limit!!! */ + "&recordSchema=dc";
       
        GetMethod sruRequest = new GetMethod(url);
        sruRequest.getParams().setParameter(HttpMethodParams.SO_TIMEOUT, Integer.valueOf(TIMEOUT));
        httpClient.executeMethod(sruRequest);
         
        // Parse metadata records
        SAXBuilder builder = new SAXBuilder();
        List<SRUResult> results = parseDom(builder.build(sruRequest.getResponseBodyAsStream()));
       
        // Extract URIs from metadata and return
        for (SRUResult aResult : results) {
          resultList.add(aResult.uri);
        }
        } catch (UnsupportedEncodingException e) {
          log.severe(e.getMessage() + " (this should never happen");
        } catch (IOException e) {
          throw new QueryValidationException("Error connecting to SRU endpoint: " + e.getMessage());
        } catch (JDOMException e) {
          throw new QueryValidationException("Invalid SRU respons: " + e.getMessage());
        }
     
        return resultList;
      } else {
        return new ArrayList<URI>();
View Full Code Here

    /**
     * {@inheritDoc}
     * @see eu.planets_project.ifr.core.storage.api.DigitalObjectManager#list(java.net.URI, eu.planets_project.ifr.core.storage.api.query.Query)
     */
    public List<URI> list(URI pdURI, Query q) throws QueryValidationException {
        throw new QueryValidationException("This implementation does not support queries.");
    }
View Full Code Here

     * {@inheritDoc}
     * @see eu.planets_project.ifr.core.storage.api.DigitalObjectManager#list(java.net.URI, eu.planets_project.ifr.core.storage.api.query.Query)
     */
    public List<URI> list(URI pdURI, Query q) throws QueryValidationException
    {
        throw new QueryValidationException("This implementation does not support queries.");
    }
View Full Code Here

  /* (non-Javadoc)
   * @see eu.planets_project.ifr.core.storage.api.DigitalObjectManager#list(java.net.URI, eu.planets_project.ifr.core.storage.api.query.Query)
   */
  public List<URI> list(URI pdURI, Query q) throws QueryValidationException {
        throw new QueryValidationException("This implementation does not support queries.");
  }
View Full Code Here

          IdentifiersList list;
          if (q == null) {
            list = server.listIdentifiers(metaDataPrefix);           
          } else {
            if (!(q instanceof QueryDateRange))
              throw new QueryValidationException("Unsupported query type");
           
            list = server.listIdentifiers(metaDataPrefix, dateFormat.format(((QueryDateRange) q).getStartDate().getTime()), dateFormat.format(((QueryDateRange) q).getEndDate().getTime()), set)
          }
         
          for (Header header : list.asList()) {
View Full Code Here

              // read titles and metadata
              resultList = retrieveAll(pdURI, server);
            } else {
              log.info("OAIDigitalObjectManagerDCImpl pdURI: " + pdURI + ", q != null");
              if (!(q instanceof QueryDateRange))
                throw new QueryValidationException("Unsupported query type");
              resultList = super.list(pdURI, q);
            }           
          } catch (Exception e) {
            log.severe(e.getMessage());
            log.info("OAIDigitalObjectManagerDCImpl pdURI: " + pdURI + ", error: " + e.getMessage());
View Full Code Here

          RecordsList list;
          if (q == null) {
            list = server.listRecords(metaDataPrefix, "2009-07-12T10:50:20Z", "2009-07-14T16:38:20Z", set);           
          } else {
            if (!(q instanceof QueryDateRange))
              throw new QueryValidationException("Unsupported query type");
           
            list = server.listRecords(metaDataPrefix, dateFormat.format(((QueryDateRange) q).getStartDate().getTime()), dateFormat.format(((QueryDateRange) q).getEndDate().getTime()), set)
          }
         
          // Prepare XPath expression
View Full Code Here

TOP

Related Classes of eu.planets_project.ifr.core.storage.api.query.QueryValidationException

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.