本文整理汇总了Java中ORG.oclc.oai.server.verb.OAIInternalServerError类的典型用法代码示例。如果您正苦于以下问题:Java OAIInternalServerError类的具体用法?Java OAIInternalServerError怎么用?Java OAIInternalServerError使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OAIInternalServerError类属于ORG.oclc.oai.server.verb包,在下文中一共展示了OAIInternalServerError类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: list
import ORG.oclc.oai.server.verb.OAIInternalServerError; //导入依赖的package包/类
private Map<?, ?> list(String stoken, Handler handler) throws BadResumptionTokenException, OAIInternalServerError
{
Optional<ResumptionToken> maybeToken = resumptionTokens.get(stoken);
if( !maybeToken.isPresent() )
{
throw new BadResumptionTokenException();
}
try
{
// Token is only valid for one use
resumptionTokens.invalidate(stoken);
ResumptionToken token = maybeToken.get();
return list(token.request, token.format, token.start + MAX_RESULTS, handler);
}
catch( NoRecordsMatchException e )
{
LOGGER.error("No records match", e);
throw new BadResumptionTokenException();
}
}
示例2: list
import ORG.oclc.oai.server.verb.OAIInternalServerError; //导入依赖的package包/类
private Map<?, ?> list(String stoken, Handler handler) throws BadResumptionTokenException, OAIInternalServerError
{
Optional<ResumptionToken> maybeToken = resumptionTokens.get(stoken);
if( !maybeToken.isPresent() )
{
throw new BadResumptionTokenException();
}
try
{
// Token is only valid for one use
resumptionTokens.invalidate(stoken);
ResumptionToken token = maybeToken.get();
return list(token.request, token.format, token.start + MAX_RESULTS, handler);
}
catch( NoRecordsMatchException e )
{
LOGGER.error("No records match", e); //$NON-NLS-1$
throw new BadResumptionTokenException();
}
}
示例3: getRecord
import ORG.oclc.oai.server.verb.OAIInternalServerError; //导入依赖的package包/类
@Override
public String getRecord(String identifier, String metadataPrefix)
throws IdDoesNotExistException, CannotDisseminateFormatException,
OAIInternalServerError {
TransformationSpec ts = new TransformationSpec(identifier);
ts.setNumberOfRecords(1);
Iterator<String> iter;
try {
iter = (Iterator<String>)listRecords(ts, metadataPrefix, false, false, false).get("records");
if (iter.hasNext())
return iter.next();
return null;
} catch (BadResumptionTokenException e) {
// TODO Auto-generated catch block
e.printStackTrace();
log.info("SHOULD NOT BE HERE!");
}
return null;
}
示例4: getRecord
import ORG.oclc.oai.server.verb.OAIInternalServerError; //导入依赖的package包/类
/**
* Retrieve the specified metadata for the specified oaiIdentifier
*
* @param oaiIdentifier the OAI identifier
* @param metadataPrefix the OAI metadataPrefix
* @return the Record object containing the result.
* @exception CannotDisseminateFormatException signals an http status
* code 400 problem
* @exception IdDoesNotExistException signals an http status code 404
* problem
* @exception OAIInternalServerError signals an http status code 500
* problem
*/
public String getRecord(String oaiIdentifier, String metadataPrefix)
throws IdDoesNotExistException, CannotDisseminateFormatException,
OAIInternalServerError {
HashMap nativeItem = null;
try {
String localIdentifier
= getRecordFactory().fromOAIIdentifier(oaiIdentifier);
nativeItem = getNativeRecord(localIdentifier + "." + metadataPrefix);
if (nativeItem == null)
throw new IdDoesNotExistException(oaiIdentifier);
return constructRecord(nativeItem, metadataPrefix);
} catch (IOException e) {
e.printStackTrace();
throw new OAIInternalServerError("Database Failure");
}
}
示例5: getSchemaLocations
import ORG.oclc.oai.server.verb.OAIInternalServerError; //导入依赖的package包/类
/**
* Retrieve a list of schemaLocation values associated with the specified
* oaiIdentifier.
*
* We get passed the ID for a record and are supposed to return a list
* of the formats that we can deliver the record in. Since we are assuming
* that all the records in the directory have the same format, the
* response to this is static;
*
* @param oaiIdentifier the OAI identifier
* @return a Vector containing schemaLocation Strings
* @exception OAIBadRequestException signals an http status code 400
* problem
* @exception OAINotFoundException signals an http status code 404 problem
* @exception OAIInternalServerError signals an http status code 500
* problem
*/
public Vector getSchemaLocations(String oaiIdentifier)
throws IdDoesNotExistException, OAIInternalServerError, NoMetadataFormatsException {
ArrayList extensionList = null;
try {
String localIdentifier
= getRecordFactory().fromOAIIdentifier(oaiIdentifier);
extensionList = getExtensionList(localIdentifier);
} catch (Exception e) {
e.printStackTrace();
throw new OAIInternalServerError("Database Failure");
}
if (extensionList != null) {
return getRecordFactory().getSchemaLocations(extensionList);
} else {
throw new IdDoesNotExistException(oaiIdentifier);
}
}
示例6: getRecord
import ORG.oclc.oai.server.verb.OAIInternalServerError; //导入依赖的package包/类
/**
* Retrieve the specified metadata for the specified oaiIdentifier
*
* @param oaiIdentifier the OAI identifier
* @param metadataPrefix the OAI metadataPrefix
* @return the <record/> portion of the XML response.
* @exception OAIInternalServerError signals an http status code 500 problem
* @exception CannotDisseminateFormatException the metadataPrefix is not
* supported by the item.
* @exception IdDoesNotExistException the oaiIdentifier wasn't found
*/
public String getRecord(String oaiIdentifier, String metadataPrefix)
throws OAIInternalServerError, CannotDisseminateFormatException,
IdDoesNotExistException {
Connection con = null;
try {
con = startConnection();
Statement stmt = con.createStatement();
ResultSet rs =
stmt.executeQuery(populateIdentifierQuery(oaiIdentifier));
if (!rs.next()) {
endConnection(con);
throw new IdDoesNotExistException(oaiIdentifier);
}
HashMap nativeItem = getColumnValues(rs);
endConnection(con);
return constructRecord(nativeItem, metadataPrefix);
} catch (SQLException e) {
if (con != null)
endConnection(con);
e.printStackTrace();
throw new OAIInternalServerError(e.getMessage());
}
}
示例7: getSetSpecs
import ORG.oclc.oai.server.verb.OAIInternalServerError; //导入依赖的package包/类
/**
* get an Iterator containing the setSpecs for the nativeItem
*
* @param nativeItem
* @return an Iterator containing the list of setSpec values for this nativeItem
*/
private Iterator getSetSpecs(HashMap nativeItem)
throws OAIInternalServerError {
Connection con = null;
try {
ArrayList setSpecs = new ArrayList();
if (setSpecQuery != null) {
con = startConnection();
RecordFactory rf = getRecordFactory();
String oaiIdentifier = rf.getOAIIdentifier(nativeItem);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(populateSetSpecQuery(oaiIdentifier));
while (rs.next()) {
HashMap setMap = getColumnValues(rs);
setSpecs.add(setMap.get(setSpecItemLabel).toString());
}
endConnection(con);
}
return setSpecs.iterator();
} catch (SQLException e) {
if (con != null)
endConnection(con);
e.printStackTrace();
throw new OAIInternalServerError(e.getMessage());
}
}
示例8: getAbouts
import ORG.oclc.oai.server.verb.OAIInternalServerError; //导入依赖的package包/类
/**
* get an Iterator containing the abouts for the nativeItem
*
* @param nativeItem
* @return an Iterator containing the list of about values for this nativeItem
*/
private Iterator getAbouts(HashMap nativeItem)
throws OAIInternalServerError {
Connection con = null;
try {
ArrayList abouts = new ArrayList();
if (aboutQuery != null) {
con = startConnection();
RecordFactory rf = getRecordFactory();
String oaiIdentifier = rf.getOAIIdentifier(nativeItem);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(populateAboutQuery(oaiIdentifier));
while (rs.next()) {
HashMap aboutMap = getColumnValues(rs);
abouts.add(aboutMap.get(aboutValueLabel));
}
endConnection(con);
}
return abouts.iterator();
} catch (SQLException e) {
if (con != null)
endConnection(con);
e.printStackTrace();
throw new OAIInternalServerError(e.getMessage());
}
}
示例9: getRecord
import ORG.oclc.oai.server.verb.OAIInternalServerError; //导入依赖的package包/类
/**
* Retrieve the specified metadata for the specified oaiIdentifier
*
* @param oaiIdentifier the OAI identifier
* @param metadataPrefix the OAI metadataPrefix
* @return the Record object containing the result.
* @exception CannotDisseminateFormatException signals an http status
* code 400 problem
* @exception IdDoesNotExistException signals an http status code 404
* problem
* @exception OAIInternalServerError signals an http status code 500
* problem
*/
public String getRecord(String oaiIdentifier, String metadataPrefix)
throws IdDoesNotExistException, CannotDisseminateFormatException,
OAIInternalServerError {
String localIdentifier
= getRecordFactory().fromOAIIdentifier(oaiIdentifier);
String recordid = localIdentifier;
if (schemaLocationIndexed) {
recordid=recordid + "/" + metadataPrefix;
}
if (debug) System.out.println("XMLFileOAICatalog.getRecord: recordid=" + recordid);
Object nativeRecord = nativeMap.get(recordid.toLowerCase());
if (nativeRecord == null)
throw new IdDoesNotExistException(oaiIdentifier);
return constructRecord(nativeRecord, metadataPrefix);
}
示例10: constructRecord
import ORG.oclc.oai.server.verb.OAIInternalServerError; //导入依赖的package包/类
/**
* Utility method to construct a Record object for a specified
* metadataFormat from a native record
*
* @param nativeRecord native item from the dataase
* @param metadataPrefix the desired metadataPrefix for performing the crosswalk
* @return the <record/> String
* @exception CannotDisseminateFormatException the record is not available
* for the specified metadataPrefix.
*/
private String constructRecord(Object nativeRecord, String metadataPrefix)
throws CannotDisseminateFormatException, OAIInternalServerError {
String schemaURL = null;
Iterator setSpecs = getSetSpecs(nativeRecord);
Iterator abouts = getAbouts(nativeRecord);
if (metadataPrefix != null) {
if (debug) {
System.out.println(getCrosswalks());
}
if ((schemaURL = getCrosswalks().getSchemaURL(metadataPrefix)) == null)
throw new CannotDisseminateFormatException(metadataPrefix);
}
return getRecordFactory().create(nativeRecord, schemaURL, metadataPrefix, setSpecs, abouts);
}
示例11: getRecord
import ORG.oclc.oai.server.verb.OAIInternalServerError; //导入依赖的package包/类
/**
* Retrieve the specified metadata for the specified oaiIdentifier
*
* @param oaiIdentifier the OAI identifier
* @param metadataPrefix the OAI metadataPrefix
* @return the Record object containing the result.
* @exception CannotDisseminateFormatException signals an http status
* code 400 problem
* @exception IdDoesNotExistException signals an http status code 404
* problem
* @exception OAIInternalServerError signals an http status code 500
* problem
*/
public String getRecord(String oaiIdentifier, String metadataPrefix)
throws IdDoesNotExistException, CannotDisseminateFormatException,
OAIInternalServerError {
HashMap nativeItem = null;
try {
String localIdentifier
= getRecordFactory().fromOAIIdentifier(oaiIdentifier);
nativeItem = getNativeRecord(localIdentifier);
if (nativeItem == null)
throw new IdDoesNotExistException(oaiIdentifier);
return constructRecord(nativeItem, metadataPrefix);
} catch (IOException e) {
e.printStackTrace();
throw new OAIInternalServerError("Database Failure");
}
}
示例12: getSchemaLocations
import ORG.oclc.oai.server.verb.OAIInternalServerError; //导入依赖的package包/类
/**
* Retrieve a list of schemaLocation values associated with the specified
* oaiIdentifier.
*
* We get passed the ID for a record and are supposed to return a list
* of the formats that we can deliver the record in. Since we are assuming
* that all the records in the directory have the same format, the
* response to this is static;
*
* @param oaiIdentifier the OAI identifier
* @return a Vector containing schemaLocation Strings
* @exception OAIBadRequestException signals an http status code 400
* problem
* @exception OAINotFoundException signals an http status code 404 problem
* @exception OAIInternalServerError signals an http status code 500
* problem
*/
public Vector getSchemaLocations(String oaiIdentifier)
throws IdDoesNotExistException, OAIInternalServerError, NoMetadataFormatsException {
HashMap nativeItem = null;
try {
String localIdentifier
= getRecordFactory().fromOAIIdentifier(oaiIdentifier);
nativeItem = getNativeRecord(localIdentifier);
} catch (IOException e) {
e.printStackTrace();
throw new OAIInternalServerError("Database Failure");
}
if (nativeItem != null) {
return getRecordFactory().getSchemaLocations(nativeItem);
} else {
throw new IdDoesNotExistException(oaiIdentifier);
}
}
示例13: FileMap2oai_dc
import ORG.oclc.oai.server.verb.OAIInternalServerError; //导入依赖的package包/类
/**
* The constructor assigns the schemaLocation associated with this crosswalk. Since
* the crosswalk is trivial in this case, no properties are utilized.
*
* @param properties properties that are needed to configure the crosswalk.
*/
public FileMap2oai_dc(Properties properties)
throws OAIInternalServerError {
super("http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd");
try {
String xsltName = properties.getProperty("FileMap2oai_dc.xsltName");
TransformerFactory tFactory = TransformerFactory.newInstance();
if (xsltName != null) {
StreamSource xslSource = new StreamSource(new FileInputStream(xsltName));
this.transformer = tFactory.newTransformer(xslSource);
} else {
this.transformer = tFactory.newTransformer();
this.transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
}
} catch (Exception e) {
e.printStackTrace();
throw new OAIInternalServerError(e.getMessage());
}
}
示例14: XSLTpro2004Crosswalk
import ORG.oclc.oai.server.verb.OAIInternalServerError; //导入依赖的package包/类
/**
* The constructor assigns the schemaLocation associated with this crosswalk. Since
* the crosswalk is trivial in this case, no properties are utilized.
*
* @param properties properties that are needed to configure the crosswalk.
*/
public XSLTpro2004Crosswalk(Properties properties)
throws OAIInternalServerError {
super(properties, "info:ofi/pro-2004 http://www.openurl.info/registry/docs/xsd/info:ofi/fmt:xml:xsd:pro-2004", null);
try {
String xsltName = properties.getProperty("XSLTproCrosswalk.xsltName");
if (xsltName != null) {
StreamSource xslSource = new StreamSource(new FileInputStream(xsltName));
TransformerFactory tFactory = TransformerFactory.newInstance();
this.transformer = tFactory.newTransformer(xslSource);
}
} catch (Exception e) {
e.printStackTrace();
throw new OAIInternalServerError(e.getMessage());
}
}
示例15: XSLTmarc21Crosswalk
import ORG.oclc.oai.server.verb.OAIInternalServerError; //导入依赖的package包/类
/**
* The constructor assigns the schemaLocation associated with this crosswalk. Since
* the crosswalk is trivial in this case, no properties are utilized.
*
* @param properties properties that are needed to configure the crosswalk.
*/
public XSLTmarc21Crosswalk(Properties properties)
throws OAIInternalServerError {
super(properties, "http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd", null);
String temp = properties.getProperty("XSLTmarc21Crosswalk.debug");
if ("true".equals(temp)) debug = true;
try {
String xsltName = properties.getProperty("XSLTmarc21Crosswalk.xsltName");
if (debug) System.out.println("XSLTmarc21Crosswalk.xsltName=" + xsltName);
if (xsltName != null) {
StreamSource xslSource = new StreamSource(new FileInputStream(xsltName));
TransformerFactory tFactory = TransformerFactory.newInstance();
this.transformer = tFactory.newTransformer(xslSource);
}
} catch (Exception e) {
e.printStackTrace();
throw new OAIInternalServerError(e.getMessage());
}
}