Example #1
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
//ORIGINAL LINE: public static org.neo4j.graphdb.security.URLAccessRule combined(final java.util.Map<String,org.neo4j.graphdb.security.URLAccessRule> urlAccessRules)
        public static URLAccessRule Combined(IDictionary <string, URLAccessRule> urlAccessRules)
        {
            return((config, url) =>
            {
                string protocol = url.Protocol;
                URLAccessRule protocolRule = urlAccessRules[protocol];
                if (protocolRule == null)
                {
                    throw new URLAccessValidationError("loading resources via protocol '" + protocol + "' is not permitted");
                }
                return protocolRule.validate(config, url);
            });
        }
Example #2
0
 public override TestGraphDatabaseFactory AddURLAccessRule(string protocol, URLAccessRule rule)
 {
     return(( TestGraphDatabaseFactory )base.AddURLAccessRule(protocol, rule));
 }
Example #3
0
 public virtual GraphDatabaseFactory AddURLAccessRule(string protocol, URLAccessRule rule)
 {
     CurrentState.addURLAccessRule(protocol, rule);
     return(this);
 }
Example #4
0
        public PlatformModule(File providedStoreDir, Config config, DatabaseInfo databaseInfo, GraphDatabaseFacadeFactory.Dependencies externalDependencies)
        {
            this.DatabaseInfo      = databaseInfo;
            this.DataSourceManager = new DataSourceManager(config);
            Dependencies           = new Dependencies();
            Dependencies.satisfyDependency(databaseInfo);

            Clock = Dependencies.satisfyDependency(CreateClock());
            Life  = Dependencies.satisfyDependency(CreateLife());

            this.StoreLayout = StoreLayout.of(providedStoreDir);

            config.AugmentDefaults(GraphDatabaseSettings.neo4j_home, StoreLayout.storeDirectory().Path);
            this.Config = Dependencies.satisfyDependency(config);

            FileSystem = Dependencies.satisfyDependency(CreateFileSystemAbstraction());
            Life.add(new FileSystemLifecycleAdapter(FileSystem));

            // Component monitoring
            Monitors = externalDependencies.Monitors() == null ? new Monitors() : externalDependencies.Monitors();
            Dependencies.satisfyDependency(Monitors);

            JobScheduler = Life.add(Dependencies.satisfyDependency(CreateJobScheduler()));
            StartDeferredExecutors(JobScheduler, externalDependencies.DeferredExecutors());

            // Cleanup after recovery, used by GBPTree, added to life in NeoStoreDataSource
            RecoveryCleanupWorkCollector = new GroupingRecoveryCleanupWorkCollector(JobScheduler);
            Dependencies.satisfyDependency(RecoveryCleanupWorkCollector);

            // Database system information, used by UDC
            UsageData = new UsageData(JobScheduler);
            Dependencies.satisfyDependency(Life.add(UsageData));

            // If no logging was passed in from the outside then create logging and register
            // with this life
            Logging = Dependencies.satisfyDependency(CreateLogService(externalDependencies.UserLogProvider()));

            config.Logger = Logging.getInternalLog(typeof(Config));

            Life.add(Dependencies.satisfyDependency(new StoreLockerLifecycleAdapter(CreateStoreLocker())));

            (new JvmChecker(Logging.getInternalLog(typeof(JvmChecker)), new JvmMetadataRepository())).checkJvmCompatibilityAndIssueWarning();

            string desiredImplementationName = config.Get(GraphDatabaseSettings.tracer);

            Tracers = Dependencies.satisfyDependency(new Tracers(desiredImplementationName, Logging.getInternalLog(typeof(Tracers)), Monitors, JobScheduler, Clock));
            Dependencies.satisfyDependency(Tracers.pageCacheTracer);
            Dependencies.satisfyDependency(FirstImplementor(typeof(LogRotationMonitor), Tracers.transactionTracer, LogRotationMonitor.NULL));
            Dependencies.satisfyDependency(FirstImplementor(typeof(CheckPointerMonitor), Tracers.checkPointTracer, CheckPointerMonitor.NULL));

            VersionContextSupplier = CreateCursorContextSupplier(config);

            CollectionsFactorySupplier = CreateCollectionsFactorySupplier(config, Life);

            Dependencies.satisfyDependency(VersionContextSupplier);
            PageCache = Dependencies.satisfyDependency(CreatePageCache(FileSystem, config, Logging, Tracers, VersionContextSupplier, JobScheduler));

            Life.add(new PageCacheLifecycle(PageCache));

            DiagnosticsManager = Life.add(Dependencies.satisfyDependency(new DiagnosticsManager(Logging.getInternalLog(typeof(DiagnosticsManager)))));
            SystemDiagnostics.registerWith(DiagnosticsManager);

            Dependencies.satisfyDependency(DataSourceManager);

            KernelExtensionFactories = externalDependencies.KernelExtensions();
            EngineProviders          = externalDependencies.ExecutionEngines();
            GlobalKernelExtensions   = Dependencies.satisfyDependency(new GlobalKernelExtensions(new SimpleKernelContext(StoreLayout.storeDirectory(), databaseInfo, Dependencies), KernelExtensionFactories, Dependencies, KernelExtensionFailureStrategies.fail()));

            UrlAccessRule = Dependencies.satisfyDependency(URLAccessRules.combined(externalDependencies.UrlAccessRules()));

            ConnectorPortRegister = new ConnectorPortRegister();
            Dependencies.satisfyDependency(ConnectorPortRegister);

            EventHandlers       = new KernelEventHandlers(Logging.getInternalLog(typeof(KernelEventHandlers)));
            PanicEventGenerator = new DatabasePanicEventGenerator(EventHandlers);

            PublishPlatformInfo(Dependencies.resolveDependency(typeof(UsageData)));
        }