Search in sources :

Example 1 with JcrIndexService

use of com.thinkbiganalytics.metadata.modeshape.service.JcrIndexService in project kylo by Teradata.

the class MetadataJcrConfig method indexService.

// should not run during upgrade
@Bean
@ConditionalOnProperty(prefix = "config", value = "search.engine")
@Profile("!kyloUpgrade")
public JcrIndexService indexService(final Search search, final DatasourceProvider datasourceProvider, final MetadataAccess metadataAccess, final Repository repository) {
    final JcrIndexService indexService = new JcrIndexService(search, datasourceProvider, metadataAccess);
    try {
        final ObservationManager observationManager = repository.login().getWorkspace().getObservationManager();
        observationManager.addEventListener(indexService, Event.NODE_ADDED | Event.NODE_REMOVED | Event.PROPERTY_ADDED | Event.PROPERTY_CHANGED | Event.PROPERTY_REMOVED, EntityUtil.pathForDerivedDatasource(), true, null, null, false);
    } catch (final RepositoryException e) {
        throw new MetadataRepositoryException("Failed to register index service: " + e, e);
    }
    return indexService;
}
Also used : ObservationManager(javax.jcr.observation.ObservationManager) RepositoryException(javax.jcr.RepositoryException) JcrIndexService(com.thinkbiganalytics.metadata.modeshape.service.JcrIndexService) Profile(org.springframework.context.annotation.Profile) Bean(org.springframework.context.annotation.Bean) ConditionalOnProperty(org.springframework.boot.autoconfigure.condition.ConditionalOnProperty)

Aggregations

JcrIndexService (com.thinkbiganalytics.metadata.modeshape.service.JcrIndexService)1 RepositoryException (javax.jcr.RepositoryException)1 ObservationManager (javax.jcr.observation.ObservationManager)1 ConditionalOnProperty (org.springframework.boot.autoconfigure.condition.ConditionalOnProperty)1 Bean (org.springframework.context.annotation.Bean)1 Profile (org.springframework.context.annotation.Profile)1