本文整理汇总了Java中ORG.oclc.oai.server.crosswalk.Crosswalk类的典型用法代码示例。如果您正苦于以下问题:Java Crosswalk类的具体用法?Java Crosswalk怎么用?Java Crosswalk使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Crosswalk类属于ORG.oclc.oai.server.crosswalk包,在下文中一共展示了Crosswalk类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSchemaLocations
import ORG.oclc.oai.server.crosswalk.Crosswalk; //导入依赖的package包/类
/**
* Get a list of supported schemaLocations for the specified native record.
* @param nativeItem native database record
* @return A Vector containing all the schemaLocations this record can support.
* @exception NoMetadatdaFormatsException This record doesn't support any of the
* available schemaLocations for this repository.
*/
public Vector getSchemaLocations(Object nativeItem)
throws NoMetadataFormatsException {
if (isDeleted(nativeItem)) {
throw new NoMetadataFormatsException();
}
Vector v = new Vector();
Iterator iterator = getCrosswalks().iterator();
while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry)iterator.next();
CrosswalkItem crosswalkItem = (CrosswalkItem)entry.getValue();
Crosswalk crosswalk = crosswalkItem.getCrosswalk();
if (crosswalk.isAvailableFor(nativeItem)) {
v.add(crosswalk.getSchemaLocation());
}
}
return v;
}
示例2: createMetadata
import ORG.oclc.oai.server.crosswalk.Crosswalk; //导入依赖的package包/类
/**
* Convert a native "item" to a "record" object.
*
* @param nativeItem native "Item"
* @param schemaURL the schemaURL of the desired metadataFormat
* or NULL for a Record object containing all
* the supported Crosswalk(s)
* @return "record" String
* @exception IllegalArgumentException One of the header components for this record is bad.
* @exception This nativeItem doesn't support the specified metadataPrefix
*/
public String createMetadata(Object nativeItem, String schemaURL, boolean isDeleted)
throws IllegalArgumentException, CannotDisseminateFormatException {
StringBuffer xmlRec = new StringBuffer();
if (isDeleted) {
throw new CannotDisseminateFormatException("Record is deleted");
}
Iterator iterator = getCrosswalks().iterator();
while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry)iterator.next();
CrosswalkItem crosswalkItem = (CrosswalkItem)entry.getValue();
Crosswalk crosswalk = crosswalkItem.getCrosswalk();
if (schemaURL == null
|| crosswalk.getSchemaURL().equals(schemaURL)) {
xmlRec.append(crosswalk.createMetadata(nativeItem));
}
}
return xmlRec.toString();
}
示例3: addCrossWalk
import ORG.oclc.oai.server.crosswalk.Crosswalk; //导入依赖的package包/类
private void addCrossWalk(String metadataPrefix, String schema, String metadataNamespace)
{
if( crosswalksMap.containsKey(metadataNamespace) )
{
return;
}
Crosswalk crosswalk1 = new TLECross(metadataPrefix, metadataNamespace + ' ' + schema, null, null, null);
crosswalksMap.put(metadataPrefix, new CrosswalkItem(metadataPrefix, schema, metadataNamespace, crosswalk1));
}
示例4: resolveOutpuGenerator
import ORG.oclc.oai.server.crosswalk.Crosswalk; //导入依赖的package包/类
private OutputGenerator resolveOutpuGenerator(String metadataPrefix, boolean resumption, boolean onlyHeader) throws CannotDisseminateFormatException, OAIInternalServerError, BadResumptionTokenException{
HashMap<String, ArrayList<String>> xslts = resolveXSLTsForMetadataPrefix(metadataPrefix);
if (xslts!=null && xslts.size()>0){
metadataPrefix = "raw";
}
OAIOutputGenerator userOutputGenerator = new OAIOutputGenerator();
userOutputGenerator.setOnlyHeader(onlyHeader);
Crosswalks crosswalks = getCrosswalks();
if (!crosswalks.containsValue(metadataPrefix)){
if (resumption)
throw new BadResumptionTokenException();
else
throw new CannotDisseminateFormatException(metadataPrefix);
}
Iterator crosswalksIterator = crosswalks.iterator();
while (crosswalksIterator.hasNext()){
Map.Entry<String, CrosswalkItem> entry = (Map.Entry<String, CrosswalkItem>) crosswalksIterator.next();
String schema = entry.getKey();
Crosswalk crosswalk = entry.getValue().getCrosswalk();
if (schema.equals(metadataPrefix)){
((OAIOutputGenerator)userOutputGenerator).setCrosswalk(crosswalk);
break;
}
}
return userOutputGenerator;
}
示例5: getCrosswalk
import ORG.oclc.oai.server.crosswalk.Crosswalk; //导入依赖的package包/类
public Crosswalk getCrosswalk() {
return crosswalk;
}
示例6: setCrosswalk
import ORG.oclc.oai.server.crosswalk.Crosswalk; //导入依赖的package包/类
public void setCrosswalk(Crosswalk crosswalk) {
this.crosswalk = crosswalk;
}
示例7: create
import ORG.oclc.oai.server.crosswalk.Crosswalk; //导入依赖的package包/类
/**
* Convert a native "item" to a "record" object.
*
* @param nativeItem native "Item"
* @param schemaURL the schemaURL of the desired metadataFormat
* or NULL for a Record object containing all
* the supported Crosswalk(s)
* @return "record" String
* @exception IllegalArgumentException One of the header components for this record is bad.
* @exception This nativeItem doesn't support the specified metadataPrefix
*/
public String create(Object nativeItem, String schemaURL,
String metadataPrefix, String identifier,
String datestamp, Iterator setSpecs, Iterator abouts, boolean isDeleted)
throws IllegalArgumentException, CannotDisseminateFormatException {
if (debug) System.out.println("RecordFactory.create");
StringBuffer xmlRec = new StringBuffer();
xmlRec.append("<record><header");
if (isDeleted) {
xmlRec.append(" status=\"deleted\"");
}
xmlRec.append("><identifier>");
xmlRec.append(OAIUtil.xmlEncode(identifier));
xmlRec.append("</identifier><datestamp>");
xmlRec.append(datestamp);
xmlRec.append("</datestamp>");
if (setSpecs != null) {
while (setSpecs.hasNext()) {
xmlRec.append("<setSpec>");
// try {
// if (encodeSetSpec) {
// xmlRec.append(URLEncoder.encode((String)setSpecs.next(), "UTF-8"));
// } else {
xmlRec.append((String)setSpecs.next());
// }
// } catch (UnsupportedEncodingException e) {
// e.printStackTrace();
// throw new OAIInternalServerError(e.getMessage());
// }
xmlRec.append("</setSpec>");
}
}
xmlRec.append("</header>");
if (debug) System.out.println("RecordFactory.create: header finished");
if (!isDeleted) {
if (debug) System.out.println("RecordFactory.create: starting metadata");
xmlRec.append("<metadata>");
Iterator iterator = getCrosswalks().iterator();
while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry)iterator.next();
String itemPrefix = (String) entry.getKey();
CrosswalkItem crosswalkItem = (CrosswalkItem)entry.getValue();
Crosswalk crosswalk = crosswalkItem.getCrosswalk();
if (debug) System.out.println("RecordFactory.create: crosswalk=" + crosswalk);
if (schemaURL == null
|| (metadataPrefix == null && crosswalk.getSchemaURL().equals(schemaURL))
|| (metadataPrefix != null && itemPrefix.equals(metadataPrefix))) {
xmlRec.append(crosswalk.createMetadata(nativeItem));
break;
}
}
xmlRec.append("</metadata>");
if (debug) System.out.println("RecordFactory.create: finished metadata");
if (abouts != null) {
while (abouts.hasNext()) {
xmlRec.append("<about>");
xmlRec.append((String)abouts.next());
xmlRec.append("</about>");
}
}
}
xmlRec.append("</record>");
if (debug) System.out.println("RecordFactory.create: return=" + xmlRec.toString());
return xmlRec.toString();
}