1.6.1. Obtaining a Repository object

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



            RepositoryService repositoryService = (RepositoryService) container.getComponentInstanceOfType(RepositoryService.class);
  Repository repository = repositoryService.getRepository("repositoryName"); 
            
  // set current repository at initial time

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

  Repository repository =(Repository) ctx.lookup("repositoryName");
Copyright ©2012. All rights reserved. eXo Platform SAS