Example #1
0
        /// <summary>
        /// Get an applier suitable for the specified IndexCommand.
        /// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private TransactionApplier applier(org.neo4j.kernel.impl.index.IndexCommand command) throws java.io.IOException
        private TransactionApplier Applier(IndexCommand command)
        {
            // Have we got an applier for this index?
            string indexName = _defineCommand.getIndexName(command.IndexNameId);
            IDictionary <string, TransactionApplier> applierByIndex = ApplierByIndexMap(command);
            TransactionApplier applier = applierByIndex[indexName];

            if (applier == null)
            {
                // We don't. Have we got an applier for the provider of this index?
                IndexEntityType entityType          = IndexEntityType.byId(command.EntityType);
                IDictionary <string, string> config = _indexConfigStore.get(entityType.entityClass(), indexName);
                if (config == null)
                {
                    // This provider doesn't even exist, return an EMPTY handler, i.e. ignore these changes.
                    // Could be that the index provider is temporarily unavailable?
                    return(TransactionApplier_Fields.Empty);
                }
                string providerName = config[PROVIDER];
                applier = ApplierByProvider[providerName];
                if (applier == null)
                {
                    // We don't, so create the applier
                    applier = _applierLookup.newApplier(providerName, _mode.needsIdempotencyChecks());
                    applier.VisitIndexDefineCommand(_defineCommand);
                    ApplierByProvider[providerName] = applier;
                }

                // Also cache this applier for this index
                applierByIndex[indexName] = applier;
            }
            return(applier);
        }
        public override bool CheckIndexExistence(IndexEntityType entityType, string indexName, IDictionary <string, string> config)
        {
            IDictionary <string, string> configuration = _indexConfigStore.get(entityType.entityClass(), indexName);

            if (configuration == null)
            {
                return(false);
            }

            string providerName          = configuration[Org.Neo4j.Graphdb.index.IndexManager_Fields.PROVIDER];
            IndexImplementation provider = _providerLookup.getProviderByName(providerName);

            assertConfigMatches(provider, indexName, configuration, config);
            return(true);
        }