/** * Convenience constructor * * @param sail * The sail (must be a {@link BigdataSail}). * @param nthreads * The number of threads to use for the SCATTER and GATHER * phases. */ public BigdataGASEngine(final Sail sail, final int nthreads) { this(((BigdataSail) sail).getIndexManager(), nthreads); }
/** * Convenience constructor * * @param sail * The sail (must be a {@link BigdataSail}). * @param nthreads * The number of threads to use for the SCATTER and GATHER * phases. */ public BigdataGASEngine(final Sail sail, final int nthreads) { this(((BigdataSail) sail).getIndexManager(), nthreads); }
/** * Return false iff the Sail can not provide a writable connection. * <p> * {@inheritDoc} * * @see BLZG-2041 (BigdataSail should not locate the AbstractTripleStore until a connection is requested) */ @Override final public boolean isWritable() throws SailException { if(getIndexManager() instanceof IRawStore) { // For backends that are willing to report whether or not they are // read-only, this returns false if the index manager is read-only. return !((IRawStore)getIndexManager()).isReadOnly(); } // Otherwise assume writable (TemporaryStore, Federation). return true; // return ! database.isReadOnly(); }
/** * Return false iff the Sail can not provide a writable connection. * <p> * {@inheritDoc} * * @see BLZG-2041 (BigdataSail should not locate the AbstractTripleStore until a connection is requested) */ @Override final public boolean isWritable() throws SailException { if(getIndexManager() instanceof IRawStore) { // For backends that are willing to report whether or not they are // read-only, this returns false if the index manager is read-only. return !((IRawStore)getIndexManager()).isReadOnly(); } // Otherwise assume writable (TemporaryStore, Federation). return true; // return ! database.isReadOnly(); }
@Override public IGraphAccessor newGraphAccessor(final SailConnection ignored) { return new BigdataGraphAccessor(sail.getIndexManager()); }
@Override public IGraphAccessor newGraphAccessor(final SailConnection ignored) { return new BigdataGraphAccessor(sail.getIndexManager()); }
/** * Return the properties associated with the {@link AbstractTripleStore} * backing the {@link BigdataSail}. * * @param sail * The sail. * * @return The persistent properties. */ public Properties getProperties(final BigdataSail sail) { return getProperties(sail.getIndexManager(), sail.getNamespace()); }
/** * Overridden to destroy the backend database and its files on the disk. */ @Override public void tearDown() throws Exception { final IIndexManager backend = sail == null ? null : ((BigdataSail) sail).getIndexManager(); super.tearDown(); if (backend != null) backend.destroy(); }
private IIndexManager getIndexManager() { final BigdataSailRepository repo = (BigdataSailRepository) this.getRepository(); final IIndexManager indexMgr = repo.getSail().getIndexManager(); return indexMgr; }
/** * Return the properties associated with the {@link AbstractTripleStore} * backing the {@link BigdataSail}. * * @param sail * The sail. * * @return The persistent properties. */ public Properties getProperties(final BigdataSail sail) { return getProperties(sail.getIndexManager(), sail.getNamespace()); }
/** * <strong>DO NOT INVOKE FROM APPLICATION CODE</strong> - this method * deletes the KB instance and destroys the backing database instance. It is * used to help tear down unit tests. */ public void __tearDownUnitTest() { closeOnShutdown = false; try { if(isOpen()) shutDown(); // database.__tearDownUnitTest(); getIndexManager().destroy(); } catch (Throwable t) { log.error("Problem during shutdown: " + t, t); } }
/** * <strong>DO NOT INVOKE FROM APPLICATION CODE</strong> - this method * deletes the KB instance and destroys the backing database instance. It is * used to help tear down unit tests. */ public void __tearDownUnitTest() { closeOnShutdown = false; try { if(isOpen()) shutDown(); // database.__tearDownUnitTest(); getIndexManager().destroy(); } catch (Throwable t) { log.error("Problem during shutdown: " + t, t); } }
protected Repository newRepository() throws RepositoryException { final Properties props = getProperties(); final BigdataSail sail = new BigdataSail(props); backend = sail.getIndexManager(); return new BigdataSailRepository(sail); }
/** * Test create and shutdown of the default store. * * @throws SailException * @throws IOException */ public void test_ctor_1() throws SailException, IOException { final File file = new File(BigdataSail.Options.DEFAULT_FILE); /* * If the default file exists, then delete it before creating the SAIL. */ if (file.exists()) { if (!file.delete()) { throw new IOException("Unable to remove default file:" + file); } } final BigdataSail sail = new BigdataSail(); try { if (!file.exists()) fail("Expected file does not exist: " + file); sail.initialize(); sail.shutDown(); } finally { sail.getIndexManager().destroy(); } }
/** * Return the {@link ITransactionService}. */ protected ITransactionService getTxService() { final IIndexManager indexManager = getIndexManager(); final ITransactionService txService; if (indexManager instanceof IJournal) { txService = ((IJournal) indexManager).getLocalTransactionManager() .getTransactionService(); } else { txService = ((AbstractFederation<?>) indexManager) .getTransactionService(); } return txService; }
/** * Return the {@link ITransactionService}. */ protected ITransactionService getTxService() { final IIndexManager indexManager = getIndexManager(); final ITransactionService txService; if (indexManager instanceof IJournal) { txService = ((IJournal) indexManager).getLocalTransactionManager() .getTransactionService(); } else { txService = ((AbstractFederation<?>) indexManager) .getTransactionService(); } return txService; }
/** * Test creates a database, obtains a writable connection on the database, * and then closes the connection and shutdown the database. * * @throws SailException */ public void test_getConnection() throws SailException { final Properties properties = new Properties(); properties.setProperty(Options.CREATE_TEMP_FILE, "true"); final BigdataSail sail = new BigdataSail(properties); try { sail.initialize(); final SailConnection conn = sail.getConnection(); conn.close(); sail.shutDown(); } finally { sail.getIndexManager().destroy(); } }
/** * Overridden to destroy the backend database and its files on the disk. */ @Override public void tearDown() throws Exception { final IIndexManager backend = sail == null ? null : ((BigdataSail) sail).getIndexManager(); super.tearDown(); if (backend != null) backend.destroy(); }
protected Repository newRepository() throws RepositoryException { final Properties props = getProperties(); final BigdataSail sail = new BigdataSail(props); backend = sail.getIndexManager(); return new BigdataSailRepository(sail); }
/** * Test creates a database, obtains a writable connection on the database, * and then closes the connection and shutdown the database. * * @throws SailException */ public void test_getConnection() throws SailException { final Properties properties = new Properties(); properties.setProperty(Options.CREATE_TEMP_FILE, "true"); final BigdataSail sail = new BigdataSail(properties); try { sail.initialize(); final SailConnection conn = sail.getConnection(); conn.close(); sail.shutDown(); } finally { sail.getIndexManager().destroy(); } }