Package ORG.oclc.oai.server.verb

Examples of ORG.oclc.oai.server.verb.BadResumptionTokenException


            resumptionId = tokenizer.nextToken();
            oldCount = Integer.parseInt(tokenizer.nextToken());
      numRows = Integer.parseInt(tokenizer.nextToken());
            metadataPrefix = tokenizer.nextToken();
        } catch (NoSuchElementException e) {
            throw new BadResumptionTokenException();
        }

  /* Get some more records from your database */
  Iterator iterator = (Iterator)resumptionResults.remove(resumptionId);
  if (iterator == null) {
View Full Code Here


            resumptionId = tokenizer.nextToken();
            oldCount = Integer.parseInt(tokenizer.nextToken());
      numRows = Integer.parseInt(tokenizer.nextToken());
            metadataPrefix = tokenizer.nextToken();
        } catch (NoSuchElementException e) {
            throw new BadResumptionTokenException();
        }

  /* Get some more records from your database */
  Iterator iterator = (Iterator)resumptionResults.remove(resumptionId);
  if (iterator == null) {
      System.out.println("XMLFileOAICatalog.listRecords: reuse of old resumptionToken?");
      iterator = nativeMap.entrySet().iterator();
      for (int i = 0; i<oldCount; ++i)
    iterator.next();
  }
       
  /* load the records ArrayLists. */
  int count = 0;
  while (count < maxListSize && iterator.hasNext()) {
      Map.Entry entryNativeMap = (Map.Entry)iterator.next();
      try {
                Object nativeRecord = nativeMap.get((String)entryNativeMap.getKey());
                String record = constructRecord(nativeRecord, metadataPrefix);
                records.add(record);
                count++;
            } catch (CannotDisseminateFormatException e) {
                /* the client hacked the resumptionToken beyond repair */
                throw new BadResumptionTokenException();
      }
  }
       
  /* decide if you're done. */
  if (iterator.hasNext()) {
View Full Code Here

    }


    public Map listSets(String resumptionToken)
      throws BadResumptionTokenException, OAIInternalServerError {
  throw new BadResumptionTokenException();
    }
View Full Code Here

     * @exception OAIInternalServerError signals an http status code 500 problem
     */
    public Map listSets(String resumptionToken)
    throws OAIInternalServerError, BadResumptionTokenException {
        if (setQuery == null) {
            throw new BadResumptionTokenException();
        } else {
            purge(); // clean out old resumptionTokens
            Map listSetsMap = new HashMap();
            ArrayList sets = new ArrayList();
           
            /****************************
             * parse your resumptionToken
             ****************************/
            StringTokenizer tokenizer = new StringTokenizer(resumptionToken, "!");
            String resumptionId;
            int oldCount;
            int numRows;
            try {
                resumptionId = tokenizer.nextToken();
                oldCount = Integer.parseInt(tokenizer.nextToken());
                numRows = Integer.parseInt(tokenizer.nextToken());
            } catch (NoSuchElementException e) {
                throw new BadResumptionTokenException();
            }
           
            try {
                /* Get some more records from your database */
                ResultSet rs = (ResultSet)resumptionResults.get(resumptionId);
                if (rs == null) {
                    throw new BadResumptionTokenException();
                }
               
                if (rs.getRow() != oldCount) {
//                  System.out.println("ExtendedJDBCOAICatalog.listIdentifiers: reuse of old resumptionToken?");
                    rs.absolute(oldCount);
View Full Code Here

            if (debug) {
                System.out.println("ExtendedJDBCOAICatalog.listIdentifiers: set=>"
                        + set + "<");
            }
        } catch (NoSuchElementException e) {
            throw new BadResumptionTokenException();
        }
       
        Connection con = null;
        try {
            con = startConnection();
View Full Code Here

                set = null;
            oldCount = Integer.parseInt(tokenizer.nextToken());
//          numRows = Integer.parseInt(tokenizer.nextToken());
            metadataPrefix = tokenizer.nextToken();
        } catch (NoSuchElementException e) {
            throw new BadResumptionTokenException();
        }
       
        Connection con = null;
        try {
            con = startConnection();
            /* Get some more records from your database */
            Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
            ResultSet rs = stmt.executeQuery(populateRangeQuery(from, until, set,
                    oldCount, maxListSize));
           
            int count;
           
            /* load the headers and identifiers ArrayLists. */
            for (count = 0; count < maxListSize && rs.next(); ++count) {
                try {
                    HashMap nativeItem = new HashMap();
                    nativeItem.put("coreResult", getColumnValues(rs));
                    extendItem(con, nativeItem);
                    String record = constructRecord(nativeItem, metadataPrefix);
                    records.add(record);
                } catch (CannotDisseminateFormatException e) {
                    /* the client hacked the resumptionToken beyond repair */
                    endConnection(con);
                    throw new BadResumptionTokenException();
                }
            }
           
            /* decide if you're done */
//          if (count == maxListSize) {
View Full Code Here

            resumptionId = tokenizer.nextToken();
            oldCount = Integer.parseInt(tokenizer.nextToken());
      numRows = Integer.parseInt(tokenizer.nextToken());
            metadataPrefix = tokenizer.nextToken();
        } catch (NoSuchElementException e) {
            throw new BadResumptionTokenException();
        }

  /* Get some more records from your database */
  Iterator iterator = (Iterator)resumptionResults.remove(resumptionId);
  if (iterator == null) {
View Full Code Here

            resumptionId = tokenizer.nextToken();
            oldCount = Integer.parseInt(tokenizer.nextToken());
      numRows = Integer.parseInt(tokenizer.nextToken());
            metadataPrefix = tokenizer.nextToken();
        } catch (NoSuchElementException e) {
            throw new BadResumptionTokenException();
        }

  /* Get some more records from your database */
  Iterator iterator = (Iterator)resumptionResults.remove(resumptionId);
  if (iterator == null) {
      System.out.println("FileSystemOAICatalog.listRecords: reuse of old resumptionToken?");
      iterator = fileDateMap.entrySet().iterator();
      for (int i = 0; i<oldCount; ++i)
    iterator.next();
  }
       
  /* load the records ArrayLists. */
  int count = 0;
  while (count < maxListSize && iterator.hasNext()) {
      Map.Entry entryDateMap = (Map.Entry)iterator.next();
      try {
                HashMap nativeItem = getNativeRecord((String)entryDateMap.getKey());
                String record = constructRecord(nativeItem, metadataPrefix);
                records.add(record);
                count++;
            } catch (CannotDisseminateFormatException e) {
                /* the client hacked the resumptionToken beyond repair */
                throw new BadResumptionTokenException();
            } catch (IOException e) {
                /* the file is probably missing */
                throw new BadResumptionTokenException();
      }
  }
       
  /* decide if you're done. */
  if (iterator.hasNext()) {
View Full Code Here

    }


    public Map listSets(String resumptionToken)
      throws BadResumptionTokenException, OAIInternalServerError {
  throw new BadResumptionTokenException();
    }
View Full Code Here

            if (debug) {
                System.out.println("JDBCLimitedOAICatalog.listIdentifiers: set=>"
                        + set + "<");
            }
        } catch (NoSuchElementException e) {
            throw new BadResumptionTokenException();
        }
       
        Connection con = null;
        try {
            con = startConnection();
View Full Code Here

TOP

Related Classes of ORG.oclc.oai.server.verb.BadResumptionTokenException

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.