eXo Platform 4.1 Documentation > Reference Guide / eXo JCR > Developer References > Basic usage > Using JCR

3.1.1.1. Obtaining repository object

A javax.jcr.Repository object can be obtained by:

RepositoryService repositoryService = (RepositoryService) container.getComponentInstanceOfType(RepositoryService.class);

  Repository repository = repositoryService.getRepository("repository");
  // set current repository at initial time

  RepositoryService repositoryService = (RepositoryService) container.getComponentInstanceOfType(RepositoryService.class);
  repositoryService.setCurrentRepositoryName("repository");
  ....
  // retrieve and use this repository
  Repository repository = repositoryService.getCurrentRepository();
Context ctx = new InitialContext();

  Repository repository =(Repository) ctx.lookup("repository");
Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus