Examples of Crosswalks


Examples of ORG.oclc.oai.server.crosswalk.Crosswalks

        sb.append(createResponseDate(new Date()));
        sb.append("</responseDate>");
//         sb.append("<requestURL>");
//         sb.append(getRequestURL(request));
//         sb.append("</requestURL>");
        Crosswalks crosswalks = abstractCatalog.getCrosswalks();
  try {
      if (metadataPrefix == null || metadataPrefix.length() == 0
    || identifier == null || identifier.length() == 0
    || hasBadArguments(request, validParamNames.iterator(), validParamNames)) {
    throw new BadArgumentException();
      }
      else if (!crosswalks.containsValue(metadataPrefix)) {
    throw new CannotDisseminateFormatException(metadataPrefix);
      } else {
    String record = abstractCatalog.getRecord(identifier, metadataPrefix);
    if (record != null) {
        sb.append(getRequestElement(request, validParamNames, baseURL));
View Full Code Here

Examples of ORG.oclc.oai.server.crosswalk.Crosswalks

  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>");
View Full Code Here

Examples of ORG.oclc.oai.server.crosswalk.Crosswalks

        String set = request.getParameter("set");
                    if (set != null) {
                        if (set.length() == 0) set = null;
                        else if (urlEncodeSetSpec) set = set.replace(' ', '+');
                    }
        Crosswalks crosswalks = abstractCatalog.getCrosswalks();
        if (metadataPrefix == null) {
      throw new BadArgumentException();
        }
       
        if (!crosswalks.containsValue(metadataPrefix)) {
      throw new CannotDisseminateFormatException(metadataPrefix);
        } else {
      listIdentifiersMap = abstractCatalog.listIdentifiers(from, until, set,
                       metadataPrefix);
        }
View Full Code Here

Examples of ORG.oclc.oai.server.crosswalk.Crosswalks

        if (debug) {
            System.out.println("Redirect.construct: identifier=" +
                               identifier);
        }
        Crosswalks crosswalks = abstractCatalog.getCrosswalks();
  try {
      if (identifier == null || identifier.length() == 0) {
                if (debug) System.out.println("Bad argument");
    throw new BadArgumentException();
      }
      else if (!crosswalks.containsValue("oai_dc")) {
                if (debug) System.out.println("crosswalk not present: oai_dc");
    throw new CannotDisseminateFormatException("oai_dc");
      } else {
     String metadata = abstractCatalog.getRecord(identifier, "oai_dc");
     if (metadata != null) {
View Full Code Here

Examples of ORG.oclc.oai.server.crosswalk.Crosswalks

        String set = request.getParameter("set");
                    if (set != null) {
                        if (set.length() == 0) set = null;
                        else if (urlEncodeSetSpec) set = set.replace(' ', '+');
                    }
        Crosswalks crosswalks = abstractCatalog.getCrosswalks();
        if (metadataPrefix == null) {
      throw new BadArgumentException();
        }
        if (!crosswalks.containsValue(metadataPrefix)) {
      throw new CannotDisseminateFormatException(metadataPrefix);
        } else {
      listRecordsMap = abstractCatalog.listRecords(from, until, set,
                     metadataPrefix);
        }
View Full Code Here

Examples of ORG.oclc.oai.server.crosswalk.Crosswalks

            System.out.println("GetMetadata.constructGetMetadata: identifier=" +
                               identifier);
            System.out.println("GetMetadata.constructGetMetadata: metadataPrefix="
                               + metadataPrefix);
        }
        Crosswalks crosswalks = abstractCatalog.getCrosswalks();
        sb.append("<?xml version=\"1.0\" encoding=\"");
        String encoding = crosswalks.getEncoding(metadataPrefix);
        if (encoding != null)
            sb.append(encoding);
        else
            sb.append("UTF-8");
        sb.append("\" ?>\n");
       
        String docType = crosswalks.getDocType(metadataPrefix);
        if (docType != null) {
            sb.append(docType);
            sb.append("\n");
        }
  try {
      if (metadataPrefix == null || metadataPrefix.length() == 0
    || identifier == null || identifier.length() == 0) {
                if (debug) System.out.println("Bad argument");
    throw new BadArgumentException();
      }
      else if (!crosswalks.containsValue(metadataPrefix)) {
                if (debug) System.out.println("crosswalk not present: " + metadataPrefix);
    throw new CannotDisseminateFormatException(metadataPrefix);
      } else {
     String metadata = abstractCatalog.getMetadata(identifier, metadataPrefix);
     if (metadata != null) {
                    sb.append(metadata);
     } else {
                    if (debug) System.out.println("ID does not exist");
         throw new IdDoesNotExistException(identifier);
     }
      }
  } catch (BadArgumentException e) {
            if (debug) e.printStackTrace();
            throw new FileNotFoundException();
  } catch (CannotDisseminateFormatException e) {
            if (debug) e.printStackTrace();
            throw new FileNotFoundException();
  } catch (IdDoesNotExistException e) {
            if (debug) e.printStackTrace();
            throw new FileNotFoundException();
  } catch (OAIInternalServerError e) {
            e.printStackTrace();
            return BadVerb.construct(context, request, response, serverTransformer);
  }
        if (debug) {
            System.out.println("GetMetadata.construct: contentType=" + crosswalks.getContentType(metadataPrefix));
            System.out.println("GetMetadata.construct: prerendered sb=" + sb.toString());
        }
        return render(response, crosswalks.getContentType(metadataPrefix), sb.toString(), (Transformer)null);
    }
View Full Code Here

Examples of ORG.oclc.oai.server.crosswalk.Crosswalks

     */
    public RecordFactory(Properties properties) {
//         if ("false".equals(properties.getProperty("RecordFactory.encodeSetSpec"))) {
//             encodeSetSpec = false;
//         }
  crosswalks = new Crosswalks(properties);
    }
View Full Code Here

Examples of ORG.oclc.oai.server.crosswalk.Crosswalks

//         }
  crosswalks = new Crosswalks(properties);
    }

    public RecordFactory(HashMap crosswalkMap) {
  crosswalks = new Crosswalks(crosswalkMap);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.