Package proj.zoie.impl.indexing.internal

Examples of proj.zoie.impl.indexing.internal.IndexSignature


    if (!_indexCopier.copy(src, dest.getAbsolutePath())) return false;

    File directoryFile = new File(dest, DirectoryManager.INDEX_DIRECTORY);
    if (!directoryFile.exists()) {
      log.warn("index directory file not exists, creating a empty one.");
      IndexSignature sig = new IndexSignature(null);
      try {
        DefaultDirectoryManager.saveSignature(sig, directoryFile);
      } catch (IOException e) {
        log.error(e.getMessage(), e);
        return false;
View Full Code Here


      log.debug("getAllArchivedDirectories" + name + " " + (file.equals(_location) ? "*" : ""));
      long ctime = 0;
      try {
        long time = dateFormatter.get().parse(name).getTime();
        if (!file.equals(_location)) { // don't count the current one
          IndexSignature sig = getIndexSignature(file);
          if (sig != null) {
            if (sig.getVersion() != null) {
              if (time > ctime) {
                version = sig.getVersion();
                ctime = time;
              }
            }
          } else {
            log.error("potential index corruption: indexSignature not in " + _location);
View Full Code Here

    return version;
  }

  public IndexSignature getIndexSignature(File file) {
    File directoryFile = new File(file, DirectoryManager.INDEX_DIRECTORY);
    IndexSignature sig = DefaultDirectoryManager.readSignature(directoryFile);
    return sig;
  }
View Full Code Here

      // create the parent directory
      _location.mkdirs();
    }

    if (create) {
      IndexSignature sig = null;
      if (_location.exists()) {
        sig = getCurrentIndexSignature();
      }

      if (sig == null) {
        File directoryFile = new File(_location, INDEX_DIRECTORY);
        sig = new IndexSignature(null);
        try {
          saveSignature(sig, directoryFile);
        } catch (IOException e) {
          throw e;
        }
View Full Code Here

    return getCurrentIndexSignature(_location);
  }

  public static IndexSignature getCurrentIndexSignature(File idxDir) {
    File directoryFile = new File(idxDir, INDEX_DIRECTORY);
    IndexSignature sig = readSignature(directoryFile);
    return sig;
  }
View Full Code Here

    return sig;
  }

  @Override
  public String getVersion() throws IOException {
    IndexSignature sig = getCurrentIndexSignature();
    return sig == null ? null : sig.getVersion();
  }
View Full Code Here

  @Override
  public void setVersion(String version) throws IOException {
    // update new index file
    File directoryFile = new File(_location, INDEX_DIRECTORY);
    IndexSignature sig = readSignature(directoryFile);
    sig.updateVersion(version);
    try {
      // make sure atomicity of the index publication
      File tmpFile = new File(_location, INDEX_DIRECTORY + ".new");
      saveSignature(sig, tmpFile);
      File tmpFile2 = new File(_location, INDEX_DIRECTORY + ".tmp");
View Full Code Here

TOP

Related Classes of proj.zoie.impl.indexing.internal.IndexSignature

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.