sb.append(getRequestElement(request, validParamNames, baseURL));
if (hasBadArguments(request, requiredParamNames.iterator(),
validParamNames)) {
sb.append(new BadArgumentException().getMessage());
} else {
Crosswalks crosswalks = abstractCatalog.getCrosswalks();
if (identifier == null || identifier.length() == 0) {
Iterator iterator = crosswalks.iterator();
sb.append("<ListMetadataFormats>");
while (iterator.hasNext()) {
Map.Entry entry = (Map.Entry)iterator.next();
String oaiSchemaLabel = (String)entry.getKey();
CrosswalkItem crosswalkItem = (CrosswalkItem)entry.getValue();
Crosswalk crosswalk = crosswalkItem.getCrosswalk();
// StringTokenizer tokenizer = new StringTokenizer(crosswalk.getSchemaLocation());
// String namespaceURI = tokenizer.nextToken();
// String schemaURL = tokenizer.nextToken();
String[] tokenizer = split(crosswalk.getSchemaLocation());
String namespaceURI = null;
String schemaURL = null;
if (tokenizer.length == 1) {
schemaURL = tokenizer[0];
} else if (tokenizer.length > 1) {
namespaceURI = tokenizer[0];
schemaURL = tokenizer[1];
}
sb.append("<metadataFormat>");
sb.append("<metadataPrefix>");
sb.append(oaiSchemaLabel);
sb.append("</metadataPrefix>");
sb.append("<schema>");
sb.append(schemaURL);
sb.append("</schema>");
sb.append("<metadataNamespace>");
sb.append(namespaceURI);
sb.append("</metadataNamespace>");
sb.append("</metadataFormat>");
}
sb.append("</ListMetadataFormats>");
} else {
try {
Vector schemaLocations = abstractCatalog.getSchemaLocations(identifier);
sb.append("<ListMetadataFormats>");
for (int i=0; i<schemaLocations.size(); ++i) {
String schemaLocation = (String)schemaLocations.elementAt(i);
// StringTokenizer tokenizer = new StringTokenizer(schemaLocation);
// String namespaceURI = tokenizer.nextToken();
// String schemaURL = tokenizer.nextToken();
String[] tokenizer = split(schemaLocation);
String namespaceURI = null;
String schemaURL = null;
if (tokenizer.length == 1) {
schemaURL = tokenizer[0];
} else if (tokenizer.length > 1) {
namespaceURI = tokenizer[0];
schemaURL = tokenizer[1];
}
sb.append("<metadataFormat>");
sb.append("<metadataPrefix>");
// make sure it's a space that separates them
sb.append(crosswalks.getMetadataPrefix(namespaceURI, schemaURL));
sb.append("</metadataPrefix>");
sb.append("<schema>");
sb.append(schemaURL);
sb.append("</schema>");
sb.append("<metadataNamespace>");