use of org.apache.jackrabbit.oak.plugins.index.IndexEditorProvider in project jackrabbit-oak by apache.
the class Jcr method setUpOak.
private void setUpOak() {
// whiteboard
if (whiteboard != null) {
oak.with(whiteboard);
}
// repository initializers
for (RepositoryInitializer repositoryInitializer : repositoryInitializers) {
oak.with(repositoryInitializer);
}
// query index providers
for (QueryIndexProvider queryIndexProvider : queryIndexProviders) {
oak.with(queryIndexProvider);
}
// commit hooks
for (CommitHook commitHook : commitHooks) {
oak.with(commitHook);
}
// conflict handlers
oak.with(conflictHandler);
// index editor providers
for (IndexEditorProvider indexEditorProvider : indexEditorProviders) {
oak.with(indexEditorProvider);
}
// editors
for (Editor editor : editors) {
oak.with(editor);
}
// editor providers
for (EditorProvider editorProvider : editorProviders) {
oak.with(editorProvider);
}
// securityProvider
oak.with(securityProvider);
// executors
if (scheduledExecutor != null) {
oak.with(scheduledExecutor);
}
if (executor != null) {
oak.with(executor);
}
// observers
for (Observer observer : observers) {
oak.with(observer);
}
// commit rate limiter
if (commitRateLimiter != null) {
oak.with(commitRateLimiter);
}
// query engine settings
if (queryEngineSettings != null) {
oak.with(queryEngineSettings);
}
// default workspace name
if (defaultWorkspaceName != null) {
oak.with(defaultWorkspaceName);
}
if (clusterable != null) {
oak.with(clusterable);
}
}
use of org.apache.jackrabbit.oak.plugins.index.IndexEditorProvider in project jackrabbit-oak by apache.
the class ReIndexer method createIndexEditorProvider.
private IndexEditorProvider createIndexEditorProvider() throws IOException {
//Need to list all used editors otherwise async index run fails with
//MissingIndexEditor exception. Better approach would be to change lane for
//those indexes and then do reindexing
NodeCounterEditorProvider counter = new NodeCounterEditorProvider();
IndexEditorProvider lucene = indexHelper.getLuceneIndexHelper().createEditorProvider();
IndexEditorProvider property = new PropertyIndexEditorProvider().with(indexHelper.getMountInfoProvider());
return CompositeIndexEditorProvider.compose(asList(lucene, property, counter));
}
use of org.apache.jackrabbit.oak.plugins.index.IndexEditorProvider in project jackrabbit-oak by apache.
the class DocumentQueueTest method setUp.
@Before
public void setUp() throws IOException {
IndexEditorProvider editorProvider = new LuceneIndexEditorProvider(null, null, null, defaultMountInfoProvider());
syncHook = new EditorHook(new IndexUpdateProvider(editorProvider));
asyncHook = new EditorHook(new IndexUpdateProvider(editorProvider, "async", false));
}
use of org.apache.jackrabbit.oak.plugins.index.IndexEditorProvider in project jackrabbit-oak by apache.
the class Oak method createNewContentRepository.
private ContentRepository createNewContentRepository() {
final RepoStateCheckHook repoStateCheckHook = new RepoStateCheckHook();
final List<Registration> regs = Lists.newArrayList();
regs.add(whiteboard.register(Executor.class, getExecutor(), Collections.emptyMap()));
IndexEditorProvider indexEditors = CompositeIndexEditorProvider.compose(indexEditorProviders);
OakInitializer.initialize(store, new CompositeInitializer(initializers), indexEditors);
QueryIndexProvider indexProvider = CompositeQueryIndexProvider.compose(queryIndexProviders);
commitHooks.add(repoStateCheckHook);
List<CommitHook> initHooks = new ArrayList<CommitHook>(commitHooks);
initHooks.add(new EditorHook(CompositeEditorProvider.compose(editorProviders)));
if (asyncTasks != null) {
IndexMBeanRegistration indexRegistration = new IndexMBeanRegistration(whiteboard);
regs.add(indexRegistration);
for (Entry<String, Long> t : asyncTasks.entrySet()) {
AsyncIndexUpdate task = new AsyncIndexUpdate(t.getKey(), store, indexEditors);
indexRegistration.registerAsyncIndexer(task, t.getValue());
closer.register(task);
}
PropertyIndexAsyncReindex asyncPI = new PropertyIndexAsyncReindex(new AsyncIndexUpdate(IndexConstants.ASYNC_REINDEX_VALUE, store, indexEditors, true), getExecutor());
regs.add(registerMBean(whiteboard, PropertyIndexAsyncReindexMBean.class, asyncPI, PropertyIndexAsyncReindexMBean.TYPE, "async"));
}
regs.add(registerMBean(whiteboard, NodeCounterMBean.class, new NodeCounter(store), NodeCounterMBean.TYPE, "nodeCounter"));
regs.add(registerMBean(whiteboard, QueryEngineSettingsMBean.class, queryEngineSettings, QueryEngineSettingsMBean.TYPE, "settings"));
// FIXME: OAK-810 move to proper workspace initialization
// initialize default workspace
Iterable<WorkspaceInitializer> workspaceInitializers = Iterables.transform(securityProvider.getConfigurations(), new Function<SecurityConfiguration, WorkspaceInitializer>() {
@Override
public WorkspaceInitializer apply(SecurityConfiguration sc) {
return sc.getWorkspaceInitializer();
}
});
OakInitializer.initialize(workspaceInitializers, store, defaultWorkspaceName, indexEditors);
// add index hooks later to prevent the OakInitializer to do excessive indexing
with(new IndexUpdateProvider(indexEditors, failOnMissingIndexProvider));
withEditorHook();
// Register observer last to prevent sending events while initialising
for (Observer observer : observers) {
regs.add(whiteboard.register(Observer.class, observer, emptyMap()));
}
RepositoryManager repositoryManager = new RepositoryManager(whiteboard);
regs.add(registerMBean(whiteboard, RepositoryManagementMBean.class, repositoryManager, RepositoryManagementMBean.TYPE, repositoryManager.getName()));
CommitHook composite = CompositeHook.compose(commitHooks);
regs.add(whiteboard.register(CommitHook.class, composite, Collections.emptyMap()));
final Tracker<Descriptors> t = whiteboard.track(Descriptors.class);
return new ContentRepositoryImpl(store, composite, defaultWorkspaceName, queryEngineSettings.unwrap(), indexProvider, securityProvider, new AggregatingDescriptors(t)) {
@Override
public void close() throws IOException {
super.close();
repoStateCheckHook.close();
new CompositeRegistration(regs).unregister();
closer.close();
}
};
}
use of org.apache.jackrabbit.oak.plugins.index.IndexEditorProvider in project jackrabbit-oak by apache.
the class DocumentClusterIT method initRepository.
/**
* initialise the repository
*
* @param clazz the current class. Used for logging. Cannot be null.
* @param repos list to which add the created repository. Cannot be null.
* @param mks list to which add the created MK. Cannot be null.
* @param clusterId the cluster ID to use. Must be greater than 0.
* @param asyncDelay the async delay to set. For default use {@link #NOT_PROVIDED}
* @throws Exception
*/
protected void initRepository(@Nonnull final Class<?> clazz, @Nonnull final List<Repository> repos, @Nonnull final List<DocumentMK> mks, final int clusterId, final int asyncDelay) throws Exception {
DocumentMK.Builder builder = new DocumentMK.Builder();
builder.setMongoDB(createConnection(checkNotNull(clazz)).getDB());
if (asyncDelay != NOT_PROVIDED) {
builder.setAsyncDelay(asyncDelay);
}
builder.setClusterId(clusterId);
DocumentMK mk = builder.open();
Jcr j = getJcr(mk.getNodeStore());
Set<IndexEditorProvider> ieps = additionalIndexEditorProviders();
if (ieps != null) {
for (IndexEditorProvider p : ieps) {
j = j.with(p);
}
}
if (isAsyncIndexing()) {
j = j.withAsyncIndexing();
}
Repository repository = j.createRepository();
checkNotNull(repos).add(repository);
checkNotNull(mks).add(mk);
}
Aggregations