Package ORG.oclc.oai.server.verb

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


            nextRecordPosition = tokenizer.nextToken();
            metadataPrefix = tokenizer.nextToken();
            if (metadataPrefix.equals("null"))
                metadataPrefix = null;
        } catch (NoSuchElementException e) {
            throw new BadResumptionTokenException();
        }
        Map listIdentifiersMap = new HashMap();
        ArrayList headers = new ArrayList();
        ArrayList identifiers = new ArrayList();
        try {
View Full Code Here


            resultSetId = tokenizer.nextToken();
            nextRecordPosition = tokenizer.nextToken();
            metadataPrefix = tokenizer.nextToken();
        } catch (NoSuchElementException e) {
            e.printStackTrace();
            throw new BadResumptionTokenException();
        }
        Map listRecordsMap = new HashMap();
        ArrayList recordsList = new ArrayList();
        try {
            Document srResponse =
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 */
            ResultSet rs = (ResultSet)resumptionResults.get(resumptionId);
            if (rs == null) {
                throw new BadResumptionTokenException();
            }
            int count;
           
            if (rs.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 */
            ResultSet rs = (ResultSet)resumptionResults.get(resumptionId);
            if (rs == null) {
                throw new BadResumptionTokenException();
            }
           
            if (rs.getRow() != oldCount) {
//              System.out.println("JDBCOAICatalog.listIdentifiers: reuse of old resumptionToken?");
                rs.absolute(oldCount);
            }
           
            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 */
                    throw new BadResumptionTokenException();
                }
            }
           
            /* decide if you're done */
            if (oldCount+count < numRows) {
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 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 */
                ResultSet rs = (ResultSet)resumptionResults.get(resumptionId);
                if (rs == null) {
                    throw new BadResumptionTokenException();
                }
               
                if (rs.getRow() != oldCount) {
//                  System.out.println("JDBCOAICatalog.listIdentifiers: reuse of old resumptionToken?");
                    rs.absolute(oldCount);
View Full Code Here

     */
    public Map listIdentifiers(String resumptionToken)
            throws BadResumptionTokenException, OAIInternalServerError
    {
        // Resumption tokens not yet supported
        throw new BadResumptionTokenException();
    }
View Full Code Here

        // null result means a problem -> bad resumption token
        if (m == null)
        {
            log.info(LogManager.getHeader(null, "oai_error",
                    "bad_resumption_token"));
            throw new BadResumptionTokenException();
        }

        return m;
    }
View Full Code Here

     */
    public Map listSets(String resumptionToken)
            throws BadResumptionTokenException, OAIInternalServerError
    {
        // Resumption tokens not yet supported
        throw new BadResumptionTokenException();
    }
View Full Code Here

            // Extract from, until, set, prefix
            for (int i = 0; i < 4; i++)
            {
                if (!st.hasMoreTokens())
                {
                    throw new BadResumptionTokenException();
                }

                String s = st.nextToken();

                // If this value is a delimiter /, we have no value for this
                // part
                // of the resumption token.
                if (s.equals("/"))
                {
                    obj[i] = null;
                }
                else
                {
                    obj[i] = s;

                    // Skip the delimiter
                    st.nextToken();
                }

                log.debug("is: " + (String) obj[i]);
            }

            if (!st.hasMoreTokens())
            {
                throw new BadResumptionTokenException();
            }

            obj[4] = new Integer(st.nextToken());
        }
        catch (NumberFormatException nfe)
        {
            throw new BadResumptionTokenException();
        }
        catch (NoSuchElementException nsee)
        {
            throw new BadResumptionTokenException();
        }

        return obj;
    }
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.