Package ORG.oclc.oai.server.verb

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


        }
        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 {
View Full Code Here


        }
  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 {
View Full Code Here

  if (debug) {
      System.out.println("AbstractCatalog.toFinestFrom: from=" + from);
      System.out.println("                            target=" + VALID_GRANULARITIES[supportedGranularityOffset]);
  }
  if (from.length() > VALID_GRANULARITIES[supportedGranularityOffset].length()) {
      throw new BadArgumentException();
  }
  if (from.length() != VALID_GRANULARITIES[supportedGranularityOffset].length()) {
      StringBuffer sb = new StringBuffer(from);
      if (sb.charAt(sb.length()-1) == 'Z')
    sb.setLength(sb.length()-1);
     
      sb.append(FROM_GRANULARITIES[supportedGranularityOffset].substring(sb.length()));
      from = sb.toString();
  }

  if (!isValidGranularity(from)) {
      throw new BadArgumentException();
  }

  return from;
    }
View Full Code Here

     */
    public String toFinestUntil(String until)
  throws BadArgumentException {
  if (until.length() == VALID_GRANULARITIES[supportedGranularityOffset].length()) {
      if (!isValidGranularity(until))
    throw new BadArgumentException();
      return until;
  }
  if (until.length() > VALID_GRANULARITIES[supportedGranularityOffset].length()) {
      throw new BadArgumentException();
  }
 
  StringBuffer sb = new StringBuffer(until);
  if (sb.charAt(sb.length()-1) == 'Z')
      sb.setLength(sb.length()-1);

  if (sb.length() < VALID_GRANULARITIES[0].length()) {
      while (sb.length() < 4) sb.append("9");
      switch (sb.length()) {
      case 4: // YYYY
    sb.append("-");
      case 5: // YYYY-
    sb.append("12");
      case 7: // YYYY-MM
    sb.append("-");
      case 8: // YYYY-MM-
    sb.append("31");
    break;
   
      case 6: // YYYY-M
      case 9: // YYYY-MM-D
    throw new BadArgumentException();
      }
  }

  until = sb.toString();
  if (until.length() == VALID_GRANULARITIES[supportedGranularityOffset].length()) {
      if (!isValidGranularity(until))
    throw new BadArgumentException();
      return until;
  }
 
  if (sb.length() < VALID_GRANULARITIES[1].length()) {
      switch (sb.length()) {
      case 10: // YYYY-MM-DD
    sb.append("T");
      case 11: // YYYY-MM-DDT
    sb.append("23");
      case 13: // YYYY-MM-DDThh
    sb.append(":");
      case 14: // YYYY-MM-DDThh:
    sb.append("59");
//       case 16: // YYYY-MM-DDThh:mm
//     sb.append("Z");
//     break;
   
//       case 12: // YYYY-MM-DDTh
//       case 15: // YYYY-MM-DDThh:m
//     throw new BadGranularityException();
//       }
//   }

//   until = sb.toString();
//   if (until.length() == VALID_GRANULARITIES[supportedGranularityOffset].length()) {
//       if (!isValidGranularity(until))
//     throw new BadGranularityException();
//       return until;
//   }

//   if (sb.charAt(sb.length()-1) == 'Z')
//       sb.setLength(sb.length()-1); // remove the trailing 'Z'
 
//   if (sb.length() < VALID_GRANULARITIES[2].length()) {
//       switch (sb.length()) {
      case 16: // YYYY-MM-DDThh:mm
    sb.append(":");
      case 17: // YYYY-MM-DDThh:mm:
    sb.append("59");
      case 19: // YYYY-MM-DDThh:mm:ss
    sb.append("Z");
    break;
   
      case 18: // YYYY-MM-DDThh:mm:s
    throw new BadArgumentException();
      }
  }

//   until = sb.toString();
//   if (until.length() == VALID_GRANULARITIES[supportedGranularityOffset].length()) {
//       if (!isValidGranularity(until))
//     throw new BadGranularityException();
//       return until;
//   }

//   if (sb.charAt(sb.length()-1) == 'Z')
//       sb.setLength(sb.length()-1); // remove the trailing 'Z'
 
//   switch (sb.length()) {
//   case 19: // YYYY-MM-DDThh:mm:ss
//       sb.append(".");
//   case 20: // YYYY-MM-DDThh:mm:ss.
//       sb.append("0");
//   case 21: // YYYY-MM-DDThh:mm:ss.s
//       sb.append("Z");
//       break;
//   }

  until = sb.toString();
  if (!isValidGranularity(until))
      throw new BadArgumentException();
  return until;
    }
View Full Code Here

            return o;
        }

        // Handle is either non-existent, or corresponds to a non-collection
        // Either way, a bad set spec, ergo a bad argument
        throw new BadArgumentException();
    }
View Full Code Here

TOP

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

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.