Package org.openrdf.sail

Examples of org.openrdf.sail.SailException


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

    if (dataDir == null) {
      throw new SailException("Data dir has not been set");
    }
    else if (!dataDir.exists()) {
      boolean success = dataDir.mkdirs();
      if (!success) {
        throw new SailException("Unable to create data directory: " + dataDir);
      }
    }
    else if (!dataDir.isDirectory()) {
      throw new SailException("The specified path does not denote a directory: " + dataDir);
    }
    else if (!dataDir.canRead()) {
      throw new SailException("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, valueCacheSize, valueIDCacheSize,
          namespaceCacheSize, namespaceIDCacheSize);
      tripleStore = new TripleStore(dataDir, tripleIndexes, forceSync);
    }
    catch (IOException e) {
      // NativeStore initialization failed, release any allocated files
      if (valueStore != null) {
        try {
          valueStore.close();
        }
        catch (IOException e1) {
          logger.warn("Failed to close value store after native store initialization failure", e);
        }
        valueStore = null;
      }
      if (namespaceStore != null) {
        namespaceStore.close();
        namespaceStore = null;
      }

      dirLock.release();

      throw new SailException(e);
    }

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


      namespaceStore.close();

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

  {
    try {
      return new AndroidNativeStoreConnection(this);
    }
    catch (IOException e) {
      throw new SailException(e);
    }
  }
View Full Code Here

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

    }
    else {
      try {
        int version = Integer.parseInt(versionStr);
        if (version < 10) {
          throw new SailException("Directory contains incompatible triple data");
        }
        else if (version > SCHEME_VERSION) {
          throw new SailException("Directory contains data that uses a newer data format");
        }
      }
      catch (NumberFormatException e) {
        logger.warn("Malformed version number in TripleStore's properties file");
      }
View Full Code Here

    throws SailException
  {
    String indexesStr = properties.getProperty(INDEXES_KEY);

    if (indexesStr == null) {
      throw new SailException(INDEXES_KEY + " missing in TripleStore's properties file");
    }

    Set<String> indexSpecs = parseIndexSpecList(indexesStr);

    if (indexSpecs.isEmpty()) {
      throw new SailException("No " + INDEXES_KEY + " found in TripleStore's properties file");
    }

    return indexSpecs;
  }
View Full Code Here

        // sanity checks
        if (index.length() != 4 || index.indexOf('s') == -1 || index.indexOf('p') == -1
            || index.indexOf('o') == -1 || index.indexOf('c') == -1)
        {
          throw new SailException("invalid value '" + index + "' in index specification: "
              + indexSpecStr);
        }

        indexes.add(index);
      }
View Full Code Here

      logger.trace("Optimized query model:\n{}", tupleExpr);

      return strategy.evaluate(tupleExpr, EmptyBindingSet.getInstance());
    }
    catch (QueryEvaluationException e) {
      throw new SailException(e);
    }
  }
View Full Code Here

      return new ExceptionConvertingIteration<Resource, SailException>(contextIter) {

        @Override
        protected SailException convert(Exception e) {
          if (e instanceof IOException) {
            return new SailException(e);
          }
          else if (e instanceof RuntimeException) {
            throw (RuntimeException)e;
          }
          else if (e == null) {
            throw new IllegalArgumentException("e must not be null");
          }
          else {
            throw new IllegalArgumentException("Unexpected exception type: " + e.getClass());
          }
        }
      };
    }
    catch (IOException e) {
      throw new SailException(e);
    }
  }
View Full Code Here

      return new ExceptionConvertingIteration<Statement, SailException>(iter) {

        @Override
        protected SailException convert(Exception e) {
          if (e instanceof IOException) {
            return new SailException(e);
          }
          else if (e instanceof RuntimeException) {
            throw (RuntimeException)e;
          }
          else if (e == null) {
            throw new IllegalArgumentException("e must not be null");
          }
          else {
            throw new IllegalArgumentException("Unexpected exception type: " + e.getClass());
          }
        }
      };
    }
    catch (IOException e) {
      throw new SailException("Unable to get statements", e);
    }
  }
View Full Code Here

TOP

Related Classes of org.openrdf.sail.SailException

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.