コード例 #1
0
  public Map listSets() throws NoSetHierarchyException, OAIInternalServerError {
    Hashtable setKeys =
        PropertiesManager.getInstance()
            .getPropertyStartingWith(Constants.getInstance().OAICAT_SETS);
    String[] keys = (String[]) setKeys.keySet().toArray(new String[0]);
    Vector<String> folderSets = getFolderSets();
    if (keys.length == 0 && folderSets.size() == 0) {
      throw new NoSetHierarchyException();
    } else {
      purge(); // clean out old resumptionTokens
      Map listSetsMap = new HashMap();
      ArrayList sets = new ArrayList();

      for (String key : keys) {
        String setSpec =
            key.replace(Constants.getInstance().OAICAT_SETS + ".", "")
                .replace("." + Constants.getInstance().OAICAT_SETS_ID, "");
        sets.add(getSetXMLRepository(PropertiesManager.getInstance().getProperty(key), setSpec));
      }
      for (String folderString : folderSets) {
        sets.add(getSetXML(folderString));
      }

      listSetsMap.put("sets", sets.iterator());
      return listSetsMap;
    }
  }
コード例 #2
0
  public FileSystemLomCatalog(Properties properties) {
    String maxListSize =
        properties.getProperty(Constants.getInstance().OAICAT_SERVER_CATALOG_MAXLSTSIZE);
    if (maxListSize == null) {
      throw new IllegalArgumentException(
          Constants.getInstance().OAICAT_SERVER_CATALOG_MAXLSTSIZE
              + " is missing from the properties file");
    } else {
      FileSystemLomCatalog.maxListSize = Integer.parseInt(maxListSize);
    }
    String basePath = properties.getProperty(Constants.getInstance().OAICAT_SERVER_CATALOG_FS_DIR);
    if (basePath == null) {
      throw new IllegalArgumentException(
          Constants.getInstance().OAICAT_SERVER_CATALOG_MAXLSTSIZE
              + " is missing from the properties file");
    } else {
      FileSystemLomCatalog.basePath = basePath;
    }
    String ext = properties.getProperty(Constants.getInstance().OAICAT_SERVER_CATALOG_FS_EXT);
    if (ext == null) {
      throw new IllegalArgumentException(
          Constants.getInstance().OAICAT_SERVER_CATALOG_FS_EXT
              + " is missing from the properties file");
    } else {
      FileSystemLomCatalog.ext = ext;
    }

    String showCount =
        properties.getProperty(Constants.getInstance().OAICAT_SERVER_CATALOG_SHOW_COUNT);
    if (showCount == null) {
      showCount = "false";
    }
    FileSystemLomCatalog.showCount = new Boolean(showCount).booleanValue();

    try {

      Hashtable setKeys =
          PropertiesManager.getInstance()
              .getPropertyStartingWith(Constants.getInstance().OAICAT_SETS);
      String[] keys = (String[]) setKeys.keySet().toArray(new String[0]);
      String reposIdentifier = "";
      for (String key : keys) {
        String setSpec =
            key.replace(Constants.getInstance().OAICAT_SETS + ".", "")
                .replace("." + Constants.getInstance().OAICAT_SETS_ID, "");
        reposIdentifier = PropertiesManager.getInstance().getProperty(key);
        sets.put(setSpec, reposIdentifier);
      }
    } catch (Exception e) {
      // NOOP
    }
  }