Exemple #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: private java.util.Map<String, String> findIndexConfig(Class cls, String indexName, java.util.Map<String, String> suppliedConfig, @Nonnull Config dbConfig)
        private IDictionary <string, string> FindIndexConfig(Type cls, string indexName, IDictionary <string, string> suppliedConfig, Config dbConfig)
        {
            // Check stored config (has this index been created previously?)
            IDictionary <string, string> storedConfig = _indexStore.get(cls, indexName);

            if (storedConfig != null && suppliedConfig == null)
            {
                // Fill in "provider" if not already filled in, backwards compatibility issue
                IDictionary <string, string> newConfig = InjectDefaultProviderIfMissing(indexName, dbConfig, storedConfig);
                if (newConfig != storedConfig)
                {
                    _indexStore.set(cls, indexName, newConfig);
                }
                return(newConfig);
            }

            IDictionary <string, string> configToUse = suppliedConfig;

            // Check db config properties for provider
            string provider;
            IndexImplementation indexProvider;

            if (configToUse == null)
            {
                provider    = GetDefaultProvider(indexName, dbConfig);
                configToUse = MapUtil.stringMap(PROVIDER, provider);
            }
            else
            {
                provider = configToUse[PROVIDER];
                provider = string.ReferenceEquals(provider, null) ? GetDefaultProvider(indexName, dbConfig) : provider;
            }
            indexProvider = _explicitIndexProvider.getProviderByName(provider);
            configToUse   = indexProvider.FillInDefaults(configToUse);
            configToUse   = InjectDefaultProviderIfMissing(indexName, dbConfig, configToUse);

            // Do they match (stored vs. supplied)?
            if (storedConfig != null)
            {
                AssertConfigMatches(indexProvider, indexName, storedConfig, suppliedConfig);
                // Fill in "provider" if not already filled in, backwards compatibility issue
                IDictionary <string, string> newConfig = InjectDefaultProviderIfMissing(indexName, dbConfig, storedConfig);
                if (newConfig != storedConfig)
                {
                    _indexStore.set(cls, indexName, newConfig);
                }
                configToUse = newConfig;
            }

            return(Collections.unmodifiableMap(configToUse));
        }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.neo4j.kernel.api.ExplicitIndex nodeChanges(String indexName) throws org.neo4j.internal.kernel.api.exceptions.explicitindex.ExplicitIndexNotFoundKernelException
        public override ExplicitIndex NodeChanges(string indexName)
        {
            IDictionary <string, string> configuration = _indexConfigStore.get(typeof(Node), indexName);

            if (configuration == null)
            {
                throw new ExplicitIndexNotFoundKernelException("Node index '" + indexName + " not found");
            }
            string providerName          = configuration[Org.Neo4j.Graphdb.index.IndexManager_Fields.PROVIDER];
            IndexImplementation provider = _providerLookup.getProviderByName(providerName);
            ExplicitIndexProviderTransaction transaction = _transactions.computeIfAbsent(providerName, k => provider.NewTransaction(this));

            return(transaction.NodeIndex(indexName, configuration));
        }
 public override TransactionApplier NewApplier(string providerName, bool recovery)
 {
     return(Provider.getProviderByName(providerName).newApplier(recovery));
 }