/** * Gets the low-level SQL Repository of the given name. * * @param repositoryName the repository name * @return the repository * @since 5.9.5 */ public RepositoryManagement getRepository(String repositoryName) { RepositoryService repositoryService = Framework.getService(RepositoryService.class); org.nuxeo.ecm.core.model.Repository repository = repositoryService.getRepository(repositoryName); if (repository == null) { throw new RuntimeException("Unknown repository: " + repositoryName); } if (repository instanceof org.nuxeo.ecm.core.storage.sql.Repository) { // (JCA) ConnectionFactoryImpl already implements Repository return (org.nuxeo.ecm.core.storage.sql.Repository) repository; } else { throw new RuntimeException("Unknown repository class: " + repository.getClass().getName()); } }
@Override public BinaryManagerStatus garbageCollectBinaries(boolean delete) { List<BinaryGarbageCollector> gcs = getGarbageCollectors(); // start gc long start = System.currentTimeMillis(); for (BinaryGarbageCollector gc : gcs) { gc.start(); } // in all repositories, mark referenced binaries // the marking itself will call back into the appropriate gc's mark method RepositoryService repositoryService = Framework.getService(RepositoryService.class); for (String repositoryName : repositoryService.getRepositoryNames()) { Repository repository = repositoryService.getRepository(repositoryName); repository.markReferencedBinaries(); } // stop gc BinaryManagerStatus globalStatus = new BinaryManagerStatus(); for (BinaryGarbageCollector gc : gcs) { gc.stop(delete); BinaryManagerStatus status = gc.getStatus(); globalStatus.numBinaries += status.numBinaries; globalStatus.sizeBinaries += status.sizeBinaries; globalStatus.numBinariesGC += status.numBinariesGC; globalStatus.sizeBinariesGC += status.sizeBinariesGC; } globalStatus.gcDuration = System.currentTimeMillis() - start; return globalStatus; }
protected void initFulltextConfiguration() { RepositoryService repositoryService = Framework.getService(RepositoryService.class); Repository repository = repositoryService.getRepository(repositoryName); fulltextConfiguration = repository.getFulltextConfiguration(); }
/** * Creates the session. It will be destroyed by calling {@link #destroy}. */ protected SessionInfo createSession() { RepositoryService repositoryService = Framework.getService(RepositoryService.class); Repository repository = repositoryService.getRepository(repositoryName); if (repository == null) { throw new LocalException("No such repository: " + repositoryName); } Session session = repository.getSession(); TransactionHelper.registerSynchronization(this); SessionInfo si = new SessionInfo(session); sessionHolder.set(si); allSessions.add(si); if (log.isDebugEnabled()) { log.debug("Adding thread " + Thread.currentThread().getName() + " for CoreSession: " + sessionId); } return si; }