private void initializeRepositories(SnowOwlConfiguration configuration, Environment env) { final Stopwatch branchStopwatch = Stopwatch.createStarted(); LOG.debug(">>> Initializing branch and review services."); final DefaultRepositoryManager repositories = (DefaultRepositoryManager) env.service(RepositoryManager.class); RepositoryConfiguration repositoryConfig = configuration.getModuleConfig(RepositoryConfiguration.class); final ICDORepositoryManager cdoRepositoryManager = env.service(ICDORepositoryManager.class); for (String repositoryId : cdoRepositoryManager.uuidKeySet()) { Repository repo = repositories .prepareCreate(repositoryId, cdoRepositoryManager.getByUuid(repositoryId).getSnowOwlTerminologyComponentId()) .setMergeMaxResults(repositoryConfig.getMergeMaxResults()) .build(env); if (repo.health() == Health.GREEN) { LOG.info("Started repository '{}' with status '{}'", repo.id(), repo.health()); } else { LOG.warn("Started repository '{}' with status '{}'. Diagnosis: {}.", repo.id(), repo.health(), repo.diagnosis()); } } LOG.debug("<<< Branch and review services registered. [{}]", branchStopwatch); }
private void initializeContent(Environment env) { final RepositoryManager repositories = env.service(RepositoryManager.class); for (Repository repository : repositories.repositories()) { final String repositoryId = repository.id(); if (repository.health() == Health.GREEN) { final ICDORepository cdoRepository = ((InternalRepository) repository).getCdoRepository(); RepositoryInitializerRegistry.INSTANCE.getInitializer(repositoryId).initialize(cdoRepository); } } }
public SnomedTraceabilityChangeProcessor(final IBranchPath branchPath, ObjectWriter objectWriter) { this.branchPath = checkNotNull(branchPath); this.objectWriter = checkNotNull(objectWriter); this.index = ApplicationContext.getServiceForClass(RepositoryManager.class).get(SnomedDatastoreActivator.REPOSITORY_UUID).service(RevisionIndex.class); this.collectSystemChanges = collectSystemChanges(branchPath.getPath()); this.descriptionLookupService = new SnomedDescriptionLookupService(); }
protected AbstractBranchChangeRemoteJob(final Repository repository, UUID id, final String sourcePath, final String targetPath, final String commitComment, final String reviewId) { super(commitComment); this.repository = repository; this.commitComment = commitComment; this.reviewId = reviewId; merge.set(MergeImpl.builder(sourcePath, targetPath).id(id).build()); setSystem(true); setRule(MultiRule.combine( new BranchExclusiveRule(repository.id(), BranchPathUtils.createPath(sourcePath)), new BranchExclusiveRule(repository.id(), BranchPathUtils.createPath(targetPath)))); }
getContext().getService(RepositoryManager.class) .get(repositoryUuid) .sendNotification(toCommitNotification(mergedChangeSet));
@Override protected IStatus run(IProgressMonitor monitor) { merge.getAndUpdate(m -> m.start()); try { applyChanges(); merge.getAndUpdate(m -> m.completed()); } catch (MergeConflictException e) { merge.getAndUpdate(m -> m.failedWithConflicts(e.getConflicts(), e.toApiError())); } catch (ApiException e) { merge.getAndUpdate(m -> m.failed(e.toApiError())); } catch (RuntimeException e) { merge.getAndUpdate(m -> m.failed(ApiError.Builder.of(e.getMessage()).build())); } finally { // Send a notification event with the final state to the global event bus repository.events().publish(String.format(Merge.ADDRESS_TEMPLATE, repository.id(), merge.get().getId()), merge.get()); } return Statuses.ok(); }