Package ORG.oclc.oai.server.verb

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


                            "http://www.openarchives.org/OAI/2.0/#header",
                            maxListSize,
                    "xml");
            } catch (IOException e) {
                e.printStackTrace();
                throw new OAIInternalServerError(e.getMessage());
            } catch (SAXException e) {
                e.printStackTrace();
                throw new OAIInternalServerError(e.getMessage());
            } catch (ParserConfigurationException e) {
                e.printStackTrace();
                throw new OAIInternalServerError(e.getMessage());
            }
            NodeList nodeList = getRecords(srResponse);
            if (nodeList != null) {
                RecordFactory recordFactory = getRecordFactory();
                for (int i = 0; i < nodeList.getLength(); ++i) {
                   
                    Object rec = getRecordData(nodeList.item(i));
                    HashMap hashMap = new HashMap();
                    hashMap.put("header", rec);
                    String localIdentifier = getRecordFactory().getLocalIdentifier(hashMap);
                    hashMap.put("metadata", getNativeMetadata(localIdentifier,
                            metadataPrefix));
                    String[] header = recordFactory.createHeader(hashMap);
                    headers.add(header[0]);
                    identifiers.add(header[1]);
//                  MessageElement[] elems = rec.get_any();
//                  if (elems.length > 0) {
//                  String[] header = recordFactory.createHeader(elems[0]);
//                  headers.add(header[0]);
//                  identifiers.add(header[1]);
//                  }
                }
                nextRecordPosition = XPathAPI.eval(srResponse,
                        "/srw:searchRetrieveResponse/srw:nextRecordPosition",
                        xmlnsEl).str();
                if (nextRecordPosition != null && nextRecordPosition.length() > 0) {
                    StringBuffer newResumptionToken = new StringBuffer();
                    newResumptionToken.append(resultSetId);
                    newResumptionToken.append(":");
                    newResumptionToken.append(nextRecordPosition);
                    newResumptionToken.append(":");
                    newResumptionToken.append(metadataPrefix);
                    listIdentifiersMap.put(
                            "resumptionMap",
                            getResumptionMap(newResumptionToken.toString()));
                }
            }
            listIdentifiersMap.put("headers", headers.iterator());
            listIdentifiersMap.put("identifiers", identifiers.iterator());
        } catch (Throwable e) {
            e.printStackTrace();
            throw new OAIInternalServerError("Database Failure");
        }
        return listIdentifiersMap;
    }
View Full Code Here


        Vector result = new Vector();
        NodeList nodeList = null;
        try {
            nodeList = getIdentifierRecords(sruURL, oaiIdentifier, (String) null);
        } catch (Throwable e) {
            throw new OAIInternalServerError("Database failure");
        }
        if (nodeList != null) {
            for (int i = 0; i < nodeList.getLength(); ++i) {
                try {
                    Object rec = getRecordData(nodeList.item(i));
                    if (rec != null) {
                        Vector schemaLocations =
                            getRecordFactory().getSchemaLocations(rec);
                        for (int j = 0; j < schemaLocations.size(); ++j) {
                            result.add(schemaLocations.get(j));
                        }
                    } else {
                        throw new OAIInternalServerError("Null Record");
                    }
                } catch (TransformerException e) {
//                  logger.warn("failure", e);
                    e.printStackTrace();
                    throw new OAIInternalServerError(e.getMessage());
                } catch (SAXException e) {
//                  logger.warn("failure", e);
                    e.printStackTrace();
                    throw new OAIInternalServerError(e.getMessage());
                } catch (IOException e) {
//                  logger.warn("failure", e);
                    e.printStackTrace();
                    throw new OAIInternalServerError(e.getMessage());
                } catch (ParserConfigurationException e) {
//                  logger.warn("failure", e);
                    e.printStackTrace();
                    throw new OAIInternalServerError(e.getMessage());
                }
            }
        } else {
            throw new IdDoesNotExistException(oaiIdentifier);
        }
View Full Code Here

//      logger.debug("getRecord: oaiIdentifier=" + oaiIdentifier);
        try {
            nativeObject = getFullRecord(sruURL, oaiIdentifier, metadataPrefix);
        } catch (IOException e) {
            e.printStackTrace();
            throw new OAIInternalServerError(e.getMessage());
        } catch (ParserConfigurationException e) {
            e.printStackTrace();
            throw new OAIInternalServerError(e.getMessage());
        } catch (TransformerException e) {
            e.printStackTrace();
            throw new OAIInternalServerError(e.getMessage());
        } catch (SAXException e) {
            e.printStackTrace();
            throw new OAIInternalServerError(e.getMessage());
        }
       
//      logger.debug("nativeObject=" + nativeObject);
       
        if (nativeObject != null) {
View Full Code Here

        Object nativeObject;
        try {
            nativeObject = getFullRecord(sruURL, oaiIdentifier, metadataPrefix);
        } catch (IOException e) {
            e.printStackTrace();
            throw new OAIInternalServerError(e.getMessage());
        } catch (ParserConfigurationException e) {
            e.printStackTrace();
            throw new OAIInternalServerError(e.getMessage());
        } catch (TransformerException e) {
            e.printStackTrace();
            throw new OAIInternalServerError(e.getMessage());
        } catch (SAXException e) {
            e.printStackTrace();
            throw new OAIInternalServerError(e.getMessage());
        }
       
        if (debug) {
            System.out.println(nativeObject);
        }
View Full Code Here

                        1,
                        maxListSize,
                "xml");
        } catch (IOException e) {
            e.printStackTrace();
            throw new OAIInternalServerError(e.getMessage());
        } catch (SAXException e) {
            e.printStackTrace();
            throw new OAIInternalServerError(e.getMessage());
        } catch (ParserConfigurationException e) {
            e.printStackTrace();
            throw new OAIInternalServerError(e.getMessage());
        }
        try {
            NodeList nodeList = getRecords(srResponse);
//          logger.debug("SRUOAICatalog.listRecords: nodeList.size=" + nodeList.getLength());
            if (nodeList != null) {
                RecordFactory recordFactory = getRecordFactory();
                String schemaURL = null;
                if (metadataPrefix != null) {
                    if ((schemaURL = getCrosswalks().getSchemaURL(metadataPrefix))
                            == null)
                        throw new CannotDisseminateFormatException(metadataPrefix);
                }
//              logger.debug("schemaURL=" + schemaURL);
                for (int i = 0; i < nodeList.getLength(); ++i) {
                    Object rec = getRecordData(nodeList.item(i));
                    HashMap hashMap = new HashMap();
                    hashMap.put("header", rec);
                    String localIdentifier = getRecordFactory().getLocalIdentifier(hashMap);
//                  logger.debug("SRUOAICatalog.listRecords: localIdentifier=" + localIdentifier);
                    try {
                        hashMap.put("metadata", getNativeMetadata(localIdentifier,
                                metadataPrefix));
                    } catch (IOException e) {
                        e.printStackTrace();
                        throw new OAIInternalServerError(e.getMessage());
                    } catch (ParserConfigurationException e) {
                        e.printStackTrace();
                        throw new OAIInternalServerError(e.getMessage());
                    } catch (SAXException e) {
                        e.printStackTrace();
                        throw new OAIInternalServerError(e.getMessage());
                    }
                    recordsList.add(
                            recordFactory.create(hashMap,
                                    schemaURL,
                                    metadataPrefix));
                }
                String nextRecordPosition = XPathAPI.eval(srResponse, "/srw:searchRetrieveResponse/srw:nextRecordPosition", xmlnsEl).str();
                if (nextRecordPosition != null && nextRecordPosition.length() > 0) {
                    String resultSetId = XPathAPI.eval(srResponse, "/srw:searchRetrieveResponse/srw:resultSetId", xmlnsEl).str();
                    StringBuffer resumptionToken = new StringBuffer();
                    resumptionToken.append(resultSetId);
                    resumptionToken.append(":");
                    resumptionToken.append(nextRecordPosition);
                    resumptionToken.append(":");
                    resumptionToken.append(metadataPrefix);
                    listRecordsMap.put(
                            "resumptionMap",
                            getResumptionMap(resumptionToken.toString()));
//                    StringBuffer resumptionToken = new StringBuffer();
//                    resumptionToken.append(from);
//                    resumptionToken.append(":");
//                    resumptionToken.append(until);
//                    resumptionToken.append(":");
//                    resumptionToken.append(set);
//                    resumptionToken.append(":");
//                    resumptionToken.append(metadataPrefix);
//                    resumptionToken.append(":");
//                    resumptionToken.append(nodeList.getLength());
//                    listRecordsMap.put(
//                            "resumptionMap",
//                            getResumptionMap(resumptionToken.toString()));
                }
            } else {
                throw new NoItemsMatchException();
            }
            listRecordsMap.put("records", recordsList.iterator());
            return listRecordsMap;
        } catch (TransformerException e) {
//          logger.warn("failure", e);
            e.printStackTrace();
            throw new OAIInternalServerError(e.getMessage());
        } catch (SAXException e) {
//          logger.warn("failure", e);
            e.printStackTrace();
            throw new OAIInternalServerError(e.getMessage());
        } catch (IOException e) {
//          logger.warn("failure", e);
            e.printStackTrace();
            throw new OAIInternalServerError(e.getMessage());
        } catch (ParserConfigurationException e) {
//          logger.warn("failure", e);
            e.printStackTrace();
            throw new OAIInternalServerError(e.getMessage());
        }
    }
View Full Code Here

                        getResumptionMap(newResumptionToken.toString()));
            }
            listRecordsMap.put("records", recordsList.iterator());
        } catch (Throwable e) {
            e.printStackTrace();
            throw new OAIInternalServerError("Database Failure");
        }
        return listRecordsMap;
    }
View Full Code Here

        if (persistentConnection == null) {
            try {
                if (debug) System.out.println("ending connection");
                con.close();
            } catch (SQLException e) {
                throw new OAIInternalServerError(e.getMessage());
            }
        }
    }
View Full Code Here

            }
        } catch (SQLException e) {
            if (con != null)
                endConnection(con);
            e.printStackTrace();
            throw new OAIInternalServerError(e.getMessage());
        }
    }
View Full Code Here

            tokenizer = new StringTokenizer(rangeSetQuery, "\\");
       
        if (tokenizer.hasMoreTokens())
            sb.append(tokenizer.nextToken());
        else
            throw new OAIInternalServerError("Invalid query");
       
        while (tokenizer.hasMoreTokens()) {
            String token = tokenizer.nextToken();
            switch (token.charAt(0)) {
            case 'f'// what are the chances someone would use this to indicate a form feed?
View Full Code Here

        StringTokenizer tokenizer = new StringTokenizer(identifierQuery, "\\");
        StringBuffer sb = new StringBuffer();
        if (tokenizer.hasMoreTokens())
            sb.append(tokenizer.nextToken());
        else
            throw new OAIInternalServerError("Invalid identifierQuery");
       
        while (tokenizer.hasMoreTokens()) {
            String token = tokenizer.nextToken();
            switch (token.charAt(0)) {
            case 'i':
View Full Code Here

TOP

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

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.