示例#1
0
 /// <summary>
 /// The entry point for neo4j admin tool's online backup functionality.
 /// </summary>
 /// <param name="outsideWorld"> provides a way to interact with the filesystem and output streams </param>
 /// <param name="contextBuilder"> helper class to validate, process and return a grouped result of processing the command line arguments </param>
 /// <param name="backupSupportingClassesFactory"> necessary for constructing the strategy for backing up over the causal clustering transaction protocol </param>
 /// <param name="backupStrategyCoordinatorFactory"> class that actually handles the logic of performing a backup </param>
 internal OnlineBackupCommand(OutsideWorld outsideWorld, OnlineBackupContextFactory contextBuilder, BackupSupportingClassesFactory backupSupportingClassesFactory, BackupStrategyCoordinatorFactory backupStrategyCoordinatorFactory)
 {
     this._outsideWorld   = outsideWorld;
     this._contextBuilder = contextBuilder;
     this._backupSupportingClassesFactory   = backupSupportingClassesFactory;
     this._backupStrategyCoordinatorFactory = backupStrategyCoordinatorFactory;
 }
示例#2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Override @Nonnull public org.neo4j.commandline.admin.AdminCommand create(java.nio.file.Path homeDir, java.nio.file.Path configDir, org.neo4j.commandline.admin.OutsideWorld outsideWorld)
        public override AdminCommand Create(Path homeDir, Path configDir, OutsideWorld outsideWorld)
        {
            bool        debug       = System.getenv().get("NEO4J_DEBUG") != null;
            LogProvider logProvider = FormattedLogProvider.withDefaultLogLevel(debug ? Level.DEBUG : Level.NONE).toOutputStream(outsideWorld.OutStream());
            Monitors    monitors    = new Monitors();

            OnlineBackupContextFactory contextBuilder = new OnlineBackupContextFactory(homeDir, configDir);
            BackupModule backupModule = new BackupModule(outsideWorld, logProvider, monitors);

            BackupSupportingClassesFactoryProvider classesFactoryProvider   = ProvidersByPriority.findFirst().orElseThrow(NoProviderException());
            BackupSupportingClassesFactory         supportingClassesFactory = classesFactoryProvider.GetFactory(backupModule);
            BackupStrategyCoordinatorFactory       coordinatorFactory       = new BackupStrategyCoordinatorFactory(backupModule);

            return(new OnlineBackupCommand(outsideWorld, contextBuilder, supportingClassesFactory, coordinatorFactory));
        }
示例#3
0
        private static OnlineBackupCommand NewOnlineBackupCommand(OutsideWorld outsideWorld, OnlineBackupContext onlineBackupContext, BackupSupportingClassesFactory backupSupportingClassesFactory, BackupStrategyCoordinatorFactory backupStrategyCoordinatorFactory)
        {
            OnlineBackupContextFactory contextBuilder = mock(typeof(OnlineBackupContextFactory));

            try
            {
                when(contextBuilder.CreateContext(any())).thenReturn(onlineBackupContext);
            }
            catch (Exception e) when(e is IncorrectUsage || e is CommandFailed)
            {
                throw new Exception("Shouldn't happen", e);
            }

            return(new OnlineBackupCommand(outsideWorld, contextBuilder, backupSupportingClassesFactory, backupStrategyCoordinatorFactory));
        }