Examples of IndexDefinition


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

    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

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

    @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

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

    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

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

        // 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

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

            // 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

Examples of org.neo4j.graphdb.schema.IndexDefinition

        }
    }

    private void reCreateIndex(GraphDatabaseService graphDatabaseService, Label label, PrimitivePropertyMethodMetadata propertyMethodMetadata) {
        PrimitivePropertyMetadata primitivePropertyMetadata = ((PrimitivePropertyMethodMetadata<PrimitivePropertyMetadata>) propertyMethodMetadata).getDatastoreMetadata();
        IndexDefinition index = findIndex(graphDatabaseService, label, primitivePropertyMetadata);
        if (propertyMethodMetadata != null && index == null) {
            LOGGER.info("Creating index for label {} on property '{}'.", label, primitivePropertyMetadata.getName());
            graphDatabaseService.schema().indexFor(label).on(primitivePropertyMetadata.getName()).create();
        } else if (propertyMethodMetadata == null && index != null) {
            LOGGER.info("Dropping index for label {} on properties '{}'.", label, index.getPropertyKeys());
            index.drop();
        }
    }
View Full Code Here

Examples of org.neo4j.graphdb.schema.IndexDefinition

        }
    }

    private void reCreateIndex(Label label, PrimitivePropertyMethodMetadata propertyMethodMetadata) {
        PropertyMetadata propertyMetadata = ((PrimitivePropertyMethodMetadata<PropertyMetadata>) propertyMethodMetadata).getDatastoreMetadata();
        IndexDefinition index = findIndex(label, propertyMetadata.getName());
        //TODO propertyMethodMetadata is always != null
        if (propertyMethodMetadata != null && index == null) {
            LOGGER.info("Creating index for label {} on property '{}'.", label, propertyMetadata.getName());
            graphDatabaseService.schema().indexFor(label).on(propertyMetadata.getName()).create();
        } else if (propertyMethodMetadata == null && index != null) {
            LOGGER.info("Dropping index for label {} on properties '{}'.", label, index.getPropertyKeys());
            index.drop();
        }
    }
View Full Code Here

Examples of org.neo4j.graphdb.schema.IndexDefinition

        }
    }

    private void reCreateIndex(Label label, PrimitivePropertyMethodMetadata propertyMethodMetadata) {
        PropertyMetadata propertyMetadata = ((PrimitivePropertyMethodMetadata<PropertyMetadata>) propertyMethodMetadata).getDatastoreMetadata();
        IndexDefinition index = findIndex(label, propertyMetadata.getName());
        //TODO propertyMethodMetadata is always != null
        if (propertyMethodMetadata != null && index == null) {
            LOGGER.info("Creating index for label {} on property '{}'.", label, propertyMetadata.getName());
            graphDatabaseService.schema().indexFor(label).on(propertyMetadata.getName()).create();
        } else if (propertyMethodMetadata == null && index != null) {
            LOGGER.info("Dropping index for label {} on properties '{}'.", label, index.getPropertyKeys());
            index.drop();
        }
    }
View Full Code Here

Examples of org.neo4j.graphdb.schema.IndexDefinition

        }
    }

    private void reCreateIndex(Label label, PrimitivePropertyMethodMetadata propertyMethodMetadata) {
        PropertyMetadata propertyMetadata = ((PrimitivePropertyMethodMetadata<PropertyMetadata>) propertyMethodMetadata).getDatastoreMetadata();
        IndexDefinition index = findIndex(label, propertyMetadata.getName());
        //TODO propertyMethodMetadata is always != null
        if (propertyMethodMetadata != null && index == null) {
            LOGGER.info("Creating index for label {} on property '{}'.", label, propertyMetadata.getName());
            graphDatabaseService.schema().indexFor(label).on(propertyMetadata.getName()).create();
        } else if (propertyMethodMetadata == null && index != null) {
            LOGGER.info("Dropping index for label {} on properties '{}'.", label, index.getPropertyKeys());
            index.drop();
        }
    }
View Full Code Here

Examples of org.neo4j.graphdb.schema.IndexDefinition

        mapperRegistry.register(new FieldDescriptorMapper());
        mapperRegistry.register(new ValueDescriptorMapper());
        descriptorDAO = new DescriptorDAOImpl(mapperRegistry, database);
        beginTransaction();
        for (NodeLabel label : NodeLabel.values()) {
            IndexDefinition index = null;
            for (IndexDefinition indexDefinition : database.schema().getIndexes(label)) {
                for (String s : indexDefinition.getPropertyKeys()) {
                    if (FQN.name().equals(s)) {
                        index = indexDefinition;
                    }
                }
            }
            if (label.isIndexed() && index == null) {
                database.schema().indexFor(label).on(FQN.name()).create();
            } else if (!label.isIndexed() && index != null) {
                index.drop();
            }
        }
        commitTransaction();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.