Package ORG.oclc.oai.server.verb

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


                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 = getColumnValues(rs);
                    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


     * @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("JDBCLimitedOAICatalog.listIdentifiers: reuse of old resumptionToken?");
                    rs.absolute(oldCount);
View Full Code Here

            oldCount = Integer.parseInt(tokenizer.nextToken());
      numRows = Integer.parseInt(tokenizer.nextToken());
            metadataPrefix = tokenizer.nextToken();
            set = 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

            oldCount = Integer.parseInt(tokenizer.nextToken());
      numRows = Integer.parseInt(tokenizer.nextToken());
            metadataPrefix = tokenizer.nextToken();
            set = 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("NewFileSystemOAICatalog.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;
        ArrayList setIdentifiers = (ArrayList)setMap.get(set);
  while (count < maxListSize && iterator.hasNext()) {
      Map.Entry entryDateMap = (Map.Entry)iterator.next();
            String path = (String)entryDateMap.getKey();
            if (setIdentifiers == null || setIdentifiers.contains(path)) {
                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. */
 
View Full Code Here

    }


    public Map listSets(String resumptionToken)
      throws BadResumptionTokenException, OAIInternalServerError {
  throw new BadResumptionTokenException();
    }
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();
        }
       
        try {
            /* Get some more records from your database */
            stmtRs = (StatementResultSet)resumptionResults.get(resumptionId);
            if (stmtRs == null) {
                throw new BadResumptionTokenException();
            }
            int count;
           
            if (stmtRs.getRow() != oldCount) {
//              System.out.println("JDBCOAICatalog.listIdentifiers: reuse of old resumptionToken?");
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();
        }
       
        try {
            /* Get some more records from your database */
            stmtRs = (StatementResultSet) resumptionResults.get(resumptionId);
            if (stmtRs == null) {
                throw new BadResumptionTokenException();
            }
           
            if (stmtRs.getRow() != oldCount) {
//              System.out.println("JDBCOAICatalog.listIdentifiers: reuse of old resumptionToken?");
                stmtRs.absolute(oldCount);
            }
           
            int count;
           
            /* load the headers and identifiers ArrayLists. */
            for (count = 0; count < maxListSize && stmtRs.next(); ++count) {
                try {
                    HashMap nativeItem = stmtRs.getColumnValues();
                    String record = constructRecord(nativeItem, metadataPrefix);
                    records.add(record);
                } catch (CannotDisseminateFormatException e) {
                    /* the client hacked the resumptionToken beyond repair */
                    throw new BadResumptionTokenException();
                }
            }
           
            /* decide if you're done */
            if (oldCount+count < numRows) {
View Full Code Here

    public Map listSets(String resumptionToken)
    throws OAIInternalServerError, BadResumptionTokenException {
        StatementResultSet stmtRs = null;
       
        if (setQuery == null) {
            throw new BadResumptionTokenException();
        } else {
            purge(); // clean out old resumptionTokens
            Map listSetsMap = new HashMap();
            ArrayList sets = new ArrayList();
           
            /**********************************************************************
             * parse your resumptionToken and look it up in the resumptionResults,
             * if necessary
             **********************************************************************/
            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 */
                stmtRs = (StatementResultSet)resumptionResults.get(resumptionId);
                if (stmtRs == null) {
                    throw new BadResumptionTokenException();
                }
               
                if (stmtRs.getRow() != oldCount) {
//                  System.out.println("JDBCOAICatalog.listIdentifiers: reuse of old resumptionToken?");
                    stmtRs.absolute(oldCount);
View Full Code Here

      } catch (IdDoesNotExistException e) {
    throw new OAIInternalServerError("GetRecord failed to retrieve identifier '"
             + identifier + "'");
      } catch (CannotDisseminateFormatException e) {
    // someone cheated
    throw new BadResumptionTokenException();
      }
  }
  listRecordsMap.put("records", records.iterator());
  if (resumptionToken != null) {
      listRecordsMap.put("resumptionToken", resumptionToken);
View Full Code Here

        return listSetsMap;
    }
   
    public Map listSets(String resumptionToken)
    throws BadResumptionTokenException {
        throw new BadResumptionTokenException();
    }
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.