Search in sources :

Example 1 with NodeTypeIndexProvider

use of org.apache.jackrabbit.oak.plugins.index.nodetype.NodeTypeIndexProvider in project jackrabbit-oak by apache.

the class IndexPathServiceImpl method getIndex.

private QueryIndex getIndex() {
    NodeTypeIndexProvider idxProvider = new NodeTypeIndexProvider();
    idxProvider.with(mountInfoProvider);
    return idxProvider.getQueryIndexes(nodeStore.getRoot()).get(0);
}
Also used : NodeTypeIndexProvider(org.apache.jackrabbit.oak.plugins.index.nodetype.NodeTypeIndexProvider)

Example 2 with NodeTypeIndexProvider

use of org.apache.jackrabbit.oak.plugins.index.nodetype.NodeTypeIndexProvider in project jackrabbit-oak by apache.

the class MultiplexingLucenePropertyIndexTest method createRepository.

@Override
protected ContentRepository createRepository() {
    IndexCopier copier = null;
    try {
        copier = new IndexCopier(executorService, temporaryFolder.getRoot());
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    LuceneIndexEditorProvider editorProvider = new LuceneIndexEditorProvider(copier, new ExtractedTextCache(10 * FileUtils.ONE_MB, 100), null, mip);
    LuceneIndexProvider provider = new LuceneIndexProvider(new IndexTracker(new DefaultIndexReaderFactory(mip, copier)));
    nodeStore = new MemoryNodeStore();
    return new Oak(nodeStore).with(new InitialContent()).with(new OpenSecurityProvider()).with((QueryIndexProvider) provider).with((Observer) provider).with(editorProvider).with(new PropertyIndexEditorProvider()).with(new NodeTypeIndexProvider()).createContentRepository();
}
Also used : NodeTypeIndexProvider(org.apache.jackrabbit.oak.plugins.index.nodetype.NodeTypeIndexProvider) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) PropertyIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider) IOException(java.io.IOException) QueryIndexProvider(org.apache.jackrabbit.oak.spi.query.QueryIndexProvider) InitialContent(org.apache.jackrabbit.oak.InitialContent) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) Oak(org.apache.jackrabbit.oak.Oak) DefaultIndexReaderFactory(org.apache.jackrabbit.oak.plugins.index.lucene.reader.DefaultIndexReaderFactory)

Example 3 with NodeTypeIndexProvider

use of org.apache.jackrabbit.oak.plugins.index.nodetype.NodeTypeIndexProvider in project jackrabbit-oak by apache.

the class UserInitializer method initialize.

//-----------------------------------------------< WorkspaceInitializer >---
@Override
public void initialize(NodeBuilder builder, String workspaceName) {
    // squeeze node state before it is passed to store (OAK-2411)
    NodeState base = squeeze(builder.getNodeState());
    MemoryNodeStore store = new MemoryNodeStore(base);
    Root root = RootFactory.createSystemRoot(store, EmptyHook.INSTANCE, workspaceName, securityProvider, null, new CompositeQueryIndexProvider(new PropertyIndexProvider(), new NodeTypeIndexProvider()));
    UserConfiguration userConfiguration = securityProvider.getConfiguration(UserConfiguration.class);
    UserManager userManager = userConfiguration.getUserManager(root, NamePathMapper.DEFAULT);
    String errorMsg = "Failed to initialize user content.";
    try {
        Tree rootTree = root.getTree(PathUtils.ROOT_PATH);
        checkState(rootTree.exists());
        Tree index = TreeUtil.getOrAddChild(rootTree, IndexConstants.INDEX_DEFINITIONS_NAME, JcrConstants.NT_UNSTRUCTURED);
        if (!index.hasChild("authorizableId")) {
            Tree authorizableId = IndexUtils.createIndexDefinition(index, "authorizableId", true, new String[] { REP_AUTHORIZABLE_ID }, new String[] { NT_REP_AUTHORIZABLE });
            authorizableId.setProperty("info", "Oak index used by the user management " + "to enforce uniqueness of rep:authorizableId property values.");
        }
        if (!index.hasChild("principalName")) {
            Tree principalName = IndexUtils.createIndexDefinition(index, "principalName", true, new String[] { REP_PRINCIPAL_NAME }, new String[] { NT_REP_AUTHORIZABLE });
            principalName.setProperty("info", "Oak index used by the user management " + "to enforce uniqueness of rep:principalName property values, " + "and to quickly search a principal by name if it was constructed manually.");
        }
        if (!index.hasChild("repMembers")) {
            Tree members = IndexUtils.createIndexDefinition(index, "repMembers", false, new String[] { REP_MEMBERS }, new String[] { NT_REP_MEMBER_REFERENCES });
            members.setProperty("info", "Oak index used by the user management to lookup group membership.");
        }
        ConfigurationParameters params = userConfiguration.getParameters();
        String adminId = params.getConfigValue(PARAM_ADMIN_ID, DEFAULT_ADMIN_ID);
        if (userManager.getAuthorizable(adminId) == null) {
            boolean omitPw = params.getConfigValue(PARAM_OMIT_ADMIN_PW, false);
            userManager.createUser(adminId, (omitPw) ? null : adminId);
        }
        String anonymousId = Strings.emptyToNull(params.getConfigValue(PARAM_ANONYMOUS_ID, DEFAULT_ANONYMOUS_ID, String.class));
        if (anonymousId != null && userManager.getAuthorizable(anonymousId) == null) {
            userManager.createUser(anonymousId, null);
        }
        if (root.hasPendingChanges()) {
            root.commit();
        }
    } catch (RepositoryException | CommitFailedException e) {
        log.error(errorMsg, e);
        throw new RuntimeException(e);
    }
    NodeState target = store.getRoot();
    target.compareAgainstBaseState(base, new ApplyDiff(builder));
}
Also used : ApplyDiff(org.apache.jackrabbit.oak.spi.state.ApplyDiff) NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) NodeTypeIndexProvider(org.apache.jackrabbit.oak.plugins.index.nodetype.NodeTypeIndexProvider) Root(org.apache.jackrabbit.oak.api.Root) CompositeQueryIndexProvider(org.apache.jackrabbit.oak.spi.query.CompositeQueryIndexProvider) RepositoryException(javax.jcr.RepositoryException) ConfigurationParameters(org.apache.jackrabbit.oak.spi.security.ConfigurationParameters) PropertyIndexProvider(org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexProvider) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) UserManager(org.apache.jackrabbit.api.security.user.UserManager) Tree(org.apache.jackrabbit.oak.api.Tree) CommitFailedException(org.apache.jackrabbit.oak.api.CommitFailedException) UserConfiguration(org.apache.jackrabbit.oak.spi.security.user.UserConfiguration)

Example 4 with NodeTypeIndexProvider

use of org.apache.jackrabbit.oak.plugins.index.nodetype.NodeTypeIndexProvider in project jackrabbit-oak by apache.

the class FunctionIndexTest method createRepository.

@Override
protected ContentRepository createRepository() {
    editorProvider = new LuceneIndexEditorProvider();
    LuceneIndexProvider provider = new LuceneIndexProvider();
    nodeStore = new MemoryNodeStore();
    return new Oak(nodeStore).with(new InitialContent()).with(new OpenSecurityProvider()).with((QueryIndexProvider) provider).with((Observer) provider).with(editorProvider).with(new PropertyIndexEditorProvider()).with(new NodeTypeIndexProvider()).createContentRepository();
}
Also used : InitialContent(org.apache.jackrabbit.oak.InitialContent) NodeTypeIndexProvider(org.apache.jackrabbit.oak.plugins.index.nodetype.NodeTypeIndexProvider) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) Oak(org.apache.jackrabbit.oak.Oak) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) PropertyIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider) QueryIndexProvider(org.apache.jackrabbit.oak.spi.query.QueryIndexProvider)

Example 5 with NodeTypeIndexProvider

use of org.apache.jackrabbit.oak.plugins.index.nodetype.NodeTypeIndexProvider in project jackrabbit-oak by apache.

the class LucenePropertyIndexTest method createRepository.

@Override
protected ContentRepository createRepository() {
    IndexCopier copier = createIndexCopier();
    editorProvider = new LuceneIndexEditorProvider(copier, new ExtractedTextCache(10 * FileUtils.ONE_MB, 100));
    provider = new LuceneIndexProvider(copier);
    nodeStore = new MemoryNodeStore();
    return new Oak(nodeStore).with(new InitialContent()).with(new OpenSecurityProvider()).with((QueryIndexProvider) provider).with((Observer) provider).with(editorProvider).with(optionalEditorProvider).with(new PropertyIndexEditorProvider()).with(new NodeTypeIndexProvider()).createContentRepository();
}
Also used : InitialContent(org.apache.jackrabbit.oak.InitialContent) NodeTypeIndexProvider(org.apache.jackrabbit.oak.plugins.index.nodetype.NodeTypeIndexProvider) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) Observer(org.apache.jackrabbit.oak.spi.commit.Observer) Oak(org.apache.jackrabbit.oak.Oak) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) PropertyIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider)

Aggregations

NodeTypeIndexProvider (org.apache.jackrabbit.oak.plugins.index.nodetype.NodeTypeIndexProvider)6 MemoryNodeStore (org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore)5 InitialContent (org.apache.jackrabbit.oak.InitialContent)4 Oak (org.apache.jackrabbit.oak.Oak)4 PropertyIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider)4 OpenSecurityProvider (org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider)4 IOException (java.io.IOException)2 DefaultIndexReaderFactory (org.apache.jackrabbit.oak.plugins.index.lucene.reader.DefaultIndexReaderFactory)2 Observer (org.apache.jackrabbit.oak.spi.commit.Observer)2 QueryIndexProvider (org.apache.jackrabbit.oak.spi.query.QueryIndexProvider)2 RepositoryException (javax.jcr.RepositoryException)1 UserManager (org.apache.jackrabbit.api.security.user.UserManager)1 CommitFailedException (org.apache.jackrabbit.oak.api.CommitFailedException)1 Root (org.apache.jackrabbit.oak.api.Root)1 Tree (org.apache.jackrabbit.oak.api.Tree)1 NodeCounterEditorProvider (org.apache.jackrabbit.oak.plugins.index.counter.NodeCounterEditorProvider)1 IndexCopier (org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier)1 IndexTracker (org.apache.jackrabbit.oak.plugins.index.lucene.IndexTracker)1 LuceneIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider)1 LuceneIndexProvider (org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProvider)1