Package org.modeshape.jcr.api.index

Examples of org.modeshape.jcr.api.index.IndexDefinition


        for (ChildReference ref : indexes.getChildReferences(system)) {
            CachedNode provider = system.getNode(ref);
            Name providerName = provider.getName(system);
            for (ChildReference indexRef : provider.getChildReferences(system)) {
                CachedNode indexDefn = system.getNode(indexRef);
                IndexDefinition defn = readIndexDefinition(indexDefn, providerName);
                if (providerNames.contains(defn.getProviderName())) {
                    defns.add(defn);
                } else {
                    // There is no provider by this name, so mark it as not enabled ...
                    defn = RepositoryIndexDefinition.createFrom(defn, false);
                }
View Full Code Here


        public IndexDefinition getIndex( final String name ) {
            if (name == null) return null;
            final Document doc = getRawIndex(name);
            if (doc == null) return null;
            return new IndexDefinition() {
                private List<IndexColumnDefinition> columns;
                private Map<String, Object> properties;

                @Override
                public String getName() {
View Full Code Here

            };
        }

        protected void validateIndexDefinitions( Problems problems ) {
            for (String indexName : getIndexNames()) {
                IndexDefinition defn = getIndex(indexName);
                // Make sure the index has a valid provider ...
                if (defn.getProviderName() == null) {
                    problems.addError(JcrI18n.indexProviderNameRequired, indexName);
                } else if (!hasIndexProvider(defn.getProviderName())) {
                    problems.addWarning(JcrI18n.indexProviderNameMustMatchProvider, indexName, defn.getProviderName());
                }
            }
        }
View Full Code Here

    public void shouldAllowValidRepositoryConfigurationWithIndexProvidersAndNotionalIndexes() {
        RepositoryConfiguration config = assertValid("config/repo-config-local-provider-and-notional-indexes.json");
        Indexes indexes = config.getIndexes();
        EnumSet<IndexKind> found = EnumSet.noneOf(IndexKind.class);
        for (String indexName : indexes.getIndexNames()) {
            IndexDefinition defn = indexes.getIndex(indexName);
            IndexKind kind = defn.getKind();
            found.add(kind);
            assertThat(kind, is(notNullValue()));
        }
        assertThat(found, is(EnumSet.allOf(IndexKind.class)));
    }
View Full Code Here

    @Test
    public void shouldAllowValidRepositoryConfigurationWithIndexProvidersAndIndexes() {
        RepositoryConfiguration config = assertValid("config/repo-config-local-provider-and-indexes.json");
        Indexes indexes = config.getIndexes();
        for (String indexName : indexes.getIndexNames()) {
            IndexDefinition defn = indexes.getIndex(indexName);
            assertThat(defn.getKind(), is(notNullValue()));
        }
    }
View Full Code Here

    synchronized void importIndexDefinitions() throws RepositoryException {
        RepositoryConfiguration.Indexes indexes = config.getIndexes();
        if (indexes.isEmpty()) return;
        List<IndexDefinition> defns = new ArrayList<>();
        for (String indexName : indexes.getIndexNames()) {
            IndexDefinition defn = indexes.getIndex(indexName);
            if (defn != null) defns.add(defn);
        }
        if (!defns.isEmpty()) {
            IndexDefinition[] array = defns.toArray(new IndexDefinition[defns.size()]);
            registerIndexes(array, true);
View Full Code Here

        // Remove the definition from the system area ...
        SessionCache systemCache = repository.createSystemSession(context, false);
        SystemContent system = new SystemContent(systemCache);
        for (String indexName : indexNames) {
            IndexDefinition defn = indexes.getIndexDefinitions().get(indexName);
            if (defn == null) {
                throw new NoSuchIndexException(JcrI18n.indexDoesNotExist.text(indexName, repository.name()));
            }
            system.remove(defn);
        }
View Full Code Here

            // Others might have been added or changed after the existing ones were removed ...
            for (Name name : info.removedIndexes) {
                changes.remove(strings.create(name));
            }
            for (Name name : info.changedIndexes) {
                IndexDefinition defn = indexes.getIndexDefinitions().get(strings.create(name));
                if (defn != null) changes.change(defn);
            }
            // Notify the provider ...
            try {
                provider.notify(changes, repository.changeBus(), repository.nodeTypeManager(), repository.repositoryCache()
View Full Code Here

TOP

Related Classes of org.modeshape.jcr.api.index.IndexDefinition

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.