Package org.openrdf.store

Examples of org.openrdf.store.StoreException


      }

      return valueStore.createStatement(subj, pred, obj, context);
    }
    catch (IOException e) {
      throw new StoreException(e);
    }
  }
View Full Code Here


  {
    try {
      btreeIter.close();
    }
    catch (IOException e) {
      throw new StoreException(e);
    }
  }
View Full Code Here

    // Check initialization parameters
    File dataDir = getDataDir();

    if (dataDir == null) {
      throw new StoreException("Data dir has not been set");
    }
    else if (!dataDir.exists()) {
      boolean success = dataDir.mkdirs();
      if (!success) {
        throw new StoreException("Unable to create data directory: " + dataDir);
      }
    }
    else if (!dataDir.isDirectory()) {
      throw new StoreException("The specified path does not denote a directory: " + dataDir);
    }
    else if (!dataDir.canRead()) {
      throw new StoreException("Not allowed to read from the specified directory: " + dataDir);
    }

    // try to lock the directory or fail
    dirLock = new DirectoryLockManager(dataDir).lockOrFail();

    logger.debug("Data dir is " + dataDir);

    try {
      namespaceStore = new NamespaceStore(dataDir);
      valueStore = new ValueStore(dataDir, forceSync);
      tripleStore = new TripleStore(dataDir, tripleIndexes, forceSync);
    }
    catch (IOException e) {
      throw new StoreException(e);
    }

    initialized = true;
    logger.debug("NativeStore initialized");
  }
View Full Code Here

          initialized = false;

          logger.debug("NativeStore shut down");
        }
        catch (IOException e) {
          throw new StoreException(e);
        }
        finally {
          writeLock.release();
        }
      }
View Full Code Here

      con = new SynchronizedInferencerConnection(con);
      con = new AutoCommitInferencerConnection(con);
      return con;
    }
    catch (IOException e) {
      throw new StoreException(e);
    }
  }
View Full Code Here

  {
    try {
      return storeLockManager.getReadLock();
    }
    catch (InterruptedException e) {
      throw new StoreException(e);
    }
  }
View Full Code Here

  {
    try {
      return storeLockManager.getWriteLock();
    }
    catch (InterruptedException e) {
      throw new StoreException(e);
    }
  }
View Full Code Here

  {
    try {
      return txnLockManager.getExclusiveLock();
    }
    catch (InterruptedException e) {
      throw new StoreException(e);
    }
  }
View Full Code Here

        logger.debug("Reading data from {}...", dataFile);

        // Initialize persistent store from file
        if (!dataFile.canRead()) {
          logger.error("Data file is not readable: {}", dataFile);
          throw new StoreException("Can't read data file: " + dataFile);
        }
        // try to create a lock for later writing
        dirLock = locker.tryLock();
        if (dirLock == null) {
          logger.warn("Failed to lock directory: {}", dataDir);
        }
        // Don't try to read empty files: this will result in an
        // IOException, and the file doesn't contain any data anyway.
        if (dataFile.length() == 0L) {
          logger.warn("Ignoring empty data file: {}", dataFile);
        }
        else {
          try {
            new FileIO(this, valueFactory).read(dataFile);
            logger.debug("Data file read successfully");
          }
          catch (IOException e) {
            logger.error("Failed to read data file", e);
            throw new StoreException(e);
          }
        }
      }
      else {
        // file specified that does not exist yet, create it
        try {
          File dir = dataFile.getParentFile();
          if (dir != null && !dir.exists()) {
            logger.debug("Creating directory for data file...");
            if (!dir.mkdirs()) {
              logger.debug("Failed to create directory for data file: {}", dir);
              throw new StoreException("Failed to create directory for data file: " + dir);
            }
          }
          // try to lock directory or fail
          dirLock = locker.lockOrFail();

          logger.debug("Initializing data file...");
          new FileIO(this, valueFactory).write(syncFile, dataFile);
          logger.debug("Data file initialized");
        }
        catch (IOException e) {
          logger.debug("Failed to initialize data file", e);
          throw new StoreException("Failed to initialize data file " + dataFile, e);
        }
        catch (StoreException e) {
          logger.debug("Failed to initialize data file", e);
          throw new StoreException("Failed to initialize data file " + dataFile, e);
        }
      }
    }

    contentsChanged = false;
View Full Code Here

  {
    try {
      return statementListLockManager.getReadLock();
    }
    catch (InterruptedException e) {
      throw new StoreException(e);
    }
  }
View Full Code Here

TOP

Related Classes of org.openrdf.store.StoreException

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.