{@inheritDoc}
@throws RepositoryException
347562
protected MultiColumnQueryHits executeQuery(long resultFetchHint)
            throws IOException, RepositoryException {
        return index.executeQuery(session, queryImpl, query,
                orderProps, orderSpecs, resultFetchHint);
    }
1279106
@Override
    public void add(Statement st, Resource... contexts) throws RepositoryException {
        add(st.getSubject(), st.getPredicate(), st.getObject(), mergeResource(st.getContext(), contexts));
    }
835548
@SuppressWarnings( "deprecation" )
    @Override
    public org.modeshape.jcr.api.query.QueryResult execute() throws RepositoryException {
        context.checkValid();
        final long start = System.nanoTime();
        // Create an executable query and set it on this object ...
        CancellableQuery newExecutable = context.createExecutableQuery(query, hints, variables);
        CancellableQuery executable = executingQuery.getAndSet(newExecutable);
        if (executable == null) {
            // We are the first to call 'execute()', so use our newly-created one ...
            executable = newExecutable;
        }
        // otherwise, some other thread called execute, so we can use it and just wait for the results ...
        final QueryResults result = executable.execute(); // may be cancelled

        // And reset the reference to null (if not already set to something else) ...
        executingQuery.compareAndSet(executable, null);

        checkForProblems(result.getProblems());
        context.recordDuration(Math.abs(System.nanoTime() - start), TimeUnit.NANOSECONDS, statement, language);
        if (Query.XPATH.equals(language)) {
            return new XPathQueryResult(context, statement, result, hints.restartable, hints.rowsKeptInMemory);
        } else if (Query.SQL.equals(language)) {
            return new JcrSqlQueryResult(context, statement, result, hints.restartable, hints.rowsKeptInMemory);
        }
        return new JcrQueryResult(context, statement, result, hints.restartable, hints.rowsKeptInMemory);
    }
793723
void close() throws RepositoryException {
        mLock.lock();
        if (mClosed) {
            mLock.unlock();
            return;
        }
 
        Map<Class<?>, CursorList<TransactionImpl<Txn>>> cursors;
        try {
            cursors = mCursors;        

            // Ensure that map is freed promptly. Thread-local reference to
            // this scope otherwise keeps map and its contents lingering around
            // for a very long time.
            mCursors = null;

            while (mActive != null) {
                mActive.exit();
            }
        } finally {
            // Swap TransactionManager out with a dummy one, to allow the
            // original one to get freed.
            mTxnMgr = (TransactionManager<Txn>) TransactionManager.Closed.THE;
            mClosed = true;
            mLock.unlock();
        }

        // Close cursors without lock held, to prevent deadlock. Cursor close
        // operation might acquire its own lock, which in turn acquires a lock
        // on this scope.
        if (cursors != null) {
            for (CursorList<TransactionImpl<Txn>> cursorList : cursors.values()) {
                cursorList.closeCursors();
            }
        }
    }
664735
public Response restoreRepository( ServletContext context, 
                                       HttpServletRequest request, 
                                       String repositoryName,
                                       String backupName, 
                                       RestoreOptions options ) throws RepositoryException {
        if (StringUtil.isBlank(backupName)) {
            throw new IllegalArgumentException("The name of the backup cannot be null");
        }
        File backup = resolveBackup(context, backupName);
        logger.debug("Restoring repository '{0}' from backup '{1}' using '{2}'", repositoryName, backup, options);
        Session session = getSession(request, repositoryName, null);
        RepositoryManager repositoryManager = ((org.modeshape.jcr.api.Workspace)session.getWorkspace()).getRepositoryManager();
        final Problems problems = repositoryManager.restoreRepository(backup, options);
        if (!problems.hasProblems()) {
            return Response.ok().build();
        }
        List<JSONAble> response = new ArrayList<JSONAble>(problems.size());
        for (Problem problem : problems) {
            RestException exception = problem.getThrowable() != null ? 
                                      new RestException(problem.getMessage(), problem.getThrowable()) : 
                                      new RestException(problem.getMessage());
            response.add(exception);
        }
        return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(response).build();
    }
407289
public function rollbackTransaction()
    {
        if ($this->isTransactionEnabled() === false) {
            throw new ServiceException(sprintf(
                'The repository for %s doesn\'t support Transactions',
                $this->getEntityServiceName()
            ));
        }

        $this->getRepository()->rollbackTransaction();
    }
789817
protected function getRepositoryUrl($repositoryId, $selector = null)
    {
        $result = $this->getRepositoryUrlCache()->getRepositoryUrl($repositoryId, $selector);

        if ($result === null) {
            $this->getRepositoriesInternal($repositoryId);
            $result = $this->getRepositoryUrlCache()->getRepositoryUrl($repositoryId, $selector);
        }

        if ($result === null) {
            throw new CmisObjectNotFoundException(
                sprintf(
                    'Unknown repository! Repository: "%s" | Selector: "%s"',
                    $repositoryId,
                    $selector
                )
            );
        }

        return $result;
    }
1229303
public QueryResult execute() throws RepositoryException
   {
      checkInitialized();
      long time = 0;
      if (log.isDebugEnabled())
      {
         time = System.currentTimeMillis();
      }

      QueryResult result = query.execute(offset, limit, caseInsensitiveOrder);

      if (log.isDebugEnabled())
      {
         time = System.currentTimeMillis() - time;
         NumberFormat format = NumberFormat.getNumberInstance();
         format.setMinimumFractionDigits(2);
         format.setMaximumFractionDigits(2);
         String seconds = format.format((double)time / 1000);
         log.debug("executed in " + seconds + " s. (" + statement + ")");
      }
      return result;
   }
32562
public function order($columns) {
		if ($this->selection)
			$this->selection->order($columns);
		else
			throw new RepositoryException("Before using the function order(...) call read(...).");
		return $this;
	}
675121
public function setCustomRepositoryClass($repositoryClassName)
    {
        if ($repositoryClassName && strpos($repositoryClassName, '\\') === false && strlen($this->namespace)) {
            $repositoryClassName = $this->namespace . '\\' . $repositoryClassName;
        }

        $this->customRepositoryClassName = $repositoryClassName;
    }
1366956
public void addRepository(String url) throws ProjectException {
        List<Repository> repositories = getRepositories();

        if ( repositories == null ) {
            repositories = new ArrayList<Repository>();
        }

        try {
            Repository repository = RepoBuilder.repositoryFromUrl( url );
            repositories.add( repository );
        } catch (MalformedURLException e) {
            throw new ProjectException( e );
        }

        getMavenModel().setRepositories( repositories );
    }
379946
@Override
    public <E extends Exception> void remove(Iteration<? extends Statement, E> statements) throws RepositoryException, E {
        while(statements.hasNext()){
            Statement st = statements.next();
            getClient().sendRemove(null, st.getSubject(), st.getPredicate(), st.getObject());
        }
    }
469776
public function insert(Repository $repository = null)
    {
        if (!$repository) {
            $repository = $this->getRepository();
        }

        $repository = $repository->aliased('write');

        $insert = $this->getQuery()->transformToInsert();

        $prepare = $repository->prepareQuery($insert);

        return $repository->executePrepared($prepare);
    }
323395
private void setRepositoryMapFile() throws MojoExecutionException {
        if (this.customRepositoryMap != null && !this.customRepositoryMap.isEmpty()) {
            File repositoryMap = getRepositoryMapFile(this.customRepositoryMap);
            if (repositoryMap.exists()) {
                checkRepositoryMapIsValid(repositoryMap);
                try {
                    this.xmlRepositoryMap = repositoryMap.toURI().toURL().openStream();
                } catch (IOException ioe) {
                    throw new MojoExecutionException(ioe.getLocalizedMessage());
                }
            } else {
                throw new MojoExecutionException("Repository map '" + repositoryMap.getAbsolutePath() + "' does not exist");
            }
        }

        if (this.xmlRepositoryMap == null) {
            this.xmlRepositoryMap = this.getClass().getResourceAsStream("/RepositoryMap.xml");
        }
    }
1334752
public ManageableRepository getRepository(String name) throws RepositoryException
   {
      RepositoryContainer repositoryContainer = repositoryContainers.get(name);
      log.debug("RepositoryServiceimpl() getRepository " + name);
      if (repositoryContainer == null)
      {
         throw new RepositoryException("Repository '" + name + "' not found.");
      }

      return (ManageableRepository)repositoryContainer.getComponentInstanceOfType(ManageableRepository.class);
   }
1190068
public function find(Repository $repository = null): array
    {
        if (!$repository && !($repository = $this->repository)) {
            throw new \RuntimeException('The current Query object is not tied to any Repository');
        }

        return $repository->find($this->compileParameters());
    }
508254
protected void doInitialize( IndexProvider provider ) throws RepositoryException {

        // Set the execution context instance ...
        Reflection.setValue(provider, "context", repository.context());
        
        // Set the environment
        Reflection.setValue(provider, "environment", repository.environment());

        provider.initialize();

        // If successful, call the 'postInitialize' method reflectively (due to inability to call directly) ...
        Method postInitialize = Reflection.findMethod(IndexProvider.class, "postInitialize");
        Reflection.invokeAccessibly(provider, postInitialize, new Object[] {});

        if (logger.isDebugEnabled()) {
            logger.debug("Successfully initialized index provider '{0}' in repository '{1}'", provider.getName(),
                         repository.name());
        }
    }