示例#1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Override public org.neo4j.kernel.lifecycle.Lifecycle newInstance(@SuppressWarnings("unused") org.neo4j.kernel.impl.spi.KernelContext context, final Dependencies dependencies)
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
        public override Lifecycle NewInstance(KernelContext context, Dependencies dependencies)
        {
            FileSystemAbstraction fileSystem = dependencies.FileSystem();
            Config       config       = dependencies.Config();
            Monitors     monitoring   = dependencies.Monitoring();
            LogService   logService   = dependencies.Logger();
            JobScheduler jobScheduler = dependencies.JobScheduler();

            return(new LifecycleAdapterAnonymousInnerClass(this, fileSystem, config, monitoring, logService, jobScheduler));
        }
示例#2
0
        public override Lifecycle NewInstance(KernelContext context, Dependencies deps)
        {
            JobScheduler scheduler = deps.JobScheduler();
            DatabaseAvailabilityGuard databaseAvailabilityGuard = deps.AvailabilityGuard();
            PageCache             pageCache         = deps.PageCache();
            FileSystemAbstraction fs                = deps.FileSystemAbstraction();
            LogService            logService        = deps.LogService();
            NeoStoreDataSource    dataSourceManager = deps.DataSource;
            Log      log      = logService.GetInternalLog(typeof(PageCacheWarmer));
            Monitors monitors = deps.Monitors();
            PageCacheWarmerMonitor monitor = monitors.NewMonitor(typeof(PageCacheWarmerMonitor));

            monitors.AddMonitorListener(new PageCacheWarmerLoggingMonitor(log));
            Config config = deps.Config();

            return(new PageCacheWarmerKernelExtension(scheduler, databaseAvailabilityGuard, pageCache, fs, dataSourceManager, log, monitor, config));
        }
示例#3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void setup(Dependencies dependencies) throws org.neo4j.internal.kernel.api.exceptions.KernelException
        public override void Setup(Dependencies dependencies)
        {
            Config                config           = dependencies.Config();
            Procedures            procedures       = dependencies.Procedures();
            LogProvider           logProvider      = dependencies.LogService().UserLogProvider;
            JobScheduler          jobScheduler     = dependencies.Scheduler();
            FileSystemAbstraction fileSystem       = dependencies.FileSystem();
            AccessCapability      accessCapability = dependencies.AccessCapability();

            SecurityLog securityLog = SecurityLog.create(config, dependencies.LogService().getInternalLog(typeof(GraphDatabaseFacade)), fileSystem, jobScheduler);

            Life.add(securityLog);

            _authManager = NewAuthManager(config, logProvider, securityLog, fileSystem, jobScheduler, accessCapability);
            Life.add(dependencies.DependencySatisfier().satisfyDependency(_authManager));

            // Register procedures
            procedures.RegisterComponent(typeof(SecurityLog), ctx => securityLog, false);
            procedures.RegisterComponent(typeof(EnterpriseAuthManager), ctx => _authManager, false);
            procedures.RegisterComponent(typeof(EnterpriseSecurityContext), ctx => AsEnterprise(ctx.get(SECURITY_CONTEXT)), true);

            if (SecurityConfig.nativeAuthEnabled)
            {
                procedures.RegisterComponent(typeof(EnterpriseUserManager), ctx => _authManager.getUserManager(ctx.get(SECURITY_CONTEXT).subject(), ctx.get(SECURITY_CONTEXT).Admin), true);
                if (config.Get(SecuritySettings.auth_providers).Count > 1)
                {
                    procedures.RegisterProcedure(typeof(UserManagementProcedures), true, "%s only applies to native users.");
                }
                else
                {
                    procedures.RegisterProcedure(typeof(UserManagementProcedures), true);
                }
            }
            else
            {
                procedures.RegisterComponent(typeof(EnterpriseUserManager), ctx => EnterpriseUserManager.NOOP, true);
            }

            procedures.RegisterProcedure(typeof(SecurityProcedures), true);
        }
示例#4
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void setup(Dependencies dependencies) throws org.neo4j.internal.kernel.api.exceptions.KernelException
        public override void Setup(Dependencies dependencies)
        {
            Config                config      = dependencies.Config();
            Procedures            procedures  = dependencies.Procedures();
            LogProvider           logProvider = dependencies.LogService().UserLogProvider;
            FileSystemAbstraction fileSystem  = dependencies.FileSystem();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final UserRepository userRepository = getUserRepository(config, logProvider, fileSystem);
            UserRepository userRepository = GetUserRepository(config, logProvider, fileSystem);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final UserRepository initialUserRepository = getInitialUserRepository(config, logProvider, fileSystem);
            UserRepository initialUserRepository = GetInitialUserRepository(config, logProvider, fileSystem);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.kernel.api.security.PasswordPolicy passwordPolicy = new BasicPasswordPolicy();
            PasswordPolicy passwordPolicy = new BasicPasswordPolicy();

            _authManager = new BasicAuthManager(userRepository, passwordPolicy, Clocks.systemClock(), initialUserRepository, config);

            Life.add(dependencies.DependencySatisfier().satisfyDependency(_authManager));

            procedures.RegisterComponent(typeof(UserManager), ctx => _authManager, false);
            procedures.RegisterProcedure(typeof(AuthProcedures));
        }